|
@ -65,6 +65,8 @@ class WechatClient extends RedisModel {
|
|
|
message.content_type == CONTENT_TYPES.PrescriptionFollowupContent)) {
|
|
|
let patientClient = clientCache.findById(targetUserId);
|
|
|
let doctorClient = clientCache.findByIdAndType(message.sender_id,SOCKET_TYPES.DOCTOR);
|
|
|
let pc_doctorClient = clientCache.findByIdAndType("pc_"+message.sender_id,SOCKET_TYPES.PC_DOCTOR);
|
|
|
var count = 0;
|
|
|
if (patientClient) {
|
|
|
log.warn("User's wechat endpoint is online, sending via web socket. User id: ", targetUserId);
|
|
|
WechatClient.sendViaWebSocket(patientClient.socket, message);
|
|
@ -78,8 +80,24 @@ class WechatClient extends RedisModel {
|
|
|
WechatClient.sendReadDoctor(doctorClient.socket, message);
|
|
|
}
|
|
|
}else{
|
|
|
count++;
|
|
|
}
|
|
|
if(pc_doctorClient){
|
|
|
log.error("doctor sessionid "+pc_doctorClient.sessionId);
|
|
|
log.error("patient sessionid "+patientClient.sessionId);
|
|
|
if(patientClient.sessionId==pc_doctorClient.sessionId){
|
|
|
//用户socket在线,推送给用户后,告知医生此消息已读
|
|
|
WechatClient.updateParticipantLastFetchTime(pc_doctorClient.sessionId, targetUserId, ObjectUtil.timestampToLong(message.timestamp));
|
|
|
WechatClient.sendReadDoctor(pc_doctorClient.socket, message);
|
|
|
}
|
|
|
}else{
|
|
|
count++;
|
|
|
}
|
|
|
|
|
|
if(count==0){
|
|
|
log.error("doctor client not found");
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
log.info("User's wechat endpoint is not online, sending via wechat template message. User id: ", targetUserId);
|
|
|
var isSendWXTem = true;//是否发送微信模板
|