function getMsgHistory() {
//向socket服务端发送数据 参数:pageSize: number, lastTime: string, orderId: string
socket.emit('getChatMsgList', 20, '2022-08-26 ', '276027147277');
}
socket.on('chatMsgList', event => {
var str = document.getElementById('msgShowHistory').innerText;
var test = document.createElement('span');
// 返回的聊天记录信息
test.appendChild(document.createTextNode(JSON.stringify(event)));
var test2 = document.createElement('p');
document
.getElementById('msgShowHistory')
.appendChild(test)
.appendChild(test2);
});curl --location --request GET 'https://consult-api.itheima.net/chatMsgList?pageSize&lastTime=&orderId=' \
--header 'Content-Type: application/json'{
"success": true,
"code": 0,
"message": "string",
"data": [
{
"sid": "string",
"orderId": "string",
"createTime": "string",
"items": [
{
"id": "string",
"from": "string",
"to": "string",
"msgType": 0,
"msg": {
"consultRecord": {
"id": "string",
"orderNo": "string",
"type": "string",
"createTime": "string",
"illnessDesc": "string",
"illnessTime": 0,
"consultFlag": 0,
"liverFunction": 0,
"renalFunction": 0,
"allergicHistory": 0,
"fertilityStatus": 0,
"patientInfo": {
"id": "string",
"name": "string",
"idCard": "string",
"gender": 0,
"age": "string"
},
"medicines": [
{
"id": "string",
"name": "string",
"specs": "string",
"usageDosag": "string",
"quantity": 0
}
],
"pictures": [
{
"id": "string",
"url": "string"
}
]
},
"prescription": {
"id": "string",
"createTime": "string",
"name": "string",
"recordId": "string",
"gender": 0,
"age": "string",
"diagnosis": "string",
"status": 1,
"medicines": [
{
"id": "string",
"name": "string",
"amount": "string",
"avatar": "string",
"specs": "string",
"usageDosag": "string",
"prescriptionFlag": "string",
"quantity": 0
}
],
"orderId": "string"
},
"content": "string",
"picture": {
"id": "string",
"url": "string"
},
"evaluateDoc\t": {
"id": "string",
"score": 0,
"content": "string",
"createTime": "string",
"creator": "string"
}
}
}
]
}
]
}