健保資料庫軟體下載及語法介紹
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

健保資料庫軟體下載及語法介紹

  • 3,035 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
3,035
On Slideshare
3,019
From Embeds
16
Number of Embeds
1

Actions

Shares
Downloads
57
Comments
0
Likes
0

Embeds 16

http://cecr.tmu.edu.tw 16

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. 健保資料庫SOP建立
  • 2. 說明
    CSV檔案皆已 ‘逗號,” 分割欄位。第一筆資料列為欄位名稱。
  • 3. 安裝Navicat
    步驟一:下載http://www.navicat.com/cht
  • 4. 安裝Navicat
    步驟二:安裝
  • 5. 安裝Navicat
    1
    2
  • 6. 安裝Navicat
  • 7. 安裝Navicat
  • 8. 安裝Navicat
  • 9. 安裝Navicat
  • 10. 開啟資料庫
  • 11. 利用匯入精靈匯入資料庫
  • 12. 匯入精靈執行步驟1/8
  • 13. 匯入精靈執行步驟2/8
  • 14. 匯入精靈執行步驟3/8
  • 15. 匯入精靈執行步驟4/8
  • 16. 匯入精靈執行步驟5/8
  • 17. 匯入精靈執行步驟6/8
  • 18. 匯入精靈執行步驟7/8
  • 19. 匯入精靈執行步驟8/8
  • 20. 匯入精靈執行步驟END
  • 21. SQL語法教學
  • 22. 案下”新增查詢”
  • 23. 在此畫面打入SQL語法
  • 24. Step1.篩選有特定癌症之紀錄(門診檔)
    SQL範例:(Ex.膀胱癌)
    CREATE TABLE bladder AS
    SELECT * FROM cd1996 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd1997 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd1998 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd1999 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2000 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2001 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2002 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2003 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2004 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2005 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2006 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2007 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2008 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
  • 25. 篩選有特定癌症之紀錄(門診檔)
    範例一:只搜尋1996年的膀胱癌紀錄
    語法:SELECT * FROM dd1996 WHERE ICD9CM_code_1 LIKE '188%' OR ICD9CM_code_2 LIKE '188%' OR ICD9CM_code_3 LIKE '188%' OR ICD9CM_code_1 LIKE 'A126%' OR ICD9CM_code_2 LIKE 'A126%' OR ICD9CM_code_3 LIKE 'A126%’
    註解: 從dd1996表單中查詢欄位” ICD9CM_code”符合膀胱癌ICD碼188或A CODE126
  • 26. 篩選有特定癌症之紀錄(門診檔)
    範例二:搜尋多年(1996~1998)的膀胱癌紀錄
    語法:SELECT * FROM dd1996 WHERE ICD9CM_code_1 LIKE '188%' OR ICD9CM_code_2 LIKE '188%' OR ICD9CM_code_3 LIKE '188%' OR ICD9CM_code_1 LIKE 'A126%' OR ICD9CM_code_2 LIKE 'A126%' OR ICD9CM_code_3 LIKE 'A126%'
    UNION SELECT * FROM dd1997 WHERE ICD9CM_code_1 LIKE '188%' OR ICD9CM_code_2 LIKE '188%' OR ICD9CM_code_3 LIKE '188%' OR ICD9CM_code_1 LIKE 'A126%' OR ICD9CM_code_2 LIKE 'A126%' OR ICD9CM_code_3 LIKE 'A126%'
    UNION SELECT * FROM dd1998 WHERE ICD9CM_code_1 LIKE '188%' OR ICD9CM_code_2 LIKE '188%' OR ICD9CM_code_3 LIKE '188%' OR ICD9CM_code_1 LIKE 'A126%' OR ICD9CM_code_2 LIKE 'A126%' OR ICD9CM_code_3 LIKE 'A126%'
    註解:使用UNION連接
  • 27. 篩選有特定癌症之紀錄(門診檔)
    範例三:新增一個膀胱癌紀錄的表單
    CREATE TABLE bladder AS
    SELECT * FROM cd1996 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd1997 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd1998 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd1999 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2000 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2001 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2002 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2003 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2004 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2005 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2006 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2007 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
    UNION SELECT * FROM cd2008 WHERE ACODE_ICD9_1 LIKE '188%' OR ACODE_ICD9_2 LIKE '188%' OR ACODE_ICD9_3 LIKE '188%' OR ACODE_ICD9_1 LIKE 'A126%' OR ACODE_ICD9_2 LIKE 'A126%' OR ACODE_ICD9_3 LIKE 'A126%'
  • 28. 篩選有特定癌症之紀錄(門診檔)
    新增後可在資料表中看見新增的表單
  • 29. Step2.產生特定癌症之病患名單
    SQL範例:(由Step1產生之表單進行)
    CREATE TABLE bladder_list AS SELECT DISTINCT ID FROM bladder
  • 30. 輸入SQL語法
  • 31. 產生新表單
  • 32. 設計資料表
  • 33. 更改欄位名稱
    將ID此欄名稱改為ID2之後儲存關閉
  • 34. Step3.13年歸人檔建立(門診檔)
    SQL範例:
    CREATE TABLE colorectal_cancer AS SELECT * FROM cd1996,colorectal_id WHERE cd1996.ID = colorectal_id.ID2 UNION SELECT * FROM cd1997,colorectal_id WHERE cd1997.ID = colorectal_id.ID2 UNION SELECT * FROM cd1998,colorectal_id WHERE cd1998.ID = colorectal_id.ID2 UNION SELECT * FROM cd1999,colorectal_id WHERE cd1999.ID = colorectal_id.ID2 UNION SELECT * FROM cd2000,colorectal_id WHERE cd2000.ID = colorectal_id.ID2 UNION SELECT * FROM cd2001,colorectal_id WHERE cd2001.ID = colorectal_id.ID2 UNION SELECT * FROM cd2002,colorectal_id WHERE cd2002.ID = colorectal_id.ID2 UNION SELECT * FROM cd2003,colorectal_id WHERE cd2003.ID = colorectal_id.ID2 UNION SELECT * FROM cd2004,colorectal_id WHERE cd2004.ID = colorectal_id.ID2 UNION SELECT * FROM cd2005,colorectal_id WHERE cd2005.ID = colorectal_id.ID2 UNION SELECT * FROM cd2006,colorectal_id WHERE cd2006.ID = colorectal_id.ID2 UNION SELECT * FROM cd2007,colorectal_id WHERE cd2007.ID = colorectal_id.ID2 UNION SELECT * FROM cd2008,colorectal_id WHERE cd2008.ID = colorectal_id.ID2
  • 35. Thank You