--- # 耗材 API ## POST Consumable List 由財會系統POST給SMC可用耗材清單。 ### Request POST /api/consumableStock/consumableItem <!-- #### Query parameter(\*必填欄位) | 欄位 | 格式 | 說明 | | - | - | - | | patientId | string | 查詢指定 patient ID | | startTime | string | 查詢起始時間(YYYY-MM-DD) | | endTime | string | 查詢結束時間(YYYY-MM-DD),查詢區間最多 30 天 | --> #### Header(\*必填欄位) | 欄位 | 格式 | 說明 | | - | - | - | | \*apikey | string | APIKEY | #### Body(\*必填欄位) | 欄位 | 格式 | 說明 | | - | - | - | | \*consumables | array | 耗材清單(參考 Consumable-Schema ) | #### Consumable-Schema Index : ( productId , organization ) | 欄位 | 格式 | 說明 | | - | - | - | | productId | string | 產品ID (PK)| | productNumber | string | 產品編號 | | productName | string | 產品名稱 | | unit | string | 產品單位 | | price | number | 產品售價 | | class | string | 產品類別名稱 | | enable | int | 是否啟用(1 啟用 / 0 停用) | | organization | string| 機構ID | ### Request Example ```json= { "productId":"A1234567", "productNumber":"A1234567", "productName":"濕紙巾", "unit":"包", "price":20, "class":"民生用品", "enable":1, } ``` ### Response Example ```json= { "_id": "6087b1bd42872b16eea4707b", "productId": "12344", "productNumber": "12344", "productName": "濕紙巾", "unit": "包", "price": 20, "class": "民生用品", "enable": 1, "organization": "5c10bdf47b43650f407de7d6", "__v": 0 } ``` ------------------------------------------------ ## Get Consumables for Paitents 取得住民在SMC使用耗材清單。 ### Request Get api/consumableStock/stockUsageOverview?startDate={startDate}&endDate={endDate} #### Header(\*必填欄位) | 欄位 | 格式 | 說明 | | - | - | - | | \*apikey | string | APIKEY | #### Query parameter(\*必填欄位) | 欄位 | 格式 | 說明 | | - | - | - | | \*startDate | string | Timestamp | | \*endDate | string | Timestamp| #### Response (欄位說明) | 欄位 | 格式 | 說明 | | - | - | - | | _id | string | 住民使用耗材 id | | patientId | string | 住民 id | | consumableId | string | 耗材 id | | quantity | number | 使用數量 | | createdDate | string | 耗材使用日期 | | unitPrice | number | 單價 | | user | string | User id | ### Response Example ```json= [ { "_id": "6087d472a3636c24e6f5a75a", "createdDate": "2021-04-27T09:07:27.211Z", "quantity": 0.4, "consumableId": "60865e73d66b9f141bbe46d9", "patient": "5c174fafe2b39b02164a71e4", "user": "5c134df8d900d7002153d3b3", "unitPrice": 5 }, ] ``` ------------------------------------------------ ## Modify Consumable 修改耗材品項 ### Request PUT /api/consumableStock/consumableItem?productId={productId} params填入要更改商品品項的productId <!-- #### Query parameter(\*必填欄位) | 欄位 | 格式 | 說明 | | - | - | - | | patientId | string | 查詢指定 patient ID | | startTime | string | 查詢起始時間(YYYY-MM-DD) | | endTime | string | 查詢結束時間(YYYY-MM-DD),查詢區間最多 30 天 | --> #### Header(\*必填欄位) | 欄位 | 格式 | 說明 | | - | - | - | | \*apikey | string | APIKEY | #### Body(\*必填欄位) 填入要更新的資料 | 欄位 | 格式 | 說明 | | - | - | - | | \*consumables | array | 耗材清單(參考 Consumable-Schema ) | #### Consumable-Schema Index : ( productId , organization ) | 欄位 | 格式 | 說明 | | - | - | - | | productId | string | 產品ID (PK)| | productNumber | string | 產品編號 | | productName | string | 產品名稱 | | unit | string | 產品單位 | | price | number | 產品售價 | | class | string | 產品類別名稱 | | enable | int | 是否啟用(1 啟用 / 0 停用) | ### Request Example ```json= { "productNumber": "118", "productName": "棉花棒", "unit": "包", "price": 50, "class": "衛生用品", "enable": 0 } ``` ### Response Example ```json= [ { "_id": "60af6cd8d960e32d2028a7d0", "productId": "116", "productNumber": "118", "productName": "棉花棒", "unit": "包", "price": 50, "class": "衛生用品", "enable": 0, "organization": "5c10bdf47b43650f407de7d6", "__v": 0 } ] ``` ## Get ConsumableList By Organization 取得機構所有耗材項目資料 ### Request Get api/consumableStock/consumableItem ### Header(\*必填欄位) | 欄位 | 格式 | 說明 | | - | - | - | | \*apikey | string | APIKEY | 機構依照apikey ### Response (欄位說明) Index : ( productId , organization ) | 欄位 | 格式 | 說明 | | - | - | - | | _Id | string | 耗材_Id| | productId | string | 產品ID (PK)| | productNumber | string | 產品編號 | | productName | string | 產品名稱 | | unit | string | 產品單位 | | price | number | 產品售價 | | class | string | 產品類別名稱 | | enable | int | 是否啟用(1 啟用 / 0 停用) | | organization | string| 機構ID | ### Response Example ```json= [ { "_id": "60af4667e37af00028c71e4f", "productId": "400", "productNumber": "E0020", "productName": "小迴紋針", "unit": "支", "price": 18, "class": "E文具類", "enable": 1, "organization": "5c10bdf47b43650f407de7d6", "__v": 0 },{ "_id": "60af4668e863cb0028465693", "productId": "407", "productNumber": "B0007", "productName": "血糖試紙", "unit": "盒", "price": 25, "class": "B護理類", "enable": 1, "organization": "5c10bdf47b43650f407de7d6", "__v": 0 }, // ...略 ] ```