# 獨立運作方案 APP
## 主機位置修改
VitalLink App,整合各家血氧,血壓,體重與體溫量測儀器之App,主機預設與Google雲端主機進行串接,本文章提供客製化主機位置的方法,僅須將 App 設定主機網址(url) 就可以指向客制主機,在針對下列 Web RESTFUL API 進行開發,就可以與 APP 互傳資料。
## APP端請求命令
- [授權](#授權-Authorization)
- [機構檔案](#機構檔案)
- [住民/個案/病人清單](#住民/個案/病人清單)
- [員工清單](#員工清單)
- [住民追蹤資料](#住民追蹤資料)
:::danger
:bulb: **提示**: 所有由手機端發出的 request,其 Content-type 均為 **application/x-www-form-urlencorded**。
:::
### 授權 Authorization
POST /jwt/auth/login
```javascript
{baseURL}/api/jwt/auth/login
```
**Request body**
|欄位|格式|說明|
|-|-|-|
|username|string|使用者帳號
|password|string|使用者密碼
```json
{
"username": "user123",
"password": "pwd123",
}
```
**Response body**
|欄位|格式|說明|
|-|-|-|
|_id|string|使用者識別號
|username|string|使用者帳號
|token|string|使用者授權
|firstName|string|使用者名字
|lastName|string|使用者姓氏
|organization|string|機構識別號
|googleCloudAccess|string|(保留欄位,開發階段使用)
```json
{
"firstName": "...",
"lastName": "...",
"_id": "...",
"username": "user123",
"organization": "...",
"token": "JWT ...",
}
```
### 機構檔案
GET /organization/devices/app
```javascript
{baseURL}/api/organization/devices/app
```
**Header**
|欄位|格式|說明|
|-|-|-|
|token|string|使用者授權
```json
{
"token": "...",
}
```
**Response body**
|欄位|格式|說明|
|-|-|-|
|_id|string|機構識別號
|name|string|機構名稱
|branch|[string]|分區
|preference|json|
```json
{
"_id": "...",
"name": "...",
"branch": ["...", "..."],
"preference": {
"vitalsign_severe": {
"TP": {
"minValue": 35.5,
"maxValue": 38
},
"PR": {
"minValue": 50,
"maxValue": 120
},
"RR": {
"minValue": 14,
"maxValue": 26
},
"SYS": {
"minValue": 90,
"maxValue": 180
},
"DIA": {
"minValue": 50,
"maxValue": 110
},
"SPO2": {
"minValue": 90,
"maxValue": 100
},
"PAIN": {
"minValue": 0,
"maxValue": 0
}
},
"bloodsugar_severe": {
"AC": {
"minValue": 70,
"maxValue": 140
},
"PC": {
"minValue": 70,
"maxValue": 200
}
}
}
}
```
### 住民/個案/病人清單
GET /patient/devices/app
```javascript
{baseURL}/api/patient/devices/app
```
**Header**
|欄位|格式|說明|
|-|-|-|
|token|string|使用者授權
```json
{
"token": "...",
}
```
**Response body**
|欄位|格式|說明|
|-|-|-|
|_id|string|住民識別號
|branch|string|分區
|room|string|房號(與編號二選一)
|bed|string|床號(與編號二選一)
|numbering|string|編號(房號床號二選一)
|firstName|string|住民名字
|lastName|string|住民姓氏
|status|string|在院狀態:["present" (在院,僅此狀態會顯示於列表), "hospital" (住院), "away" (請假), "withdraw" (退住), "reservation" (預約入住), "unpresented" (取消預約)]
|vsMeasurementTime|string|(選填)"yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|bsMeasurementTime|string|(選填)"yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|weightMeasurementTime|string|(選填)"yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|medicalOrder|string|住民血糖紀錄醫囑
|remark|string|住民資料備註(附註於住民姓名之後)
|photoUrl|string|住民圖片位置(URL)
```json
[
{
"_id": "...",
"branch": "...",
"room": "...",
"bed": "...",
"numbering": "...",
"firstName": "...",
"lastName": "...",
"status": "...",
"vsMeasurementTime": "...",
"bsMeasurementTime": "...",
"weightMeasurementTime": "...",
"medicalOrder": "...",
"remark": "...",
"photoUrl": "...",
}
]
```
### 員工清單
GET /staff/devices/app
```javascript
{baseURL}/api/staff/devices/app
```
**Header**
|欄位|格式|說明|
|-|-|-|
|token|string|使用者授權
```json
{
"token": "...",
}
```
**Response body**
|欄位|格式|說明|
|-|-|-|
|_id|string|識別號
|employeeNumber|string|編號
|jobTitle|string|職稱
|displayName|string|姓+名
|firstName|string|名字
|lastName|string|姓氏
|vsMeasurementTime|string|(選填)"yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|staffStatus|string|["employed", "resigned"]
|photoUrl|string|圖片位置(URL)
```json
[
{
"_id": "...",
"displayName": "...",
"employeeNumber": "...",
"firstName": "...",
"lastName": "...",
"vsMeasurementTime": "...",
"jobTitle": "...",
"staffStatus": "...",
"photoUrl": "...",
}
]
```
### 住民追蹤資料
GET /vitalsignTrack/devices/trackList
```javascript
{baseURL}/api/vitalsignTrack/devices/trackList
```
**Header**
|欄位|格式|說明|
|-|-|-|
|token|string|使用者授權
```json
{
"token": "...",
}
```
**Response body**
|欄位|格式|說明|
|-|-|-|
|_id|string|識別號
|vitalsign|json|生命徵象資料
|finished|boolean|追中完成與否
|items|[string]|異常項目
```json
[
{
"_id": "...",
"finished": false,
"items": ["...", "...", "..."],
"vitalsignBean": {
"_id" : "...",
"patient" : "...",
}
}
]
```
## APP端請求命令
- [生命徵象上傳](#生命徵象上傳)
- [血糖上傳](#血糖上傳)
- [體重體脂上傳](#體重體脂上傳)
- [員工生命徵象上傳](#員工生命徵象上傳)
### 生命徵象上傳
GET /myvitalsign/devices/app
```javascript
{baseURL}/api/myvitalsign/devices/app
```
**Header**
|欄位|格式|說明|
|-|-|-|
|token|string|使用者授權
```json
{
"token": "...",
}
```
**Request body**
|欄位|格式|說明|
|-|-|-|
|uuid|string|資料uuid
|deviceTime|long|資料創建時間(millisecond)
|organization|string|
|user|string|
|patient|string|
|SYS|int|收縮壓
|DIA|int|舒張壓
|PR|int|心跳
|SPO2|int|血氧
|O2THERAPY|int|供氧量
|TP|float|體溫
|RR|int|呼吸
|PAIN|int|疼痛[0-10]
|mood|string|心情["happy", "calm", "sad", "agitated", "sick"]
|deviceMac|string|phone device
|vitalsign|string|追蹤資料(track data)id
|note|string|備註
|status|json|資料輸入源(-1: default, 0: Device, 1: Manual)
```json
[
{
"uuid": "...",
"deviceTime": 1356689117695,
"organization": "...",
"user": "...",
"patient": "...",
"SYS": 130,
"DIA": 80,
"PR": 0,
"SPO2": 100,
"O2THERAPY": 0,
"TP": 36.7,
"RR": 17,
"PAIN": 0,
"mood": "happy",
"deviceMac": "...",
"vitalsign": "...",
"status": {
"sys": 0,
"dia": 0,
"pr": 0,
"rr": 0,
"spo2": 0,
"therapy": 0,
"tp": 0,
"pain": 0,
}
}
]
```
**Response body**
|欄位|格式|說明|
|-|-|-|
|uuid|string|資料UUID
|status|boolean|上傳完成
|errorCode|int|http code
```json
{
"uuid": "...",
"status": true,
"errorCode": 200
}
```
### 血糖上傳
GET /bloodsugar/devices/app
```javascript
{baseURL}/api/bloodsugar/devices/app
```
**Header**
|欄位|格式|說明|
|-|-|-|
|token|string|使用者授權
```json
{
"token": "...",
}
```
**Request body**
|欄位|格式|說明|
|-|-|-|
|uuid|string|資料uuid
|deviceTime|long|資料創建時間(millisecond)
|organization|string|
|user|string|
|patient|string|
|sugarType|string|["AC", "PC"]
|sugarValue|int|血糖
|valueRangeStatus|string|["low", "normal", "hi"]
|deviceMac|string|phone device
|vitalsign|string|追蹤資料(track data)id
|status|json|資料輸入源(-1: default, 0: Device, 1: Manual)
```json
[
{
"uuid": "...",
"deviceTime": 1356689117695,
"organization": "...",
"user": "...",
"patient": "...",
"sugarType": "AC",
"sugarValue": 123,
"valueRangeStatus": "normal",
"deviceMac": "...",
"status": {
"acpc": 0,
"bs": 0
}
}
]
```
**Response body**
|欄位|格式|說明|
|-|-|-|
|uuid|string|資料UUID
|status|boolean|上傳完成
|errorCode|int|http code
```json
{
"uuid": "...",
"status": true,
"errorCode": 200
}
```
### 體重體脂上傳
GET /weight/devices/app
```javascript
{baseURL}/api/weight/devices/app
```
**Header**
|欄位|格式|說明|
|-|-|-|
|token|string|使用者授權
```json
{
"token": "...",
}
```
**Request body**
|欄位|格式|說明|
|-|-|-|
|uuid|string|資料uuid
|deviceTime|long|資料創建時間(millisecond)
|organization|string|
|user|string|
|patient|string|
|weight|float|體重
|fat|float|體脂
|deviceMac|string|phone device
|vitalsign|string|追蹤資料(track data)id
|status|json|資料輸入源(-1: default, 0: Device, 1: Manual)
```json
[
{
"uuid": "...",
"deviceTime": 1356689117695,
"organization": "...",
"user": "...",
"patient": "...",
"weight": 73.2,
"fat": 19.0,
"deviceMac": "...",
"status": {
"weight": 0,
"fat": 0
}
}
]
```
**Response body**
|欄位|格式|說明|
|-|-|-|
|uuid|string|資料UUID
|status|boolean|上傳完成
|errorCode|int|http code
```json
{
"uuid": "...",
"status": true,
"errorCode": 200
}
```
### 員工生命徵象上傳
GET /vitalsignstaff/devices/app
```javascript
{baseURL}/api/vitalsignstaff/devices/app
```
**Header**
|欄位|格式|說明|
|-|-|-|
|token|string|使用者授權
```json
{
"token": "...",
}
```
**Request body**
|欄位|格式|說明|
|-|-|-|
|uuid|string|資料uuid
|createdTime|long|資料創建時間(millisecond)
|organization|string|
|user|string|
|staff|string|
|SYS|int|收縮壓
|DIA|int|舒張壓
|PR|int|心跳
|SPO2|int|血氧
|O2THERAPY|int|供氧量
|TP|float|體溫
|RR|int|呼吸
|PAIN|int|疼痛[0-10]
|mood|string|心情["happy", "calm", "sad", "agitated", "sick"]
|deviceMac|string|phone device
|vitalsign|string|追蹤資料(track data)id
|note|string|備註
|status|json|資料輸入源(-1: default, 0: Device, 1: Manual)
```json
[
{
"uuid": "...",
"createdTime": 1356689117695,
"organization": "...",
"user": "...",
"staff": "...",
"SYS": 130,
"DIA": 80,
"PR": 0,
"SPO2": 100,
"O2THERAPY": 0,
"TP": 36.7,
"RR": 17,
"PAIN": 0,
"mood": "happy",
"deviceMac": "...",
"status": {
"sys": 0,
"dia": 0,
"pr": 0,
"rr": 0,
"spo2": 0,
"therapy": 0,
"tp": 0,
"pain": 0,
},
"note": ""
}
]
```
**Response body**
|欄位|格式|說明|
|-|-|-|
|uuid|string|資料UUID
|status|boolean|上傳完成
|errorCode|int|http code
```json
{
"uuid": "...",
"status": true,
"errorCode": 200
}
```