---
# System prepended metadata

title: 個案追蹤管理 - 個案 API List

---

# 個案追蹤管理 - 個案 API List


1. **[WEB] 取得疾病個案總覽**

    [GET /{contextPath}/casePatient/diseaseOverview?diseaseType={diseaseType}](#1-web-取得疾病個案總覽-get-casepatientdiseaseoverview)


2. **[WEB] 取得疾病總覽-本月VPN收案與完成狀態統計**

    [GET /{contextPath}/casePatient/monthlyVPNCount?diseaseType={diseaseType}](#2-web-取得疾病總覽-本月vpn收案與完成狀態統計-get-casepatientmonthlyvpncount)
    
3. **[WEB] 個案GIS地圖查詢**

    [POST /{contextPath}/caseGis/getGisInfos](#3-web-個案gis地圖查詢-post-casegisgetgisinfos)
    
4. **[WEB] 個案姓名清單**

    [GET/{contextPath}/casePatient/list](#4-web-個案姓名清單-get-casepatientlist)
    
5. **[WEB] 同步HIS資料**

    [POST /{contextPath}/casePatient/his/sync](#5-web-同步his資料-post-casepatienthissync)

6. **[WEB] 病歷清單**

    [POST/{contextPath}/case/list](#6-web-病歷清單-post-caselist)

7. **[Web] 取得指標分析**

    [POST /{contextPath}/vpnCase/getAnnualStatistic](#7-取得指標分析-post-vpncasegetannualstatistic)

8. **[Web] 匯出指標分析**

    [POST /{contextPath}/vpnCase/exportAnnualStatistic](#8-匯出指標分析-post-vpncaseexportannualstatistic)

9. **[Web] 用藥處方-日期列表**

    [POST /{contextPath}/casePatient/drug/list](#9-用藥處方-日期列表-post-casepatientdruglist)

10. **[Web] 用藥處方-Detail列表**

    [POST /{contextPath}/casePatient/drug/details](#10-用藥處方-detail列表-post-casepatientdrugdetails)

11. **[Web] 檢驗報告**

    [POST /{contextPath}/casePatient/report/list](#11-檢驗報告-post-casepatientreportlist)

12. **[Web] 檢驗報告-Detail列表**

    [POST /{contextPath}/casePatient/report/details](#12-檢驗報告-detail列表-post-casepatientreportdetails)

13. **[Web] 取得病歷基本資訊**

    [GET /{contextPath}/casePatient/info](#13-取得病歷基本資訊-get-casepatientinfo)

14. **[Web] 更新病歷基本資訊**

    [POST /{contextPath}/casePatient/info/update](#14-更新病歷基本資訊-post-casepatientinfoupdate)


15. **[Web] 治療計畫-取得疾病指標項目**

    [GET /{contextPath}/casePatient/indicator](#15-web-治療計畫-取得疾病指標項目-get-casepatientindicator)


16. **[Web] 治療計畫-取得疾病指標項目的標準範圍值**

    [GET /{contextPath}/casePatient/indicator/detail](#16-web-治療計畫-取得疾病指標項目的標準範圍值-get-casepatientindicatordetail)

17. **[Web] 治療計畫-更新疾病指標項目的標準範圍值**

    [POST /{contextPath}/casePatient/indicator/update](#17-web-治療計畫-更新疾病指標項目的標準範圍值-post-casepatientindicatorupdate)

18. **[Web] 最後用藥處方-Detail列表**

    [POST /{contextPath}/casePatient/drug/getLastdetails](#18-最後用藥處方-detail列表-post-casepatientdruggetlastdetails)
    
19. **[WEB] 新增個案清單並自動加入家戶與收案清單**

    [POST/{contextPath}/case/add](#19-web-新增個案清單並自動加入家戶與收案清單-post-caseadd)

---

* API Require Headers:
```javascript
{
      Content-Type: 'application/json',
      Authorization: accessToken,
}
```
---
## 1. [WEB] 取得疾病個案總覽 **GET /casePatient/diseaseOverview**

### 用於：

*  WEB(醫生、護士、醫院管理者)
   ``` javascript
   個案追蹤管理 > 個案總覽 // 需先從 profile 的 manageableDiseases 資訊，取得該帳戶可管理疾病(diseaseType)
   ```

### Request Parameter:
| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| diseaseType |Y | String |疾病類型，目前定義的項目如文件： [Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#diseasetype)|

### Request Example:
```javascript
// 取得 ECKD
GET /casePatient/diseaseOverview?diseaseType=ECKD

// 取得 BC
GET /casePatient/diseaseOverview?diseaseType=BC

// 取得 DM
GET /casePatient/diseaseOverview?diseaseType=DM
```

### Response Body:
* DM response

| Parameter |  format |    desc   |
| -----| -----|-------- |
| total | int | 該疾病總個案數量 |
| LDL | Object | **key**: HBA1C_NORMAL/HBA1C_CAUTION/HBA1C_DANGER [Ref. doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#dmoverviewoption)<br> **value**: 該指標的數量(int) |
| HBA1C | Object | **key**: HBA1C_CAUTION/HBA1C_DANGER/HBA1C_NORMAL [Ref. doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#dmoverviewoption)<br> **value**: 該指標的數量(int) |

* BC response

| Parameter |  format |    desc   |
| -----| -----|-------- |
| total | int | 該疾病總個案數量 |
| B | Object | **key**: HAS_B/NO_B [Ref. doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#bcoverviewoption)<br> **value**: 該指標的數量(int) |
| C | Object | **key**: HAS_C/NO_C [Ref. doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#bcoverviewoption)<br> **value**: 該指標的數量(int) |

* ECKD response

| Parameter |  format |    desc   |
| -----| -----|-------- |
| total | int | 該疾病總個案數量 |
| STAGE | Object | **key**: STAGE_1/STAGE_2/STAGE_3A [Ref. doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#eckdoverviewoption)<br> **value**: 該指標的數量(int) |





### Response Body Example:
```javascript
// DM
{
    "httpCode": 200,
    "result": {
        "data": {
            "total": 7,
            "LDL": {
                "LDL_DANGER": 2,
                "LDL_CAUTION": 3,
                "LDL_NORMAL": 2
            },
            "HBA1C": {
                "HBA1C_CAUTION": 1,
                "HBA1C_DANGER": 1,
                "HBA1C_NORMAL": 5
            }
        }
    }
}

// BC
{
    "httpCode": 200,
    "result": {
        "data": {
            "B": {
                "NO_B": 6,
                "HAS_B": 7
            },
            "total": 13,
            "C": {
                "NO_C": 8,
                "HAS_C": 5
            }
        }
    }
}

// ECKD
{
    "httpCode": 200,
    "result": {
        "data": {
            "total": 6,
            "STAGE": {
                "STAGE_2": 2,
                "STAGE_1": 3,
                "STAGE_3A": 1
            }
        }
    }
}

```
---
## 2. [WEB] 取得疾病總覽-本月VPN收案與完成狀態統計 **GET /casePatient/monthlyVPNCount**

### 用於：

*  WEB(醫生、護士、醫院管理者)
   ``` javascript
   個案追蹤管理 > 個案總覽 // 需先從 profile 的 manageableDiseases 資訊，取得該帳戶可管理疾病(diseaseType)
   ```

### Request Parameter:
| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| diseaseType |Y | String |疾病類型，目前定義的項目如文件： [Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#diseasetype)|

### Request Example:
```javascript
// 取得 ECKD
GET /casePatient/monthlyVPNCount?diseaseType=ECKD

// 取得 BC
GET /casePatient/monthlyVPNCount?diseaseType=BC

// 取得 DM
GET /casePatient/monthlyVPNCount?diseaseType=DM
```

### Response Body:
* data (ECKD/BC/DM)

| Parameter |  format |    desc   |
| -----| -----|-------- |
|inCasePerson | int | 本月份收案人數  |
|outCasePerson | int |  本月份結案或轉出人數|
|waitingCasePerson | int |本月份未完成人數 |
|finishCasePerson | int |本月份已完成人數 |
|uploadedCasePerson  | int |本月份已上傳人數 |
|totalPerson  | int | 本月份總人數 |




### Response Body Example:
```javascript
{
    "httpCode": 200,
    "result": {
        "data": {
            "inCasePerson": 2,
            "outCasePerson": 0,
            "waitingCasePerson": 0,
            "finishCasePerson": 1,
            "uploadedCasePerson": 1,
            "totalPerson": 2
        }
    }
}

```

---

## 3. [WEB] 個案GIS地圖查詢 **POST /caseGis/getGisInfos**

### 用於：

*  WEB(醫生、護士、醫院管理者)
   ``` javascript
   個案追蹤管理 > 個案GIS地圖查詢 
   ```

### Request Parameter:
| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| filterType|Y | String |篩選疾病類型，目前定義的項目如文件： [Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#diseasetype)|
| villageCode|N | String | 個案所在村里代碼|

### Request Example:
```javascript
{
"villageCode":"",
"filterType":"DM"
}
```

### Response Body:
| Parameter    |  format  |  desc                  |
| ------------ | -------- | ---------------------- |
| area         | String   | 區域名稱i18n            |
| position     | String   | 區域經緯度              |
| villages     | Object   | 村里不同標籤統計資訊     |
| markers      | Object   | 符合過濾條件的家戶或成員 |

**villages**

| Parameter           |  format |  desc                  |
| ------------------- | ------- | ---------------------- |
| village             | String  | 村里名稱i18n            |
| villageCode         | String  | 個案所在村里代碼         |
| position            | Object  | 村里經緯度              |
| hasBCount           | Integer | 有B肝個案數             |
| noBCount            | Integer | 無B肝個案數             |
| hasCCount           | Integer | 有C肝個案數             |
| noCCount            | Integer | 無C肝個案數             |
| stage1Count         | Integer | ECKD stage1個案數       |
| stage2Count         | Integer | ECKD stage2個案數       |
| stage3aCount        | Integer | ECKD stage3a個案數      |
| hba1cNormalCount    | Integer | HbA1C正常個案數         |
| hba1cCautionCount   | Integer | HbA1C異常個案數         |
| hba1cDangerCountt   | Integer | HbA1C危險個案數         |
| ldlNormalCount      | Integer | LDL正常個案數           |
| ldlCautionCount     | Integer | LDL異常個案數           |
| ldlDangerCountt     | Integer | LDL危險個案數           |

**markers**

| Parameter           |  format  |  desc                  |
| ------------------- | -------- | ---------------------- |
| village             | String   | 村里名稱i18n            |
| villageCode         | String  | 個案所在村里代碼         |
| position            | Object   | 個案地址經緯度          |
| tag                 | Array    | 疾病指標狀態，目前定義的項目如文件： [DM](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#dmoverviewoption),  [BC肝](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#bcoverviewoption),  [ECKD](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#eckdoverviewoption) |
| cpiId               | String   | 個案病例ID              |
| name                | String   | 個案名稱                |
| address             | String   | 個案地址                |
| tel                 | String   | 個案電話                |
| prevAppoint         | String   | 上次回診日期 YYYY-MM-DD，若無回空字串|

### Response Body Example:
* response: 200 

```javascript

{
    "httpCode": 200,
    "result": {
        "data": {
            "area": "REGION.AREA.NAMAXIA",
            "position": {
                "lat": 23.26886,
                "lng": 120.732688
            },
            "villages": [
                {
                    "village": "REGION.VILLAGE.DAKANUWA",
                    "villageCode": "6403800-001",
                    "position": {
                        "lat": 23.290136,
                        "lng": 120.743069
                    },
                    "hba1cNormalCount": 5,
                    "hba1cCautionCount": 1,
                    "ldlNormalCount": 2,
                    "ldlCautionCount": 3
                }
            ],
            "markers": [
                {
                    "village": "REGION.VILLAGE.DAKANUWA",
                    "villageCode": "6403800-001",
                    "position": {
                        "lat": 23.2677982,
                        "lng": 120.7201951
                    },
                    "tag": [
                        "HBA1C_CAUTION",
                        "LDL_DANGER"
                    ],
                    "cpiId": "4abd007cd00e4fb2be9d135ab752d376",
                    "name": "袁鳴明",
                    "address": "高雄市鹽埕區",
                    "tel": "07-1234567",
                    "prevAppoint": "2019-04-01"
                },
                {
                    "village": "REGION.VILLAGE.DAKANUWA",
                    "villageCode": "6403800-001",
                    "position": {
                        "lat": 23.2677982,
                        "lng": 120.7201951
                    },
                    "tag": [
                        "HBA1C_DANGER",
                        "LDL_NORMAL"
                    ],
                    "cpiId": "c302670fdcad4622811f87625428e4e3",
                    "name": "幸炎純",
                    "address": "高雄市那瑪夏區二坡18號",
                    "tel": "9085565460",
                    "prevAppoint": "2019-04-05"
                },
                {
                    "village": "REGION.VILLAGE.DAKANUWA",
                    "villageCode": "6403800-001",
                    "position": {
                        "lat": 23.2068329,
                        "lng": 120.7005044
                    },
                    "tag": [
                        "HBA1C_NORMAL",
                        "LDL_CAUTION"
                    ],
                    "cpiId": "dbec989ce72745d5b001b0db1546391b",
                    "name": "蘇寒冠",
                    "address": "高雄市那瑪夏區和正街43號",
                    "tel": "0098610826",
                    "prevAppoint": "2019-03-01"
                },
                ...
            ]
        }
    }
}
```

---

## 4. [WEB] 個案姓名清單 **GET /casePatient/list**

### 用於：

*  WEB(醫生、護士、醫院管理者)
   ``` javascript
   個案追蹤管理> 排程行事曆 > 排程預約，依身分證字號取得個案姓名清單
   ```
### Request Parameter:
NONE

### Response Body:
| Parameter    |  format  |  desc                  |
| ------------ | -------- | ---------------------- |
| patIdNo      | String   | 病患身份證字號          |
| patName      | String   | 病患姓名                |

### Response Body Example:
* response: 200 

```javascript
{
    "httpCode": 200,
    "result": {
        "data": [
            {
                "patIdNo": "A123456777",
                "patName": "蘇寒冠"
            },
            {
                "patIdNo": "A887766554",
                "patName": "從強珠"
            },
            ...
        ]
    }
}

```

## 5. [WEB] 同步his資料 **POST /casePatient/his/sync**

### Request Parameter:
| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| id |Y | String |case_paitent_id|


### Request Example:
```javascript
{
    "id":"WEIWEI"
}
```

### Response Body Example:
* response: 200 
```javascript
{
    "httpCode": 200,
    "result": {
        "data": "Sync data success"
    }
}
```

## 6. [WEB] 病歷清單 **POST /case/list**

### 用於：
*  病歷清單

### Request Body:
* query 

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| diseaseType   | Y | String | 疾病類型，目前定義的項目如文件： [Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#diseasetype) |
| villageCode | N | String | 村里代碼 |
| chartNo| N | String | 病歷編號 |
| name| N | String | 病患名稱 |
|isClosed|N|Boolean| 是否結案(單一個案名單中的開關) <br>**null**:全部<br>**true**:結案 <br>**false**:收案中(預設值)|

* sorter (sorter can be null, default sorter field: updateTime desc)

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| field| N| String | 排序欄位，預設為 updateTime，可排序欄位: updateTime, mealTime，isClosed|
| order| N| String | desc/asc，預設為 desc|

* pagination (pagination can be null. If null, it will return all data)

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| current| N| String | 目前頁數|
| pageSize| N| String |一頁幾筆 |

### Request Body Example:
```javascript
// 一般民眾身分
{
    "query": {
	    "diseaseType": "BC",
	    "villageCode": "",
	    "chartNo": "",
	    "name": "",
            "isClosed": false
	},
    // pagination can be null, if null, it will return all data.
    "pagination": {
        "current": 1,
        "pageSize": 10
    },
    // sortercan be null, default sorter field: measureDate desc
    "sorter": {
        "field": "updateTime",
        "order": "desc"
    }
}
// 非一般民眾身分
{
    "query": {
        "endDate": 1650214298000, 
        "startDate": 1550448540000,
        "householdMemberId": "78af42a808c64ff58cf0db08f420db16"
    },
    "pagination": {
        "current": 1,
        "pageSize": 10
    },
    "sorter": {
        "field": "dietTime",
        "order": "desc"
    }
}
```

### Response Body:
* data 

| Parameter |  format  |  desc   |
| --------- |-------- |-------- |
| id | String | 病歷id |
| chartNo | String | 病歷編號 |
| diseaseType | String | 疾病類型 |
| patName | String | 病人姓名 |
| birthDate | String | 病人生日 utc+0 |
| areaCode | String | 區域代碼 |
| villageCode | String | 村里代碼 |
| villageName | String | 村里名稱 |
| updateTime | String | 更新時間 utc+0 |
| hepBStatus | String | [BC肝](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#bcoverviewoption) |
| hepCStatus | String | [BC肝](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#bcoverviewoption) |
| eckdStage | String | [ECKD](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#eckdoverviewoption) |
| ldlStatus | String | [DM](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#dmoverviewoption) |
| hba1cStatus | String | [DM](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#dmoverviewoption) |
| prevAppoint | String | 上次預約日期 YYYY-MM-DD，若無回空字串|
| nextAppoint | String | 下次預約日期 YYYY-MM-DD，若無回空字串|
| isClosed | Boolean| 是否結案(單一個案名單中的開關) <br>**true**:結案 <br>**false**:收案中(預設值)|

### Response Body Example:
```javascript
{
    "httpCode": 200,
    "result": {
        "data": [
            {
                "id": "3c28f982d27a4dcebdbe2aab9339b718",
                "chartNo": "843006090",
                "patName": "袁鳴明",
                "birthDate": 1552736617310,
                "areaCode": "6403800",
                "villageCode": "6403800-003",
                "updateTime": 1554145481175,
                "diseaseType": "DM",
                "hba1cStatus": "HBA1C_NORMAL",
                "ldlStatus": "LDL_DANGER",
                "villageName": "南沙魯里",
                "prevAppoint ": "2019-05-10",
                "nextAppoint ": "2019-06-10",
                "isClosed": false
            },
            ...
        ]
    }
}
```
---
## 7. 取得指標分析: **[POST] /vpnCase/getAnnualStatistic**

### 用於：
*  個案追蹤管理 > 指標分析 

```
提供衛生所人員可以查看各疾病的指標分析，包含各疾病每月各收案階段人數/人次等指標項目。
```

### Request Body:
* query 

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| year | Y | String | 年度，最小為2010(目前收案的限制) |
| diseaseType | Y | String | 疾病類別，定義項目請參考: [Ref. Doc.](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#diseasetype)|


### Request Example:
```javascript
{
	"year": "2019",
	"diseaseType": "ECKD"
}
```

### Response Body:

* data

| Parameter |  format |    desc   |
| -----| -----|-------- |
| data |Object| Key: 指標項目<br>Value: (**monthObject**) 該指標每個月份的統計人次|

* monthObject

| Parameter |  format |    desc   |
| -----| -----|-------- |
| monthObject |Object| Key: 月份<br>Value: 人次|


##### 各疾病指標項目
* DM

| Indicator Item |    desc   |
| ----------|-------- |
| IN_CASE_COUNT | 收案總人次(包含新收案+追蹤+年度評估+轉入)  |
| FIRST_COUNT |新收案人次 |
| REVIEW_COUNT |追蹤人次(包含二階)    |
| YEARREVIEW_COUNT |年度評估人次(包含二階)    |
| OUT_CASE_COUNT | 結案總人次(包含結案+轉出)  |
| CLOSE_COUNT |  結案人次  |

* BC

| Indicator Item |    desc   |
| ----------|-------- |
| IN_CASE_COUNT | 收案總人次(包含新收案+追蹤+年度評估+轉入)  |
| FIRST_COUNT |新收案人次 |
| REVIEW_COUNT |追蹤人次   |
| TRANSFER_IN_COUNT | 轉入人次  |
| OUT_CASE_COUNT | 結案總人次(包含結案+轉出)  |
| CLOSE_COUNT |  結案人次  |
| TRANSFER_OUT_COUNT | 轉出人次  |

* ECKD

| Indicator Item |    desc   |
| ----------|-------- |
| IN_CASE_COUNT | 收案總人次(包含新收案+追蹤+年度評估+轉入)  |
| FIRST_COUNT |新收案人次 |
| REVIEW_COUNT |追蹤人次   |
| OUT_CASE_COUNT | 結案總人次(包含結案+轉出)  |
| CLOSE_COUNT |  結案人次  |



### Response Body Example:

```javascript
{
    "httpCode": 200,
    "result": {
        "data": {
            "REVIEW_COUNT": {
                "1": 0,
                "2": 0,
                "3": 4,
                "4": 0,
                "5": 0,
                "6": 0,
                "7": 0,
                "8": 0,
                "9": 0,
                "10": 0,
                "11": 0,
                "12": 0
            },
            "FIRST_COUNT": {
                "1": 0,
                "2": 0,
                "3": 4,
                "4": 1,
                "5": 0,
                "6": 0,
                "7": 0,
                "8": 0,
                "9": 0,
                "10": 0,
                "11": 0,
                "12": 0
            },
            "OUT_CASE_COUNT": {
                "1": 0,
                "2": 0,
                "3": 3,
                "4": 0,
                "5": 0,
                "6": 0,
                "7": 0,
                "8": 0,
                "9": 0,
                "10": 0,
                "11": 0,
                "12": 0
            },
            "CLOSE_COUNT": {
                "1": 0,
                "2": 0,
                "3": 3,
                "4": 0,
                "5": 0,
                "6": 0,
                "7": 0,
                "8": 0,
                "9": 0,
                "10": 0,
                "11": 0,
                "12": 0
            },
            "IN_CASE_COUNT": {
                "1": 0,
                "2": 0,
                "3": 8,
                "4": 1,
                "5": 0,
                "6": 0,
                "7": 0,
                "8": 0,
                "9": 0,
                "10": 0,
                "11": 0,
                "12": 0
            }
        }
    }
}
```
---
## 8. 匯出指標分析: **[POST] /vpnCase/exportAnnualStatistic**

### 用於：
*  個案追蹤管理 > 指標分析 

```
提供衛生所人員可以匯出各疾病的年度指標分析，包含各疾病每月各收案階段人數/人次等指標項目。
```

### Request Body:
* query 

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| year | Y | String | 年度，最小為2010(目前收案的限制) |
| diseaseType | Y | String | 疾病類別，定義項目請參考: [Ref. Doc.](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#diseasetype)|


### Request Example:
```javascript
{
	"year": "2019",
	"diseaseType": "ECKD"
}
```

### Response Body:

* Excel file

```javascript
fileName: {year}_{diseaseType}_VPN_annual_statistic.xlsx
```

---
## 9. 用藥處方-日期列表: **[POST] /casePatient/drug/list**
#### 用於：
*  WEB(醫生、護士、區管理者)
   ```
   個案名單 > 單一個案追蹤 > 用藥處方
   ```
   
#### Request Parameter:

* query

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| cpiId| Y| String |個案id|
| startDate | N | String | 開始時間 YYYY-MM-dd |
| endDate   | N | String | 結束時間 YYYY-MM-dd |


* sorter (sorter can be null, default sorter field: measureDate desc)

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| field| N| String | 排序欄位，預設為 registerDate，可排序欄位: registerDate/deptName/noonNo/longFlag |
| order| N| String | desc/asc，預設為 asc|

* pagination (pagination can be null. If null, it will return all data)

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| current| N| String | 目前頁數|
| pageSize| N| String |一頁幾筆 |

#### Request Body Example:
```javascript
{
    "query": {
    	"cpiId" : "JIMMYHOU", // required
    	"startDate": "2019-01-01", // format: YYYY-MM-dd
    	"endDate": "2019-03-31" // format: YYYY-MM-dd
    },
    // sorter can be null, if null, it will sort list by default
    "sorter": {
    	"field": "chartNo", // default: registerDate; can be sorted: registerDate/deptName/noonNo/longFlag
    	"order": "asc" // default: asc;
    },
    // pagination can be null, if null, it will return without paging.
    "pagination": {
    	"current": 1,
    	"pageSize": 10
    }
}
```

#### Response Body:
* data

| Parameter |  format  |  desc   |
| --------- |-------- |-------- |
| id        |  String | 該筆資料id |
|chartNo|  String |病歷號|
|registerDate | String  |開藥日期(西元yyyy-MM-dd) |
|deptName | String  |看診科別名稱|
|noonNo | String  | 看診午別|
|longFlag | Boolean  |慢簽(Y|N)|


#### Response Example:
```json
{
    "httpCode": 200,
    "result": {
        "data": [
            {
                "id": "e95c9693-0ce2-4550-ad1c-b63cd99a9c6a",
                "chartNo": "07009152",
                "registerDate": "2019-01-25",
                "deptName": "巡醫(內科)",
                "noonNo": "早上",
                "longFlag": false
            },
            {
                "id": "148808cb-f85f-4c07-807f-bd497c4fe89d",
                "chartNo": "07009152",
                "registerDate": "2019-02-11",
                "deptName": "一般內科",
                "noonNo": "晚上",
                "longFlag": false
            },
            {
                "id": "7f6919cf-ea24-4cc0-a210-7be8ff753d27",
                "chartNo": "07009152",
                "registerDate": "2019-03-31",
                "deptName": "一般內科",
                "noonNo": "早上",
                "longFlag": false
            }
        ],
        "pagination": {
            "current": 1,
            "pageSize": 10,
            "total": 3
        },
        "sorter": {
            "field": "registerDate",
            "order": "asc"
        }
    }
}
```


---

## 10. 用藥處方-Detail列表: **[POST] casePatient/drug/details**
#### 用於：
*  WEB(醫生、護士、區管理者)
   ```
   個案名單 > 單一個案追蹤 > 用藥處方 > 用藥處方單筆 Detail 列表
   ```
   
#### Request Parameter:

* query

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| drugitemId| Y| String |用藥id|


* sorter (sorter can be null, default sorter field: measureDate desc)

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| field| N| String | 排序欄位，預設為 seqNo，可排序欄位: drugCode/codeName/perQty/doseUnit/atcCode/frequency/takeIndicate/pathCode/medDays/totalQty/drugUnit |
| order| N| String | desc/asc，預設為 asc|

* pagination (pagination can be null. If null, it will return all data)

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| current| N| String | 目前頁數|
| pageSize| N| String |一頁幾筆 |

#### Request Body Example:
```javascript
{
    "query": {
    	"drugitemId" : "e95c9693-0ce2-4550-ad1c-b63cd99a9c6a" // required
    },
    // sorter can be null, if null, it will sort list by default
    "sorter": {
    	"field": "codeName", // default: seqNo; can be sorted: drugCode/codeName/perQty/doseUnit/atcCode/frequency/takeIndicate/pathCode/medDays/totalQty/drugUnit
    	"order": "asc" // default: asc;
    },
    // pagination can be null, if null, it will return without paging.
    "pagination": {
    	"current": 1,
    	"pageSize": 10
    }
}
```

#### Response Body:
* data

| Parameter |  format  |  desc   |
| --------- |-------- |-------- |
| id        |  String | 該筆資料id |
|drugitemId|  String |用藥id|
|seqNo|  String |序號|
|drugCode|  String |藥品代碼|
|codeName|  String |藥品名稱|
|perQty|  String |服用劑量(量/每次)|
|doseUnit|  String |醫囑單位(劑量)|
|specialTimesQty1|  String |特殊處方早上次量|
|specialTimesQty2|  String |特殊處方中午次量|
|specialTimesQty3|  String |特殊處方晚上次量|
|specialTimesQty4|  String |特殊處方睡前次量|
|atcCode|  String |藥性(定義參考 https://data.gov.tw/dataset/9119)|
|frequency|  String |用藥頻次(吃幾次藥)|
|takeIndicate|  String |指示／用法 AC、PC、WM  ...(飯前、飯後、)|
|pathCode|  String |途徑 PO、IVP、IM ...(口服、外用)|
|medDays|  String |天數|
|totalQty|  String |總量|
|drugUnit|  String |計價單位 (包裝)|


#### Response Example:
```json
{
    "httpCode": 200,
    "result": {
        "data": [
            {
                "id": "9cb42bb4-2621-4b5e-b82f-bc6801c9b5b3",
                "drugitemId": "e95c9693-0ce2-4550-ad1c-b63cd99a9c6a",
                "seqNo": "04",
                "drugCode": "A026636329",
                "codeName": "Ulex Cream 悠力素乳膏",
                "perQty": "1",
                "doseUnit": "Tube",
                "specialTimesQty1": "",
                "specialTimesQty2": "",
                "specialTimesQty3": "",
                "specialTimesQty4": "",
                "atcCode": "D07XA01",
                "frequency": "2",
                "takeIndicate": "BID",
                "pathCode": "TOPI",
                "medDays": "14",
                "totalQty": "3",
                "drugUnit": "Tube"
            },
            {
                "id": "f589a870-d546-4b78-aea0-c71ea71655d7",
                "drugitemId": "e95c9693-0ce2-4550-ad1c-b63cd99a9c6a",
                "seqNo": "03",
                "drugCode": "AC50145100",
                "codeName": "Xyzine(Lcetirizine)5mg萊欣膜衣錠",
                "perQty": "1",
                "doseUnit": "TAB",
                "specialTimesQty1": "",
                "specialTimesQty2": "",
                "specialTimesQty3": "",
                "specialTimesQty4": "",
                "atcCode": "R06AE09",
                "frequency": "1",
                "takeIndicate": "QD",
                "pathCode": "PC",
                "medDays": "7",
                "totalQty": "7",
                "drugUnit": "TAB"
            },
            {
                "id": "55d703de-8dd7-454c-a891-5c8e49d91281",
                "drugitemId": "e95c9693-0ce2-4550-ad1c-b63cd99a9c6a",
                "seqNo": "01",
                "drugCode": "00120C",
                "codeName": "未開處方或處方由本院所自行調劑(≦50)",
                "perQty": "0",
                "doseUnit": "次",
                "specialTimesQty1": "",
                "specialTimesQty2": "",
                "specialTimesQty3": "",
                "specialTimesQty4": "",
                "atcCode": "",
                "frequency": "",
                "takeIndicate": "",
                "pathCode": "",
                "medDays": "0",
                "totalQty": "1",
                "drugUnit": "次"
            },
            {
                "id": "5d568605-d248-415a-8eda-5785d456d006",
                "drugitemId": "e95c9693-0ce2-4550-ad1c-b63cd99a9c6a",
                "seqNo": "02",
                "drugCode": "05204D",
                "codeName": "門診藥事服務費-一般處方給藥(7天以內)",
                "perQty": "0",
                "doseUnit": "次",
                "specialTimesQty1": "",
                "specialTimesQty2": "",
                "specialTimesQty3": "",
                "specialTimesQty4": "",
                "atcCode": "",
                "frequency": "",
                "takeIndicate": "",
                "pathCode": "",
                "medDays": "0",
                "totalQty": "1",
                "drugUnit": "次"
            }
        ],
        "pagination": {
            "current": 1,
            "pageSize": 10,
            "total": 4
        },
        "sorter": {
            "field": "codeName",
            "order": "asc"
        }
    }
}

```

---
## 11. 檢驗報告: **[POST] /casePatient/report/list**

#### 用於：
*  WEB(醫生、護士、區管理者)
   ```
   個案名單 > 單一個案追蹤 > 檢驗報告
   ```
   
#### Request Parameter:

* query

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
|category|Y| String | 檢查單別: EXAM、LABDATA ([Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#hisexamreportcategory))|
| cpiId| Y| String |個案id|
| startDate | N | String | 開始時間 YYYY-MM-dd |
| endDate   | N | String | 結束時間 YYYY-MM-dd |

* sorter (sorter can be null, default sorter field: measureDate desc)

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| field| N| String | 排序欄位，預設為 collectDate，可排序欄位:chartNo/collectDate/deptName/specNo|
| order| N| String | desc/asc，預設為 asc|

* pagination (pagination can be null. If null, it will return all data)

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| current| N| String | 目前頁數|
| pageSize| N| String |一頁幾筆 |

#### Request Body Example:
```javascript
{
    "query": {
    	"category": "LABDATA", // required, LABDATA or EXAM
    	"cpiId" : "a6be8d6c-db7c-47b7-97a5-50bab48e3dd5",
    	"startDate": "2019-01-01",  // format: YYYY-MM-dd
    	"endDate": "2019-03-31"  // format: YYYY-MM-dd
    }, 
    // sorter can be null, if null, it will sort list by default
    "sorter": {
    	"field": "deptName", // default: collectDate; can be sorted: chartNo/collectDate/deptName/specNo
    	"order": "asc" // default: asc;
    },
    "pagination": {
    	"current": 1,
    	"pageSize": 10
    }
}
```

#### Response Body:
* data - ```LABDATA```

| Parameter |  format  |  desc   |
| --------- |-------- |-------- |
| id        |  String | 該筆 recordId |
| chartNo|  String |病歷號|
| collectDate|  String |採檢日期 YYYY-MM-dd|
| deptName |  String | 科別名稱 |
| specNo |  String |檢驗單號 |

* data - ```EXAM```

| Parameter |  format  |  desc   |
| --------- |-------- |-------- |
| id        |  String | 該筆 recordId |
| chartNo |  String |病歷號|
| examDate |  String |採檢日期 YYYY-MM-dd|
| deptName |  String | 科別名稱 |
| examNo |  String |檢驗單號 |


#### Response Example:
```json
// LABDATA
{
    "httpCode": 200,
    "result": {
        "data": [
            {
                "id": "756b0fa9-719a-4db3-ac03-2ca3ce1ef0e6",
                "chartNo": "00440107",
                "collectDate": "2019-01-03",
                "deptName": "一般內科",
                "specNo": "T0906225"
            },
            {
                "id": "55b15428-db1d-457c-9f8c-c907e06ea46a",
                "chartNo": "00440107",
                "collectDate": "2019-03-05",
                "deptName": "一般內科",
                "specNo": "T0906298"
            },
            {
                "id": "2c229282-428c-4497-9083-6edab87cca3f",
                "chartNo": "00440107",
                "collectDate": "2019-03-05",
                "deptName": "一般內科",
                "specNo": "T0906337"
            }
        ],
        "pagination": {
            "current": 1,
            "pageSize": 10,
            "total": 3
        },
        "sorter": {
            "field": "specNo",
            "order": "asc"
        }
    }
}

// EXAM
{
    "httpCode": 200,
    "result": {
        "data": [
            {
                "id": "78c87eb3-9825-4e92-8415-f2183e105061",
                "chartNo": "843006090",
                "examDate": "2019-02-13",
                "deptName": "健康檢查門診",
                "examNo": "0018825"
            }
        ]
    }
}
```

---

## 12. 檢驗報告-Detail列表: **[POST] casePatient/report/details**

#### 用於：
*  WEB(醫生、護士、區管理者)
   ```
   個案名單 > 單一個案追蹤 > 檢驗報告 > 檢驗單號 Detail 列表
   ```
   
#### Request Parameter:

* query

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
|category|Y| String | 檢查單別: EXAM、LABDATA ([Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#hisexamreportcategory))|
| reportId| Y| String |檢驗報告id|

* sorter (sorter can be null, default sorter field: measureDate desc)

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| field| N| String | 排序欄位，預設為 reportDate，可排序欄位: labCode/labName/specKind/reportDate/labResult/labUnit/abnormalFlag/abnormalNote/labComment|
| order| N| String | desc/asc，預設為 asc|

* pagination (pagination can be null. If null, it will return all data)

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| current| N| String | 目前頁數|
| pageSize| N| String |一頁幾筆 |

#### Request Body Example:
```javascript
{
    "query": {
    	"category": "LABDATA",  // required, LABDATA or EXAM
    	"reportId" : "756b0fa9-719a-4db3-ac03-2ca3ce1ef0e6"  // uuidId from list
    },
    // sorter can be null, if null, it will sort list by default
    "sorter": {
    	"field": "abnormalFlag", // default: reportDate; can be sorted: labCode/labName/specKind/reportDate/labResult/labUnit/abnormalFlag/abnormalNote/labComment
    	"order": "desc" // default: asc;
    },
    // pagination can be null, if null, it will return without paging.
    "pagination": {
    	"current": 1,
    	"pageSize": 10
    }
}

```

#### Response Body:
* data - ```LABDATA```

| Parameter |  format  |  desc   |
| --------- |-------- |-------- |
| id        |  String | 該筆資料id |
|labdataId|  String |檢驗報告id|
|labCode | String  |檢驗項目 |
|labName | String  |檢驗名稱|
|specKind | String  | 檢體|
|reportDate | String  | 報告日期 yyyy-MM-dd HH:mm|
|labResult | String  |檢驗結果 |
|labUnit | String  | 檢驗項目單位|
|abnormalFlag | String  |檢驗結果判斷 |
|abnormalNote | String  | 檢驗結果判斷說明|
|labComment | String  |備註 |


* data - ```EXAM```

| Parameter |  format  |  desc   |
| --------- |-------- |-------- |
| id        |  String | 該筆資料id |
|examdataId|  String |檢驗報告id|
|examCode | String  |檢驗項目 |
|examName | String  |檢驗名稱|
|reportDate | String  | 報告日期 yyyy-MM-dd HH:mm|
|report | String  |檢驗結果 |
|reportDoc | String  | 醫生 |
|position | String  | 部位 |


#### Response Example:
```json
// LABDATA
{
    "httpCode": 200,
    "result": {
        "data": [
            {
                "id": "47dc26a6-c64e-48ad-b17f-e6b388fcdf0b",
                "labdataId": "756b0fa9-719a-4db3-ac03-2ca3ce1ef0e6",
                "labCode": "T09026",
                "labName": "S-GPT 血清麩胺酸丙酮酸轉胺基脢",
                "specKind": "",
                "reportDate": "2019-01-03 17:23",
                "labResult": "15.8      ",
                "labUnit": "U/L       ",
                "abnormalFlag": "N",
                "abnormalNote": "test",
                "labComment": "test"
            },
            {
                "id": "493f3db9-d6a8-4f06-872b-a1ed490074c8",
                "labdataId": "756b0fa9-719a-4db3-ac03-2ca3ce1ef0e6",
                "labCode": "T09015",
                "labName": "Creatinine (B) CRTN 肌酐、血",
                "specKind": "",
                "reportDate": "2019-01-03 17:23",
                "labResult": "0.8       ",
                "labUnit": "",
                "abnormalFlag": "N"
            },
            ...
        ],
        "pagination": {
            "current": 1,
            "pageSize": 10,
            "total": 8
        },
        "sorter": {
            "field": "abnormalFlag",
            "order": "desc"
        }
    }
}

// EXAM
{
    "httpCode": 200,
    "result": {
        "data": [
            {
                "id": "3aa6b6d8-c484-44e3-abd9-4616195ad8c3",
                "examdataId": "78c87eb3-9825-4e92-8415-f2183e105061",
                "examCode": "C003",
                "examName": "身體檢查",
                "reportDate": "2019-02-13 14:18",
                "report": "檢查結果為合格",
                "reportDoc": "林醫生",
                "position": "脈搏"
            }
        ],
        "pagination": {
            "current": 1,
            "pageSize": 10,
            "total": 1
        },
        "sorter": {}
    }
}
```

---

## 13. 取得病歷基本資訊 **GET /casePatient/info**

### 用於：

*  WEB(醫生、護士、醫院管理者) ```用於 個案列表 > 個案dashbord```

### Request Parameter:
| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| cpiId |Y | String | 病歷ID |

### Request Example:
```javascript
GET /casePatient/info?cpiId=42c3e84e-8c52-4906-967a-3188e125b474
```

### Response Body:

| Parameter |  format |    desc   |
| -----| -----|-------- |
| id | String | ID |
| patIdNo | String | 病患身分證號 |
| chartNo | String | 病歷號 |
| patName | String | 病患姓名 |
| birthDate | String | 病患生日 |
| sex | String | 病患性別 |
| patTel | String | 病患連絡電話 |
| patAddr | String | 病患地址 |
| patBlood | String | 病患血型 |
| patEmail | String | 病患Email |
| caseNo | String | 個案編號 |
| diseaseType | String | 疾病類型 |
| areaCode | String | 區碼 |
| villageCode | String | 村碼 |

#### Response Example:
```json
{
    "httpCode": 200,
    "result": {
        "data": {
            "id": "42c3e84e-8c52-4906-967a-3188e125b474",
            "patIdNo": "m190412",
            "chartNo": "5395844843",
            "patName": "平婭青",
            "birthDate": -809213966419,
            "sex": 1,
            "patTel": "1008914261",
            "patAddr": "高雄市那瑪夏區秀嶺巷109號",
            "patBlood": "AB",
            "patEmail": "m190412@yopmail.com",
            "areaCode": "6403800",
            "villageCode": "6403800-003"
        }
    }
}
```

---

## 14. 更新病歷基本資訊 **POST /casePatient/info/update**

### 用於：

*  WEB(醫生、護士、醫院管理者) ```用於 個案列表 > 個案dashbord```

### Request Parameter:
| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| id |Y | String | 病歷ID |
| villageCode |Y | String | 村里代碼 |

### Request Example:
```javascript
{
	"id": "a6be8d6c-db7c-47b7-97a5-50bab48e3dd5",
	"villageCode": "6403800-003"
}
```

### Response Body:

| Parameter |  format |    desc   |
| -----| -----|-------- |
| count | Integer | 更新數量 |

#### Response Example:
```json
{
    "httpCode": 200,
    "result": {
        "data": {
            "count": 1
        }
    }
}
```

---


## 15. [WEB] 治療計畫-取得疾病指標項目 **GET /casePatient/indicator**

### 用於：

*  WEB(醫生、護士、醫院管理者)
   ``` javascript
   個案名單 > 單一個案追蹤 > 治療計畫 - 此個案的疾病指標項目
   ```

### Request Parameter:
| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
|cpiId|Y|String|個案id|

### Request Example:
```
GET /casePatient/indicator?cpiId=9b7318d0-6e8b-4bd0-8109-ddc3846d7652
```

### Response Body:
* result

| Parameter |  format |    desc   |
| -----| -----|-------- |
| data | Object | key: **diseaseType**<br> value: **indicator array** [...indicator] |

* indicator

| Parameter |  format |    desc   |
| -----| -----|-------- |
| id | String | 指標  id |
| name | String | 指標名稱 |


### Response Body Example:
```javascript
{
    "httpCode": 200,
    "result": {
        "data": {
            "BC": [
                {
                    "id": "BC_GOT",
                    "name": "GOT"
                },
                {
                    "id": "BC_GPT",
                    "name": "GPT"
                }
            ],
            "ECKD": [
                {
                    "id": "ECKD_EGFR",
                    "name": "Stage 1~3a(eGFR)"
                }
            ],
            "DM": [
                {
                    "id": "DM_HBA1C",
                    "name": "HbA1C"
                },
                {
                    "id": "DM_LDL",
                    "name": "LDL"
                }
            ]
        }
    }
}
```

---


## 16. [WEB] 治療計畫-取得疾病指標項目的標準範圍值 **GET /casePatient/indicator/detail**

### 用於：

*  WEB(醫生、護士、醫院管理者)
   ``` javascript
   個案名單 > 單一個案追蹤 > 治療計畫 - 取得某疾病的所有指標範圍值
   ```

### Request Parameter:
| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| diseaseType |Y | String |疾病類型，目前定義的項目如文件： [Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#diseasetype)|
|cpiId|Y|String|個案id|

### Request Example:
```
GET /casePatient/indicator/detail?diseaseType=BC&cpiId=9b7318d0-6e8b-4bd0-8109-ddc3846d7652
```

### Response Body:
* result

| Parameter |  format |    desc   |
| -----| -----|-------- |
| data | Object | key: **指標id**<br> value: **indicatorDetail array** [...indicatorDetail] |

* indicatorDetail

| Parameter |  format |    desc   |
| -----| -----|-------- |
| unit | String | 單位 |
| min | double | 最小值 |
| max | double | 最大值 |


### Response Body Example:
```javascript
// DM
{
    "httpCode": 200,
    "result": {
        "data": {
            "DM_HBA1C": {
                "unit": "%",
                "min": 0,
                "max": 7
            },
            "DM_LDL": {
                "unit": "mg/dl",
                "min": 9.9,
                "max": 99.9
            }
        }
    }
}
// ECKD
{
    "httpCode": 200,
    "result": {
        "data": {
            "ECKD_EGFR": {
                "unit": "ml/min/1.73m²",
                "min": 90,
                "max": 1000
            }
        }
    }
}
// BC
{
    "httpCode": 200,
    "result": {
        "data": {
            "BC_GPT": {
                "unit": "U/L",
                "min": 0,
                "max": 40
            },
            "BC_GOT": {
                "unit": "U/L",
                "min": 0.2,
                "max": 45
            }
        }
    }
}
```

---

## 17. [WEB] 治療計畫-更新疾病指標項目的標準範圍值 **POST /casePatient/indicator/update**

### 用於：

*  WEB(醫生、護士、醫院管理者)
   ``` javascript
   個案名單 > 單一個案追蹤 > 治療計畫 - 取得某疾病的所有指標範圍值
   ```

### Request Body:
| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| id |Y | String |指標id|
|cpiId|Y|String|個案id|
| min | Y | Double |最小值|
| max | Y | Double |最大值|

### Request Example:
```json
{
	"id": "BC_GOT",
	"cpiId": "9b7318d0-6e8b-4bd0-8109-ddc3846d7652",
	"min": 0.1,
	"max": 41
}
```

### Response Body:
* result

| Parameter |  format |    desc   |
| -----| -----|-------- |
| data | String | 更新成功的指標id |


### Response Body Example:
```javascript
{
    "httpCode": 200,
    "result": {
        "data": "BC_GOT"
    }
}
```

---
## 18. 最後用藥處方-Detail列表: **[POST] /casePatient/drug/getLastdetails**
#### 用於：
*  WEB(醫生、護士、區管理者)
   ```
   個案名單 > 單一個案追蹤 > 個案dashbord
   ```
   
#### Request Parameter:

* query

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| cpiId| Y| String |個案id|

* sorter (sorter can be null, default sorter field: measureDate desc)

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| field| N| String | 排序欄位，預設為 seqNo，可排序欄位: drugCode/codeName/perQty/doseUnit/atcCode/frequency/takeIndicate/pathCode/medDays/totalQty/drugUnit |
| order| N| String | desc/asc，預設為 asc|

* pagination (pagination can be null. If null, it will return all data)

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| current| N| String | 目前頁數|
| pageSize| N| String |一頁幾筆 |

#### Request Body Example:
```javascript
{
    "query": {
    	"cpiId" : "e6ac231b00444771b232c4f10402e4cc" // required
    },
    // sorter can be null, if null, it will sort list by default
    "sorter": {
    	"field": "codeName", // default: seqNo; can be sorted: drugCode/codeName/perQty/doseUnit/atcCode/frequency/takeIndicate/pathCode/medDays/totalQty/drugUnit
    	"order": "asc" // default: asc;
    },
    // pagination can be null, if null, it will return without paging.
    "pagination": {
    	"current": 1,
    	"pageSize": 10
    }
}
```

#### Response Body:
* data
| id        |  String | 該筆資料id |
|chartNo|  String |病歷號|
|registerDate | String  |開藥日期(西元yyyy-MM-dd) |
|deptName | String  |看診科別名稱|
|noonNo | String  | 看診午別|
|longFlag | Boolean  |慢簽(Y|N)|
|details | Array  | 藥品記錄 |

* details

| Parameter |  format  |  desc   |
| --------- |-------- |-------- |
| id        |  String | 該筆資料id |
|drugitemId|  String |用藥id|
|seqNo|  String |序號|
|drugCode|  String |藥品代碼|
|codeName|  String |藥品名稱|
|perQty|  String |服用劑量(量/每次)|
|doseUnit|  String |醫囑單位(劑量)|
|specialTimesQty1|  String |特殊處方早上次量|
|specialTimesQty2|  String |特殊處方中午次量|
|specialTimesQty3|  String |特殊處方晚上次量|
|specialTimesQty4|  String |特殊處方睡前次量|
|atcCode|  String |藥性(定義參考 https://data.gov.tw/dataset/9119)|
|frequency|  String |用藥頻次(吃幾次藥)|
|takeIndicate|  String |指示／用法 AC、PC、WM  ...(飯前、飯後、)|
|pathCode|  String |途徑 PO、IVP、IM ...(口服、外用)|
|medDays|  String |天數|
|totalQty|  String |總量|
|drugUnit|  String |計價單位 (包裝)|


#### Response Example:
```json
{
    "httpCode": 200,
    "result": {
        "data": {
            "id": "17bce573-b320-4db1-9c8f-d6ad0486f3d3",
            "chartNo": "07009152",
            "registerDate": 1553961600000,
            "deptName": "一般內科",
            "noonNo": "早上",
            "longFlag": false,
            "cpiId": "e6ac231b00444771b232c4f10402e4cc",
            "details": [
                {
                    "id": "3fddff65-546a-4e39-bc63-10c7c19530ca",
                    "drugitemId": "17bce573-b320-4db1-9c8f-d6ad0486f3d3",
                    "seqNo": "03",
                    "drugCode": "AC21924321",
                    "codeName": "Mycomb 美康",
                    "perQty": "1",
                    "doseUnit": "TUBE",
                    "specialTimesQty1": "",
                    "specialTimesQty2": "",
                    "specialTimesQty3": "",
                    "specialTimesQty4": "",
                    "atcCode": "D07CB01",
                    "frequency": "3",
                    "takeIndicate": "TID",
                    "pathCode": "TOPI",
                    "medDays": "14",
                    "totalQty": "3",
                    "drugUnit": "TUBE"
                },
                ...
            ]
        },
        "pagination": {
            "current": 1,
            "pageSize": 10,
            "total": 3
        },
        "sorter": {
            "field": "codeName",
            "order": "asc"
        }
    }
}
```

---
## 19. [WEB] 新增個案清單並自動加入家戶與收案清單 **POST /case/add**



### 用於：
*  新增個案清單後，會自動加入家戶資料與新增收案資料

### Request Body:
* query 

| Parameter | Required |  format  |  desc   |
| --------- | -------- | -------- |-------- |
| diseaseType   | Y | String | 疾病類型，目前定義的項目如文件： [Ref. Doc](https://gitlab.devpack.cc/Wei_Chang/wicc-kmuh/wikis/Type-Definition#diseasetype) |
| cureStage| Y | String | 疾病階段 |
| acceptDate | Y | timestamp |收案日期，以 milliseconds 表示|
| medicalStaffId| Y | String | 醫生代碼 |
| patName| Y | String | 病患名稱 |
| patIdNo| Y | String | 病患身份證字號 |
| birthDate| Y | timestamp | 病患生日，以 milliseconds 表示 |
| sex| Y | number | 病患性別，1為男性，2為女性 |
| bodyHeight| Y | number | 病患身高 |
| patBlood| Y | String | 病患血型 |
| patEmail| N | String | 病患電子信箱 |
| patTel| N | String | 病患電話 |
| postCode| Y | String | 病患郵遞區號 |
| cityName| Y | String | 病患居住城市 |
| areaName| Y | String | 病患居住地區 |
| villageName| Y | String | 病患居住鄉里 |
| houseNumber| Y | String | 病患地址號碼 |
| remark| N | String | 額外註記 |


### Request Body Example:
```javascript
{
    "diseaseType":"DM",
    "cureStage":"FIRST",
    "acceptDate":1717771683570,
    "medicalStaffId":"3e955c1f-e0d2-42b8-bb77-f1809937a5f7",
    "patName":"林中華",
    "patIdNo":"S263440075",
    "birthDate":588600675000,
    "sex":2,
    "patBlood":"O",
    "patEmail":"ttvv@gmail.com",
    "patTel":"0922-958563",
    "postCode": 801,
    "cityName":"高雄市",
    "areaName":"茂林區",
    "villageName":"茂林里",
    "houseNumber":"靠冰街44號",
    "remark":"erer"
}
```

### Response Body:
* data 

| Parameter |  format  |  desc   |
| --------- |-------- |-------- |
| caseId | String | 已成功新增個案的id |


### Response Body Example:
```javascript
{
    "httpCode": 200,
    "result": {
        "data": {
            "caseId": "2f38f914-500e-4b64-826c-7945c796bdac"
        }
    }
}
```