H365V2
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Help
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
:::spoiler API 清單 [TOC] ::: # 飲食紀錄管理 ## 常數定義 ### 食物分類 欄位 | 型態 | 說明 ---|---|--- category | string | WHOLE_GRAINS: 全榖雜糧, LEGUME_FISH_MEAT_EGG: 豆魚肉蛋, DAIRY: 乳製品, VEGETABLES: 蔬菜, FRUITS: 水果, OILS_AND_NUTS: 食用油與堅果, DRINK: 飲料, OTHER: 其他 ### 食物類型-LEGUME_FISH_MEAT_EGG 欄位 | 型態 | 說明 ---|---|--- type | string | LOW_FAT: 低脂, MEDIUM_FAT: 中脂, HIGH_FAT: 高脂, VERY_HIGH_FAT: 超高脂 ### 食物類型-DAIRY 欄位 | 型態 | 說明 ---|---|--- type | string | LOW_FAT: 低脂, WHOLE_FAT: 全脂, SKIM: 脫脂 ### 食物類型-VEGETABLES 欄位 | 型態 | 說明 ---|---|--- type | string | RAW: 生, COOKED: 熟 ### 食物類型-OILS_AND_NUTS 欄位 | 型態 | 說明 ---|---|--- type | string | OIL: 食用油, NUT: 堅果 ### 食物類型-DRINK 欄位 | 型態 | 說明 ---|---|--- type | string | WATER: 水, FULL_SUGAR: 全糖, LESS_SUGAR: 少糖, HALF_SUGAR: 半糖, QUARTER_SUGAR: 微糖, SUGAR_FREE: 無糖 ### 用餐時段 欄位 | 型態 | 說明 ---|---|--- timePeriod | int | ALL: -1(查詢用), 早上: 1, 中午: 2, 晚上: 3, 睡前: 4 ### 用餐餐別 欄位 | 型態 | 說明 ---|---|--- timePeriodType | int | ALL: -1(查詢用), <br/> **早上**<br/> 早餐: 10, 早午餐: 11, 運動前一小時: 12, 運動前兩小時: 13, 運動後一小時: 14, 運動後兩小時: 15, <br/> **中午**<br/> 午餐: 20, 下午茶: 21, 運動前一小時: 22, 運動前兩小時: 23, 運動後一小時: 24, 運動後兩小時: 25, <br/> **晚上**<br/> 晚餐: 30, 點心: 31, 運動前一小時: 32, 運動前兩小時: 33, 運動後一小時: 34, 運動後兩小時: 35 <br/> **睡前**<br/> 40:宵夜, 運動前一小時: 42, 運動前兩小時: 43, 運動後一小時: 44, 運動後兩小時: 45 ### 烹調方式 欄位 | 型態 | 說明 ---|---|--- type | string | FAT_FREE: 無油, FRY: 非油炸, FRIED: 油炸 ### 額外加糖 欄位 | 型態 | 說明 ---|---|--- type | string | NONE: 無添加, WITH_SUGAR: 加糖 ### 餐盤狀態 欄位 | 型態 | 說明 ---|---|--- status | string | DRAFT: 草稿, PUBLISHED: 已發布 ### 飲食記錄方式 欄位 | 型態 | 說明 ---|---|--- diaryRecordType | string | DIET_PLAN: 我的餐盤, FOOD_DB: 食品資料庫 ### 飲食分數查詢區間類別 欄位 | 型態 | 說明 ---|---|--- scorePeriod | string | DAILY: 日, WEEKLY: 週, MONTHLY: 月 ## Schema ### 飲食紀錄目標(DietGoal) Name | Type | 說明 --- | --- | --- weight | double | 標準體重 targetCalorie | double | 目標熱量(kCal) protein | double | 蛋白質(g) carbohydrate | double | 碳水化合物(g) fat | double | 脂肪(g) example: ```javascript { "weight": 65, "targetCalorie": 1883, "protein": 78, "carbohydrate": 56, "fat": 60 } ``` ### 食品(DietFood) Name | Type | 說明 --- | --- | --- id | int | 食品id foodNo | string | 食品編號 foodType | string | 食品分類 name | string | 食品名稱 quantity | string | 數量(每100g可食用含量) unit | string | 單位(每100g可食用含量) calorie | double | 修正熱量(kcal) protein | double | 粗蛋白(g) dietaryFiber | double | 膳食纖維(g) carbohydrate | double | 總碳水化合物(g) fat | double | 粗脂肪(g) size | string | 份量 example: ```javascript { "id": 940, "foodNo": "I0400301", "foodType": "肉類", "name": "烏骨雞", "quantity": 100, "unit": "g", "calorie": 213.0, "protein": 17.9, "fat": 15.1, "carbohydrate": 0.8, "size": "份" } ``` ### 飲食紀錄圖片 (DietDiaryImage) Name | Type | 建立時傳入 | 說明 --- | --- | --- | --- id | string | N | 飲食紀錄圖片id image | string | Y | 新增時,APP 會傳入圖片 base64 字串,後端會儲存成影像檔後,在 image 屬性裡存入飲食紀錄圖片 url imageType | string | N | enum: ['jpg', 'png'] time | timestamp | Y | 飲食紀錄時間 timePeriod | int | Y | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | Y | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) example: ```javascript //Upload { "image": "圖片BASE64編碼", "time": 1615249186619, "timePeriod": 1, "timePeriodType": 10 } //Response { "id": "6eff39d7-8287-4ce0-abd0-7940338a6e17", "image": "http://content-service/swift/v1/diet/diary/8985df36-c3a7-464b-9f53-c453a953be15.png", "time": 1615249186619, "timePeriod": 1, "timePeriodType": 10 } ``` ### 飲食紀錄 (DietDiary) Name | Type | 建立時傳入 | 說明 --- | --- | --- | --- id | long | N | 飲食紀錄id time | timestamp | Y | 飲食紀錄時間 hhmmOfTime | int | N | time 的 hhmm 格式,比如早上 10:30, 這個值就是 1030,作為搜尋的條件之用 timePeriod | int | Y | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | Y | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) foodId | int | Y | 飲食紀錄的的食品編號 (-1則為自訂飲食名稱, 或是記錄方式為使用我的餐盤計劃) foodName | string | - | 如果foodId = -1,且記錄方式為食品資料庫時則為必填,<br/>**當foodCategoryId為其他食材時必填** timeAndTimePeriodType | timestamp | N | 作為排序之用,先依 time 排出每日的飲食紀錄,再依 timePeriodType 來排序 quantity | double | Y | 飲食紀錄的的食品數量 calorie | double | N | 建議熱量 (需乘上 quantity,四捨五入到小數點第一位),<br/>**當foodCategoryId為其他食材時, calorie會由使用者輸入的protein, carbohydrate, fat及quantity計算出來** protein | double | N | 建議蛋白質 (需乘上 quantity,四捨五入到小數點第一位),<br/>**當foodCategoryId為其他食材時, 開放使用者可以輸入, 表示1份的值** dietaryFiber | double | N | 建議膳食纖維 (需乘上 quantity,四捨五入到小數點第一位) carbohydrate | double | N | 建議碳水化合物 (需乘上 quantity,四捨五入到小數點第一位),<br/>**當foodCategoryId為其他食材時, 開放使用者可以輸入, 表示1份的值** fat | double | N | 脂肪 (需乘上 quantity,四捨五入到小數點第一位),<br/>**當foodCategoryId為其他食材時, 開放使用者可以輸入, 表示1份的值** foodCategoryId | string | Y | 食材營養素id, 飲食記錄方式使用我的餐盤計劃時為必填 plateId | string | N | 目前使用的我的餐盤id cookedType | string | Y | 飲食記錄方式使用我的餐盤計劃時, 食材的烹調方式, 參閱 [烹調方式](#烹調方式) addedSugar | string | Y | 飲食記錄方式使用我的餐盤計劃時, 食材是否額外加糖, 參閱 [額外加糖](#額外加糖) foodCategory | string | N | 飲食記錄方式使用我的餐盤計劃時, 食物分類, 參閱[食物分類](#食物分類) foodCategoryType | string | N | 飲食記錄方式使用我的餐盤計劃時, 食物類型, 請參閱[各食物類型](#食物類型-LEGUME_FISH_MEAT_EGG) remark | string | N | 飲食記錄備註, 一個餐別只會有一個備註 isSaveMe | boolean | N | 是否將其他記錄方式的食品加入到常用清單裡 example: ```javascript //飲食記錄方式-食品資料庫(原本API使用方式) { "id": 1, "time": 1585546156101, "timePeriod": 2, "timePeriodType": 21, "foodId": 12, "quantity": 2, "calorie": 500, "protein": 12.9, "dietaryFiber": 8.09, "carbohydrate": 73.0587, "fat": 30 } //飲食記錄方式-我的餐盤計劃 { "id": 1, "time": 1585546156101, "timePeriod": 2, "timePeriodType": 21, "foodId": -1, "foodName": "豆魚肉蛋(中脂)(非油炸)", "quantity": 2, "calorie": 500, "protein": 12.9, "dietaryFiber": 8.09, "carbohydrate": 73.0587, "fat": 30, "foodCategoryId": "5ac5e206-881d-4d0d-b6b7-6ef9c61713b4", "plateId": null, "cookedType": "FRY", "addedSugar": null } ``` ## API ### 取得飲食目標[WEB/APP] ```url POST /diet/goal ``` #### Request 欄位 | 型態 | 必填 | 長度限制 | 預設 | 說明 ---|---|---|---|---|--- householdMemberId | string | Y | | | App User不用填,會由token取得 ```javascript { "householdMemberId": "8e19e873-a043-4c1d-9259-f95d78881ea7" } ``` #### Response (成功): ```javascript { "httpCode": 200, "result": { "data": { "weight": 75.6, "targetCalorie": 2268.0, "protein": 85.1, "fat": 75.6, "carbohydrate": 311.9 } } } ``` ### 新增飲食紀錄[APP] ```url POST /diet/diary/bulkAdd ``` * 當新增其他食材時, foodName為必填, 並開放protein, carbohydrate, fat 讓使用者可以輸入 - protein, carbohydrate, fat 輸入的值代表的是1份的數值 - calorie 會由使用者輸入的 protein, carbohydrate, fat 及份量去計算出來 - calorie = (protein * 4 + carbohydrate * 4 + fat * 9) * quantity #### Request ```javascript //飲食記錄方式-食品資料庫(原本API使用方式) { "householdMemberId":"123", //App User不需填 "remark": "備註", "dietDiaryList": [ { "time": 1608145199000, "timePeriod": 3, "timePeriodType": 30, "foodId": -1, "quantity": 1, "foodName": "大腸包小腸" }, ... ] } //飲食記錄方式-我的餐盤計劃 { "householdMemberId":"123", //App User不需填 "remark": "備註", "dietDiaryList": [ { //一般六大營養素食材 "time": 1608145199000, "timePeriod": 2, "timePeriodType": 21, "foodId": -1, "quantity": 2, "foodCategoryId": "5ac5e206-881d-4d0d-b6b7-6ef9c61713b4", "plateId": null, "cookedType": "FRY", "addedSugar": null }, { //其他記錄方式, 使用者自行輸入 "time": 1608145199000, "timePeriod": 2, "timePeriodType": 21, "foodId": -1, "quantity": 1, "foodCategoryId": "db3bdb82-f814-457f-a588-869871671cb8", "plateId": null, "foodName": "大俠愛吃漢堡包", "calorie": null, "protein": 35, "carbohydrate": 250, "fat": 87, "isSaveMe": true, } ] } ``` #### Response ```javascript //飲食記錄方式-食品資料庫(原本API使用方式) { "httpCode": 200, "result": { "data": [ { "householdMemberId": "123", "time": 1585546156101, "hhmmOfTime": 1126, "timePeriod": 2, "timePeriodType": 21, "foodId": 0, "foodName": "test food", "timeAndTimePeriodType": 1607961600021, "quantity": 2, "calorie": 0, "protein": 0, "dietaryFiber": 0, "carbohydrate": 0, "fat": 0, "createdAt": 1608002816917 } ] } } //飲食記錄方式-我的餐盤計劃 { "httpCode": 200, "result": { "data": [ { "householdMemberId": "123", "time": 1585546156101, "hhmmOfTime": 1126, "timePeriod": 2, "timePeriodType": 21, "foodId": -1, "foodName": "豆魚肉蛋(中脂)(非油炸)", "timeAndTimePeriodType": 1607961600021, "quantity": 2, "calorie": 0, "protein": 0, "dietaryFiber": 0, "carbohydrate": 0, "fat": 0, "createdAt": 1608002816917, "foodCategoryId": "5ac5e206-881d-4d0d-b6b7-6ef9c61713b4", "plateId": null, "cookedType": "FRY", "addedSugar": null } ] } } ``` ### 依飲食紀錄餐別整批更新[APP] ```url POST /diet/diary/bulkUpdate ``` 依照PayLoad陣列裡面的timePeriod來批次刪除並批次新增 #### Request ```javascript //飲食記錄方式-食品資料庫(原本API使用方式) { "householdMemberId":"123", //APP User不需填 "date":"2020/12/15", "timePeriod": 2, "timePeriodType": 21, "remark": "備註", "dietDiaryList": [ { //old data "id": 123, "time": 1608145199000, "foodId": 19, "quantity": 1 }, { // new data "time": 1585546156101, "foodId": -1, "quantity": 1, "foodName": "大腸包小腸" }, ... ] } //飲食記錄方式-我的餐盤計劃 { "householdMemberId":"123", //APP User不需填 "date":"2020/12/15", "timePeriod": 2, "timePeriodType": 21, "remark": "備註", "dietDiaryList": [ { //old data "id": 123, "time": 1608145199000, "foodId": -1, "quantity": 2, "foodCategoryId": "5ac5e206-881d-4d0d-b6b7-6ef9c61713b4", "plateId": null, "cookedType": "FRY", "addedSugar": null }, { // new data "time": 1585546156101, "foodId": -1, "quantity": 1, "foodCategoryId": "3bab6bb8-b286-4ccd-9de3-bc282acdb090", "plateId": null, "cookedType": "FRY", "addedSugar": null } ] } ``` #### Response ```javascript { "httpCode": 200, "result": { "data": [ { "id": 20, "image": "diet/diary/70137f1c-e68d-4644-bd06-f7b1fee29978.png", "householdMemberId": "123", "time": 1608002816917, "hhmmOfTime": 1126, "timePeriod": 2, "timePeriodType": 21, "foodId": 11, "foodName": "低筋麵粉", "timeAndTimePeriodType": 1607961600021, "quantity": 1, "calorie": 359, "protein": 8, "dietaryFiber": 2, "carbohydrate": 78, "fat": 1, "createdAt": 1608101032626 } ] } } ``` ### 依飲食紀錄餐別整批更新-新版[APP] ```url POST /diet/diary/bulk-update-new ``` * 依照PayLoad裡面的oldTime, oldTimePeriod, oldTimePeriodType 來批次刪除並批次新增 #### Request 欄位 | 型態 | Required | 長度限制 | 預設 | 說明 ---- | --- | --- | --- | --- | --- oldTime | timestamp | Y | | | 要修改的原飲食記錄日期 oldTimePeriod | int | Y | | | 要修改的原飲食記錄用餐時段, 參閱 [用餐時段](#用餐時段) oldTimePeriodType | int | Y | | | 要修改的原飲食記錄用餐餐別, 參閱 [用餐餐別](#用餐餐別) newTime | timestamp | Y | | | 變更後的飲食記錄日期 newTimePeriod | int | Y | | | 變更後的飲食記錄用餐時段, 參閱 [用餐時段](#用餐時段) newTimePeriodType | int | Y | | | 變更後的飲食記錄用餐餐別, 參閱 [用餐餐別](#用餐餐別) dietDiaryList | json array | Y | | | 飲食記錄 json array, payload裡的time, timePeriod, timePeriodType不用填, 會由newTime, newTimePeriod, newTimePeriodType帶入, 其餘欄位參閱 [新增飲食紀錄APP](#新增飲食紀錄APP) ```javascript //飲食記錄方式-食品資料庫(原本API使用方式) { "oldTime": 1675825132000, "oldTimePeriod": 1, "oldTimePeriodType": 10, "newTime": 1676003400000, "newTimePeriod": 2, "newTimePeriodType": 20, "remark": "備註", "dietDiaryList": [ { "foodId": 1234, "quantity": 1, "foodName": "大腸包小腸" }, ... ] } //飲食記錄方式-我的餐盤計劃 { "oldTime": 1675825132000, "oldTimePeriod": 1, "oldTimePeriodType": 10, "newTime": 1676003400000, "newTimePeriod": 2, "newTimePeriodType": 20, "remark": "備註", "dietDiaryList": [ { "foodId": -1, "quantity": 1, "foodCategoryId": "3bab6bb8-b286-4ccd-9de3-bc282acdb090", "plateId": null, "cookedType": "FRY", "addedSugar": null } ] } ``` #### Response ```javascript { "httpCode": 200, "result": { "data": [ { "id": 2096, "householdMemberId": "c0fbb6d5-53c4-4962-bc17-1591e4903b2f", "time": 1670660760000, "hhmmOfTime": 1626, "timePeriod": 2, "timePeriodType": 20, "foodId": -1, "foodName": "豆魚肉蛋(中脂)(非油炸)", "timeAndTimePeriodType": 1670601600020, "quantity": 1, "calorie": 88, "protein": 7, "dietaryFiber": 0, "carbohydrate": 0, "fat": 6.67, "createdAt": 1679905292839, "foodCategoryId": "5ac5e206-881d-4d0d-b6b7-6ef9c61713b4", "cookedType": "FRY" }, ... ] } } ``` ### 編輯飲食紀錄[APP] ```url PUT /diet/diary/:id ``` #### Request ```javascript { "time": "1585546156101", "timePeriod": "2", "timePeriodType": "21 ", "foodId": 12, "quantity": 2 } ``` #### Response ```javascript { "httpCode": 200, "result": { "data": { "id": 5, "time": 1585546157101, "hhmmOfTime": 1329, "foodName": "小麥胚芽", "timeAndTimePeriodType": 1585497600021, "calorie": 792, "protein": 63, "dietaryFiber": 20, "carbohydrate": 96, "fat": 23 } } } ``` ### 查詢飲食紀錄[APP] ```url GET /diet/diary/$id ``` #### Response ```javascript { "httpCode": 200, "result": { "data": { "id": 12, "householdMemberId": "123", "time": 1608159599000, "hhmmOfTime": 659, "timePeriod": 3, "timePeriodType": 31, "foodId": 17, "foodName": "餛飩皮", "timeAndTimePeriodType": 1608134400031, "quantity": 1, "calorie": 268, "protein": 8, "dietaryFiber": 2, "carbohydrate": 58, "fat": 1, "createdAt": 1608100300826 } } } ``` ### 查詢飲食紀錄列表[APP/WEB] ```url POST /diet/diary (WEB/APP 共用) ``` #### Request 欄位 | 型態 | 預設 | 說明 --- | --- | --- |--- query | json | | 查詢條件json pagination | json | | 分頁json sorter | json | | 排序json ##### query (查詢條件json) 欄位 | 型態 | 必填 | 長度限制 | 預設 | 說明 ---|---|---|---|---|--- householdMemberId | string | | | | 要搜尋的 householdMemberId,若沒有傳入 householdMemberId,就以改由 token 取得個案資料 startedAt | timestamp | | | | 要搜尋的日期區間 endAt | timestamp | | | | 要搜尋的日期區間 timePeriod | int | | | -1 | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | | | -1 | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) ##### pagination (分頁json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- current | int | | 1 | 當前頁數 pageSize | int | | 10 | 每頁結果數量,-1 為顯示所有 ##### sorter (排序json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- field | string | | createdAt | 排序欄位,"timeAndTimePeriodType":這個可以先依 time 排出每日的飲食紀錄,再依 timePeriodType 來排序 order | string | | asc | 升序或降序 ```javascript { "query": { "startedAt": 1607990400000, "endAt": 1608076799000, "householdMemberId": "123", "timePeriod": -1, "timePeriodType": -1 }, "pagination": { "current": 1, "pageSize":10 }, "sorter": { "field": "createdAt", "order": "desc" } } ``` #### Response ```javascript { "httpCode": 200, "result": { "data": [ { "id": 20, "householdMemberId": "123", "time": 1608002816917, "hhmmOfTime": 1126, "timePeriod": 2, "timePeriodType": 21, "foodId": 11, "foodName": "低筋麵粉", "timeAndTimePeriodType": 1607961600021, "quantity": 1, "calorie": 359, "protein": 8, "dietaryFiber": 2, "carbohydrate": 78, "fat": 1 }, ... ], "pagination": { "current": 1, "pageSize": 10, "total": 2 } } } ``` ### 查詢特定時段的飲食紀錄列表[APP] ```url POST /diet/diary/timeframe ``` #### Request 欄位 | 型態 | 預設 | 說明 --- | --- | --- |--- query | json | | 查詢條件json pagination | json | | 分頁json sorter | json | | 排序json ##### query (查詢條件json) 欄位 | 型態 | 必填 | 長度限制 | 預設 | 說明 ---|---|---|---|---|--- householdMemberId | string | | | | 要搜尋的 householdMemberId,若沒有傳入 householdMemberId,就以改由 token 取得個案資料 startDate | string | | | | 要搜尋的日期區間起日milliseconds,範例:"2020/02/19"-> 1582070400000 endDate | string | | | | 要搜尋的日期區間迄日milliseconds,範例:"2020/02/19" -> 1582070400000 startTime | string | | | | 要搜尋的時間區間,範例:"12:02" endTime | string | | | | 要搜尋的時間區間,範例:"12:02" timePeriod | int | | | -1 | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | | | -1 | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) ##### pagination (分頁json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- current | int | | 1 | 當前頁數 pageSize | int | | 10 | 每頁結果數量,-1 為顯示所有 ##### sorter (排序json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- field | string | | createdAt | 排序欄位,"timeAndTimePeriodType":這個可以先依 time 排出每日的飲食紀錄,再依 timePeriodType 來排序 order | string | | asc | 升序或降序 ```javascript { "query": { "startDate": 1582070400000, "endDate": 1582070400000, "startTime":"11:00", "endTime":"11:50", "timePeriod": "2", "householdMemberId": "123" }, "pagination": { "current": 1, "pageSize":10 }, "sorter": { "field": "timeAndTimePeriodType", "order": "desc" } } ``` #### Response ```javascript { "httpCode": 200, "result": { "data": [ { "id": 20, "householdMemberId": "123", "time": 1608002816917, "hhmmOfTime": 1126, "timePeriod": 2, "timePeriodType": 21, "foodId": 11, "foodName": "低筋麵粉", "timeAndTimePeriodType": 1607961600021, "quantity": 1, "calorie": 359, "protein": 8, "dietaryFiber": 2, "carbohydrate": 78, "fat": 1 }, ... ], "pagination": { "current": 1, "pageSize": 10, "total": 2 } } } ``` ### 刪除飲食紀錄[APP] ```url DELETE /diet/diary/$id ``` #### Response ```javascript { "httpCode": 200, "result": { "data": { "count": 1 } } } ``` ### 上傳食物圖片[APP] ```url POST /diet/diary/image/upload ``` * 如果沒有給householdMemberId,會用token來取 #### Request ```javascript { "time": 1608002816917, "timePeriod": 3, "timePeriodType": 30, "image": "......" } ``` #### Response ```javascript { "httpCode": 200, "result": { "data": { "time": 1608002816917, "timePeriod": 3, "timePeriodType": 30, "householdMemberId": "de4e7194-29c9-488a-855c-d054f26ed3e1", "image": "diet/diary/746f2de8-2180-4495-9427-ccc9f2a34e2f.png" } } } ``` ### 依照時段查詢食物圖片[APP] ```url POST /diet/diary/image/list ``` * 如果沒有給householdMemberId,會用token來取 #### Request 欄位 | 型態 | Required | 說明 --- | --- | --- | --- date | string | Y | 紀錄日期(yyyy-MM-dd) timePeriod | int | Y | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | Y | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) ```javascript { "date": "2022-09-30", "timePeriod": 3, "timePeriodType": 30 } ``` #### Response 欄位 | 型態 | 說明 --- | --- |--- id | String | ImageId image | String | Image Url ```javascript { "httpCode": 200, "result": { "data": [ { "id": "145d277e-e359-42a1-aca2-a66ee9e1d668", "image": "http://192.168.101.120/swift/v1/AUTH_test/kmuh/diet/diary/f8b061fd-729c-467f-a430-57ae449fe214.png?temp_url_sig=9fc341130ddb0f8a783b444b3a0993d84e6b7ffa&temp_url_expires=1613963517" } ] } } ``` ### 依照日期查詢食物圖片[APP] ```url POST /diet/diary/image/listAll ``` * 如果沒有給householdMemberId,會用token來取 #### Request 欄位 | 型態 | Required | 說明 --- | --- | --- |--- date | string | Y | 紀錄日期(yyyy-MM-dd) ```javascript { "date":"2020-12-15" } ``` 欄位 | 型態 | 說明 --- | --- | --- id | string | ImageId image | string | Image Url time | timestamp | 飲食紀錄時間 timePeriod | int | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) #### Response ```javascript { "httpCode": 200, "result": { "data": [ { "id": "3b6e6ac6-aa52-4e84-b103-4e240cd3b3cd", "time": 1608002816917, "image": "http://192.168.101.120/swift/v1/AUTH_test/kmuh/diet/diary/746f2de8-2180-4495-9427-ccc9f2a34e2f.png?temp_url_sig=6e23d242cb472792f5f1c4689dfd45f2763bd155&temp_url_expires=1614076023", "timePeriod": 3, "timePeriodType": 30 } ] } } ``` ### 刪除食物圖片[APP] ```url POST /diet/diary/image/delete ``` * 如果沒有給householdMemberId,會用token來取 #### Request 欄位 | 型態 | Required | 說明 --- | --- | --- |--- id | String | Y| ImageId ```javascript { "id": "145d277e-e359-42a1-aca2-a66ee9e1d668" } ``` #### Response ```javascript { "httpCode": 200, "result": { "data": true } } ``` ### 查詢飲食紀錄圖片列表[WEB] ```url POST /diet/diary/image/list-web ``` #### Request 欄位 | 型態 | Required | 預設 | 說明 ---- | --- | --- | --- | --- startAt | timestamp | Y | 無 | 要搜尋的日期區間 endAt | timestamp | Y | 無 | 要搜尋的日期區間 householdMemberId | string | Y | 無 | 要搜尋的 householdMemberId timePeriod | int | N | -1 | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | N | -1 | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) ```javascript { "startAt": 1609459200000, "endAt": 1617148800000, "householdMemberId": "14cd03fb-719a-425a-a913-9955d1c69101", "timePeriod": -1, "timePeriodType": -1 } ``` #### Response 欄位 | 型態 | 說明 --- | --- |--- date | string | 日期 imageList | json array | image json array ##### Response-imageList 欄位 | 型態 | 說明 --- | --- |--- id | string | image id image | string | image url time | timestamp | 記錄時間 timePeriod | int | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) ```javascript { "httpCode": 200, "result": { "data": [ { "date": "2021-03-09", "imageList": [ { "id": "6eff39d7-8287-4ce0-abd0-7940338a6e17", "image": "http://content-service/swift/v1/diet/diary/8985df36-c3a7-464b-9f53-c453a953be15.png", "time": 1615249186619, "timePeriod": 1, "timePeriodType": 10 }, ... ] }, ... ] } } ``` ### 查詢食品列表[APP/WEB] ```url GET /diet/food ``` #### Request #### Response ```javascript { "httpCode": 200, "result": { "data": [ { Food }, ... ] } } ``` ### 取得飲食記錄選項列表[APP/WEB] ```url GET /diet/diary/options ``` #### Request #### Response 欄位 | 型態 | 說明 --- | --- |--- timePeriods | json array | 用餐時段json array ##### Response-timePeriods 欄位 | 型態 | 說明 --- | --- |--- code | string | 用餐時段code value | int | 用餐時段value, 飲食記錄相關API 的timePeriod 欄位的值 description | string | 用餐時段說明 timePeriodTypes | json array | 用餐餐別json array ##### Response-timePeriodTypes 欄位 | 型態 | 說明 --- | --- |--- code | string | 用餐餐別code value | int | 用餐餐別value, 飲食記錄相關API 的timePeriodType 欄位的值 description | string | 用餐餐別說明 ```javascript { "httpCode": 200, "result": { "data": { "timePeriods": [ { "code": "ALL", "description": "全部", "value": -1, "timePeriodTypes": [ { "code": "ALL", "description": "全部", "value": -1 } ] }, { "code": "MORNING", "description": "早上", "value": 1, "timePeriodTypes": [ { "code": "BREAKFAST", "description": "早餐", "value": 10 }, ... ] }, ... ] } } } ``` ### 查詢飲食紀錄列表-新版[APP/WEB] ```url POST /diet/diary/list (WEB/APP 共用) ``` * 返回結果包含調整後記錄 * 調整後記錄(adjustInfo)的 adjustFoodCategoryId, adjustFoodCategory, adjustFoodCategoryType, adjustFoodDescription, adjustFoodSimpleUnit, adjustFoodSimpleUnitTransferCoefficient欄位, 只有在調整成不同食品類型(如中脂改為高脂)時, 才會有值, 如沒有adjustFoodSimpleUnit欄位時, 請使用該筆飲食記錄所帶的簡易單位 #### Request 欄位 | 型態 | 預設 | 說明 --- | --- | --- |--- query | json | | 查詢條件json pagination | json | | 分頁json sorter | json | | 排序json ##### query (查詢條件json) 欄位 | 型態 | 必填 | 長度限制 | 預設 | 說明 ---|---|---|---|---|--- householdMemberId | string | | | | 要搜尋的 householdMemberId,若沒有傳入 householdMemberId,就以改由 token 取得個案資料 startedAt | timestamp | | | | 要搜尋的日期區間 endAt | timestamp | | | | 要搜尋的日期區間 timePeriod | int | | | -1 | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | | | -1 | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) ##### pagination (分頁json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- current | int | | 1 | 當前頁數 pageSize | int | | 10 | 每頁結果數量,-1 為顯示所有 ##### sorter (排序json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- field | string | | createdAt | 排序欄位,"timeAndTimePeriodType":這個可以先依 time 排出每日的飲食紀錄,再依 timePeriodType 來排序 order | string | | asc | 升序或降序 ```javascript { "query": { "startedAt": 1666627200000, "endAt": 1667145599000, "householdMemberId": null, "timePeriod": -1, "timePeriodType": -1 }, "pagination": { "current": 1, "pageSize":10 }, "sorter": { "field": "createdAt", "order": "desc" } } ``` #### Response-查詢飲食紀錄列表-新版 欄位 | 型態 | 說明 --- | --- | --- diaryList | json array | 飲食記錄json array diaryExtList | json array | 飲食記錄附屬資訊 json array ##### Response-diaryList 欄位 | 型態 | 說明 --- | --- | --- id | long | N | 飲食紀錄id householdMemberId | string | householdMemberId time | timestamp | 飲食紀錄時間 hhmmOfTime | int | time 的 hhmm 格式,比如早上 10:30, 這個值就是 1030,作為搜尋的條件之用 timePeriod | int | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) foodId | int | 飲食紀錄的的食品編號 (-1則為自訂飲食名稱, 或是記錄方式為使用我的餐盤計劃) foodName | string | 如果foodId = -1,且記錄方式為食品資料庫時則為必填 timeAndTimePeriodType | timestamp | 作為排序之用,先依 time 排出每日的飲食紀錄,再依 timePeriodType 來排序 quantity | double | 飲食紀錄的的食品數量 calorie | double | 建議熱量 (需乘上 quantity,四捨五入到小數點第一位) protein | double | 建議蛋白質 (需乘上 quantity,四捨五入到小數點第一位) dietaryFiber | double | 建議膳食纖維 (需乘上 quantity,四捨五入到小數點第一位) carbohydrate | double | 建議碳水化合物 (需乘上 quantity,四捨五入到小數點第一位) fat | double | 脂肪 foodCategoryId | string | 食材營養素id, 飲食記錄方式使用我的餐盤計劃時為必填 plateId | string | 目前使用的我的餐盤id cookedType | string | 飲食記錄方式使用我的餐盤計劃時, 食材的烹調方式, 參閱 [烹調方式](#烹調方式) addedSugar | string | 飲食記錄方式使用我的餐盤計劃時, 食材是否額外加糖, 參閱 [額外加糖](#額外加糖) foodCategory | string | 飲食記錄方式使用我的餐盤計劃時, 食物分類, 參閱[食物分類](#食物分類) foodCategoryType | string | 飲食記錄方式使用我的餐盤計劃時, 食物類型, 請參閱[各食物類型](#食物類型-LEGUME_FISH_MEAT_EGG) foodDescription | string | 飲食記錄方式使用我的餐盤計劃時, 食材描述 simpleUnit | string | 飲食記錄方式使用我的餐盤計劃時, 簡易份量單位 simpleUnitTransferCoefficient | double | 飲食記錄方式使用我的餐盤計劃時, 簡易單位轉換成一般份量的轉換係數<BR>上方的重量和熱量都是基於一般分量. 要用簡易熱量轉換時要乘上轉換係數<BR>e.g.: 每份熱量: 50, 轉換係數: 2, 0.5份簡易份量熱量等於: 0.5 x 2 x 50 diaryRecordType | string | 飲食記錄方式, 請參閱[飲食記錄方式](#飲食記錄方式) suggestInfo | json | 我的餐盤食品建議json adjustInfo | json | 調整記錄json ###### Response-diaryList-adjustInfo 欄位 | 型態 | 說明 --- | --- | --- id | string | 飲食調整記錄id adjustQuantity | double | 調整後數量 adjustCalorie | double | 調整後的熱量 adjustProtein | double | 調整後的蛋白質(g) adjustCarbohydrate | double | 調整後的碳水化合物(g) adjustFat | double | 調整後的脂肪(g) adjustDietaryFiber | double | 調整後的膳食纖維(g) adjustCookedType | string | 調整後的烹調方式, 請參照[烹調方式](#烹調方式) adjustAddedSugar | string | 調整後的額外加糖, 請參照[額外加糖](#額外加糖) adjustFoodCategoryId | string | 調整後的食物id adjustFoodCategory | string | 調整後的食物分類 adjustFoodCategoryType | string | 調整後的食物類型, 請參照[各食物類型](#食物類型-LEGUME_FISH_MEAT_EGG) adjustFoodDescription | string | 調整後的食材描述 adjustFoodSimpleUnit | string | 調整後的簡易份量單位 adjustFoodSimpleUnitTransferCoefficient | string | 調整後的簡易單位轉換成一般份量的轉換係數<BR>上方的重量和熱量都是基於一般分量. 要用簡易熱量轉換時要乘上轉換係數<BR>e.g.: 每份熱量: 50, 轉換係數: 2, 0.5份簡易份量熱量等於: 0.5 x 2 x 50 creator | string | 建立記錄人員的account id ##### Response-diaryExtList 欄位 | 型態 | 說明 --- | --- | --- id | long | N | 飲食紀錄id householdMemberId | string | householdMemberId time | timestamp | 飲食紀錄時間 timePeriodType | int | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) timeAndTimePeriodType | timestamp | 作為排序之用,先依 time 排出每日的飲食紀錄,再依 timePeriodType 來排序 remark | string | 飲食記錄備註, 一個餐別只會有一個備註 ```javascript { "httpCode": 200, "result": { "data": { "diaryList": [ { "id": 945, "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "time": 1666678268435, "hhmmOfTime": 1411, "timePeriod": 2, "timePeriodType": 20, "foodId": -1, "foodName": "豆魚肉蛋(高脂)(油炸)", "timeAndTimePeriodType": 1666627200020, "quantity": 6, "calorie": 776, "protein": 42, "dietaryFiber": 0, "carbohydrate": 0, "fat": 67.5, "foodCategoryId": "eb568c78-be07-4ad6-8b86-e1b18fcef509", "plateId": "", "cookedType": "FRIED", "foodCategory": "LEGUME_FISH_MEAT_EGG", "foodCategoryType": "HIGH_FAT", "foodDescription": "豆魚肉蛋(高脂)", "simpleUnit": "掌心", "simpleUnitTransferCoefficient": 2, "adjustInfo": { "id": "af547029-7ee1-4aaf-b481-5a2e155cfddf", "adjustQuantity": 4, "adjustCalorie": 472, "adjustProtein": 28, "adjustDietaryFiber": 0, "adjustCarbohydrate": 0, "adjustFat": 40, "creator": "6ec4bd89-633a-4f67-be6e-01172f92223e" }, "diaryRecordType": "DIET_PLAN" }, ... ], "diaryExtList": [ { "id": "4589a77f-f9ca-4a8a-8cc6-ee113004a0c4", "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "time": 1666627200000, "timePeriodType": 11, "timeAndTimePeriodType": 1666627200011, "remark": "拼盤就是爽" }, ... ] }, "pagination": { "current": 1, "pageSize": 10, "total": 3 }, "sorter": { "field": "createdAt", "order": "desc" }, "total": 3 } } ``` ### 查詢特定時段的飲食紀錄列表-新版[APP] ```url POST /diet/diary/list-timeframe ``` * 返回結果包含調整後記錄 * 調整後記錄(adjustInfo)的 adjustFoodCategoryId, adjustFoodCategory, adjustFoodCategoryType, adjustFoodDescription, adjustFoodSimpleUnit, adjustFoodSimpleUnitTransferCoefficient欄位, 只有在調整成不同食品類型(如中脂改為高脂)時, 才會有值, 如沒有adjustFoodSimpleUnit欄位時, 請使用該筆飲食記錄所帶的簡易單位 #### Request 欄位 | 型態 | 預設 | 說明 --- | --- | --- |--- query | json | | 查詢條件json pagination | json | | 分頁json sorter | json | | 排序json ##### query (查詢條件json) 欄位 | 型態 | 必填 | 長度限制 | 預設 | 說明 ---|---|---|---|---|--- householdMemberId | string | | | | 要搜尋的 householdMemberId,若沒有傳入 householdMemberId,就以改由 token 取得個案資料 startDate | string | | | | 要搜尋的日期區間起日milliseconds,範例:"2020/02/19"-> 1582070400000 endDate | string | | | | 要搜尋的日期區間迄日milliseconds,範例:"2020/02/19" -> 1582070400000 startTime | string | | | | 要搜尋的時間區間,範例:"12:02" endTime | string | | | | 要搜尋的時間區間,範例:"12:02" timePeriod | int | | | -1 | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | | | -1 | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) ##### pagination (分頁json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- current | int | | 1 | 當前頁數 pageSize | int | | 10 | 每頁結果數量,-1 為顯示所有 ##### sorter (排序json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- field | string | | createdAt | 排序欄位,"timeAndTimePeriodType":這個可以先依 time 排出每日的飲食紀錄,再依 timePeriodType 來排序 order | string | | asc | 升序或降序 ```javascript { "query": { "startDate": 1666627200000, "endDate": 1667145599000, "startTime": "00:00", "endTime": "23:59", "householdMemberId": null, "timePeriod": null, "timePeriodType": null }, "pagination": { "current": 1, "pageSize":10 }, "sorter": { "field": "createdAt", "order": "desc" } } ``` #### Response 請參閱[查詢飲食紀錄列表-新版](#response-查詢飲食紀錄列表-新版) ```javascript { "httpCode": 200, "result": { "data": { "diaryList": [ { "id": 945, "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "time": 1666678268435, "hhmmOfTime": 1411, "timePeriod": 2, "timePeriodType": 20, "foodId": -1, "foodName": "豆魚肉蛋(高脂)(油炸)", "timeAndTimePeriodType": 1666627200020, "quantity": 6, "calorie": 776, "protein": 42, "dietaryFiber": 0, "carbohydrate": 0, "fat": 67.5, "foodCategoryId": "eb568c78-be07-4ad6-8b86-e1b18fcef509", "plateId": "", "cookedType": "FRIED", "foodCategory": "LEGUME_FISH_MEAT_EGG", "foodCategoryType": "HIGH_FAT", "foodDescription": "豆魚肉蛋(高脂)", "simpleUnit": "掌心", "simpleUnitTransferCoefficient": 2, "adjustInfo": { "id": "af547029-7ee1-4aaf-b481-5a2e155cfddf", "adjustQuantity": 4, "adjustCalorie": 472, "adjustProtein": 28, "adjustDietaryFiber": 0, "adjustCarbohydrate": 0, "adjustFat": 40, "creator": "6ec4bd89-633a-4f67-be6e-01172f92223e" }, "diaryRecordType": "DIET_PLAN" }, ... ], "diaryExtList": [ { "id": "4589a77f-f9ca-4a8a-8cc6-ee113004a0c4", "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "time": 1666627200000, "timePeriodType": 11, "timeAndTimePeriodType": 1666627200011, "remark": "拼盤就是爽" }, ... ] }, "pagination": { "current": 1, "pageSize": 10, "total": 3 }, "sorter": { "field": "createdAt", "order": "desc" }, "total": 3 } } ``` ### 查詢飲食紀錄附屬資訊列表[APP/WEB] ```url POST /diet/diary-ext/list (WEB/APP 共用) ``` #### Request 欄位 | 型態 | 預設 | 說明 --- | --- | --- |--- query | json | | 查詢條件json ##### query (查詢條件json) 欄位 | 型態 | 必填 | 長度限制 | 預設 | 說明 ---|---|---|---|---|--- householdMemberId | string | | | | 要搜尋的 householdMemberId,若沒有傳入 householdMemberId,就以改由 token 取得個案資料 startedAt | timestamp | | | | 要搜尋的日期區間 endAt | timestamp | | | | 要搜尋的日期區間 timePeriodType | int | | | -1 | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) ```javascript { "query": { "startedAt": 1666627200000, "endAt": 1667145599000, "householdMemberId": null, "timePeriodType": -1 } } ``` #### Response 欄位 | 型態 | 說明 --- | --- | --- id | long | N | 飲食紀錄id householdMemberId | string | householdMemberId time | timestamp | 飲食紀錄時間 timePeriodType | int | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) timeAndTimePeriodType | timestamp | 作為排序之用,先依 time 排出每日的飲食紀錄,再依 timePeriodType 來排序 remark | string | 飲食記錄備註, 一個餐別只會有一個備註 ```javascript { "httpCode": 200, "result": { "data": [ { "id": "4589a77f-f9ca-4a8a-8cc6-ee113004a0c4", "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "time": 1666627200000, "timePeriodType": 11, "timeAndTimePeriodType": 1666627200011, "remark": "拼盤就是爽" }, ... ] } } ``` ### APP端-修改飲食記錄方式[APP] ```url POST /diet/diary/update-record-type ``` #### Request 欄位 | 型態 | Required | 長度限制 | 預設 | 說明 ---- | --- | --- | --- | --- | --- diaryRecordType | string | Y | | | 飲食記錄方式, 請參閱[飲食記錄方式](#飲食記錄方式) ```javascript { "diaryRecordType": "DIET_PLAN" } ``` #### Error httpCode | 錯誤碼 | 說明 --- | --- | --- #### Response 欄位 | 型態 | 說明 --- | --- | --- diaryRecordType | string | 變更後的飲食記錄方式, 請參閱[飲食記錄方式](#飲食記錄方式) ```javascript { "httpCode": 200, "result": { "data": { "diaryRecordType": "DIET_PLAN" } } } ``` ### APP端-其他食品-我的常用清單[APP] ```url POST /diet/diary/my-diet-food-list ``` #### Request #### Error httpCode | 錯誤碼 | 說明 --- | --- | --- #### Response 欄位 | 型態 | 說明 --- | --- | --- id | string | 常用食品項目id householdMemberId | string | householdMemberId foodName | string | 食品項目名稱 calorie | double | 熱量(Kcal)(1份), 由 protein, carbohydrate, fat去計算出來的 protein | double | 蛋白質(g)(1份) carbohydrate | double | 碳水化合物(g)(1份) fat | double | 脂肪(g)(1份) createTime | timestamp | 建立時間 updateTime | timestamp | 更新時間 ```javascript { "httpCode": 200, "result": { "data": [ { "id": "5ee8362e-b155-4933-933f-8cc4e668ca75", "householdMemberId": "150b53f5-7126-4900-9fb0-87a08b45e06b", "foodName": "MiLo XLarge", "calorie": 300.0, "protein": 30.0, "dietaryFiber": 0.0, "carbohydrate": 60.0, "fat": 150.0, "createTime": 1695196012628, "updateTime": 1695196012628 }, ... ] } } ``` ### WEB/APP端-取得飲食記錄Summary[WEB/APP] ```url POST /diet/diary/summary ``` * 包含飲食分數, 飲食記錄攝取熱量, 調整後攝取熱量, 三大營養素熱量比率 * 飲食分數是以整天為計算基礎 * 飲食記錄攝取熱量, 調整後攝取熱量, 三大營養素熱量比率 數值會依timePeriod, timePeriodType有所不同 #### Request 欄位 | 型態 | 預設 | 說明 --- | --- | --- |--- query | json | | 查詢條件json ##### query (查詢條件json) 欄位 | 型態 | 必填 | 長度限制 | 預設 | 說明 ---|---|---|---|---|--- householdMemberId | string | WEB:**Y** | | | Web端必填, APP端由token取得 timePeriod | int | | | -1 | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | | | -1 | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) dietDate | string | | | | 要搜尋的日期, YYYY-MM-DD, 或毫秒值 scorePeriod | string | | | | 飲食分數查詢區間類別, 請參閱[飲食分數查詢區間類別](#飲食分數查詢區間類別) ```javascript { "query": { "householdMemberId": null, "timePeriod": -1, "timePeriodType": -1, "dietDate": "2022-10-25", "scorePeriod": "DAILY" } } ``` #### Response 欄位 | 型態 | 說明 --- | --- | --- dietDate | date | 查詢的日期 dietPlateInfo | json | 建議餐盤 json scoreSummaryInfo | json | 飲食分數 json nutrientSummaryInfo | json | 飲食記錄summary json nutrientSummaryDailyList | json array | 飲食記錄summary daily list ##### Response-dietPlateInfo(json) 請參閱[Response-取得我的建議餐盤](#Response-取得我的建議餐盤) ##### Response-scoreSummaryInfo(json) 欄位 | 型態 | 說明 --- | --- | --- scoreInfo | json | 飲食分數json, scorePeriod=DAILY時, 表示當日分數, scorePeriod=WEEKLY/MONTHLY時, 表示平均分數 scoreDailyList | json array | scoreInfo daily list ###### Response-scoreInfo(json) 欄位 | 型態 | 說明 --- | --- | --- score | double | 飲食分數 suggestDescription | string | 飲食分數建議說明 mealDate | date | 飲食分數日期 ingredients | json array | 飲食分數各食品類別達成率 json array ###### Response-ingredient(json) 欄位 | 型態 | 說明 --- | --- | --- foodCategory | string | 食物分類, 請參閱[食物分類](#食物分類) completionRate | double | 達成率(%) ##### Response-nutrientSummaryInfo(json) 欄位 | 型態 | 說明 --- | --- | --- dietDate | date | 飲食記錄日期 totalCalorie | double | 攝取總熱量 protein | double | 攝取蛋白質(g) carbohydrate | double | 攝取碳水化合物(g) fat | double | 攝取脂肪(g) proteinCal | double | 攝取蛋白質熱量 carbohydrateCal | double | 攝取碳水化合物熱量 fatCal | double | 攝取脂肪熱量 proteinRate | double | 攝取蛋白質比率(%) carbohydrateRate | double | 攝取碳水化合物比率(%) fatRate | double | 攝取脂肪比率(%) isAdjust | boolean | 飲食記錄是否有調整過, true表示有調整過, 可使用調整後的相關欄位數值 adjustTotalCalorie | double | 調整後攝取總熱量 adjustProtein | double | 調整後攝取蛋白質(g) adjustCarbohydrate | double | 調整後攝取碳水化合物(g) adjustFat | double | 調整後攝取脂肪(g) adjustProteinCal | double | 調整後攝取蛋白質熱量 adjustCarbohydrateCal | double | 調整後攝取碳水化合物熱量 adjustFatCal | double | 調整後攝取脂肪熱量 adjustProteinRate | double | 調整後攝取蛋白質比率(%) adjustCarbohydrateRate | double | 調整後攝取碳水化合物比率(%) adjustFatRate | double | 調整後攝取脂肪比率(%) ##### Response-nutrientSummaryDailyList(json) 請參閱[nutrientSummaryInfo](#Response-nutrientSummaryInfojson) ```javascript { "httpCode": 200, "result": { "data": { "dietDate": 1666627200000, "dietPlateInfo": { "id": "b2f0701d-91ef-456c-9282-2abea10a2a43", "createTime": 1665651861183, "updateTime": 1665713995045, "status": "PUBLISHED", "creatorId": "7a17be34-13ae-4687-b971-1e5f586c8e3a", "creatorName": "Dr. X", "creatorRole": "腳科醫生", "tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc", "tenantName": "緯緯醫學", "totalCalorie": 477, "totalProteinCalorie": 72, "totalSugarCalorie": 180, "totalFatCalorie": 225, "totalProtein": 18, "totalSugar": 45, "totalFat": 25, "timePeriods": [ { "timePeriod": 2, "timePeriodType": 20, "totalCalorie": 236, "totalProteinCalorie": 56, "totalSugarCalorie": 0, "totalFatCalorie": 180, "totalProtein": 14, "totalSugar": 0, "totalFat": 20, "meals": [ { "calorie": 236, "proteinCal": 56, "sugarCal": 0, "fatCal": 180, "protein": 14, "sugar": 0, "fat": 20, "foodCategory": "LEGUME_FISH_MEAT_EGG", "foodType": "HIGH_FAT", "quantity": 2, "simpleUnit": "掌心", "simpleUnitTransferCoefficient": 2 } ], "foodCategorys": [ { "calorie": 236, "proteinCal": 56, "sugarCal": 0, "fatCal": 180, "protein": 14, "sugar": 0, "fat": 20, "foodCategory": "LEGUME_FISH_MEAT_EGG", "quantity": 2, "simpleUnit": "掌心", "simpleUnitTransferCoefficient": 2 } ] }, ... ], "nutritionalDiagnosisInfo": { "categoryId": "f9223c4b-4d0e-4246-b47f-8e66e856413d", "categoryDescription": "體位", "problemId": "ce2ec4c5-19ea-4317-a7ea-134ad3311207", "problemDescription": "體重過輕", "etiologyId": "39f991d5-98fe-41f2-8cd5-688c08337364", "etiologyDescription": "熱量需求增加", "signs": "tes draft publish" } }, "scoreSummaryInfo": { "scoreInfo": { "score": 0, "mealDate": 1666683673892, "suggestDescription": "慘了!慘了!您的均衡飲食分數非常糟糕,建議下定決心每天都要均衡的攝取六大類食物,一起跟著我的餐盤,營養跟著來唷!", "ingredients": [ { "foodCategory": "LEGUME_FISH_MEAT_EGG", "completionRate": 820 }, ... ] } }, "nutrientSummaryInfo": { "dietDate": 1666627200000, "totalCalorie": 2139.2, "protein": 114.8, "carbohydrate": 0, "fat": 186.5, "proteinCal": 459.2, "carbohydrateCal": 0, "fatCal": 1678.5, "proteinRate": 21, "carbohydrateRate": 0, "fatRate": 78, "isAdjust": true, "adjustTotalCalorie": 1835.2, "adjustProtein": 100.8, "adjustCarbohydrate": 0, "adjustFat": 159, "adjustProteinCal": 403.2, "adjustCarbohydrateCal": 0, "adjustFatCal": 1431, "adjustProteinRate": 22, "adjustCarbohydrateRate": 0, "adjustFatRate": 78 }, "nutrientSummaryDailyList": [ { "dietDate": 1666627200000, "totalCalorie": 2139.2, "protein": 114.8, "carbohydrate": 0, "fat": 186.5, "proteinCal": 459.2, "carbohydrateCal": 0, "fatCal": 1678.5, "proteinRate": 21, "carbohydrateRate": 0, "fatRate": 78, "isAdjust": true, "adjustTotalCalorie": 1835.2, "adjustProtein": 100.8, "adjustCarbohydrate": 0, "adjustFat": 159, "adjustProteinCal": 403.2, "adjustCarbohydrateCal": 0, "adjustFatCal": 1431, "adjustProteinRate": 22, "adjustCarbohydrateRate": 0, "adjustFatRate": 78 } ] } } } ``` ### WEB端-取得飲食記錄列表[WEB] ```url POST /diet-plan-mgmt/diary/list ``` #### Request 欄位 | 型態 | 預設 | 說明 --- | --- | --- |--- query | json | | 查詢條件json pagination | json | | 分頁json sorter | json | | 排序json ##### query (查詢條件json) 欄位 | 型態 | 必填 | 長度限制 | 預設 | 說明 ---|---|---|---|---|--- householdMemberId | string | Y | | | 要搜尋的 householdMemberId startDate | string | | | | 要搜尋的啟始日期, YYYY-MM-DD endDate | string | | | | 要搜尋的結束日期, YYYY-MM-DD timePeriod | int | | | -1 | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | | | -1 | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) ##### pagination (分頁json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- current | int | | 1 | 當前頁數 pageSize | int | | 10 | 每頁結果數量,-1 為顯示所有 ##### sorter (排序json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- field | string | | time | 排序欄位,可排序欄位有 time, timePeriod, timePeriodType, foodName, diaryRecordType order | string | | desc | 升序或降序 ```javascript { "query": { "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "startDate": "2022-10-01", "endDate": "2022-10-30", "timePeriod": 2, "timePeriodType": null }, "pagination": { "current": 1, "pageSize":10 }, "sorter": { "field": "time", "order": "desc" } } ``` #### Response 欄位 | 型態 | 說明 --- | --- | --- id | string | 飲食記錄id householdMemberId | string | time | long | 飲食記錄日期 timePeriod | int | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) hhmmOfTime | int | time 的 hhmm 格式,比如早上 10:30, 這個值就是 1030,作為搜尋的條件之用 foodId | int | 飲食紀錄的的食品編號 (-1則為自訂飲食名稱, 或是記錄方式為使用我的餐盤計劃) foodName | string | 如果foodId = -1,且記錄方式為食品資料庫時則為必填 timeAndTimePeriodType | timestamp | 作為排序之用,先依 time 排出每日的飲食紀錄,再依 timePeriodType 來排序 quantity | double | 飲食紀錄的的食品數量 calorie | double | 建議熱量 (需乘上 quantity,四捨五入到小數點第一位) protein | double | 建議蛋白質 (需乘上 quantity,四捨五入到小數點第一位) dietaryFiber | double | 建議膳食纖維 (需乘上 quantity,四捨五入到小數點第一位) carbohydrate | double | 建議碳水化合物 (需乘上 quantity,四捨五入到小數點第一位) fat | double | 脂肪 foodCategoryId | string | 食材營養素id, 飲食記錄方式使用我的餐盤計劃時為必填 plateId | string | 目前使用的我的餐盤id cookedType | string | 飲食記錄方式使用我的餐盤計劃時, 食材的烹調方式, 參閱 [烹調方式](#烹調方式) addedSugar | string | 飲食記錄方式使用我的餐盤計劃時, 食材是否額外加糖, 參閱 [額外加糖](#額外加糖) foodCategory | string | 飲食記錄方式使用我的餐盤計劃時, 食物分類, 參閱[食物分類](#食物分類) foodCategoryType | string | 飲食記錄方式使用我的餐盤計劃時, 食物類型, 請參閱[各食物類型](#食物類型-LEGUME_FISH_MEAT_EGG) diaryRecordType | string | 飲食記錄方式, 請參閱[飲食記錄方式](#飲食記錄方式) ```javascript { "httpCode": 200, "result": { "data": [ { "id": 951, "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "time": 1666683673892, "hhmmOfTime": 1541, "timePeriod": 2, "timePeriodType": 21, "foodId": -1, "foodName": "豆魚肉蛋(高脂)(油炸)", "timeAndTimePeriodType": 1666627200021, "quantity": 2.4, "calorie": 351.2, "protein": 16.8, "dietaryFiber": 0.0, "carbohydrate": 0.0, "fat": 31.5, "foodCategoryId": "eb568c78-be07-4ad6-8b86-e1b18fcef509", "plateId": "", "cookedType": "FRIED", "foodCategory": "LEGUME_FISH_MEAT_EGG", "foodCategoryType": "HIGH_FAT", "diaryRecordType": "DIET_PLAN" }, ... ], "pagination": { "current": 1, "pageSize": 10, "total": 7 }, "sorter": { "field": "time", "order": "desc" }, "total": 7 } } ``` ### WEB端-取得飲食記錄詳細列表(含我的餐盤建議及調整記錄)[WEB] ```url POST /diet-plan-mgmt/diary/list-detail ``` * 返回結果以建議餐盤為優先, 若無id, 表示此筆結果為建議餐盤項目, 請直接存取suggestInfo json * 返回結果包含我的餐盤建議以及調整後記錄 * 返回結果可選擇是否要包含飲食記錄Summary(飲食分數, 攝取熱量, 調整後攝取熱量, 三大營養素熱量比率) * 調整後記錄(adjustInfo)的 adjustFoodCategoryId, adjustFoodCategory, adjustFoodCategoryType, adjustFoodDescription, adjustFoodSimpleUnit, adjustFoodSimpleUnitTransferCoefficient欄位, 只有在調整成不同食品類型(如中脂改為高脂)時, 才會有值, 如沒有adjustFoodSimpleUnit欄位時, 請使用該筆飲食記錄所帶的簡易單位 #### Request 欄位 | 型態 | 預設 | 說明 --- | --- | --- |--- query | json | | 查詢條件json pagination | json | | 分頁json sorter | json | | 排序json ##### query (查詢條件json) 欄位 | 型態 | 必填 | 長度限制 | 預設 | 說明 ---|---|---|---|---|--- householdMemberId | string | Y | | | 要搜尋的 householdMemberId startDate | string | | | | 要搜尋的啟始日期, YYYY-MM-DD endDate | string | | | | 要搜尋的結束日期, YYYY-MM-DD timePeriod | int | | | -1 | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | | | -1 | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) includeSummary | boolean | | | false | 是否要包含飲食記錄Summary(飲食分數, 攝取熱量, 調整後攝取熱量, 三大營養素熱量比率) dietDate | string | includeSummary=true | | | 飲食記錄日期, YYYY-MM-DD 或日期的毫秒 scorePeriod | string | includeSummary=true | | | 飲食分數查詢區間類別, 請參閱[飲食分數查詢區間類別](#飲食分數查詢區間類別) ##### pagination (分頁json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- current | int | | 1 | 當前頁數 pageSize | int | | 10 | 每頁結果數量,-1 為顯示所有 ##### sorter (排序json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- field | string | | time | 排序欄位,可排序欄位有 time, timePeriod, timePeriodType, foodName, diaryRecordType order | string | | desc | 升序或降序 ```javascript { "query": { "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "startDate": "2022-10-25", "endDate": "2022-10-25", "timePeriod": -1, "timePeriodType": -1, "includeSummary": true, "dietDate": "2022-10-25", "scorePeriod": "DAILY" }, "pagination": { "current": 1, "pageSize":10 }, "sorter": { "field": "time", "order": "desc" } } ``` #### Response 欄位 | 型態 | 說明 --- | --- | --- dietPlanInfo | json | diaryList | json array | 飲食記錄json array scoreSummaryInfo | json | includeSummary=true時才會返回, 飲食記錄Summary(飲食分數, 攝取熱量, 調整後攝取熱量, 三大營養素熱量比率) json nutrientSummaryInfo | json | includeSummary=true時才會返回, 飲食記錄summary json nutrientSummaryDailyList | json array | includeSummary=true時才會返回, 飲食記錄summary json daily list ##### Response-dietPlanInfo 請參閱[Response-取得我的建議餐盤](#Response-取得我的建議餐盤) ##### Response-diaryList 欄位 | 型態 | 說明 --- | --- | --- id | string | 飲食記錄id householdMemberId | string | time | long | 飲食記錄日期 timePeriod | int | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) hhmmOfTime | int | time 的 hhmm 格式,比如早上 10:30, 這個值就是 1030,作為搜尋的條件之用 foodId | int | 飲食紀錄的的食品編號 (-1則為自訂飲食名稱, 或是記錄方式為使用我的餐盤計劃) foodName | string | 如果foodId = -1,且記錄方式為食品資料庫時則為必填 timeAndTimePeriodType | timestamp | 作為排序之用,先依 time 排出每日的飲食紀錄,再依 timePeriodType 來排序 quantity | double | 飲食紀錄的的食品數量 calorie | double | 建議熱量 (需乘上 quantity,四捨五入到小數點第一位) protein | double | 建議蛋白質 (需乘上 quantity,四捨五入到小數點第一位) dietaryFiber | double | 建議膳食纖維 (需乘上 quantity,四捨五入到小數點第一位) carbohydrate | double | 建議碳水化合物 (需乘上 quantity,四捨五入到小數點第一位) fat | double | 脂肪 foodCategoryId | string | 食材營養素id, 飲食記錄方式使用我的餐盤計劃時為必填 plateId | string | 目前使用的我的餐盤id cookedType | string | 飲食記錄方式使用我的餐盤計劃時, 食材的烹調方式, 參閱 [烹調方式](#烹調方式) addedSugar | string | 飲食記錄方式使用我的餐盤計劃時, 食材是否額外加糖, 參閱 [額外加糖](#額外加糖) foodCategory | string | 飲食記錄方式使用我的餐盤計劃時, 食物分類, 參閱[食物分類](#食物分類) foodCategoryType | string | 飲食記錄方式使用我的餐盤計劃時, 食物類型, 請參閱[各食物類型](#食物類型-LEGUME_FISH_MEAT_EGG) foodDescription | string | 飲食記錄方式使用我的餐盤計劃時, 食材描述 simpleUnit | string | 飲食記錄方式使用我的餐盤計劃時, 簡易份量單位 simpleUnitTransferCoefficient | double | 飲食記錄方式使用我的餐盤計劃時, 簡易單位轉換成一般份量的轉換係數<BR>上方的重量和熱量都是基於一般分量. 要用簡易熱量轉換時要乘上轉換係數<BR>e.g.: 每份熱量: 50, 轉換係數: 2, 0.5份簡易份量熱量等於: 0.5 x 2 x 50 diaryRecordType | string | 飲食記錄方式, 請參閱[飲食記錄方式](#飲食記錄方式) suggestInfo | json | 我的餐盤食品建議json adjustInfo | json | 調整記錄json ##### Response-diaryList-suggestInfo 請參閱[我的建議餐盤-meals](#Response-meals) ##### Response-diaryList-adjustInfo 欄位 | 型態 | 說明 --- | --- | --- id | string | 飲食調整記錄id, 若無id, 表示此筆為建議盤餐的項目 adjustQuantity | double | 調整後數量 adjustCalorie | double | 調整後的熱量 adjustProtein | double | 調整後的蛋白質(g) adjustCarbohydrate | double | 調整後的碳水化合物(g) adjustFat | double | 調整後的脂肪(g) adjustDietaryFiber | double | 調整後的膳食纖維(g) adjustCookedType | string | 調整後的烹調方式, 請參照[烹調方式](#烹調方式) adjustAddedSugar | string | 調整後的額外加糖, 請參照[額外加糖](#額外加糖) adjustFoodCategoryId | string | 調整後的食物id adjustFoodCategory | string | 調整後的食物分類 adjustFoodCategoryType | string | 調整後的食物類型, 請參照[各食物類型](#食物類型-LEGUME_FISH_MEAT_EGG) adjustFoodDescription | string | 調整後的食材描述 adjustFoodSimpleUnit | string | 調整後的簡易份量單位 adjustFoodSimpleUnitTransferCoefficient | string | 調整後的簡易單位轉換成一般份量的轉換係數<BR>上方的重量和熱量都是基於一般分量. 要用簡易熱量轉換時要乘上轉換係數<BR>e.g.: 每份熱量: 50, 轉換係數: 2, 0.5份簡易份量熱量等於: 0.5 x 2 x 50 creator | string | 建立記錄人員的account id ##### Response-scoreSummaryInfo(json) 請參閱[飲食記錄Summary-Response-飲食分數](#Response-scoreSummaryInfojson) ##### Response-nutrientSummaryInfo(json) 請參閱[飲食記錄Summary-Response-飲食記錄summary](#Response-nutrientSummaryInfojson) ##### Response-nutrientSummaryDailyList(json array) 請參閱[飲食記錄Summary-Response-飲食記錄summary daily list](#Response-nutrientSummaryDailyListjson) ```javascript { "httpCode": 200, "result": { "data": { "dietPlanInfo": { "id": "b2f0701d-91ef-456c-9282-2abea10a2a43", "createTime": 1665651861183, "updateTime": 1665713995045, "status": "PUBLISHED", "creatorId": "7a17be34-13ae-4687-b971-1e5f586c8e3a", "creatorName": "Dr. X", "creatorRole": "腳科醫生", "tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc", "tenantName": "緯緯醫學", "totalCalorie": 477, "totalProteinCalorie": 72, "totalSugarCalorie": 180, "totalFatCalorie": 225, "totalProtein": 18, "totalSugar": 45, "totalFat": 25, "timePeriods": [ { "timePeriod": 2, "timePeriodType": 20, "totalCalorie": 236, "totalProteinCalorie": 56, "totalSugarCalorie": 0, "totalFatCalorie": 180, "totalProtein": 14, "totalSugar": 0, "totalFat": 20, "meals": [ { "calorie": 236, "proteinCal": 56, "sugarCal": 0, "fatCal": 180, "protein": 14, "sugar": 0, "fat": 20, "foodCategory": "LEGUME_FISH_MEAT_EGG", "foodType": "HIGH_FAT", "quantity": 2, "simpleUnit": "掌心", "simpleUnitTransferCoefficient": 2 } ], "foodCategorys": [ { "calorie": 236, "proteinCal": 56, "sugarCal": 0, "fatCal": 180, "protein": 14, "sugar": 0, "fat": 20, "foodCategory": "LEGUME_FISH_MEAT_EGG", "quantity": 2, "simpleUnit": "掌心", "simpleUnitTransferCoefficient": 2 } ] }, ... ], "nutritionalDiagnosisInfo": { "categoryId": "f9223c4b-4d0e-4246-b47f-8e66e856413d", "categoryDescription": "體位", "problemId": "ce2ec4c5-19ea-4317-a7ea-134ad3311207", "problemDescription": "體重過輕", "etiologyId": "39f991d5-98fe-41f2-8cd5-688c08337364", "etiologyDescription": "熱量需求增加", "signs": "tes draft publish" } }, "diaryList": [ { "id": 945, "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "time": 1666678268435, "hhmmOfTime": 1411, "timePeriod": 2, "timePeriodType": 20, "foodId": -1, "foodName": "豆魚肉蛋(高脂)(油炸)", "timeAndTimePeriodType": 1666627200020, "quantity": 6, "calorie": 776, "protein": 42, "dietaryFiber": 0, "carbohydrate": 0, "fat": 67.5, "foodCategoryId": "eb568c78-be07-4ad6-8b86-e1b18fcef509", "plateId": "", "cookedType": "FRIED", "foodCategory": "LEGUME_FISH_MEAT_EGG", "foodCategoryType": "HIGH_FAT", "foodDescription": "豆魚肉蛋(高脂)", "simpleUnit": "掌心", "simpleUnitTransferCoefficient": 2, "suggestInfo": { "calorie": 236, "proteinCal": 56, "sugarCal": 0, "fatCal": 180, "protein": 14, "sugar": 0, "fat": 20, "foodCategory": "LEGUME_FISH_MEAT_EGG", "foodType": "HIGH_FAT", "quantity": 2, "simpleUnit": "掌心", "simpleUnitTransferCoefficient": 2 }, "adjustInfo": { "id": "af547029-7ee1-4aaf-b481-5a2e155cfddf", "adjustQuantity": 4, "adjustCalorie": 472, "adjustProtein": 28, "adjustDietaryFiber": 0, "adjustCarbohydrate": 0, "adjustFat": 40, "creator": "6ec4bd89-633a-4f67-be6e-01172f92223e" }, "diaryRecordType": "DIET_PLAN" }, ... ], "scoreSummaryInfo": { "scoreInfo": { "score": 0, "mealDate": 1666683673892, "ingredients": [ { "foodCategory": "FRUITS", "completionRate": 0 }, ... ] } }, "nutrientSummaryInfo": { "dietDate": 1666627200000, "totalCalorie": 2139.2, "protein": 114.8, "carbohydrate": 0, "fat": 186.5, "proteinCal": 459.2, "carbohydrateCal": 0, "fatCal": 1678.5, "proteinRate": 21, "carbohydrateRate": 0, "fatRate": 78, "isAdjust": true, "adjustTotalCalorie": 1835.2, "adjustProtein": 100.8, "adjustCarbohydrate": 0, "adjustFat": 159, "adjustProteinCal": 403.2, "adjustCarbohydrateCal": 0, "adjustFatCal": 1431, "adjustProteinRate": 22, "adjustCarbohydrateRate": 0, "adjustFatRate": 78 }, "nutrientSummaryDailyList": [ { "dietDate": 1666627200000, "totalCalorie": 2139.2, "protein": 114.8, "carbohydrate": 0, "fat": 186.5, "proteinCal": 459.2, "carbohydrateCal": 0, "fatCal": 1678.5, "proteinRate": 21, "carbohydrateRate": 0, "fatRate": 78, "isAdjust": true, "adjustTotalCalorie": 1835.2, "adjustProtein": 100.8, "adjustCarbohydrate": 0, "adjustFat": 159, "adjustProteinCal": 403.2, "adjustCarbohydrateCal": 0, "adjustFatCal": 1431, "adjustProteinRate": 22, "adjustCarbohydrateRate": 0, "adjustFatRate": 78 } ] }, "pagination": { "current": 1, "pageSize": 10, "total": 3 }, "sorter": { "field": "time", "order": "desc" }, "total": 3 } } ``` ### WEB端-新增飲食記錄[WEB] ```url POST /diet-plan-mgmt/diary/add ``` #### Request 欄位 | 型態 | Required | 預設 | 說明 ---- | --- | --- | --- | --- householdMemberId | string | Y | | householdMemberId time | timestamp | Y | | 飲食紀錄時間 timePeriod | int | Y | | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | Y | | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) foodId | int | Y | | 飲食紀錄的的食品編號 (-1則為自訂飲食名稱, 或是記錄方式為使用我的餐盤計劃) foodName | string | - | | 如果foodId = -1,且記錄方式為食品資料庫時則為必填 quantity | double | Y | | 飲食紀錄的的食品數量 foodCategoryId | string | Y | | 食材營養素id, 飲食記錄方式使用我的餐盤計劃時為必填 plateId | string | N | | 目前使用的我的餐盤id cookedType | string | Y | | 飲食記錄方式使用我的餐盤計劃時, 食材的烹調方式, 參閱 [烹調方式](#烹調方式) addedSugar | string | Y | | 飲食記錄方式使用我的餐盤計劃時, 食材是否額外加糖, 參閱 [額外加糖](#額外加糖) ```javascript { "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "time": 1664955020000, "timePeriod": 2, "timePeriodType": 21, "foodId": -1, "quantity": 1, "foodCategoryId": "3bab6bb8-b286-4ccd-9de3-bc282acdb090", "plateId": "678901f0-8834-4a31-b381-5f5faab62825", "cookedType": "FRY" } ``` #### Error httpCode | 錯誤碼 | 說明 --- | --- | --- #### Response 欄位 | 型態 | 說明 --- | --- | --- id | long | 飲食紀錄id householdMemberId | string | householdMemberId time | timestamp | 飲食紀錄時間 hhmmOfTime | int | time 的 hhmm 格式,比如早上 10:30, 這個值就是 1030,作為搜尋的條件之用 timePeriod | int | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) foodId | int | 飲食紀錄的的食品編號 (-1則為自訂飲食名稱, 或是記錄方式為使用我的餐盤計劃) foodName | string | 食品名稱 timeAndTimePeriodType | timestamp | 作為排序之用,先依 time 排出每日的飲食紀錄,再依 timePeriodType 來排序 quantity | double | 食品數量 calorie | double | 熱量 (需乘上 quantity,四捨五入到小數點第一位) protein | double | 蛋白質 (需乘上 quantity,四捨五入到小數點第一位) dietaryFiber | double | 膳食纖維 (需乘上 quantity,四捨五入到小數點第一位) carbohydrate | double | 碳水化合物 (需乘上 quantity,四捨五入到小數點第一位) fat | double | 脂肪 (需乘上 quantity,四捨五入到小數點第一位) foodCategoryId | string | 食材營養素id, 飲食記錄方式使用我的餐盤計劃時為必填 plateId | string | 目前使用的我的餐盤id cookedType | string | 飲食記錄方式使用我的餐盤計劃時, 食材的烹調方式, 參閱 [烹調方式](#烹調方式) addedSugar | string | 飲食記錄方式使用我的餐盤計劃時, 食材是否額外加糖, 參閱 [額外加糖](#額外加糖) foodCategory | string | 飲食記錄方式使用我的餐盤計劃時, 食物分類, 參閱[食物分類](#食物分類) foodCategoryType | string | 飲食記錄方式使用我的餐盤計劃時, 食物類型, 請參閱[各食物類型](#食物類型-LEGUME_FISH_MEAT_EGG) ```javascript { "httpCode": 200, "result": { "data": { "id": 917, "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "time": 1664955020000, "hhmmOfTime": 1530, "timePeriod": 2, "timePeriodType": 21, "foodId": -1, "foodName": "全榖雜糧(非油炸)", "timeAndTimePeriodType": 1664899200021, "quantity": 1, "calorie": 113, "protein": 2, "dietaryFiber": 0, "carbohydrate": 15, "fat": 5, "createdAt": 1666170077905, "creator": "6ec4bd89-633a-4f67-be6e-01172f92223e", "foodCategoryId": "3bab6bb8-b286-4ccd-9de3-bc282acdb090", "plateId": "678901f0-8834-4a31-b381-5f5faab62825", "cookedType": "FRY" } } } ``` ### WEB端-修改飲食記錄[WEB] ```url POST /diet-plan-mgmt/diary/update ``` #### Request 欄位 | 型態 | Required | 預設 | 說明 ---- | --- | --- | --- | --- id | long | Y | | 飲食記錄id householdMemberId | string | Y | | householdMemberId time | timestamp | Y | | 飲食紀錄時間 timePeriod | int | Y | | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | Y | | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) foodId | int | Y | | 飲食紀錄的的食品編號 (-1則為自訂飲食名稱, 或是記錄方式為使用我的餐盤計劃) foodName | string | - | | 如果foodId = -1,且記錄方式為食品資料庫時則為必填 quantity | double | Y | | 飲食紀錄的的食品數量 foodCategoryId | string | Y | | 食材營養素id, 飲食記錄方式使用我的餐盤計劃時為必填 plateId | string | N | | 目前使用的我的餐盤id cookedType | string | Y | | 飲食記錄方式使用我的餐盤計劃時, 食材的烹調方式, 參閱 [烹調方式](#烹調方式) addedSugar | string | Y | | 飲食記錄方式使用我的餐盤計劃時, 食材是否額外加糖, 參閱 [額外加糖](#額外加糖) ```javascript { "id": 917, "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "time": 1664955020000, "timePeriod": 2, "timePeriodType": 21, "foodId": -1, "quantity": 1.5, "foodCategoryId": "3bab6bb8-b286-4ccd-9de3-bc282acdb090", "plateId": "678901f0-8834-4a31-b381-5f5faab62825", "cookedType": "FRIED" } ``` #### Error httpCode | 錯誤碼 | 說明 --- | --- | --- 400 | API_ERROR.NOT_EXIST | 無此筆資料 403 | API_ERROR.PERMISSION_DENIED | 無此操作權限 422 | SERVICE_ERROR.DIET_DIARY_HAD_ADJUST_UPDATE_NOT_ALLOWED | 有調整記錄,不允許編輯飲食記錄 #### Response 欄位 | 型態 | 說明 --- | --- | --- id | long | 飲食紀錄id householdMemberId | string | householdMemberId time | timestamp | 飲食紀錄時間 hhmmOfTime | int | time 的 hhmm 格式,比如早上 10:30, 這個值就是 1030,作為搜尋的條件之用 timePeriod | int | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) foodId | int | 飲食紀錄的的食品編號 (-1則為自訂飲食名稱, 或是記錄方式為使用我的餐盤計劃) foodName | string | 食品名稱 timeAndTimePeriodType | timestamp | 作為排序之用,先依 time 排出每日的飲食紀錄,再依 timePeriodType 來排序 quantity | double | 食品數量 calorie | double | 熱量 (需乘上 quantity,四捨五入到小數點第一位) protein | double | 蛋白質 (需乘上 quantity,四捨五入到小數點第一位) dietaryFiber | double | 膳食纖維 (需乘上 quantity,四捨五入到小數點第一位) carbohydrate | double | 碳水化合物 (需乘上 quantity,四捨五入到小數點第一位) fat | double | 脂肪 (需乘上 quantity,四捨五入到小數點第一位) foodCategoryId | string | 食材營養素id, 飲食記錄方式使用我的餐盤計劃時為必填 plateId | string | 目前使用的我的餐盤id cookedType | string | 飲食記錄方式使用我的餐盤計劃時, 食材的烹調方式, 參閱 [烹調方式](#烹調方式) addedSugar | string | 飲食記錄方式使用我的餐盤計劃時, 食材是否額外加糖, 參閱 [額外加糖](#額外加糖) foodCategory | string | 飲食記錄方式使用我的餐盤計劃時, 食物分類, 參閱[食物分類](#食物分類) foodCategoryType | string | 飲食記錄方式使用我的餐盤計劃時, 食物類型, 請參閱[各食物類型](#食物類型-LEGUME_FISH_MEAT_EGG) ```javascript { "httpCode": 200, "result": { "data": { "id": 917, "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "time": 1664955020000, "hhmmOfTime": 1530, "timePeriod": 2, "timePeriodType": 21, "foodId": -1, "foodName": "全榖雜糧(油炸)", "timeAndTimePeriodType": 1664899200021, "quantity": 1.5, "calorie": 170, "protein": 3, "dietaryFiber": 0, "carbohydrate": 22.5, "fat": 5, "createdAt": 1666170077905, "creator": "6ec4bd89-633a-4f67-be6e-01172f92223e", "foodCategoryId": "3bab6bb8-b286-4ccd-9de3-bc282acdb090", "plateId": "678901f0-8834-4a31-b381-5f5faab62825", "cookedType": "FRIED" } } } ``` ### WEB端-刪除飲食記錄[WEB] ```url POST /diet-plan-mgmt/diary/delete ``` #### Request 欄位 | 型態 | Required | 預設 | 說明 ---- | --- | --- | --- | --- id | long | Y | | 飲食記錄id ```javascript { "id": 918 } ``` #### Error httpCode | 錯誤碼 | 說明 --- | --- | --- 400 | API_ERROR.NOT_EXIST | 無此筆資料 403 | API_ERROR.PERMISSION_DENIED | 無此操作權限 422 | SERVICE_ERROR.DIET_DIARY_HAD_ADJUST_DELETE_NOT_ALLOWED | 有調整記錄,不允許刪除飲食記錄 #### Response 欄位 | 型態 | 說明 --- | --- | --- count | int | count > 0 表示刪除成功 ```javascript { "httpCode": 200, "result": { "data": { "count": 1 } } } ``` ### 取得飲食建議列表[APP/WEB] ```url POST /diet/diary/advice/list ``` #### Request 欄位 | 型態 | 預設 | 說明 --- | --- | --- |--- query | json | | 查詢條件json pagination | json | | 分頁json sorter | json | | 排序json ##### query (查詢條件json) 欄位 | 型態 | 必填 | 長度限制 | 預設 | 說明 ---|---|---|---|---|--- householdMemberId | string | **Web**Y | | | 要搜尋的 householdMemberId,Web端必填,App端由 token 取得 dietDate | string | | | | 要搜尋的日期, YYYY-MM-DD timePeriod | int | | | -1 | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | | | -1 | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) ##### pagination (分頁json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- current | int | | 1 | 當前頁數 pageSize | int | | 10 | 每頁結果數量,-1 為顯示所有 ##### sorter (排序json) 欄位 | 型態 | 必填 | 預設 | 說明 ---|---|---|---|--- field | string | | updateTime | 排序欄位,可排序欄位有 updateTime, timePeriodType, creatorName order | string | | desc | 升序或降序 ```javascript { "query": { "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "dietDate": "2022-10-15", "timePeriod": null, "timePeriodType": null }, "pagination": { "current": 1, "pageSize":10 }, "sorter": { "field": "createdAt", "order": "desc" } } ``` #### Response 欄位 | 型態 | 說明 --- | --- | --- id | string | 飲食建議id householdMemberId | string | dietDate | timestamp | 飲食記錄日期 timePeriod | int | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) advice | string | 飲食建議內容 creator | string | 建議人員的account id creatorName | string | 建議人員名稱 creatorRoleName | string | 建議人員角色名稱 tenantName | string | 建議人員租戶名稱 ```javascript { "httpCode": 200, "result": { "data": [ { "id": "39e5ccce-7c1b-4c32-bb81-09e0513b6bfd", "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "dietDate": 1665763200000, "timePeriod": 2, "timePeriodType": 21, "advice": "別吃太多啦~~", "creator": "6ec4bd89-633a-4f67-be6e-01172f92223e", "createTime": 1666172892334, "updater": "6ec4bd89-633a-4f67-be6e-01172f92223e", "updateTime": 1666172892334, "creatorName": "蘇凱文" } ], "pagination": { "current": 1, "pageSize": 10, "total": 1 }, "sorter": { "field": "createdAt", "order": "desc" }, "total": 1 } } ``` ### WEB端-新增飲食建議[WEB] ```url POST /diet-plan-mgmt/advice/add ``` #### Request 欄位 | 型態 | Required | 長度限制 | 預設 | 說明 ---- | --- | --- | --- | --- | --- householdMemberId | string | Y | | | householdMemberId dietDate | string | Y | | | 飲食記錄日期, YYYY-MM-DD timePeriod | int | Y | | | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | Y | | | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) advice | string | N | 2000 | | 飲食建議內容 ```javascript { "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "dietDate": "2022-10-15", "timePeriod": 2, "timePeriodType": 21, "advice": "別吃太多啦~~" } ``` #### Error httpCode | 錯誤碼 | 說明 --- | --- | --- #### Response 欄位 | 型態 | 說明 --- | --- | --- id | string | 飲食建議id householdMemberId | string | dietDate | timestamp | 飲食記錄日期 timePeriod | int | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) advice | string | 飲食建議內容 creator | string | 建議人員的account id creatorName | string | 建議人員名稱 creatorRoleName | string | 建議人員角色名稱 tenantName | string | 建議人員租戶名稱 ```javascript { "httpCode": 200, "result": { "data": { "id": "39e5ccce-7c1b-4c32-bb81-09e0513b6bfd", "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "dietDate": 1665763200000, "timePeriod": 2, "timePeriodType": 21, "advice": "別吃太多啦~~", "creator": "6ec4bd89-633a-4f67-be6e-01172f92223e", "createTime": 1666172892334, "updater": "6ec4bd89-633a-4f67-be6e-01172f92223e", "updateTime": 1666172892334 } } } ``` ### WEB端-修改飲食建議[WEB] ```url POST /diet-plan-mgmt/advice/update ``` #### Request 欄位 | 型態 | Required | 長度限制 | 預設 | 說明 ---- | --- | --- | --- | --- | --- id | string | Y | | | 飲食建議id householdMemberId | string | Y | | | householdMemberId dietDate | string | Y | | | 飲食記錄日期, YYYY-MM-DD timePeriod | int | Y | | | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | Y | | | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) advice | string | N | 2000 | | 飲食建議內容 ```javascript { "id": "5ed0c1f8-717a-476d-9d7c-9990eac14335", "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "dietDate": "2022-10-15", "timePeriod": 2, "timePeriodType": 20, "advice": "吃太多不好唷~~" } ``` #### Error httpCode | 錯誤碼 | 說明 --- | --- | --- 400 | API_ERROR.NOT_EXIST | 無此筆資料 403 | API_ERROR.PERMISSION_DENIED | 無此操作權限 #### Response 欄位 | 型態 | 說明 --- | --- | --- id | string | 飲食建議id householdMemberId | string | dietDate | timestamp | 飲食記錄日期 timePeriod | int | 飲食紀錄時段, 請參閱[用餐時段](#用餐時段) timePeriodType | int | 飲食紀錄餐別, 請參閱[用餐餐別](#用餐餐別) advice | string | 飲食建議內容 creator | string | 建議人員的account id creatorName | string | 建議人員名稱 creatorRoleName | string | 建議人員角色名稱 tenantName | string | 建議人員租戶名稱 ```javascript { "httpCode": 200, "result": { "data": { "id": "39e5ccce-7c1b-4c32-bb81-09e0513b6bfd", "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "dietDate": 1665763200000, "timePeriod": 2, "timePeriodType": 21, "advice": "別吃太多啦~~", "creator": "6ec4bd89-633a-4f67-be6e-01172f92223e", "createTime": 1666172892334, "updater": "6ec4bd89-633a-4f67-be6e-01172f92223e", "updateTime": 1666172892334 } } } ``` ### WEB端-刪除飲食建議[WEB] ```url POST /diet-plan-mgmt/advice/delete ``` #### Request 欄位 | 型態 | Required | 長度限制 | 預設 | 說明 ---- | --- | --- | --- | --- | --- id | string | Y | | | 飲食建議id ```javascript { "id": "5ed0c1f8-717a-476d-9d7c-9990eac14335" } ``` #### Error httpCode | 錯誤碼 | 說明 --- | --- | --- 400 | API_ERROR.NOT_EXIST | 無此筆資料 403 | API_ERROR.PERMISSION_DENIED | 無此操作權限 #### Response 欄位 | 型態 | 說明 --- | --- | --- count | int | count > 0 表示刪除成功 ```javascript { "httpCode": 200, "result": { "data": { "count": 1 } } } ``` ### WEB端-新增飲食調整記錄[WEB] ```url POST /diet-plan-mgmt/adjust/add ``` #### Request 欄位 | 型態 | Required | 長度限制 | 預設 | 說明 ---- | --- | --- | --- | --- | --- householdMemberId | string | Y | | | householdMemberId dietdiaryId | long | Y | | | 飲食記錄id adjustQuantity | double | Y | | | 調整後數量 adjustFoodCategoryType | string | | 20 | | 調整後的食物類型, 請參照[各食物類型](#食物類型-LEGUME_FISH_MEAT_EGG) adjustCookedType | string | | 36 | | 調整後的烹調方式, 請參照[烹調方式](#烹調方式) adjustAddedSugar | string | | 36 | | 調整後的額外加糖, 請參照[額外加糖](#額外加糖) ```javascript { "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "dietdiaryId": 917, "adjustQuantity": 2, "adjustFoodCategoryType": null, "adjustCookedType": null, "adjustAddedSugar": null } ``` #### Error httpCode | 錯誤碼 | 說明 --- | --- | --- 402 | SERVICE_ERROR.DIET_DIARY_NOT_EXIST | 飲食記錄不存在 #### Response 欄位 | 型態 | 說明 --- | --- | --- id | string | 飲食調整記錄id householdMemberId | string | householdMemberId dietdiaryId | long | 飲食記錄id adjustQuantity | double | 調整後數量 adjustFoodCategoryId | string | 調整後的食物id adjustFoodCategoryType | string | 調整後的食物類型, 請參照[各食物類型](#食物類型-LEGUME_FISH_MEAT_EGG) adjustCookedType | string | 調整後的烹調方式, 請參照[烹調方式](#烹調方式) adjustAddedSugar | string | 調整後的額外加糖, 請參照[額外加糖](#額外加糖) adjustCalorie | double | 調整後的熱量 adjustProtein | double | 調整後的蛋白質(g) adjustDietaryFiber | double | 調整後的膳食纖維(g) adjustCarbohydrate | double | 調整後的碳水化合物(g) adjustFat | double | 調整後的脂肪(g) creator | string | 建議人員的account id creatorName | string | 調整人員名稱 creatorRoleName | string | 調整人員角色名稱 tenantName | string | 調整人員租戶名稱 ```javascript { "httpCode": 200, "result": { "data": { "id": "4be5af28-27e3-4e2d-91da-defc6b5a6851", "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "dietdiaryId": 917, "adjustQuantity": 2, "adjustCalorie": 0, "adjustProtein": 0, "adjustDietaryFiber": 0, "adjustCarbohydrate": 0, "adjustFat": 0, "creator": "6ec4bd89-633a-4f67-be6e-01172f92223e", "createTime": 1666252976431, "updater": "6ec4bd89-633a-4f67-be6e-01172f92223e", "updateTIme": 1666252976431 } } } ``` ### WEB端-修改飲食調整記錄[WEB] ```url POST /diet-plan-mgmt/adjust/update ``` #### Request 欄位 | 型態 | Required | 長度限制 | 預設 | 說明 ---- | --- | --- | --- | --- | --- id | string | Y | | | 飲食調整記錄id householdMemberId | string | Y | | | householdMemberId dietdiaryId | long | Y | | | 飲食記錄id adjustQuantity | double | Y | | | 調整後數量 adjustFoodCategoryType | string | | 20 | | 調整後的食物類型, 請參照[各食物類型](#食物類型-LEGUME_FISH_MEAT_EGG) adjustCookedType | string | | 36 | | 調整後的烹調方式, 請參照[烹調方式](#烹調方式) adjustAddedSugar | string | | 36 | | 調整後的額外加糖, 請參照[額外加糖](#額外加糖) ```javascript { "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "dietdiaryId": 917, "adjustQuantity": 2, "adjustFoodCategoryType": null, "adjustCookedType": null, "adjustAddedSugar": null } ``` #### Error httpCode | 錯誤碼 | 說明 --- | --- | --- 402 | SERVICE_ERROR.DIET_DIARY_NOT_EXIST | 飲食記錄不存在 400 | API_ERROR.NOT_EXIST | 無此筆資料 403 | API_ERROR.PERMISSION_DENIED | 無此操作權限 #### Response 欄位 | 型態 | 說明 --- | --- | --- id | string | 飲食調整記錄id householdMemberId | string | householdMemberId dietdiaryId | long | 飲食記錄id adjustQuantity | double | 調整後數量 adjustFoodCategoryId | string | 調整後的食物id adjustFoodCategoryType | string | 調整後的食物類型, 請參照[各食物類型](#食物類型-LEGUME_FISH_MEAT_EGG) adjustCookedType | string | 調整後的烹調方式, 請參照[烹調方式](#烹調方式) adjustAddedSugar | string | 調整後的額外加糖, 請參照[額外加糖](#額外加糖) adjustCalorie | double | 調整後的熱量 adjustProtein | double | 調整後的蛋白質(g) adjustDietaryFiber | double | 調整後的膳食纖維(g) adjustCarbohydrate | double | 調整後的碳水化合物(g) adjustFat | double | 調整後的脂肪(g) creator | string | 建議人員的account id creatorName | string | 調整人員名稱 creatorRoleName | string | 調整人員角色名稱 tenantName | string | 調整人員租戶名稱 ```javascript { "httpCode": 200, "result": { "data": { "id": "4be5af28-27e3-4e2d-91da-defc6b5a6851", "householdMemberId": "8a9e980a-c612-4f87-af07-a97a5f0fbed5", "dietdiaryId": 917, "adjustQuantity": 2, "adjustCalorie": 0, "adjustProtein": 0, "adjustDietaryFiber": 0, "adjustCarbohydrate": 0, "adjustFat": 0, "creator": "6ec4bd89-633a-4f67-be6e-01172f92223e", "createTime": 1666252976431, "updater": "6ec4bd89-633a-4f67-be6e-01172f92223e", "updateTIme": 1666252976431 } } } ``` ### WEB端-刪除飲食調整記錄[WEB] ```url POST /diet-plan-mgmt/adjust/delete ``` #### Request 欄位 | 型態 | Required | 長度限制 | 預設 | 說明 ---- | --- | --- | --- | --- | --- id | string | Y | | | 飲食調整記錄id ```javascript { "id": "5ed0c1f8-717a-476d-9d7c-9990eac14335" } ``` #### Error httpCode | 錯誤碼 | 說明 --- | --- | --- 400 | API_ERROR.NOT_EXIST | 無此筆資料 403 | API_ERROR.PERMISSION_DENIED | 無此操作權限 #### Response 欄位 | 型態 | 說明 --- | --- | --- count | int | count > 0 表示刪除成功 ```javascript { "httpCode": 200, "result": { "data": { "count": 1 } } } ```

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully