聊天-发处方
开发中GET
/sendPrescription点击发处方按钮,后台模拟生成处方,并自动审核后,发送处方信息给患者
客户端使用sendPrescription请求发送处方
用receiveChatMsg接收聊天信息即可
代码示例:
// 发送处方
function sendPrescription() {
//向socket服务端发送数据 参数:pageSize: number, lastTime: string, orderId: string
socket.emit('sendPrescription', '276027147277');
}
// 接受处方信息
socket.on('<span class="colour" style="color: rgb(146, 214, 158);">**receiveChatMsg**</span>', event => {
<span class="colour" style="color: rgb(199, 146, 234);">var</span><span class="colour" style="color: rgb(187, 187, 187);"></span><span class="colour" style="color: rgb(222, 124, 132);">str</span><span class="colour" style="color: rgb(187, 187, 187);"></span><span class="colour" style="color: rgb(171, 178, 191);">=</span><span class="colour" style="color: rgb(187, 187, 187);"></span><span class="colour" style="color: rgb(222, 124, 132);">document</span><span class="colour" style="color: rgb(187, 187, 187);">.</span><span class="colour" style="color: rgb(97, 175, 239);">getElementById</span><span class="colour" style="color: rgb(187, 187, 187);">(</span><span class="colour" style="color: rgb(146, 214, 158);">'msgShow'</span><span class="colour" style="color: rgb(187, 187, 187);">).</span><span class="colour" style="color: rgb(222, 124, 132);">innerText</span><span class="colour" style="color: rgb(187, 187, 187);">;</span>
var test = document.createElement('span');
test.appendChild(document.createTextNode(JSON.stringify(event)));
var test2 = document.createElement('p');
document.getElementById('msgShow').appendChild(test).appendChild(test2);
});
请求参数
Query 参数
orderId
string
必需
Header 参数
Content-Type
string
必需
示例值:
application/json
authorization
string
可选
示例值:
{{Btoken}}
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
id
string
聊天消息id
from
string
发送人-医生
fromAvatar
string
发送人头像
to
string
接收人
toAvatar
string
接收人头像
msgType
number
必需
22卡片-处方信息
createTime
string
发送时间
msg
object
聊天内容信息
prescription
object
可选
msgType为22-处方信息
示例
{
"id": "string",
"from": "string",
"fromAvatar": "string",
"to": "string",
"toAvatar": "string",
"msgType": 0,
"createTime": "string",
"msg": {
"prescription": {
"id": "string",
"createTime": "string",
"name": "string",
"recordId": "string",
"gender": 0,
"genderValue": "string",
"age": 0,
"diagnosis": "string",
"status": 1,
"medicines": [
{
"id": "string",
"name": "string",
"amount": "string",
"avatar": "string",
"specs": "string",
"usageDosag": "string",
"prescriptionFlag": 0,
"quantity": 0
}
],
"orderId": "string"
}
}
}
最后修改时间: 10 个月前