# 排程行事曆 1. **依身分證號列出排程預約清單** [POST/ {contextPath}/appointment/list](#1-list-appointment) 2. **新增排程預約** [POST/ {contextPath}/appointment/add](#2-add-appointment) 3. **編輯排程預約** [POST/ {contextPath}/appointment/update](#3-update-appointment) 4. **刪除排程預約** [GET/ {contextPath}/appointment/delete](#4-delete-appointment) 5. **排程預約細節** [GET/ {contextPath}/appointment/detail](#5-detail-appointment) 6. **取得排程預約行事曆** [POST/ {contextPath}/appointment/calendar](#6-appointment-calendar) 7. **依不同排程項目列出預約清單** [POST/ {contextPath}/appointment/listPresent](#7-list-present-appointment) 8. **拿取衛生所電話** [POST/ {contextPath}/hisInfo/phone](#8-list-his_phone) ## 1. list appointment ```url= POST/ {contextPath}/appointment/list ``` 排程預約清單 ### Request Body: * query | Parameter | Required | format | desc | | ------------- | -------- | -------- |------------------ | | idCardNo | N | String | 個案身分證號 | | cpiId | N | String | 個案Id 若沒有身分證字號則使用cpiId | Note:如為一般民眾Token 則都不需要帶query 預設拿取所有預約資訊 * sorter | Parameter | Required | format | desc | | --------- | -------- | -------- |------------------------------ | | field | N | String | 排序欄位,預設為 reservItemName | | order | N | String | desc/asc,預設為 asc | ### Request Body Example: ``` javascript { "query":{ "idCardNo":"A123456789" }, "pagination": { "current": "1", "pageSize": "5" }, "sorter": { "field": "reservItemName", "order": "desc" } } ``` ### Response Body: | Parameter | format | desc | sort supported| | ---------------- | -------- |----------------------|-------------- | | appointId | String | 預約主檔ID | N | | appointRangeId | String | 預約時段ID | N | | appointDateId | String | 預約日期ID | N | | reservItemId | String | 預約項目ID | N | | reservItemName | String | 預約項目名稱 | Y | | appointDate | String | 預約日期 | Y | | remark | String | 預約排程備註 | N | | timeSlot | String | 預約排程時段,定義如下:<br>**MORING** (早上)<br>**AFTERNOON** (下午)<br>**EVENING** (晚上)<br>[Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#timeslot) | Y| | medicalStaffId | String | 預約醫師ID | N | | doctorName | String | 預約醫師名稱 | N | | hisName | String | 衛生所名稱 | Y | | hisPhone | Array<String> | 衛生所電話 | N | ### Response Body Example: * response: 200 ``` javascript { "httpCode": 200, "result": { "data": [ { "appointId": "1dbc9ff6-4580-49c6-ac87-69fd5c01433e", "appointRangeId": "9f7d8e0c-ff45-4aa2-9e86-a2ac4be61003", "appointDateId": "89363f1a-1f27-4730-9e63-6aa58da98a54", "reservItemId": "c4b32cd6-7fa9-42cc-90c7-748a2382623e", "reservItemName": "驗血", "appointDate": "2019-04-09", "remark": "SINGLE TEST", "timeSlot": "MORING", "medicalStaffId": "cc77d3fe-f541-462a-80a2-929db7184f5a", "doctorName": "大武鄉醫師", "hisName": "大武鄉衛生所", "hisPhone": ["089-791143"], "appointDateValue": 1588694400000 } ], "pagination": { "current": 1, "pageSize": 5, "total": 1 }, "sorter": { "field": "reservItemName", "order": "desc" } } } ``` ## 2. add appointment ```url= POST/ {contextPath}/appointment/add ``` 新增排程預約 ### Request Body: | Parameter | Required | format | desc | | ------------- | -------- | -------- |---------------------- | | idCardNo | Y | String | 個案身分證號 | | reservItemId | Y | String | 預約項目ID | | appointDate | **Y** (單次預約)、<br>**N** (重複預約) | String | 預約日期 | | timeSlot | **Y** (單次預約)、<br>**N** (重複預約) | String | 單次預約排程時段,定義如下:<br>**MORING** (早上)<br>**AFTERNOON** (下午)<br>**EVENING** (晚上)<br>[Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#timeslot) | | startDate | **Y** (重複預約)、<br>**N** (單次預約) | String | 開始日期 | | endDate | **Y** (重複預約)、<br>**N** (單次預約) | String | 結束日期 | | repeatTime | **Y** (重複預約)、<br>**N** (單次預約) | Object | 重複週期預約設定 | | loopType | Y | String | 預約排程週期,定義如下:<br>**SINGLE** (單次)<br>**REPEAT** (重複)<br>[Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#%E6%8E%92%E7%A8%8B%E9%A0%90%E7%B4%84%E9%80%B1%E6%9C%9F%E9%A1%9E%E5%9E%8B) | | remark | N | String | 預約排程備註 | | medicalStaffId| Y | String | 預約醫師ID | * repeatTime | Parameter | Required | format | desc | | ------------- | -------- | -------- |---------------------- | | weekday | Y | String | 星期幾,定義參考 [Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#%E6%8E%92%E7%A8%8B%E9%A0%90%E7%B4%84%E6%98%9F%E6%9C%9F%E5%B9%BE) | | timeSlot | Y | String | 預約排程時段,定義如下:<br>**MORING** (早上)<br>**AFTERNOON** (下午)<br>**EVENING** (晚上)<br>[Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#timeslot) | ### Request Body Example: * 單次預約 ``` javascript { "idCardNo":"A998877004", "reservItemId":"c4b32cd6-7fa9-42cc-90c7-748a2382623e", "appointDate":"2019-04-09", "timeSlot":"MORING", "loopType":"SINGLE", "remark":"SINGLE TEST", "medicalStaffId":"e38e14cc-6d76-41d7-94c1-314a9971ab0a" } ``` * 重複預約 ``` javascript { "idCardNo":"A123456777", "reservItemId":"c4b32cd6-7fa9-42cc-90c7-748a2382623e", "startDate":"2019-05-12", "endDate":"2019-06-12", "repeatTime":[ { "weekday":"MONDAY", "timeSlot":"MORNING" }, { "weekday":"FRIDAY", "timeSlot":"MORNING" } ], "loopType":"REPEAT", "remark":"REPEAT TEST", "medicalStaffId":"e38e14cc-6d76-41d7-94c1-314a9971ab0a" } ``` ### Response Body: * httpCode 200 | Parameter | format | desc | | ---------------- | -------- |----------------------| | appointId | String | 預約主檔ID | * httpCode 422 - errorMsg | errorMsg | desc | | --------- |-------- | | SERVICE_ERROR.APPOINMENT_FULL | 預約時段人數已滿 | | SERVICE_ERROR.APPOINMENT_DUPLICATE | 重複預約 | | SERVICE_ERROR.APPOINMENT_REPEAT_PERIOD_OVER_ONE_YEAR | 重複周期時間間距超過一年| ### Response Body Example: ``` javascript // 422 預約時段人數已滿 { "errorMsg": "SERVICE_ERROR.APPOINMENT_FULL ", "httpCode": 422 } // 422 重複預約 { "errorMsg": "SERVICE_ERROR.APPOINMENT_DUPLICATE ", "httpCode": 422 } // 422 重複周期時間間距超過一年 { "errorMsg": "SERVICE_ERROR.APPOINMENT_REPEAT_PERIOD_OVER_ONE_YEAR ", "httpCode": 422 } //200 { "httpCode": 200, "result": { "data": { "appointId": "b870b89c-df0c-44e8-9d8b-f57f9935296e" } } } ``` ## 3. update appointment ```url= POST/ {contextPath}/appointment/update ``` 編輯排程預約 ### Request Body: | Parameter | Required | format | desc | | ------------- | -------- | -------- |----------------------- | | appointId | Y | String | 預約主檔ID | | appointRangeId| Y | String | 預約時段ID | | appointDateId | Y | String | 預約日期ID | | idCardNo | Y | String | 個案身分證號 | | reservItemId | Y | String | 預約項目ID | | appointDate | Y | String | 預約日期 | | timeSlot | Y | String | 預約排程時段,定義如下:<br>**MORING** (早上)<br>**AFTERNOON** (下午)<br>**EVENING** (晚上)<br>[Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#timeslot) | | loopType | Y | String | 預約排程週期,定義如下:<br>**SINGLE** (單次)<br>**REPEAT** (重複)<br>[Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#%E6%8E%92%E7%A8%8B%E9%A0%90%E7%B4%84%E9%80%B1%E6%9C%9F%E9%A1%9E%E5%9E%8B) | | remark | N | String | 預約排程備註 | | medicalStaffId| Y | String | 預約醫師ID | ### Request Body Example: ``` javascript { "appointId":"b870b89c-df0c-44e8-9d8b-f57f9935296e", "appointRangeId":"074fefd2-ba97-4bda-b87a-7fc377204935", "appointDateId":"b99f7f73-8fdd-427d-956f-915be7a30b84", "reservItemId":"c4b32cd6-7fa9-42cc-90c7-748a2382623e", "idCardNo":"A123456777", "appointDate":"2019-07-03", "timeSlot":"EVENING", "loopType":"SINGLE", "remark":"SINGLE TEST 2", "medicalStaffId":"e38e14cc-6d76-41d7-94c1-314a9971ab0a" } ``` ### Response Body: * httpCode 200 | Parameter | format | desc | | ---------------- | -------- |----------------------| | count | Integer | 異動個數 | * httpCode 422 - errorMsg | errorMsg | desc | | --------- |-------- | | SERVICE_ERROR.APPOINMENT_FULL | 預約時段人數已滿 | | SERVICE_ERROR.APPOINMENT_DUPLICATE | 重複預約 | | SERVICE_ERROR.APPOINMENT_CAN_NOT_UPDATE_AS_REPEAT | 預約不得編輯改為重複週期| | SERVICE_ERROR.APPOINMENT_NOT_EXIST | 預約不存在 | | SERVICE_ERROR.APPOINMENT_UPDATE_MORE_THAN_ONE_RECORD | 預約編輯筆數超過一筆 | ### Response Body Example: ``` javascript // 422 預約時段人數已滿 { "errorMsg": "SERVICE_ERROR.APPOINMENT_FULL ", "httpCode": 422 } // 422 重複預約 { "errorMsg": "SERVICE_ERROR.APPOINMENT_DUPLICATE ", "httpCode": 422 } // 422 預約不得編輯改為重複週期 { "errorMsg": "SERVICE_ERROR.APPOINMENT_CAN_NOT_UPDATE_AS_REPEAT ", "httpCode": 422 } // 422 預約不存在 { "errorMsg": "SERVICE_ERROR.APPOINMENT_NOT_EXIST ", "httpCode": 422 } // 422 預約編輯筆數超過一筆 { "errorMsg": "SERVICE_ERROR.APPOINMENT_UPDATE_MORE_THAN_ONE_RECORD ", "httpCode": 422 } //200 { "httpCode": 200, "result": { "data": { "count": 1 } } } ``` ## 4. delete appointment ```url= GET/ {contextPath}/appointment/delete ``` 刪除排程預約 ### Request Param: | Parameter | Required | format | desc | | ------------- | -------- | -------- |------------------ | | appointDateId | Y | String | 預約日期ID | ### Request Example: ``` javascript GET /appointment/delete?appointDateId=b99f7f73-8fdd-427d-956f-915be7a30b84 ``` ### Response Body: | Parameter | format | desc | | ---------------- | -------- |----------------------| | count | Integer | 異動個數 | ### Response Body Example: * response: 200 ``` javascript { "httpCode": 200, "result": { "data": { "count": 1 } } } ``` ## 5. detail appointment ```url= GET/ {contextPath}/appointment/detail ``` 排程預約細節 ### Request Body: | Parameter | Required | format | desc | | ------------- | -------- | -------- |------------------ | | appointDateId | Y | String | 預約日期ID | ### Request Example: ``` javascript GET /appointment/detail?appointDateId=b99f7f73-8fdd-427d-956f-915be7a30b84 ``` ### Response Body: | Parameter | format | desc | | ---------------- | -------- |----------------------| | appointId | String | 預約主檔ID | | appointRangeId | String | 預約時段ID | | appointDateId | String | 預約日期ID | | reservItemId | String | 預約項目ID | | reservItemName | String | 預約項目名稱 | | idCardNo | String | 個案身分證號 | | patName | String | 個案姓名 | | appointDate | String | 預約日期 | | startDate | String | 開始日期 | | endDate | String | 結束日期 | | loopType | String | 預約排程週期,定義如下:<br>**SINGLE** (單次)<br>**REPEAT** (重複)<br>[Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#%E6%8E%92%E7%A8%8B%E9%A0%90%E7%B4%84%E9%80%B1%E6%9C%9F%E9%A1%9E%E5%9E%8B) | | remark | String | 預約排程備註 | | timeSlot | String | 預約排程時段,定義如下:<br>**MORING** (早上)<br>**AFTERNOON** (下午)<br>**EVENING** (晚上)<br>[Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#timeslot) | | medicalStaffId | String | 預約醫師ID | N | | doctorName | String | 預約醫師名稱 | N | | hisName | String | 衛生所名稱 | Y | | hisPhone | Array<String> | 衛生所電話 | N | ### Response Body Example: * response: 200 ``` javascript { "httpCode": 200, "result": { "data": { "appointId": "1dbc9ff6-4580-49c6-ac87-69fd5c01433e", "appointRangeId": "9f7d8e0c-ff45-4aa2-9e86-a2ac4be61003", "appointDateId": "89363f1a-1f27-4730-9e63-6aa58da98a54", "reservItemId": "c4b32cd6-7fa9-42cc-90c7-748a2382623e", "reservItemName": "驗血", "idCardNo": "A998877004", "patName": "大發", "doctorName": "桃源區衛生所醫師", "medicalStaffId": "e38e14cc-6d76-41d7-94c1-314a9971ab0a", "appointDate": "2019-04-09", "startDate": "2019-04-09", "endDate": "2019-04-09", "loopType": "SINGLE", "remark": "SINGLE TEST", "timeSlot": "MORING", "medicalStaffId": "12a68dac-6244-46c8-b703-7e84a657848a", "doctorName": "杜佳佳", "hisName": "那瑪夏衛生所", "hisPhone": ["07-6701142"], "appointDateValue": 1565712000000 } } } ``` * response: 400 傳入的 id 不存在 ``` { "errorMsg": "API_ERROR.NO_DATA", "httpCode": 400 } ``` ## 6. appointment calendar ```url= POST/ {contextPath}/appointment/calendar ``` 取得排程預約行事曆 ### Request Body: | Parameter | Required | format | desc | | ------------- | -------- | -------- |----------------------- | | startDate | N | String | 開始日期 | | endDate | N | String | 結束日期 | ### Response Body Example: * response: 200 ``` javascript { "startDate":"2019-04-08", "endDate":"2019-04-13" } ``` ### Response Body: | Parameter | format | desc | | ---------------- | -------- |----------------------| | appointId | String | 預約主檔ID | | appointRangeId | String | 預約時段ID | | appointDateId | String | 預約日期ID | | reservItemId | String | 預約項目ID | | reservItemName | String | 預約項目名稱 | | idCardNo | String | 個案身分證號 | | patName | String | 個案姓名 | | appointDate | String | 預約日期 | | remark | String | 預約排程備註 | | weekday | String | 星期幾,定義參考 [Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#%E6%8E%92%E7%A8%8B%E9%A0%90%E7%B4%84%E6%98%9F%E6%9C%9F%E5%B9%BE) | | timeSlot | String | 預約排程時段,定義如下:<br>**MORING** (早上)<br>**AFTERNOON** (下午)<br>**EVENING** (晚上)<br>[Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#timeslot) | | medicalStaffId | String | 預約醫師ID | N | | doctorName | String | 預約醫師名稱 | N | | hisName | String | 衛生所名稱 | Y | | hisPhone | Array<String> | 衛生所電話 | N | ### Response Body Example: * response: 200 ``` javascript { "httpCode": 200, "result": { "data": [ { "appointId": "816a5a36-fd4a-4c11-8565-ee91966e0d96", "appointRangeId": "fd39d0b4-7bdc-45d4-857b-bb744f569ba4", "appointDateId": "bea0c273-39a5-4919-b7bc-cd8426e9287f", "reservItemId": "c4b32cd6-7fa9-42cc-90c7-748a2382623e", "reservItemName": "驗血", "idCardNo": "A123456777", "patName": "蘇寒冠", "doctorName": "桃源區衛生所醫師", "medicalStaffId": "e38e14cc-6d76-41d7-94c1-314a9971ab0a", "appointDate": "2019-04-09", "remark": "SINGLE TEST", "weekday": "TUESDAY", "timeSlot": "MORNING", "medicalStaffId": "fbc9d26e-4cfc-4de1-85d2-bc9d560a1289", "doctorName": "那瑪夏區衛生所醫師", "hisName": "那瑪夏衛生所", "hisPhone": ["07-6701142"], "appointDateValue": 1588608000000 }, { "appointId": "e13bc02e-c116-4c0d-bef8-dbe6c64008a8", "appointRangeId": "8ef62458-1bb1-4be2-9220-46a0595192e4", "appointDateId": "5f91e9bc-4a1f-4a50-8af8-695e055be756", "reservItemId": "c4b32cd6-7fa9-42cc-90c7-748a2382623e", "reservItemName": "驗血", "idCardNo": "A123456777", "patName": "蘇寒冠", "doctorName": "桃源區衛生所醫師", "medicalStaffId": "e38e14cc-6d76-41d7-94c1-314a9971ab0a", "appointDate": "2019-04-12", "remark": "SINGLE TEST 2", "weekday": "FRIDAY", "timeSlot": "EVENING", "medicalStaffId": "fbc9d26e-4cfc-4de1-85d2-bc9d560a1289", "doctorName": "那瑪夏區衛生所醫師", "hisName": "那瑪夏衛生所", "hisPhone": ["07-6701142"], "appointDateValue": 1588608000000 } ] } } ``` ## 7. list present appointment ```url= POST/ {contextPath}/appointment/listPresent ``` 依不同排程項目列出預約清單 (於個案儀表板畫面顯示) ### Request Body: * query | Parameter | Required | format | desc | | ------------- | -------- | -------- |------------------ | | idCardNo | N | String | 個案身分證號 | | cpiId | N | String | 個案Id 若沒有身分證字號則使用cpiId | * sorter | Parameter | Required | format | desc | | --------- | -------- | -------- |------------------------------ | | field | N | String | 排序欄位,預設為 reservItemName | | order | N | String | desc/asc,預設為 asc | ### Request Body Example: ``` javascript { "query":{ "idCardNo":"S123991591" }, "pagination": { "current": "1", "pageSize": "5" }, "sorter": { "field": "reservItemName", "order": "desc" } } ``` ### Response Body: | Parameter | format | desc | sort supported| | ---------------- | -------- |------------------------------------|-------------- | | reservItemId | String | 預約項目ID | N | | reservItemName | String | 預約項目名稱 | Y | | remark | String | 預約排程備註 | N | | prevAppoint | String | 上次預約日期 YYYY-MM-DD,若無回空字串 | N | | nextAppoint | String | 下次預約日期 YYYY-MM-DD,若無回空字串 | N | ### Response Body Example: * response: 200 ``` javascript { "httpCode": 200, "result": { "data": [ { "reservItemId": "c4b32cd6-7fa9-42cc-90c7-748a2382623e", "reservItemName": "驗血", "idCardNo": "S123991591", "remark": "Aaron test", "prevAppoint": "", "nextAppoint": "2019-05-01" } ], "pagination": { "current": 1, "pageSize": 5, "total": 1 }, "sorter": { "field": "reservItemName", "order": "desc" } } } ``` ## 8. list his_phone ```url= GET/ {contextPath}/hisInfo/phone ``` 拿取該區衛生所電話 ### Response Body: | Parameter | format | desc | sort supported| | ---------------- | -------- |------------------------------------|-------------- | | data | Array<String> | 衛生所電話Array | N | ### Response Body Example: * response: 200 ``` javascript { "httpCode": 200, "result": { "data": [ "07-1239873", "07-2347654" ] } } ```