|
@ -341,10 +341,11 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
|
|
|
String msgHead = doctor.getName() + "医生给您发来了一篇患教文章";
|
|
|
String endMsg = "为了您的健康," + doctor.getName() + "医生给您发送了一篇患教文章,请仔细查阅,如有问题,可随时咨询医生。";
|
|
|
JSONArray messages = new JSONArray();
|
|
|
Map<String, Map<String, Object>> msgs = new HashMap<>();
|
|
|
for (String p : patientSet) {
|
|
|
Patient patientTemp = patientService.findByCode(p);
|
|
|
SignFamily signFamily = signFamilyDao.findByjiatingPatient(p);
|
|
|
if(signFamily == null){
|
|
|
if (signFamily == null) {
|
|
|
throw new Exception("can not find patient's family sign info");
|
|
|
}
|
|
|
for (String a : articles) {
|
|
@ -391,7 +392,11 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
|
|
|
json.put("doctorName", doctor.getName());
|
|
|
json.put("date", DateUtil.dateToStrLong(DateUtil.getNowDate()));
|
|
|
json.put("remark", endMsg);
|
|
|
PushMsgTask.getInstance().putWxMsg(getAccessToken(), 9, patientTemp.getOpenid(), patientTemp.getName(), json);
|
|
|
Map<String, Object> content = new HashMap<>();
|
|
|
content.put("openid", patientTemp.getOpenid());
|
|
|
content.put("name", patientTemp.getName());
|
|
|
content.put("json", json);
|
|
|
msgs.put(patientTemp.getCode(), content);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -400,6 +405,14 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
|
|
|
if (row <= 0) {
|
|
|
return error(-1, "发送失败!");
|
|
|
} else {
|
|
|
for (String key : msgs.keySet()) {
|
|
|
Map<String,Object> map = msgs.get(key);
|
|
|
PushMsgTask.getInstance().putWxMsg(getAccessToken(), 9,
|
|
|
map.get("openid") == null ? "":map.get("openid").toString(),
|
|
|
map.get("name") == null ? "":map.get("name").toString(),
|
|
|
(JSONObject) map.get("json"));
|
|
|
}
|
|
|
|
|
|
// 推送消息给患者
|
|
|
PushMsgTask.getInstance().put(messages);
|
|
|
return success("发送成功!");
|