|
@ -238,40 +238,38 @@ public class DoctorFeldsherTemplateService extends BaseService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 拼装医生助手 医生类模板消息 并发送到IM
|
|
|
* @param templateId 微信模板Id
|
|
|
* @param receiver 接收者openid
|
|
|
* @param url 模板跳转链接
|
|
|
* @param first 头消息
|
|
|
* @param remark 备注消息
|
|
|
* @param keywords 消息体
|
|
|
* 拼装医生助手 医生类模板消息并发送
|
|
|
* @param doctorCode 医生code
|
|
|
* @param sessionId 会话Id
|
|
|
* @param sessionType 会话类型
|
|
|
* @param businessType 消息类型
|
|
|
* @param from 发送者
|
|
|
* @param content 消息内容
|
|
|
* @return
|
|
|
*/
|
|
|
public Boolean sendDoctorTemplate(String templateId,String receiver,String url,String first,String remark,String ... keywords) {
|
|
|
try{
|
|
|
public Boolean sendDoctorTemplate(String doctorCode, String sessionId, String sessionType, String businessType, String from, String content) {
|
|
|
try {
|
|
|
String remark = "请进入手机APP查看,如尚未安装APP请点击详情下载安装";
|
|
|
String url = "www.baidu.com";
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
|
|
JSONObject sendJson = new JSONObject();
|
|
|
for (int i=0;i<keywords.length;i++) {
|
|
|
sendJson.put("keyword"+i, keywords[i]);
|
|
|
}
|
|
|
|
|
|
Doctor doctor = doctorDao.findByCode(doctorCode);
|
|
|
String doctorName = doctor.getName();
|
|
|
String doctorOpenId = doctor.getOpenid();
|
|
|
|
|
|
String first = businessType;
|
|
|
sendJson.put("keyword1", content);
|
|
|
sendJson.put("keyword2", dateFormat.format(new Date()));
|
|
|
sendJson.put("first", first);
|
|
|
sendJson.put("remark", remark);
|
|
|
sendJson.put("url", url);//带参数的模板跳转链接
|
|
|
sendJson.put("templateId", templateId);//微信模板Id
|
|
|
|
|
|
JSONObject participants = new JSONObject();
|
|
|
participants.put("system",0);
|
|
|
participants.put(receiver,0);
|
|
|
JSONObject sessionObj = imUtill.createSession(participants,ImUtill.SESSION_TYPE_SYSTEM,"系统消息","");
|
|
|
if(sessionObj.getInt("status")==-1){
|
|
|
throw new RuntimeException(sessionObj.getString("message"));
|
|
|
}
|
|
|
JSONObject session = sessionObj.getJSONObject("data");
|
|
|
// imUtill.sendImMsg("system","系统",session.getString("id"),"1", msg,businessType);
|
|
|
imUtill.sendImMsg("system","系统",session.getString("id"),"1", sendJson.toString(),"1");
|
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, doctorOpenId, doctorName, sendJson);
|
|
|
logger.info("sendJson: " + sendJson);
|
|
|
return true;
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
}
|