---
# System prepended metadata

title: 諮詢討論

---

# 諮詢討論

## 新增諮詢內容

```url=
POST /consult/question/add
```
Request
|  欄位 | 型態  | 必填 | 預設 | 說明  |
|---|---|---|---|---|
| title | String |N | | 諮詢標題 |
| content | String | Y | | 諮詢內容 |
| tenantId | String | Y | | 期望回復單位的租戶ID |


### Request Body Example:
```javascript=
{
   "content": "test content",
   "tenantId": "858b7fbb-3ba0-4d49-9882-c893a1ef07dc"
}
```
### Response Body Param
|  欄位 | 型態   | 說明  |
| -----| -----|-------- |
| id|  String | 諮詢ID |
### Response Body Example
```json=
{
    "httpCode": 200,
    "result": {
        "data": {
            "id": "927ea139-88a7-42e2-aa91-f3f8bb2db298"
        }
    }
}
```

## 編輯諮詢內容

```url=
POST /consult/question/update
```
Request
|  欄位 | 型態  | 必填 | 預設 | 說明  |
|---|---|---|---|---|
| consultQuestionId | String | Y | | 要編輯的諮詢ID |
| title | String |N | | 諮詢標題 |
| content | String | Y | | 諮詢內容 |


### Request Body Example:
```javascript=
{
   "consultQuestionId": "1503588f-f611-463b-b031-68395570ca00",
   "content": "new content1"
}
```
### Response Body Param
|  欄位 | 型態   | 說明  |
| -----| -----|-------- |
| id|  String | 諮詢ID |
### Response Body Example
```json=
{
    "httpCode": 200,
    "result": {
        "data": {
            "id": "927ea139-88a7-42e2-aa91-f3f8bb2db298"
        }
    }
}
```

## 回覆諮詢內容

```url=
POST /consult/answer/add
```
Request
|  欄位 | 型態  | 必填 | 預設 | 說明  |
|---|---|---|---|---|
| consultQuestionId | String | Y | | 要回覆的諮詢ID |
| content | String | Y | | 諮詢內容 |


### Request Body Example:
```javascript=
{
   "consultQuestionId":"927ea139-88a7-42e2-aa91-f3f8bb2db298",
   "content": "reply content 1"
}
```
### Response Body Param
|  欄位 | 型態   | 說明  |
| -----| -----|-------- |
| consultAnswerId|  String | 回覆ID |
### Response Body Example
```json=
{
    "httpCode": 200,
    "result": {
        "data": {
            "consultAnswerId": "927ea139-88a7-42e2-aa91-f3f8bb2db298"
        }
    }
}
```

## 編輯回覆諮詢內容

```url=
POST /consult/answer/update
```
Request
|  欄位 | 型態  | 必填 | 預設 | 說明  |
|---|---|---|---|---|
| consultQuestionId | String | Y | | 要編輯的諮詢ID |
| consultAnswerId | String | Y | | 要編輯的回覆ID |
| content | String | Y | | 諮詢內容 |


### Request Body Example:
```javascript=
{
   "consultQuestionId":"927ea139-88a7-42e2-aa91-f3f8bb2db298",
   "consultAnswerId": "64e5c7da-b246-4f5b-9280-e17a5546988f",
   "content": "reply content new"
}
```
### Response Body Param
|  欄位 | 型態   | 說明  |
| -----| -----|-------- |
| id|  String | 諮詢ID |
### Response Body Example
```json=
{
    "httpCode": 200,
    "result": {
        "data": {
            "id": "927ea139-88a7-42e2-aa91-f3f8bb2db298"
        }
    }
}
```

## 取得諮詢列表(by作者)

```url=
GET /consult/question/listByAuthor
```
Request
|  欄位 | 型態  | 必填 | 預設 | 說明  |
|---|---|---|---|---|
| read|  Boolean|N | 過濾回復已讀狀態 |不帶的話就是撈全部, 帶false就是撈回復未讀的諮詢


### Request Body Example:
```javascript=

```
### Response Body Param
|  欄位 | 型態   | 說明  |
| -----| -----|-------- |
| consultQuestionId|  String | 諮詢ID |
| title|  String | 諮詢標題 |
| content|  String | 諮詢內容 |
| authorName|  String | 作者姓名 |
| authorAccount|  String | 諮詢帳號 |
| answerCount|  int | 回覆數量 |
| isAuthor|  String | 該諮詢/回覆 是否為本人提交 |
| roleType|  String | 該篇作者腳色(GENERAL_PUBLIC為app用戶, 其他是web 用戶) |
| diseaseInfo|  String | 當腳色是app用戶時, 且有被收案. 該欄位為被收案的疾病 |
| roleName|  String | 當腳色是web用戶時, 且有被設定腳色. 該欄位為腳色名稱 |
| divisionName|  String | 當腳色是web用戶時, 且有被設定科別. 該欄位為科別名稱 |
| createTime|  String | 諮詢項目創建時間 |
| updateTime|  String | 諮詢項目更新時間 |
| read|  Boolean | 諮詢問題是否已讀 |
| latestAnswer|  json  | 當answerCount > 0時, 這項會列出最新一筆回覆 |
| consultQuestionId|  String | 諮詢ID |
|consultAnswerId| String|回覆ID|
| content|  String | 回覆內容 |
| authorName|  String | 作者姓名 |
| authorAccount|  String | 諮詢帳號 |
| isAuthor|  String | 該諮詢/回覆 是否為本人提交 |
| read|  boolean | 是否已讀 |
| roleType|  String | 該篇作者腳色(GENERAL_PUBLIC為app用戶, 其他是web 用戶) |
| diseaseInfo|  String | 當腳色是app用戶時, 且有被收案. 該欄位為被收案的疾病 |
| roleName|  String | 當腳色是web用戶時, 且有被設定腳色. 該欄位為腳色名稱 |
| divisionName|  String | 當腳色是web用戶時, 且有被設定科別. 該欄位為科別名稱 |
| createTime|  String | 回覆諮詢創建時間 |
| updateTime|  String | 回覆諮詢更新時間 |
### Response Body Example
```json=
{
    "httpCode": 200,
    "result": {
        "data": [
            {
                "consultQuestionId": "927ea139-88a7-42e2-aa91-f3f8bb2db298",
                "title": "test title",
                "authorAccount": "F147926210",
                "authorName": "陳大天",
                "content": "test content",
                "answerCount": 3,
                "isAuthor": true,
                "roleType": "GENERAL_PUBLIC",
                "diseaseInfo": "DM ,ECKD Stage 1,ECKD Stage 1",
                "createTime": "2021-03-17 17:42",
                "updateTime": "2021-03-17 17:42",
                "total": 2,
                "read": false,
                "latestAnswer": {
                    "consultAnswerId": "26eeab10-738e-4a9f-8a0c-af30b102462c",
                    "consultQuestionId": "833e0f22-c603-4629-b9d2-3290b8b3e15a",
                    "authorAccount": "n_nurse@nn.nn",
                    "authorName": "n護士",
                    "content": "reply content 2",
                    "isAuthor": false,
                    "roleType": "TENANT_ROLE_USER",
                    "roleName": "護士",
                    "divisionName": "神經科",
                    "read": false,
                    "createTime": "2021-03-22 13:12",
                    "updateTime": "2021-03-22 13:12"
                }
            },
            {
                "consultQuestionId": "1503588f-f611-463b-b031-68395570ca00",
                "title": "new title",
                "authorAccount": "F147926210",
                "authorName": "陳大天",
                "content": "new content",
                "answerCount": 0,
                "isAuthor": true,
                "roleType": "TENANT_ROLE_USER",
                "roleName": "腦科醫生",
                "divisionName": "心臟科",
                "read": false,
                "createTime": "2021-03-17 17:29",
                "updateTime": "2021-03-17 17:37",
                "total": 2
            }
        ]
    }
}
```

## 取得諮詢內容(含回覆)
(租戶呼叫後會把諮詢題目和同租戶以外的回復設為已讀, 個人用戶呼叫後會把非自己的回覆設為已讀)
```url=
POST /consult/question
```
Request
|  欄位 | 型態  | 必填 | 預設 | 說明  |
|---|---|---|---|---|
| consultQuestionId | String | Y | | 要查詢的諮詢ID |



### Request Body Example:
```javascript=
{
   "query": {
       "consultQuestionId":"927ea139-88a7-42e2-aa91-f3f8bb2db298"
   }
}
```
### Response Body Param
|  欄位 | 型態   | 說明  |
| -----| -----|-------- |
| question|  json | 諮詢內容 |
| consultQuestionId|  String | 諮詢ID |
| title|  String | 諮詢標題 |
| content|  String | 諮詢內容 |
| authorName|  String | 作者姓名 |
| authorAccount|  String | 諮詢帳號 |
| isAuthor|  String | 該諮詢/回覆 是否為本人提交 |
| roleType|  String | 該篇作者腳色(GENERAL_PUBLIC為app用戶, 其他是web 用戶) |
| diseaseInfo|  String | 當腳色是app用戶時, 且有被收案. 該欄位為被收案的疾病 |
| roleName|  String | 當腳色是web用戶時, 且有被設定腳色. 該欄位為腳色名稱 |
| divisionName|  String | 當腳色是web用戶時, 且有被設定科別. 該欄位為科別名稱 |
| createTime|  String | 諮詢項目創建時間 |
| updateTime|  String | 諮詢項目更新時間 |
| answers|  json array | 諮詢內容 |
| consultQuestionId|  String | 諮詢ID |
|consultAnswerId| String|回覆ID|
| content|  String | 回覆內容 |
| authorName|  String | 作者姓名 |
| authorAccount|  String | 諮詢帳號 |
| isAuthor|  String | 該諮詢/回覆 是否為本人提交 |
| roleType|  String | 該篇作者腳色(GENERAL_PUBLIC為app用戶, 其他是web 用戶) |
| diseaseInfo|  String | 當腳色是app用戶時, 且有被收案. 該欄位為被收案的疾病 |
| roleName|  String | 當腳色是web用戶時, 且有被設定腳色. 該欄位為腳色名稱 |
| divisionName|  String | 當腳色是web用戶時, 且有被設定科別. 該欄位為科別名稱 |
| createTime|  String | 回覆諮詢創建時間 |
| updateTime|  String | 回覆諮詢更新時間 |
### Response Body Example
```json=
{
    "httpCode": 200,
    "result": {
        "data": {
            "question": {
                "consultQuestionId": "927ea139-88a7-42e2-aa91-f3f8bb2db298",
                "title": "test title",
                "authorAccount": "F147926210",
                "authorName": "陳大天",
                "content": "test content",
                "answerCount": 3,
                "isAuthor": true,
                "roleType": "GENERAL_PUBLIC",
                "createTime": "2021-03-17 17:42",
                "updateTime": "2021-03-17 17:42",
                "total": 1
            },
            "answers": [
                {
                    "consultAnswerId": "64e5c7da-b246-4f5b-9280-e17a5546988f",
                    "consultQuestionId": "927ea139-88a7-42e2-aa91-f3f8bb2db298",
                    "authorAccount": "F147926210",
                    "authorName": "陳大天",
                    "content": "reply content 1",
                    "isAuthor": true,
                    "roleType": "GENERAL_PUBLIC",
                    "createTime": "2021-03-18 08:57",
                    "updateTime": ""
                }
            ]
        }
    }
}