---
# System prepended metadata

title: AIO設備管理

---

# AIO設備管理
[權限說明]
-AiO由系統管理員(L0)設定，醫院(L1)及企業(L2)可讀取
-不同AiO裝置有不同API Secret
-連線狀態因目前不知道取得方法，現階段不須實作
Attribute | Description | IsRequired| Remark
-|-|-|-
id | number | true | Primary Key
organId | String | true | 醫療單位(組織)Id - Level1
organName | String | false | 醫療單位名稱 - Level1
authOrganId | number | false | 授權單位(組織)Id - Level2
authOrganName | number | false | 授權單位名稱 - Level2
siteName | String | true | 站點名稱
modelNo | String | true | 型號
macAddress | String | true | MAC Address
secretNo | String | false | API Secret
active | boolean | true | 設備狀態 (default false) [啟用/停用]
connectionStatus | String | false | 連線狀態 [無()/低電量(LB)/.....] need to be checked with annie and BE
remark | String | false | 備註
createdAt | timestamp | true | 建立時間(timestamp)
updatedAt | timestamp | false | 修改時間(timestamp) 

### 查詢
```url=
GET /device/aio
```
Query Params:
|  欄位 | 型態  | 預設   | 說明  | 
|---|---|---|---|---|
| page | number |1| 當前頁數|
| pageSize | number |10| 每頁結果數量，-1 為顯示所有|
| sort | string | createdAt | 排序欄位
| desc | boolean | false | 是否倒序排列？
| FuzzyQuery | String | false | 模糊查詢,欄位(醫療單位名稱、授權單位名稱、站點名稱、型號)

Response (成功):
```json=
{
    "success": true,
    "totoal": 20,
    "data": [
        {
            "id": 1,
            "organId": "1101",
            "organName": "高雄醫學大學附設中和紀念醫院",
            "authOrganId": "1110",
            "authOrganName": "鼓山失智老人日間照顧中心",
            "siteName": "AIO-17",
            "modelNo": "華晞-02",
            "macAddress": "62-43-AD-F5-E9-C2",
            "secretNo": "90d13c60-19ae-3333-b6b0-9270aa69ad17",
            "active": true,
            "connectionStatus": null,
            "remark": null,
            "createdAt": 1583991833330,
            "updatedAt": 1583991933330
        }, {
            "id": 2,
            "organId": "1101",
            "organName": "高雄醫學大學附設中和紀念醫院",
            "authOrganId": "1111",
            "authOrganName": "前金日間照顧中心",
            "siteName": "AIO-18",
            "modelNo": "先進-01",
            "macAddress": "D9-03-75-F9-EF-FE",
            "secretNo": "80S13c6a-32ai-8909-b6b0-9270vv11ad23",
            "active": true,
            "connectionStatus": "LB",
            "remark": null,
            "createdAt": 1583991833330,
            "updatedAt": 1583991933330
        },
        ...
    ]
}
```
### 單筆查詢
```url=
GET /device/aio/$id
```
Response (成功):
```json=
{
    "success": true,
    "data": {
        "id": 1,
        "organId": "1101",
        "organName": "高雄醫學大學附設中和紀念醫院",
        "authOrganId": "1110",
        "authOrganName": "鼓山失智老人日間照顧中心",
        "siteName": "AIO-17",
        "modelNo": "華晞-02",
        "macAddress": "62-43-AD-F5-E9-C2",
        "secretNo": "90d13c60-19ae-3333-b6b0-9270aa69ad17",
        "active": true,
        "connectionStatus": null,
        "remark": null,
        "createdAt": 1583991833330,
        "updatedAt": 1583991933330
    }
}
```
### 新增
Request:
```url=
POST /device/aio
```
Payload：
```json=
{
    "organId": "1101",
    "authOrganId": "1110",
    "siteName": "AIO-17",
    "modelNo": "華晞-02",
    "macAddress": "62-43-AD-F5-E9-C2",
    "active": true,
    "remark": null,
}
```
Response (成功):
```json=
{
    "success": true,
    "data": {
        "id": 6,
        "secretNo": "71S13c3c-31ab-8i01-b6p0-9t70vv88ad11",
        "createdAt": 1583991833330
    }
}
```
### 修改
Request:
```url=
PUT /device/aio/$id
```
Payload：
```json=
{
    "organId": "1101",
    "authOrganId": "1110",
    "siteName": "AIO-17",
    "modelNo": "華晞-02",
    "macAddress": "79-43-AD-F5-E9-C2",
    "active": true,
    "remark": "This is a AIO device",
}
```
Response (成功):
```json=
{
    "success": true,
    "data": {
        "id": 1,
        "updatedAt": 1583991833330
    }
}
```

### 停用／啟用
Request:
```url=
PATCH /device/aio/$id/activate
```
Payload：
```json=
{ 
    "active": false
}
```
Response (成功):
```json=
{
    "success": true.
    "data": {
        "id": 1,
        "active": false,
        "updatedAt": 1583991833330
    }
}
```
### 刪除
Request:
```url=
DEL /device/aio/$id
```
Response (成功):
```json=
{
    "success": true
}
```

## 多媒體設備管理
[權限說明]
-多媒體設備由系統管理員(L0)設定，醫院(L1)及企業(L2)可讀取
-來自同一的單位的裝置有相同API Secret (與企業新增時產生之API Secret相同)

Attribute | Description | IsRequired| Remark
-|-|-|-
id | number | true | Primary Key
organId | String | true | 醫療單位(組織)Id - Level1
organName | String | false | 醫療單位名稱 - Level1
authOrganId | number | false | 授權單位(組織)Id - Level2
authOrganName | number | false | 授權單位名稱 - Level2
siteName | String | true | 站點名稱
modelNo | String | true | 型號
macAddress | String | true | MAC Address
secretNo | String | false | API Secret
active | boolean | true | 設備狀態 (default false) [啟用/停用]
remark | String | false | 備註
createdAt | timestamp | true | 建立時間(timestamp)
updatedAt | timestamp | false | 修改時間(timestamp) 

### 查詢
```url=
GET /device/multimedia
```
Query Params:
|  欄位 | 型態  | 預設   | 說明  | 
|---|---|---|---|---|
| page | number |1| 當前頁數|
| pageSize | number |10| 每頁結果數量，-1 為顯示所有|
| sort | string | createdAt | 排序欄位
| desc | boolean | false | 是否倒序排列？
| FuzzyQuery | String | false | 模糊查詢,欄位(醫療單位名稱、授權單位名稱、站點名稱、型號)

Response (成功):
```json=
{
    "success": true,
    "totoal": 20,
    "data": [
        {
            "id": 1,
            "organId": "1101",
            "organName": "高雄醫學大學附設中和紀念醫院",
            "authOrganId": "1110",
            "authOrganName": "鼓山失智老人日間照顧中心",
            "siteName": "AIO-17",
            "modelNo": "華晞-02",
            "macAddress": "62-43-AD-F5-E9-C2",
            "secretNo": "90d13c60-19ae-3333-b6b0-9270aa69ad17",
            "active": true,
            "remark": null,
            "createdAt": 1583991833330,
            "updatedAt": 1583991933330
        }, {
            "id": 2,
            "organId": "1101",
            "organName": "高雄醫學大學附設中和紀念醫院",
            "authOrganId": "1111",
            "authOrganName": "前金日間照顧中心",
            "siteName": "AIO-18",
            "modelNo": "先進-01",
            "macAddress": "D9-03-75-F9-EF-FE",
            "secretNo": "80S13c6a-32ai-8909-b6b0-9270vv11ad23",
            "active": true,
            "remark": null,
            "createdAt": 1583991833330,
            "updatedAt": 1583991933330
        },
        ...
    ]
}
```
### 單筆查詢
```url=
GET /device/multimedia/$id
```
Response (成功):
```json=
{
    "success": true,
    "data": {
        "id": 1,
        "organId": "1101",
        "organName": "高雄醫學大學附設中和紀念醫院",
        "authOrganId": "1110",
        "authOrganName": "鼓山失智老人日間照顧中心",
        "siteName": "AIO-17",
        "modelNo": "華晞-02",
        "macAddress": "62-43-AD-F5-E9-C2",
        "secretNo": "90d13c60-19ae-3333-b6b0-9270aa69ad17",
        "active": true,
        "remark": null,
        "createdAt": 1583991833330,
        "updatedAt": 1583991933330
    }
}
```
### 新增
Request:
```url=
POST /device/multimedia
```
Payload：
```json=
{
    "organId": "1101",
    "authOrganId": "1110",
    "siteName": "AIO-17",
    "modelNo": "華晞-02",
    "macAddress": "62-43-AD-F5-E9-C2",
    "active": true,
    "remark": null,
}
```
Response (成功):
```json=
{
    "success": true,
    "data": {
        "id": 6,
        "secretNo": "71S13c3c-31ab-8i01-b6p0-9t70vv88ad11",
        "createdAt": 1583991833330
    }
}
```
### 修改
Request:
```url=
PUT /device/multimedia/$id
```
Payload：
```json=
{
    "organId": "1101",
    "authOrganId": "1110",
    "siteName": "AIO-17",
    "modelNo": "華晞-02",
    "macAddress": "79-43-AD-F5-E9-C2",
    "active": true,
    "remark": "This is a AIO device",
}
```
Response (成功):
```json=
{
    "success": true,
    "data": {
        "id": 1,
        "updatedAt": 1583991833330
    }
}
```

### 停用／啟用
Request:
```url=
PATCH /device/multimedia/$id/activate
```
Payload：
```json=
{ 
    "active": false
}
```
Response (成功):
```json=
{
    "success": true.
    "data": {
        "id": 1,
        "active": false,
        "updatedAt": 1583991833330
    }
}
```
### 刪除
Request:
```url=
DEL /device/multimedia/$id
```
Response (成功):
```json=
{
    "success": true
}
```


