健保資料庫SOP建立<br />
 說明<br />CSV檔案皆已 ‘逗號,” 分割欄位。第一筆資料列為欄位名稱。<br />
安裝Navicat<br />步驟一:下載http://www.navicat.com/cht<br />
安裝Navicat<br />步驟二:安裝<br />
安裝Navicat<br />1<br />2<br />
安裝Navicat<br />
安裝Navicat<br />
安裝Navicat<br />
安裝Navicat<br />
開啟資料庫<br />
利用匯入精靈匯入資料庫<br />
匯入精靈執行步驟1/8<br />
匯入精靈執行步驟2/8<br />
匯入精靈執行步驟3/8<br />
匯入精靈執行步驟4/8<br />
匯入精靈執行步驟5/8<br />
匯入精靈執行步驟6/8<br />
匯入精靈執行步驟7/8<br />
匯入精靈執行步驟8/8<br />
匯入精靈執行步驟END<br />
SQL語法教學<br />
案下”新增查詢”<br />
在此畫面打入SQL語法<br />
Step1.篩選有特定癌症之紀錄(門診檔)<br />SQL範例:(Ex.膀胱癌)<br />CREATE TABLE bladder AS <br />SELECT * FROM cd1996 WHERE ACODE_ICD9_1 LIKE ...
篩選有特定癌症之紀錄(門診檔)<br />範例一:只搜尋1996年的膀胱癌紀錄<br />語法:SELECT * FROM dd1996 WHERE ICD9CM_code_1 LIKE '188%' OR ICD9CM_code_2 LIKE...
篩選有特定癌症之紀錄(門診檔)<br />範例二:搜尋多年(1996~1998)的膀胱癌紀錄<br />語法:SELECT * FROM dd1996 WHERE ICD9CM_code_1 LIKE '188%' OR ICD9CM_code...
篩選有特定癌症之紀錄(門診檔)<br />範例三:新增一個膀胱癌紀錄的表單<br />CREATE TABLE bladder AS <br />SELECT * FROM cd1996 WHERE ACODE_ICD9_1 LIKE '188...
篩選有特定癌症之紀錄(門診檔)<br />新增後可在資料表中看見新增的表單<br />
Step2.產生特定癌症之病患名單<br />SQL範例:(由Step1產生之表單進行)<br />CREATE TABLE bladder_list AS SELECT DISTINCT ID FROM bladder<br />
輸入SQL語法<br />
產生新表單<br />
設計資料表<br />
更改欄位名稱<br />將ID此欄名稱改為ID2之後儲存關閉<br />
Step3.13年歸人檔建立(門診檔)<br />SQL範例:<br />CREATE TABLE colorectal_cancer AS SELECT * FROM cd1996,colorectal_id WHERE cd1996.ID ...
Thank   You<br />
Upcoming SlideShare
Loading in …5
×

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

3,675 views

Published on

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,675
On SlideShare
0
From Embeds
0
Number of Embeds
19
Actions
Shares
0
Downloads
85
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

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

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

×