---
# System prepended metadata

title: 生理量測

---


# 生理量測

## 取得量測類型列表 (WEB & APP)
Request:
```url=
GET /phy/kind
```
Response (成功):
```json=
{
    "success": true,
    "data":[
        {"id": 1, "name": "身高", "code":"height", "description": "cm"},
        {"id": 2, "name": "體重", "code":"weight", "description": "kg"},
        ...
    ]
}
```



## 新增量測紀錄 (WEB & APP)
Request:
```url=
POST /phy
```
Payload:
```json=
{
    "dateTime": 1585546156101,
    "patientId": 999, //不填的話，會以Token的patientId寫入
    "device": "手動新增",
    "data":[
        {"kindId": 1, "value": 180},
        {"kindId": 2, "value": 75},
        {"kindId": 3, "value": 22},
        {"kindId": 4, "value": 120},
        {"kindId": 5, "value": 90},
        {"kindId": 6, "value": 140},
        {"kindId": 9, "value": 19.1, "insulinId" : 100}
    ]
}
```

Response (成功):
```json=
{
    "success": true,
    "data":[
        {"id": 1, "kindId": 1, "value": 180},
        {"id": 2, "kindId": 2, "value": 75},
        {"id": 3, "kindId": 3, "value": 22},
        {"id": 4, "kindId": 4, "value": 120},
        {"id": 5, "kindId": 5, "value": 90},
        {"id": 6, "kindId": 6, "value": 140},
        {"id": 7, "kindId": 9, "value": 19.1, "insulinId" : 100} "insulinId" : 100}
    ]
}
```

## 整批更新 (APP)
```url
PUT /phy/bulkUpdate
```

Payload:
```json=
{
    "dateTime": 1585546156101,
    "patientId": 999, //不填的話，會以Token的patientId寫入
    "device": "手動新增",
    "data":[
        {"id": 1, "kindId": 1, "value": 180},
        {"id": 2, "kindId": 2, "value": 75},
        {"id": 3, "kindId": 3, "value": 22},
        {"id": 4, "kindId": 4, "value": 110},
        {"id": 5, "kindId": 5, "value": 90},
        //{"id": 6, "kindId": 6, "value": 140},
        {"id": 7, "kindId": 9, "value": 19.1, "insulinId" : 100} "insulinId" : 100}
    ]
}
```
Response (成功):
```json=
{
    "success": true,
    "data":[
        {"id": 8, "kindId": 1, "value": 180},
        {"id": 9, "kindId": 2, "value": 75},
        {"id": 10, "kindId": 3, "value": 22},
        {"id": 11, "kindId": 4, "value": 110},
        {"id": 12, "kindId": 5, "value": 90},
        {"id": 13, "kindId": 9, "value": 19.1, "insulinId" : 100}
    ]
}
```


## 編輯量測紀錄 (<font color="red">Web專用</font>)

Request:
```url=
PUT /phy/$id
```

Payload:
```json=
{
    "dateTime": 1585546156101,
    "value": 26.5,
    "kindId": 9,
    "insulinId": 1, // InsulinID if need. Null is also available
}
```

Response (成功):
```json=
{
    "success": true,
    "data" : {
        "id": 100,
        "dateTime": 1585546156101,
        "value": 26.5,
        "kindId": 9,
        "insulinId": 1
    }
}
```

## 刪除量測紀錄(<font color="red">Web專用</font>)

Request:
```url=
DELETE /phy/$id
```

Response (成功):
```json=
{
    "success": true,
}
```

## 取得量測紀錄(<font color="red">Web專用</font>)
Request:
```url=
GET /phy?$queryParams
```

[Query Params:]

| 欄位 | 型態 | 預設 | 說明 |
| -------- | -------- | -------- |-------- |
| kind     | json     | 無     | 量測種類 id 範例: kind:{"id":[1,2,5,6]}|
| patientId| number     | 1     | Patient ID |
| page     | number     | 1     | 當前頁數 |
| pageSize | number     | -1    | 每頁結果數量，-1 為顯示所有 |
| sort    | string     |  無    | 排序欄位|
| startDate    | timestamp | 無    | 要搜尋的日期區間
| endDate    | timestamp | 無    | 要搜尋的日期區間
| startTime    | string | 無    | 要搜尋的時間區間 範例 05:20
| endTime    | string | 無    | 要搜尋的時間區間 範例 18:50


Response (成功):
```json=
{
    "success": true,
    "total": 20,
    "data":[
        {"id":1,"kindId":1,"value":187,"dateTime": 1585546156101, 
        "remark":"", "device":"手動新增"},
        {"id":2,"kindId":2,"value":75,"dateTime": 1585546156101, 
        "remark":"", "device":"手動新增"},
        {"id":3,"kindId":9,"value":35,"dateTime": 1585546156101, 
        "remark":"Apidra 愛胰達", "device":"Diabnext-C3Xs"},
        {"id":4,"kindId":12,"value":25,"dateTime": 1585546156101, 
        "remark":"{"height":{"id":1, "value":187},
        "weight":{"id":2, "value":75}}", 
        "device":"Diabnext-C3Xs"}
        // 前端需顯示(身高/體重)顯示現存BMI如何得出
        // 且BMI可以被update竄改(但還是保留原數值身高體重)
        // 如引用之體重與身高數值被刪除，此筆BMI也要被刪除
        // 故必須紀錄引用之身高體重ID
    ]
}
```
# 查詢(<font color="red">App專用</font>)

## 最近各項數值
Request:
```url=
GET /phy/recent
```
Response (成功):
```json=
{
    "success": true,
    "total": 2,
    "data": {
        "weight":{
            "bodyWeight": 75,
            "bmi": 22.5,
            "fat": 32
        },
        "heart": {
            "systolic": 75,
            "diastolic": 25,
            "heartRate": 32
        },
        "insulin":{
            "beforeMeals": 75,
            "afterMeals": 22.5,
            "insulin": 32
        },
        "oxygen":{
            "temperature": 75.4,
            "oxygen": 22
        }        
    }    
}
```
<!-- Request:
```url=
GET /phy/recent
```
Response (成功):

```json=
{
    "success": true,
    "data":[
        {"id":1,"kindId":1,"value":187,"dateTime": 1585546156101},
        {"id":2,"kindId":2,"value":75,"dateTime": 1585546156101},
        {"id":3,"kindId":9,"value":35,"dateTime": 1585546156101, 
        "insulinId":1}, // If kindId == 9, need insulin type 
        {"id":4,"kindId":12,"value":25,"dateTime": 1585546156101}
    ]
}
``` -->

## 體重BMI體脂
Attribute | Description | IsRequired| Remark
-|-|-|-
dateTime | number | true | 測量時間
isApp | Boolean | true | 手動新增
bodyWeight  | number | false | 體重
fat | number | false | 體脂


### 查詢
```url=
GET /phy/weight
```
Query Params:
|  欄位 | 型態  | 預設   | 說明  | 
|---|---|---|---|---|
| page | number |1| 當前頁數|
| pageSize | number |10| 每頁結果數量，-1 為顯示所有|
| sort | string | dateTime | 排序欄位
| startAt | number | false | 從(測量時間)
| endAt | number | false | 結束(測量時間)
| avg | number | number| 0:當日 1:日平均 2 :月平均 |
| desc | boolean | false | 是否倒序排列？

|  欄位 | 型態   | 說明  | 
|---|---|---|---|---|
bodyWeightAvg | number  | 日/月平均體重
bmiAvg | number |  日/月平均BMI
fatAvg  | number | 日/月平均體脂
bodyWeightMax | number  | 日/月最高體重
bmiMax | number |  日/月最高BMI
fatMax  | number | 日/月最高體脂
bodyWeightMin | number  | 日/月最低體重
bmiMin | number |  日/月最低BMI
fatMin  | number | 日/月最低體脂

Response (成功):
```json=
// avg == 0 當日單項數值陣列
{
    "success": true,
    "total": 2,
    "data": {
        "bodyWeightAvg" : 32,
        "bmiAvg": 20,
        "fatAvg": 32,
        "bodyWeightMax" : 32,
        "bmiMax": 20,
        "fatMax": 32,
        "bodyWeightMin" : 32,
        "bmiMin": 20,
        "fatMin": 32,
        "phyWeight":[{
            "dateTime": 1583991833000,
            "bodyWeight": 72,
            }, {
            "dateTime": 1583991863330,
            "bodyWeight": 75,
            }, {
            "dateTime": 1583991863330,
            "bmi": 25,
            }, {
            "dateTime": 1583991863330,
            "fat": 32,
            },
            ...
        ]
    }
}
// avg == 1 or 2 平均數值、多項目陣列
{
    "success": true,
    "total": 2,
    "data": {
        "bodyWeightAvg" : 32,
        "bmiAvg": 20,
        "fatAvg": 32,
        "bodyWeightMax" : 32,
        "bmiMax": 20,
        "fatMax": 32,
        "bodyWeightMin" : 32,
        "bmiMin": 20,
        "fatMin": 32,
        "phyWeight":[{
            "dateTime": 1583991833330,
            "bodyWeight": 72,
            "fat": 32,
            "bmi": 25
            }, {
            "dateTime": 1583991833330,
            "bodyWeight": 72,
            "fat": 32,
            "bmi": 25
            }, {
            "dateTime": 1583991833330,
            "bodyWeight": 72,
            "fat": 32,
            "bmi": 25
            }
            ...
        ]
    }
}
```
## 血壓心律
Attribute | Description | IsRequired| Remark
-|-|-|-
dateTime | number | true | 測量時間
systolic  | number | false | 收縮壓
diastolic | number | false | 舒張壓
heartRate | number | false | 心率


### 查詢
```url=
GET /phy/heart
```
Query Params:
|  欄位 | 型態  | 預設   | 說明  | 
|---|---|---|---|---|
| page | number |1| 當前頁數|
| pageSize | number |10| 每頁結果數量，-1 為顯示所有|
| sort | string | dateTime | 排序欄位
| startAt | number | false | 從(測量時間)
| endAt | number | false | 結束(測量時間)
| avg | number | number| 0:當日 1:日平均 2 :月平均 |
| desc | boolean | false | 是否倒序排列？

|  欄位 | 型態  | 說明  | 
|---|---|---|---|---|
systolicAvg | number | 日/月平均收縮壓
diastolicAvg | number | 日/月平均舒張壓
heartRateAvg | number | 日/月平均心律
systolicMax | number | 日/月最高收縮壓
diastolicMax | number | 日/月最高舒張壓
heartRateMax | number | 日/月最高心律
systolicMin | number | 日/月最低收縮壓
diastolicMin | number | 日/月最低舒張壓
heartRateMin | number |  日/月最低心律

Response (成功):
```json=
// avg == 0 當日單項數值陣列
{
    "success": true,
    "total": 2,
    "data":{
        "systolicAvg": 72,
        "diastolicAvg": 20,
        "heartRateAvg": 32,
        "systolicMax": 72,
        "diastolicMax": 20,
        "heartRateMax": 32,
        "systolicMin": 72,
        "diastolicMin": 20,
        "heartRateMin": 32,
        "phyHeart":[{   
            "dateTime": 1583991833330,
            "systolic": 72
            }, {
            "dateTime": 1583991863330,
            "systolic": 72
            }, {
            "dateTime": 1583991863330,
            "diastolic": 10
            }, {
            "dateTime": 1583991863330,
            "heartRate": 32
            },
            ...
        ]
    }
}
// avg == 1 or 2 平均數值、多項目陣列
{
    "success": true,
    "total": 2,
    "data":{
        "systolicAvg": 72,
        "diastolicAvg": 20,
        "heartRateAvg": 32,
        "systolicMax": 72,
        "diastolicMax": 20,
        "heartRateMax": 32,
        "systolicMin": 72,
        "diastolicMin": 20,
        "heartRateMin": 32,
        "phyHeart":[{   
            "dateTime": 1583991833330,
            "systolic": 72,
            "diastolic": 10,
            "heartRate": 32
            }, {
            "dateTime": 1583991833330,
            "systolic": 72,
            "diastolic": 10,
            "heartRate": 32
            }, {
            "dateTime": 1583991833330,
            "systolic": 72,
            "diastolic": 10,
            "heartRate": 32
            }
            ...
        ]
    }
}
```
## 血糖胰島素
Attribute | Description | IsRequired| Remark
-|-|-|-
dateTime | number | true | 測量時間
beforeMeals  | number | false | 飯前血糖
afterMeals | number | false | 飯後血糖
insulinId | number | false | 胰島素編號
insulin | number | false | 胰島素劑量


### 查詢
```url=
GET /phy/insulin
```
Query Params:
|  欄位 | 型態  | 預設   | 說明  | 
|---|---|---|---|---|
| page | number |1| 當前頁數|
| pageSize | number |10| 每頁結果數量，-1 為顯示所有|
| sort | string | dateTime | 排序欄位
| startAt | number | false | 從(測量時間)
| endAt | number | false | 結束(測量時間)
| avg | number | number| 0:當日 1:日平均 2 :月平均 |
| desc | boolean | false | 是否倒序排列？

|  欄位 | 型態 | 說明  | 
|---|---|---|---|---|
beforeMealsAvg | number | 日/月平均餐前血糖
afterMealsAvg | number |  日/月平均餐後血糖
insulinAvg | number |  日/月平均胰島素
beforeMealsMax | number | 日/月最高餐前血糖
afterMealsMax  | number |  日/月最高餐後血糖
insulinMax  | number |  日/月最高胰島素
beforeMealsMin | number | 日/月最低餐前血糖
afterMealsMin | number |  日/月最低餐後血糖
insulinMin | number |  日/月最低胰島素

Response (成功):
```json=
// avg == 0 當日單項數值陣列
{
    "success": true,
    "total": 2,
    "data": {
        "beforeMealsAvg": 75,
        "afterMealsAvg": 22.5,
        "insulinAvg": 32.2,
        "beforeMealsMax": 75,
        "afterMealsMax": 22.5,
        "insulinMax": 32.2,
        "beforeMealsMin": 75,
        "afterMealsMin": 22.5,
        "insulinMin": 32.2,
        "phyInsulin": [
            {
                "dateTime": 1585546156101,
                "beforeMeals": 75
            }, {
                "dateTime": 1585546156101,
                "beforeMeals": 75
            }, {
                "dateTime": 1585546156101,
                "afterMeals": 22.5
            }, {
                "dateTime": 1585546156101,
                "insulin": 32.5
            },
            // avg == 0 當日單項數值陣列
            
            
            // avg == 1 or 2 平均數值、多項目陣列
            {
                "dateTime": 1583991863330,
                "beforeMeals": 75,
                "afterMeals": 22.5,
                "insulin": 32.5
            }
            ...
        ]
    }
}

// avg == 1 or 2 平均數值、多項目陣列
{
    "success": true,
    "total": 2,
    "data": {
        "beforeMealsAvg": 75,
        "afterMealsAvg": 22.5,
        "insulinAvg": 32.2,
        "beforeMealsMax": 75,
        "afterMealsMax": 22.5,
        "insulinMax": 32.2,
        "beforeMealsMin": 75,
        "afterMealsMin": 22.5,
        "insulinMin": 32.2,
        "phyInsulin": [
            {
                "dateTime": 1583991863330,
                "beforeMeals": 75,
                "afterMeals": 22.5,
                "insulin": 32.5
            }, {
                "dateTime": 1583991863330,
                "beforeMeals": 75,
                "afterMeals": 22.5,
                "insulin": 32.5
            }, {
                "dateTime": 1583991863330,
                "beforeMeals": 75,
                "afterMeals": 22.5,
                "insulin": 32.5
            }
            ...
        ]
    }
}
```
## 體溫血氧
Attribute | Description | IsRequired| Remark
-|-|-|-
dateTime | number | true | 測量時間
temperature   | number(float4) | false | 體溫
oxygen  | number(int4) | false | 血氧


### 查詢
```url=
GET /phy/oxygen
```
Query Params:
|  欄位 | 型態  | 預設   | 說明  | 
|---|---|---|---|---|
| page | number |1| 當前頁數|
| pageSize | number |10| 每頁結果數量，-1 為顯示所有|
| sort | string | dateTime | 排序欄位
| startAt | number | false | 從(測量時間)
| endAt | number | false | 結束(測量時間)
| avg | number | number| 0:當日 1:日平均 2 :月平均 |
| desc | boolean | false | 是否倒序排列？


|  欄位 | 型態 | 說明  | 
|---|---|---|---|---|
temperatureAvg | number | 日/月平均體溫
oxygenAvg | number |  日/月平均血氧
temperatureMax | number | 日/月最高體溫
oxygenMax | number |  日/月最高血氧
temperatureMin | number | 日/月最低體溫
oxygenMin | number |  日/月最低血氧

Response (成功):
```json=
// if avg == 0 當日單項數值陣列
{
    "success": true,
    "total": 2,
    "data": {
        "temperatureAvg": 75.4,
        "oxygenAvg": 22,
        "temperatureMax": 75.4,
        "oxygenMax": 22,
        "temperatureMin": 75.4,
        "oxygenMin": 22,
        "phyOxygen": [
            {
                "dateTime": 1583991833330,
                "temperature": 75.4
            }, {
                "dateTime": 1583991863330,
                "temperature": 75.4
            }, {
                "dateTime": 1583991863330,
                "oxygen": 22
            }
            ...
        ]
    }
}

// avg == 1 or 2 平均數值、多項目陣列
{
    "success": true,
    "total": 2,
    "data": {
        "temperatureAvg": 75.4,
        "oxygenAvg": 22,
        "temperatureMax": 75.4,
        "oxygenMax": 22,
        "temperatureMin": 75.4,
        "oxygenMin": 22,
        "phyOxygen": [
            {
                "dateTime": 1583991863330,
                "temperature": 75.4,
                "oxygen": 22
            }, {
                "dateTime": 1583991863330,
                "temperature": 75.4,
                "oxygen": 22
            }, {
                "dateTime": 1583991863330,
                "temperature": 75.4,
                "oxygen": 22
            }, {
                "dateTime": 1583991863330,
                "temperature": 75.4,
                "oxygen": 22
            }
            ...
        ]
    }
}
```


# 以下為舊版本API for APP


## 體重BMI體脂
Attribute | Description | IsRequired| Remark
-|-|-|-
dateTime | number | true | 測量時間
isApp | Boolean | true | 手動新增
bodyWeight  | number | false | 體重
bmi | number | false | BMI
fat | number | false | 體脂

### 新增
Request:
```url=
POST /phy/weight
```

Payload：
```json=
{
    "dateTime": 1585546156101,
    "isApp": true,
    "bodyWeight": 75,
    "bmi": 22.5,
    "fat": 32
}
```
Response (成功):
```json=
{
    "success": true,
    "data": {
        "dateTime": 1585546156101,
        "isApp": true,
        "bodyWeight": 75,
        "bmi": 22.5,
        "fat": 32
    }
}
```

### 查詢
```url=
GET /phy/weight
```
Query Params:
|  欄位 | 型態  | 預設   | 說明  | 
|---|---|---|---|---|
| page | number |1| 當前頁數|
| pageSize | number |10| 每頁結果數量，-1 為顯示所有|
| sort | string | dateTime | 排序欄位
| startAt | number | false | 從(測量時間)
| endAt | number | false | 結束(測量時間)
| avg | number | number| 0:當日 1:日平均 2 :月平均 |
| desc | boolean | false | 是否倒序排列？

|  欄位 | 型態   | 說明  | 
|---|---|---|---|---|
bodyWeightAvg | number  | 日/月平均體重
bmiAvg | number |  日/月平均BMI
fatAvg  | number | 日/月平均體脂
bodyWeightMax | number  | 日/月最高體重
bmiMax | number |  日/月最高BMI
fatMax  | number | 日/月最高體脂
bodyWeightMin | number  | 日/月最低體重
bmiMin | number |  日/月最低BMI
fatMin  | number | 日/月最低體脂

Response (成功):
```json=
{
    "success": true,
    "total": 2,
    "bodyWeightAvg" : 32,
    "bmiAvg": 20,
    "fatAvg": 32,
    "bodyWeightMax" : 32,
    "bmiMax": 20,
    "fatMax": 32,
    "bodyWeightMin" : 32,
    "bmiMin": 20,
    "fatMin": 32,
    "data": {
        "bodyWeightAvg" : 32,
        "bmiAvg": 20,
        "fatAvg": 32,
        "bodyWeightMax" : 32,
        "bmiMax": 20,
        "fatMax": 32,
        "bodyWeightMin" : 32,
        "bmiMin": 20,
        "fatMin": 32,
        "phyWeight":[{
            "dateTime": 1583991833330,
            "isApp": true,
            "bodyWeight": 72,
            "bmi": 20,
            "fat": 32
        }, {
            "dateTime": 1583991863330,
            "isApp": true,
            "bodyWeight": 72,
            "bmi": 10,
            "fat": 32
            },
            ...
        ]
    }
}
```
## 血壓心律
Attribute | Description | IsRequired| Remark
-|-|-|-
dateTime | number | true | 測量時間
isApp | Boolean | true | 手動新增
systolic  | number | false | 收縮壓
diastolic | number | false | 舒張壓
heartRate | number | false | 心率

### 新增
Request:
```url=
POST /phy/heart
```

Payload：
```json=
{
    "dateTime": 1585546156101,
    "isApp": true,
    "systolic": 75,
    "diastolic": 25,
    "heartRate": 32
}
```
Response (成功):
```json=
{
    "success": true,
    "data": {
        "dateTime": 1585546156101,
        "isApp": true,
        "systolic": 75,
        "diastolic": 25,
        "heartRate": 32
    }
}
```

### 查詢
```url=
GET /phy/heart
```
Query Params:
|  欄位 | 型態  | 預設   | 說明  | 
|---|---|---|---|---|
| page | number |1| 當前頁數|
| pageSize | number |10| 每頁結果數量，-1 為顯示所有|
| sort | string | dateTime | 排序欄位
| startAt | number | false | 從(測量時間)
| endAt | number | false | 結束(測量時間)
| avg | number | number| 0:當日 1:日平均 2 :月平均 |
| desc | boolean | false | 是否倒序排列？

|  欄位 | 型態  | 說明  | 
|---|---|---|---|---|
systolicAvg | number | 日/月平均收縮壓
diastolicAvg | number | 日/月平均舒張壓
heartRateAvg | number | 日/月平均心律
systolicMax | number | 日/月最高收縮壓
diastolicMax | number | 日/月最高舒張壓
heartRateMax | number | 日/月最高心律
systolicMin | number | 日/月最低收縮壓
diastolicMin | number | 日/月最低舒張壓
heartRateMin | number |  日/月最低心律

Response (成功):
```json=
{
    "success": true,
    "total": 2,
    "data":{
        "systolicAvg": 72,
        "diastolicAvg": 20,
        "heartRateAvg": 32,
        "systolicMax": 72,
        "diastolicMax": 20,
        "heartRateMax": 32,
        "systolicMin": 72,
        "diastolicMin": 20,
        "heartRateMin": 32,
        "phyHeart":[{   
            "dateTime": 1583991833330,
            "isApp": true,
            "systolic": 72,
            "diastolic": 20,
            "heartRate": 32
            }, {
            "dateTime": 1583991863330,
            "isApp": true,
            "systolic": 72,
            "diastolic": 10,
            "heartRate": 32
            },
            ...
        ]
    }
}
```
## 血糖胰島素
Attribute | Description | IsRequired| Remark
-|-|-|-
dateTime | number | true | 測量時間
isApp | Boolean | true | 手動新增
beforeMeals  | number | false | 飯前血糖
afterMeals | number | false | 飯後血糖
insulinId | number | false | 胰島素編號
insulin | number | false | 胰島素劑量

### 新增
Request:
```url=
POST /phy/insulin
```

Payload：
```json=
{
    "dateTime": 1585546156101,
    "isApp": true,
    "beforeMeals": 75,
    "afterMeals": 22.5,
    "insulinId": 1,
    "insulin": 32
}
```
Response (成功):
```json=
{
    "success": true,
    "data": {
        "dateTime": 1585546156101,
        "isApp": true,
        "beforeMeals": 75,
        "afterMeals": 22.5,
        "insulinId": 1,
        "insulin": 32
    }
}
```

### 查詢
```url=
GET /phy/insulin
```
Query Params:
|  欄位 | 型態  | 預設   | 說明  | 
|---|---|---|---|---|
| page | number |1| 當前頁數|
| pageSize | number |10| 每頁結果數量，-1 為顯示所有|
| sort | string | dateTime | 排序欄位
| startAt | number | false | 從(測量時間)
| endAt | number | false | 結束(測量時間)
| avg | number | number| 0:當日 1:日平均 2 :月平均 |
| desc | boolean | false | 是否倒序排列？

|  欄位 | 型態 | 說明  | 
|---|---|---|---|---|
beforeMealsAvg | number | 日/月平均餐前血糖
afterMealsAvg | number |  日/月平均餐後血糖
insulinAvg | number |  日/月平均胰島素
beforeMealsMax | number | 日/月最高餐前血糖
afterMealsMax  | number |  日/月最高餐後血糖
insulinMax  | number |  日/月最高胰島素
beforeMealsMin | number | 日/月最低餐前血糖
afterMealsMin | number |  日/月最低餐後血糖
insulinMin | number |  日/月最低胰島素

Response (成功):
```json=
{
    "success": true,
    "total": 2,
    "data": {
        "beforeMealsAvg": 75,
        "afterMealsAvg": 22.5,
        "insulinAvg": 32.2,
        "beforeMealsMax": 75,
        "afterMealsMax": 22.5,
        "insulinMax": 32.2,
        "beforeMealsMin": 75,
        "afterMealsMin": 22.5,
        "insulinMin": 32.2,
        "phyInsulin": [
            {
                "dateTime": 1585546156101,
                "isApp": true,
                "beforeMeals": 75,
                "afterMeals": 22.5,
                "insulin": 32.2
            }, {
                "dateTime": 1585546156101,
                "isApp": true,
                "beforeMeals": 75,
                "afterMeals": 22.5,
                "insulin": 32.5
            },
            ...
        ]
    }
}
```
## 體溫血氧
Attribute | Description | IsRequired| Remark
-|-|-|-
dateTime | number | true | 測量時間
isApp | Boolean | true | 手動新增
temperature   | number(float4) | false | 體溫
oxygen  | number(int4) | false | 血氧

### 新增
Request:
```url=
POST /phy/oxygen
```

Payload：
```json=
{
    "dateTime": 1585546156101,
    "isApp": true,
    "temperature": 22.5,
    "oxygen": 32
}
```
Response (成功):
```json=
{
    "success": true,
    "data": {
        "dateTime": 1585546156101,
        "isApp": true,
        "temperature": 75.4,
        "oxygen": 22
    }
}
```

### 查詢
```url=
GET /phy/oxygen
```
Query Params:
|  欄位 | 型態  | 預設   | 說明  | 
|---|---|---|---|---|
| page | number |1| 當前頁數|
| pageSize | number |10| 每頁結果數量，-1 為顯示所有|
| sort | string | dateTime | 排序欄位
| startAt | number | false | 從(測量時間)
| endAt | number | false | 結束(測量時間)
| avg | number | number| 0:當日 1:日平均 2 :月平均 |
| desc | boolean | false | 是否倒序排列？


|  欄位 | 型態 | 說明  | 
|---|---|---|---|---|
temperatureAvg | number | 日/月平均體溫
oxygenAvg | number |  日/月平均血氧
temperatureMax | number | 日/月最高體溫
oxygenMax | number |  日/月最高血氧
temperatureMin | number | 日/月最低體溫
oxygenMin | number |  日/月最低血氧

Response (成功):
```json=
{
    "success": true,
    "total": 2,
    "data": {
        "temperatureAvg": 75.4,
        "oxygenAvg": 22,
        "temperatureMax": 75.4,
        "oxygenMax": 22,
        "temperatureMin": 75.4,
        "oxygenMin": 22,
        "phyOxygen": [
            {
                "dateTime": 1583991833330,
                "isApp": true,
                "temperature": 75.4,
                "oxygen": 22
            }, {
                "dateTime": 1583991863330,
                "isApp": true,
                "temperature": 75.4,
                "oxygen": 22
            },
            ...
        ]
    }
}
```