--- title: EPIC API Document tags: BackendApi, EPIC DEMO disqus: hackmd --- {%hackmd BJrTq20hE %} # EPIC API Document ## Handshake User Login 1. 客戶端訪問userLogin API The client accesses the userLogin API 2. 認證後API傳回醫生相關信息,服務器開始倒計時連線訪問時間 After certified, the API returns the Doctor information and the server starts to count down the session access time 3. 客戶端在cookie中存儲醫生相關信息 The client stores the Doctor information in the cookie 4. 客戶端根據醫生代碼訪問其他API The client accessed other APIs per the Doctor code 5. 如果時間到,服務端終止訪問連接,客戶端再次訪問 userLogin API If time up, the server terminals the access connection and the client accesses the userLogin API again ## **<font color="#49cc90">[POST]</font> 使用者登入 (User login)** ==End point== ``` /api/DemoEpic/userLogin ``` ==Request json== ``` json { "UserID": "aesop", //醫生代碼 (Doctor code) "UserPwd": "password" //密碼 (Password) } ``` ==Response json== ```json { "DoctorName": "Dr.Aesop M.D", //使用者名稱 "DivisionCode": "01", //科別 "DivisionName": "Division of Family Medicine", //科別名稱 "DoctorCode": "aesop" //醫生代碼 } ``` --- ## **<font color="#50e3c2">[PATCH]</font> 修改使用者資訊 (Change user information)** ==End point== ``` /api/DemoEpic/user ``` ==Request json== >不修改,保留null或是"" (null or "", keep current parameter) ```json { "UserID": "aesop", //※醫生代碼 必填 不得修改 (Doctor code, must, not changeable) "Name": "Dr.Aesop M.D", //使用者名稱 (Doctor name) "Email": "aesop@aesoptek.com", //電子郵件 (Email) "UserPwd": "password", //密碼 (Password) "DivisionCode": "01" //科別 (Division) } ``` --- ## **<font color="#49cc90">[POST]</font> 建立使用者 (Create a new user)** ==End point== ``` /api/DemoEpic/user ``` ==Request json== ```json { "UserID": "aesop", //※醫生代碼 必填 不得修改 (Doctor code, must, not changeable) "Name": "Dr.Aesop M.D", //使用者名稱 (Doctor name) "Email": "aesop@aesoptek.com", //電子郵件 (Email) "UserPwd": "password", //密碼 (Password) "DivisionCode": "01" //科別 (Division) } ``` --- ## **<font color="#49cc90">[POST]</font> 新增群組列表 (Add a new Patient Group)** ==End point== ``` /api/DemoEpic/Customize ``` ==Request json== ```json { "uuid": "00000000-0000-0000-0000-000000000000", //Guid "ListName": "aesop" //群組名稱 (Patient Group name) } ``` --- ## **<font color="#61affe">[GET]</font> 取得全部群組列表 (Get Patient Groups)** ==End point== ``` /api/DemoEpic/Customize ``` ==Response json== ``` json [ { "uuid": "c65f30fa-083d-4d3d-893a-cb08cbeea6b9", //Guid "ListName": "Positive" //群組名稱 (Patient Group name) }, { "uuid": "3c66fc27-0caa-42fd-b27d-d34091e361ff", "ListName": "Negative" } ] ``` --- ## **<font color="#50e3c2">[PATCH]</font> 修改群組名稱 (Change Patient Group name)** ==End point== ``` /api/DemoEpic/Customize ``` ==Request json== ```json { "uuid": "c65f30fa-083d-4d3d-893a-cb08cbeea6b90", //需取代的Guid (Target Guid) "ListName": "修改後" //新的群組名稱 (New Patient Group name) } ``` ==Database Status== >取代前 (Before API execution) ```json { "uuid": "c65f30fa-083d-4d3d-893a-cb08cbeea6b90", //需取代的Guid (Target Guid) "ListName": "修改前" //現在的群組名稱 (Current Patient Group name) } ``` >取代後 (After API execution) ```json { "uuid": "c65f30fa-083d-4d3d-893a-cb08cbeea6b90", //需取代的Guid (Target Guid) "ListName": "修改後" //新的群組名稱 (New Patient Group name) } ``` --- ## **<font color="#f93e3e">[DELETE]</font> 刪除群組列表 (Delete a Patient Group)** ==End point== ``` /api/DemoEpic/Customize/{uuid} ``` ==Request== ``` /api/DemoEpic/Customize/c65f30fa-083d-4d3d-893a-cb08cbeea6b90 ``` > 範例c65f30fa-083d-4d3d-893a-cb08cbeea6b90為病人群組Guid (c65f30fa-083d-4d3d-893a-cb08cbeea6b90, Patient Group Guid) >會將該群組內的病人群組Guid改為==未指定病人群組Guid== >(the Guid of this Patient Group will be changed to ==Not specified Patient Group Guid==) >00000000-0000-0000-0000-000000000000 --- ## **<font color="#61affe">[GET]</font> 用醫生代碼取得群組列表中全部病人資訊 (Get all patient information with the Patient Group per the Doctor code)** ==End point== ``` /api/DemoEpic/Customize/{drCode} ``` > ==差異比較== /api/DemoEpic/Customize/{drCode} 回應帶病人群組 (Response json includes the Patient Group information) /api/DemoEpic/Patient/{drCode} 回應 :bulb:==不會==帶病人群組 (Response json does ==not include== the Patient Group information) ==Request== ``` /api/DemoEpic/Customize/aesop ``` > 範例aesop為醫生代碼 (aesop, Doctor code) ==Response json== ``` json [ { "ListId": "c65f30fa-083d-4d3d-893a-cb08cbeea6b9", "ListName": "Positive", "PatientList": [ { "PatientCode": "1301200010_20210510_11_381986353_221347", "PatientName": "THEA WATSON", "Gender": "F", "Age": 76, "DivisionCode": "11", "DivisionName": "Division of Dermatology" }, { "PatientCode": "AESOPDemoOnly_20210524_11_381986353_080925", "PatientName": "ELAINA GRANT", "Gender": "F", "Age": 76, "DivisionCode": "11", "DivisionName": "Division of Dermatology" } ] }, { "ListId": "3c66fc27-0caa-42fd-b27d-d34091e361ff", "ListName": "Negative", "PatientList": [ { "PatientCode": "1301200010_20210510_11_381986353_221347", "PatientName": "THEA WATSON", "Gender": "F", "Age": 76, "DivisionCode": "11", "DivisionName": "Division of Dermatology" }, { "PatientCode": "AESOPDemoOnly_20210524_11_381986353_080925", "PatientName": "ELAINA GRANT", "Gender": "F", "Age": 76, "DivisionCode": "11", "DivisionName": "Division of Dermatology" } ] } ] ``` --- ## **<font color="#50e3c2">[PATCH]</font> 設定醫生代碼到指定病人群組 (Apply the Doctor code to a specified Patient Group)** ==End point== ``` /api/DemoEpic/PxDrCustomize ``` ==Request json== ```json { "UserID": "aesop", //醫生代碼 (Doctor code) "CustomizeUUID": "c65f30fa-083d-4d3d-893a-cb08cbeea6b9" //指定的病人群組Guid (Target Patient Group Guid) } ``` ==Database Status== >取代前 (Before API execution) ```json { "attribute_uuid": "00000000-0000-0000-0000-000000000000", //未指定病人群組Guid (Not specified Patient Group Guid) "attribute_name": "全病人群組" //未指定病人群組名稱 (Not specified Patient Group name) "doctor_code": "aesop" //醫生代碼 (Doctor code) } ``` >取代後 (After API execution) ```json { "attribute_uuid": "c65f30fa-083d-4d3d-893a-cb08cbeea6b9", //指定的病人群組Guid (Target Patient Group Guid) "attribute_name": "Positive" //指定的病人群組名稱 (Target Patient Group name) "doctor_code": "aesop" //醫生代碼 (Doctor code) } ``` --- ## **<font color="#f93e3e">[DELETE]</font> 刪除醫生與病人群組連結 (Delete the connection between the Doctor code and the Patient Group)** ==End point== ``` /api/DemoEpic/PxDrCustomize ``` ==Request json== ```json { "UserID": "aesop", //醫生代號 (Doctor code) "CustomizeUUID": "c65f30fa-083d-4d3d-893a-cb08cbeea6b9" //需要刪除的Guid (Target Guid) } ``` --- ## **<font color="#61affe">[GET]</font> 取得資料庫中最後指定筆數的病人資訊 (Get last patient information per specified number)** ==End point== ``` /api/DemoEpic/GetAllPatient/{limit} ``` ==Request== /api/DemoEpic/GetAllPatient/1 >範例1為取得一組 (1, get last one patient information) ==Request json== ```json [ { "PatientCode": "1301200010_20210510_11_381986353_221347", "PatientName": "JOANNA BANKS", "Gender": "F", "Age": 76, "DivisionCode": "11", "DivisionName": "Division of Dermatology" } ] ``` --- ## **<font color="#50e3c2">[PATCH]</font> 修改病人分類 (Change the Patient Group of this Patient code)** ==End point== ``` /api/DemoEpic/Patient ``` ==Request json== ```json [ { "uuid": "c65f30fa-083d-4d3d-893a-cb08cbeea6b9", //指定的病人群組Guid (Target Patient Group Guid) "PatientCode": "381986353", //病人代碼 (Patient code) } ] ``` ==Database Status== >修改前 (Before API execution) ```json [ { "uuid": "00000000-0000-0000-0000-000000000000", //Guid(0) 代表為未指定病人群組 (Guid(0), not specified Patient Group) "PatientCode": "381986353", } ] ``` >修改後 (After API execution) ```json [ { "uuid": "c65f30fa-083d-4d3d-893a-cb08cbeea6b9", //指定的病人群組Guid (Target Patient Group Guid) "PatientCode": "381986353", } ] ``` --- ## **<font color="#f93e3e">[DELETE]</font> 刪除病人分類 (Delete the Patient Group of this Patient code)** ==End point== ``` /api/DemoEpic/Patient/{pxCode} ``` ==Request== ``` /api/DemoEpic/Patient/381986353 ``` >範例381986353為病人代碼 (381986353, Patient code) ==Database Status== >修改前 (Before API execution) ```json [ { "uuid": "c65f30fa-083d-4d3d-893a-cb08cbeea6b9", "PatientCode": "381986353", } ] ``` >修改後 (After API execution) ```json [ { "uuid": "00000000-0000-0000-0000-000000000000", //Guid(0) 代表為未指定病人群組 (Guid(0), not specified Patient Group) "PatientCode": "381986353", } ] ``` --- ## **<font color="#61affe">[GET]</font> 取得該醫生全部病人資訊 (Get all patient information of this Doctor code)** ==End point== ``` /api/DemoEpic/Patient/{drCode} ``` ==Request== ``` /api/DemoEpic/Patient/aesop ``` >範例aesop為醫生代碼 (aesop, Doctor code) ==Response json== ```json [ { "PatientCode": "1301200010_20210510_11_381986353_221347", "PatientName": "ZOE MASON", "Gender": "F", "Age": 76, "DivisionCode": "02", "DivisionName": "Department of Internal Medicine" }, { "PatientCode": "1301200010_20210510_11_381221347_221347", "PatientName": "BRIANNA MORRIS", "Gender": "F", "Age": 76, "DivisionCode": "11", "DivisionName": "Division of Dermatology" } ] ``` --- ## **<font color="#61affe">[GET]</font> 取得病人詳細資訊 (Get detail information of this Patient code)** ==End point== ``` /api/DemoEpic/PatienDetail/{pxCode} ``` ==Request== ``` /api/DemoEpic/PatienDetail/1301200010_20210510_11_381986353_221347 ``` >範例1301200010_20210510_11_381986353_221347為病人代碼 (1301200010_20210510_11_381986353_221347, Patient code) ==Response json== ```json { "PatientCode": "1301200010_20210510_11_381986353_221347", "DivisionName": "Department of Internal Medicine", "DivisionCode": "02", "PatientName": "ZOE MASON", "Gender": "F", "Age": 76, "Allergies": [ "Peanut" ], "PCP": "Megan O’Connor, M.D.", "SpecialtyComments": "None", "Demographics": { "Name": "ZOE MASON", "Age": 76, "Gender": "F", "Birthday": "05/14/1945", "StreeInfo": "710 Willow Rd", "CityInfo": "California", "StateInfo": "Menlo Park", "ZipCode": "94025", "HomePhoneNumber": "16503228803", "MobileNumber": "2034910739" }, "TobaccoHistory": { "SomkingStatus": "Never", "SmokelessTobaccoStatus": "Never" }, "SurgicalHistory": [], "ExternalProcedures": [], "ProblemList": [ { "ProblemCode": "E11.09", "ProblemDesc": "" } ], "MedicalHistory": [ { "Icd10Code": "E11.09", "DiagnosisName": "" } ], "FamilyHistory": [ "NA" ], "MedicationList": [ { "GenericDrugName": "erythromycin", "BrandDrugName": "ERYTHROMYCIN OPHTHALMIC OINTMENT 0.5%", "DrugCode": "A035459417" }, { "GenericDrugName": "mometasone", "BrandDrugName": "NASONEX AQUEOUS NASAL SPRAY", "DrugCode": "B022924424" }, { "GenericDrugName": "diclofenac", "BrandDrugName": "CATAFLAM 25MG SUGAR COATED TABLETS", "DrugCode": "B020157100" }, { "GenericDrugName": "thalidomide", "BrandDrugName": "THADO CAP 50 MG", "DrugCode": "AB48969100" } ], "HealthMaintenance": [ "AAFP and USPSTF", "NCEP–ATP III", "ADA", "USPSTF" ] } ``` ---