|
@ -253,7 +253,7 @@ class WechatClient extends RedisModel {
|
|
|
},
|
|
|
// 获取议题信息
|
|
|
function (map, callback) {
|
|
|
TopicRepo.findLastTopicStatus(message.session_id, function (err, res) {
|
|
|
TopicRepo.findLastTopicStatusAndType(message.session_id, function (err, res) {
|
|
|
if (err) {
|
|
|
ModelUtil.logError("Get topic failed", err);
|
|
|
return;
|
|
@ -284,6 +284,7 @@ class WechatClient extends RedisModel {
|
|
|
map.delete("openid");
|
|
|
let mainOpenId = patient.openid;
|
|
|
let agent = topic.agent;
|
|
|
let url = config.wechatConfig.baseUrl + "/wx/html/yszx/html/consulting-doctor.html";
|
|
|
if(agent){//代理人发起的议题
|
|
|
var agentOpenid = "";
|
|
|
if(map.size>0){
|
|
@ -297,7 +298,7 @@ class WechatClient extends RedisModel {
|
|
|
WechatSDK.sendTemplateMessage({
|
|
|
touser: openid,
|
|
|
template_id: config.wechatConfig.template.consultTemplate,
|
|
|
url: config.wechatConfig.baseUrl + "/wx/html/yszx/html/consulting-doctor.html?openid=" + openid +
|
|
|
url: url + "?openid=" + openid + "&type="+topic.type+"&doctor="+message.sender_id+
|
|
|
"&consult=" + topic.id + "&toUser=" + member.code + "&toName=" + member.name+"&represented="+patient.code,
|
|
|
data: {
|
|
|
first: {value: first, color: "#000000"}
|
|
@ -313,13 +314,12 @@ class WechatClient extends RedisModel {
|
|
|
}
|
|
|
}
|
|
|
if(mainOpenId!=agentOpenid){
|
|
|
var openid = mainOpenId;
|
|
|
var first = "您的健康咨询有新的回复";
|
|
|
// 发送模板消息
|
|
|
WechatSDK.sendTemplateMessage({
|
|
|
touser: openid,
|
|
|
touser: mainOpenId,
|
|
|
template_id: config.wechatConfig.template.consultTemplate,
|
|
|
url: config.wechatConfig.baseUrl + "/wx/html/yszx/html/consulting-doctor.html?openid=" + openid +
|
|
|
url: url + "?openid=" + mainOpenId +"&type="+topic.type+"&doctor="+message.sender_id+
|
|
|
"&consult=" + topic.id + "&toUser=" + targetUserId + "&toName=" + targetUserName+"&represented="+patient.code,
|
|
|
data: {
|
|
|
first: {value: first, color: "#000000"}
|
|
@ -338,7 +338,7 @@ class WechatClient extends RedisModel {
|
|
|
WechatSDK.sendTemplateMessage({
|
|
|
touser: mainOpenId,
|
|
|
template_id: config.wechatConfig.template.consultTemplate,
|
|
|
url: config.wechatConfig.baseUrl + "/wx/html/yszx/html/consulting-doctor.html?openid=" + mainOpenId +
|
|
|
url: url + "?openid=" + mainOpenId +"&type="+topic.type+"&doctor="+message.sender_id+
|
|
|
"&consult=" + topic.id + "&toUser=" + targetUserId + "&toName=" + targetUserName+"&represented="+patient.code,
|
|
|
data: {
|
|
|
first: {value: "您的健康咨询有新的回复", color: "#000000"}
|
|
@ -360,7 +360,7 @@ class WechatClient extends RedisModel {
|
|
|
WechatSDK.sendTemplateMessage({
|
|
|
touser: openid,
|
|
|
template_id: config.wechatConfig.template.consultTemplate,
|
|
|
url: config.wechatConfig.baseUrl + "/wx/html/yszx/html/consulting-doctor.html?openid=" + openid +
|
|
|
url: url + "?openid=" + openid +"&type="+topic.type+"&doctor="+message.sender_id+
|
|
|
"&consult=" + topic.id + "&toUser=" + member.code + "&toName=" + member.name+"&represented="+patient.code,
|
|
|
data: {
|
|
|
first: {value: first, color: "#000000"}
|