# Consult API List
##### 諮詢問題
1. **取得諮詢問題列表**
[POST /{contextPath}/consult/question/list](#取得諮詢問題列表-consultquestionlist)
2. **新增諮詢問題**
[POST /{contextPath}/consult/question/add](#新增諮詢問題-consultquestionadd)
3. **編輯諮詢問題**
[POST /{contextPath}/consult/question/update](#編輯諮詢問題-consultquestionupdate)
4. **取得諮詢問題**
[POST /{contextPath}/consult/question](#取得諮詢問題-consultquestion)
5. **刪除諮詢問題**
[POST /{contextPath}/consult/question/delete](#刪除諮詢問題-consultquestiondelete)
##### 諮詢回應
1. **新增諮詢回應**
[POST /{contextPath}/consult/answer/add](#新增諮詢回應-consultansweradd)
2. **編輯諮詢回應**
[POST /{contextPath}/consult/answer/update](#編輯諮詢回應-consultanswerupdate)
3. **取得諮詢問題底下的回應列表**
[POST /{contextPath}/consult/answer/list](#取得諮詢問題底下的回應列表-consultanswerlist)
4. **刪除諮詢回應**
[POST /{contextPath}/consult/answer/delete](#刪除諮詢回應-consultanswerdelete)
5. **取得回應明細**
[POST /{contextPath}/consult/answer/detail](#取得回應明細-consultanswerdetail)
6. **取得未讀回應列表**
[POST /{contextPath}/consult/answer/unread](#取得未讀回應列表-consultanswerunread)
7. **回應全部已讀**
[POST /{contextPath}/consult/answer/allread](#回應全部已讀-consultanswerallread)
API Require Headers:
```javascript
{
Content-Type: 'application/json',
Accept: 'application/json',
Authorization: accessToken,
}
```
---
## 取得諮詢問題列表: **/consult/question/list**
### 用於:
* 取得諮詢問題列表
### Request Body:
* query
| Parameter | Required | format | desc |
| --------- | -------- | -------- |-------- |
| title| N| String | 問題標題 |
| authorName| N| String | 作者名稱 |
* sorter
| Parameter | Required | format | desc |
| --------- | -------- | -------- |-------- |
| field| N| String | 排序欄位,預設為 createTime|
| order| N| String | desc/asc,預設為 desc
* pagination
| Parameter | Required | format | desc |
| --------- | -------- | -------- |-------- |
| current| N| String | 目前頁數|
| pageSize| N| String |一頁幾筆 |
### Request Body Example:
``` javascript
{
"query": {
"title": "",
"authorName": ""
},
"pagination": {
"current": "1",
"pageSize": "10"
},
"sorter": {
"field": "createTime",
"order": "desc"
}
}
```
### Response Body:
| Parameter | format | desc | sort supported|
| --------- | -------- |--------|-------- |
| consultQuestionId | String| 問題 ID, UUID | N |
| title| String | 標題| Y |
| authorAccount| String | 發問人ID | N|
| authorName | String | 發問人姓名 | N|
| answerCount| Integer | 回覆數量 | Y|
| isAuthor| String | 是否為發文者 | N|
| roleType| String | 發文者角色 | N|
| roleName| String | 發文者角色名稱 | N|
| createTime| timestamp | 提問時間 | Y|
### Response Body Example:
``` javascript
{
"httpCode": 200,
"result": {
"data": [
{
"consultQuestionId": "6eeb7bf95c3c49eb9c826b96ea88f816",
"title": "中暑該如何處理?!!!!3333123123123213!!!",
"authorAccount": "hc_admin_1_6403800@yopmail.com",
"authorName": "那瑪夏區衛生所管理員",
"answerCount": 0,
"isAuthor": false,
"roleType": "GENERAL_PUBLIC",
"roleName": "一般民眾",
"createTime": 1553652506235
}
],
"pagination": {
"current": 1,
"pageSize": 10,
"total": 4
},
"sorter": {
"field": "createDate",
"order": "desc"
}
}
}
```
---
## **新增諮詢問題**: **/consult/question/add**
### 用於:
* 新增諮詢問題
### Request Parameter:
| Parameter | format | desc | Required|
| --------- | -------- |--------|-------- |
| title| String | 標題| Y |
| content | String | 問題內容 | Y|
### Request Body Example:
``` javascript
{
"title": "問題標題",
"content": "問題內容"
}
```
### Response Body:
| Parameter | format | desc |
| --------- | -------- |--------|
| id | String| 問題 ID, UUID |
### Response Body Example:
``` json
{
"httpCode": 200,
"result": {
"data": {
"id": "6eeb7bf95c3c49eb9c826b96ea88f816"
}
}
}
```
---
## **編輯諮詢問題**: **/consult/question/update**
### 用於:
* 編輯諮詢問題
### Request Body:
| Parameter | format | desc | Required|
| --------- | -------- |--------|-------- |
| consultQuestionId | String| 問題 ID, UUID | Y |
| title| String | 標題| Y |
| content | String | 問題內容 | Y|
### Request Body Example:
``` javascript
{
"consultQuestionId": "6eeb7bf95c3c49eb9c826b96ea88f816",
"title": "問題標題",
"content": "問題內容"
}
```
### Response Body:
| Parameter | format | desc |
| --------- | -------- |--------|
| id | String| 問題 ID, UUID |
### Response Body Example:
``` javascript
{
"httpCode": 200,
"result": {
"data": {
"id": "6eeb7bf95c3c49eb9c826b96ea88f816"
}
}
}
```
---
## 取得諮詢問題: **/consult/question**
### 用於:
* 取得諮詢問題
### Request Body:
* query
| Parameter | Required | format | desc |
| --------- | -------- | -------- |-------- |
| consultQuestionId |Y | String| 問題 ID, UUID |
### Request Body Example:
``` javascript
{
"query": {
"consultQuestionId": "796b52c883d8474ea7c77fc0dd75d036"
}
}
```
### Response Body:
**question**
| Parameter | format | desc | sort supported|
| --------- | -------- |--------|-------- |
| consultQuestionId | String| 問題 ID, UUID | N |
| title| String | 標題| N |
| authorAccount| String | 發問人ID | N|
| authorName | String | 回覆人姓名 | N|
| answerCount| Integer | 回覆數量 | N|
| content | String | 問題內容 | N|
| isAuthor| String | 是否為發問者 | N|
| roleType| String | 發問者角色 | N|
| roleName| String | 發文者角色名稱 | N|
| createTime| timestamp | 提問時間 | N|
### Response Body Example:
```
{
"httpCode": 200,
"result": {
"data": {
"question": {
"consultQuestionId": "796b52c883d8474ea7c77fc0dd75d036",
"title": "中暑該如何處理?!!!!33333!!!",
"authorAccount": "hc_admin_1_6403800@yopmail.com",
"content": "我中暑了!!!",
"answerCount": 2,
"isAuthor": false,
"roleType": "GENERAL_PUBLIC",
"roleName": "一般民眾",
"createTime": 1553652506235
}
}
}
}
```
---
## **刪除諮詢問題**: **/consult/question/delete**
### 用於:
* 刪除諮詢問題
### Request Body:
| Parameter | format | desc | Required|
| --------- | -------- |--------|-------- |
| consultQuestionId | String| 問題 ID, UUID | Y |
### Request Body Example:
``` javascript
{
"consultQuestionId": "6eeb7bf95c3c49eb9c826b96ea88f816",
}
```
### Response Body:
| Parameter | format | desc |
| --------- | -------- |--------|
| consultQuestionId | String| 問題 ID, UUID |
### Response Body Example:
``` javascript
{
"httpCode": 200,
"result": {
"data": {
"consultQuestionId": "6eeb7bf95c3c49eb9c826b96ea88f816"
}
}
}
```
---
## **新增諮詢回應**: **/consult/answer/add**
### 用於:
* 新增諮詢回應
### Request Parameter:
| Parameter | format | desc | Required|
| --------- | -------- |--------|-------- |
| consultQuestionId | String| 問題 ID, UUID | Y |
| content | String | 回覆內容 | Y|
### Request Body Example:
``` javascript
{
"consultQuestionId": "796b52c883d8474ea7c77fc0dd75d036",
"content": "多喝水"
}
```
### Response Body:
| Parameter | format | desc |
| --------- | -------- |--------|
| id | String| 回應 ID, UUID |
### Response Body Example:
``` json
{
"httpCode": 200,
"result": {
"data": {
"id": "6eeb7bf95c3c49eb9c826b96ea88f816"
}
}
}
```
---
## **編輯諮詢回應**: **/consult/answer/update**
### 用於:
* 編輯諮詢回應
### Request Parameter:
| Parameter | format | desc | Required|
| --------- | -------- |--------|-------- |
| consultAnswerId | String| 回應 ID, UUID | Y |
| consultQuestionId | String| 問題 ID, UUID | Y |
| content | String | 回覆內容 | Y|
### Request Body Example:
``` javascript
{
"consultAnswerId": "8f719904a8d948329792d1d80b01cd9b",
"consultQuestionId": "796b52c883d8474ea7c77fc0dd75d036",
"content": "多喝水"
}
```
### Response Body:
| Parameter | format | desc |
| --------- | -------- |--------|
| id | String| 回應 ID, UUID |
### Response Body Example:
``` json
{
"httpCode": 200,
"result": {
"data": {
"id": "6eeb7bf95c3c49eb9c826b96ea88f816"
}
}
}
```
---
## 取得諮詢問題底下的回應列表: **/consult/answer/list**
### 用於:
* 取得諮詢問題底下的回應列表
### Request Body:
* query
| Parameter | Required | format | desc |
| --------- | -------- | -------- |-------- |
| consultQuestionId |Y | String| 問題 ID, UUID |
* pagination
| Parameter | Required | format | desc |
| --------- | -------- | -------- |-------- |
| current| N| String | 目前頁數|
| pageSize| N| String |一頁幾筆 |
### Request Body Example:
``` javascript
{
"query": {
"consultQuestionId": "796b52c883d8474ea7c77fc0dd75d036"
},
"pagination": {
"current": "1",
"pageSize": "10"
}
}
```
### Response Body:
| Parameter | format | desc | sort supported|
| --------- | -------- |--------|-------- |
| consultAnswerId | String| 回應 ID, UUID | N |
| consultQuestionId | String| 問題 ID, UUID | N |
| authorAccount| String | 發問人ID | N|
| authorName | String | 發問人姓名 | N|
| content | String | 回覆內容 | N|
| isAuthor| String | 是否為回覆者 | N|
| roleType| String | 回覆者角色 | N|
| roleName| String | 回覆者角色名稱 | N|
| createTime| timestamp | 回覆時間 | N|
| read | boolean | 已讀未讀 | N|
### Response Body Example:
```
{
"httpCode": 200,
"result": {
"data": [
{
"consultAnswerId": "1",
"consultQuestionId": "796b52c883d8474ea7c77fc0dd75d036",
"authorAccount": "hc_admin_1_6403800@yopmail.com",
"authorName": "那瑪夏區衛生所管理員",
"content": "33333",
"isAuthor": false,
"roleType": "HEALTH_CENTER_ADMIN",
"roleName": "醫生",
"createTime": 1553652506235,
"read": true
},
{
"consultAnswerId": "8f719904a8d948329792d1d80b01cd9b",
"consultQuestionId": "796b52c883d8474ea7c77fc0dd75d036",
"authorAccount": "user_1_6403800@yopmail.com",
"authorName": "那瑪夏區民眾1",
"content": "多喝水11111",
"isAuthor": false,
"roleType": "HEALTH_CENTER_ADMIN",
"roleName": "醫生",
"createTime": 1553652506235,
"read": false
}
],
"pagination": {
"current": 1,
"pageSize": 10,
"total": 2
}
}
}
```
---
## **刪除諮詢回應**: **/consult/answer/delete**
### 用於:
* 刪除諮詢回應
### Request Body:
| Parameter | format | desc | Required|
| --------- | -------- |--------|-------- |
| consultQuestionId | String| 問題 ID, UUID | Y |
| consultAnswerId | String| 回應 ID, UUID | Y |
### Request Body Example:
``` javascript
{
"consultQuestionId": "6eeb7bf95c3c49eb9c826b96ea88f816"
"consultAnswerId": "6eeb7bf95c3c49eb9c826b96ea88f816",
}
```
### Response Body:
| Parameter | format | desc |
| --------- | -------- |--------|
| consultAnswerId | String| 回應 ID, UUID |
### Response Body Example:
``` javascript
{
"httpCode": 200,
"result": {
"data": {
"consultAnswerId": "6eeb7bf95c3c49eb9c826b96ea88f816"
}
}
}
```
---
## 取得回應明細: **/consult/answer/detail**
### 用於:
* 取得回應明細
### Request Body:
* query
| Parameter | Required | format | desc |
| --------- | -------- | -------- |-------- |
| consultAnswerId |Y | String| 回應 ID, UUID |
### Request Body Example:
``` javascript
{
"query": {
"consultQuestionId": "796b52c883d8474ea7c77fc0dd75d036"
}
}
```
### Response Body:
| Parameter | format | desc | sort supported|
| --------- | -------- |--------|-------- |
| consultAnswerId | String| 回應 ID, UUID | N |
| consultQuestionId | String| 問題 ID, UUID | N |
| authorAccount| String | 發問人ID | N|
| authorName | String | 發問人姓名 | N|
| content | String | 回覆內容 | N|
| isAuthor| String | 是否為回覆者 | N|
| roleType| String | 回覆者角色 | N|
| roleName| String | 回覆者角色名稱 | N|
| createTime| timestamp | 回覆時間 | N|
| read | boolean | 已讀未讀 | N|
### Response Body Example:
```
{
"httpCode": 200,
"result": {
"data": {
"consultAnswerId": "1",
"consultQuestionId": "796b52c883d8474ea7c77fc0dd75d036",
"authorAccount": "hc_admin_1_6403800@yopmail.com",
"authorName": "那瑪夏區衛生所管理員",
"content": "33333",
"isAuthor": false,
"roleType": "HEALTH_CENTER_ADMIN",
"roleName": "醫生",
"createTime": 1553652506235,
"read": true
}
}
}
```
---
## 取得未讀回應列表: **/consult/answer/unread**
### 用於:
* 取得未讀回應列表
### Request Body:
* query
| Parameter | Required | format | desc |
| --------- | -------- | -------- |-------- |
* pagination
| Parameter | Required | format | desc |
| --------- | -------- | -------- |-------- |
| current| N| String | 目前頁數|
| pageSize| N| String |一頁幾筆 |
### Request Body Example:
``` javascript
{
"query": {
},
"pagination": {
"current": "1",
"pageSize": "10"
}
}
```
### Response Body:
| Parameter | format | desc | sort supported|
| --------- | -------- |--------|-------- |
| consultAnswerId | String| 回應 ID, UUID | N |
| consultQuestionId | String| 問題 ID, UUID | N |
| authorAccount| String | 發問人ID | N|
| authorName | String | 發問人姓名 | N|
| content | String | 回覆內容 | N|
| isAuthor| String | 是否為回覆者 | N|
| roleType| String | 回覆者角色 | N|
| roleName| String | 回覆者角色名稱 | N|
| createTime| timestamp | 回覆時間 | N|
| read | boolean | 已讀未讀 | N|
### Response Body Example:
```
{
"httpCode": 200,
"result": {
"data": [
{
"consultAnswerId": "1",
"consultQuestionId": "796b52c883d8474ea7c77fc0dd75d036",
"authorAccount": "hc_admin_1_6403800@yopmail.com",
"authorName": "那瑪夏區衛生所管理員",
"content": "33333",
"isAuthor": false,
"roleType": "HEALTH_CENTER_ADMIN",
"roleName": "醫生",
"createTime": 1553652506235,
"read": false
},
{
"consultAnswerId": "8f719904a8d948329792d1d80b01cd9b",
"consultQuestionId": "796b52c883d8474ea7c77fc0dd75d036",
"authorAccount": "user_1_6403800@yopmail.com",
"authorName": "那瑪夏區民眾1",
"content": "多喝水11111",
"isAuthor": false,
"roleType": "HEALTH_CENTER_ADMIN",
"roleName": "醫生",
"createTime": 1553652506235,
"read": false
}
],
"pagination": {
"current": 1,
"pageSize": 10,
"total": 2
}
}
}
```
---
## 回應全部已讀: **/consult/answer/allread**
### 用於:
* 回應全部已讀
### Request Body:
* query
| Parameter | Required | format | desc |
| --------- | -------- | -------- |-------- |
### Request Body Example:
``` javascript
{
"query": {
}
}
```
### Response Body:
| Parameter | format | desc | sort supported|
| --------- | -------- |--------|-------- |
| count | int | 將未讀的改成已讀的筆數 | N |
### Response Body Example:
```
{
"httpCode": 200,
"result": {
"data": {
"count": 1
}
}
}
```
---