|
@ -371,71 +371,75 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
|
|
String batchNo = UUID.randomUUID().toString();
|
|
String batchNo = UUID.randomUUID().toString();
|
|
Date createTime = new Date();
|
|
Date createTime = new Date();
|
|
for (String p : patientSet) {
|
|
for (String p : patientSet) {
|
|
Patient patientTemp = patientService.findByCode(p);
|
|
|
|
SignFamily signFamily = signFamilyDao.findByjiatingPatient(p);
|
|
|
|
if (signFamily == null) {
|
|
|
|
throw new Exception("can not find patient's family sign info");
|
|
|
|
}
|
|
|
|
for (String a : articles) {
|
|
|
|
// 查询文章信息
|
|
|
|
HealthEduArticle temp = maps.get(a);
|
|
|
|
if (temp == null) {
|
|
|
|
temp = healthEduArticleService.findArticleByCode(a);
|
|
|
|
// 添加到缓存
|
|
|
|
maps.put(a, temp);
|
|
|
|
|
|
try{
|
|
|
|
Patient patientTemp = patientService.findByCode(p);
|
|
|
|
SignFamily signFamily = signFamilyDao.findByjiatingPatient(p);
|
|
|
|
if (signFamily == null) {
|
|
|
|
throw new Exception("can not find patient's family sign info");
|
|
}
|
|
}
|
|
|
|
for (String a : articles) {
|
|
|
|
// 查询文章信息
|
|
|
|
HealthEduArticle temp = maps.get(a);
|
|
|
|
if (temp == null) {
|
|
|
|
temp = healthEduArticleService.findArticleByCode(a);
|
|
|
|
// 添加到缓存
|
|
|
|
maps.put(a, temp);
|
|
|
|
}
|
|
|
|
|
|
HealthEduArticlePatient heap = new HealthEduArticlePatient();
|
|
|
|
// 设置文章标识
|
|
|
|
heap.setArticle(a);
|
|
|
|
// 设置文章简介
|
|
|
|
//heap.setContent(temp.getContent());
|
|
|
|
// 设置文章标题
|
|
|
|
//heap.setTitle(temp.getTitle());
|
|
|
|
// 设置文章查看URL
|
|
|
|
//heap.setUrl(temp.getUrl());
|
|
|
|
// 设置发送时间
|
|
|
|
heap.setCzrq(new Date());
|
|
|
|
// 设置医生标识
|
|
|
|
heap.setDoctor(doctor.getCode());
|
|
|
|
// 设置医生姓名
|
|
|
|
heap.setDoctorName(doctor.getName());
|
|
|
|
// 设置患者标识
|
|
|
|
heap.setPatient(p);
|
|
|
|
// 设置为示读
|
|
|
|
heap.setRead(1);
|
|
|
|
// 签约类型
|
|
|
|
heap.setSignType(2);
|
|
|
|
// 行政团队
|
|
|
|
heap.setAdminTeamCode(signFamily.getAdminTeamId());
|
|
|
|
//附加内容
|
|
|
|
heap.setAttachedContent(attachedContent);
|
|
|
|
//批次号记录发送批次
|
|
|
|
heap.setBatchNo(batchNo);
|
|
|
|
//创建时间
|
|
|
|
heap.setCzrq(createTime);
|
|
|
|
heap.setSignCode(patientService.getSignCodeByPatient(p));
|
|
|
|
list.add(heap);
|
|
|
|
consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, "{\"title\":\"" + temp.getTitle()+ "\",\"type\":0,\"id\":\"" + temp.getCode() + "\",\"img\":\"" + temp.getUrl() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4", patientTemp.getName());
|
|
|
|
if(StringUtils.isNotBlank(attachedContent)){
|
|
|
|
//发送备注
|
|
|
|
consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, attachedContent, ImUtill.CONTENT_TYPE_TEXT, patientTemp.getName());
|
|
|
|
|
|
HealthEduArticlePatient heap = new HealthEduArticlePatient();
|
|
|
|
// 设置文章标识
|
|
|
|
heap.setArticle(a);
|
|
|
|
// 设置文章简介
|
|
|
|
//heap.setContent(temp.getContent());
|
|
|
|
// 设置文章标题
|
|
|
|
//heap.setTitle(temp.getTitle());
|
|
|
|
// 设置文章查看URL
|
|
|
|
//heap.setUrl(temp.getUrl());
|
|
|
|
// 设置发送时间
|
|
|
|
heap.setCzrq(new Date());
|
|
|
|
// 设置医生标识
|
|
|
|
heap.setDoctor(doctor.getCode());
|
|
|
|
// 设置医生姓名
|
|
|
|
heap.setDoctorName(doctor.getName());
|
|
|
|
// 设置患者标识
|
|
|
|
heap.setPatient(p);
|
|
|
|
// 设置为示读
|
|
|
|
heap.setRead(1);
|
|
|
|
// 签约类型
|
|
|
|
heap.setSignType(2);
|
|
|
|
// 行政团队
|
|
|
|
heap.setAdminTeamCode(signFamily.getAdminTeamId());
|
|
|
|
//附加内容
|
|
|
|
heap.setAttachedContent(attachedContent);
|
|
|
|
//批次号记录发送批次
|
|
|
|
heap.setBatchNo(batchNo);
|
|
|
|
//创建时间
|
|
|
|
heap.setCzrq(createTime);
|
|
|
|
heap.setSignCode(patientService.getSignCodeByPatient(p));
|
|
|
|
list.add(heap);
|
|
|
|
consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, "{\"title\":\"" + temp.getTitle()+ "\",\"type\":0,\"id\":\"" + temp.getCode() + "\",\"img\":\"" + temp.getUrl() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4", patientTemp.getName());
|
|
|
|
if(StringUtils.isNotBlank(attachedContent)){
|
|
|
|
//发送备注
|
|
|
|
consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, attachedContent, ImUtill.CONTENT_TYPE_TEXT, patientTemp.getName());
|
|
|
|
}
|
|
|
|
// 推送消息给微信端
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
json.put("first", patientTemp.getName() + ",您好!\n" + msgHead);
|
|
|
|
json.put("toUser", p);
|
|
|
|
json.put("article", temp.getCode() + "");
|
|
|
|
json.put("title", temp.getTitle());
|
|
|
|
json.put("doctorName", doctor.getName());
|
|
|
|
json.put("date", DateUtil.dateToStrLong(DateUtil.getNowDate()));
|
|
|
|
json.put("remark", endMsg);
|
|
|
|
Map<String, Object> content = new HashMap<>();
|
|
|
|
content.put("openid", patientTemp.getOpenid());
|
|
|
|
content.put("name", patientTemp.getName());
|
|
|
|
content.put("json", json);
|
|
|
|
content.put("code",patientTemp.getCode());
|
|
|
|
msgs.put(patientTemp.getCode(), content);
|
|
}
|
|
}
|
|
// 推送消息给微信端
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
json.put("first", patientTemp.getName() + ",您好!\n" + msgHead);
|
|
|
|
json.put("toUser", p);
|
|
|
|
json.put("article", temp.getCode() + "");
|
|
|
|
json.put("title", temp.getTitle());
|
|
|
|
json.put("doctorName", doctor.getName());
|
|
|
|
json.put("date", DateUtil.dateToStrLong(DateUtil.getNowDate()));
|
|
|
|
json.put("remark", endMsg);
|
|
|
|
Map<String, Object> content = new HashMap<>();
|
|
|
|
content.put("openid", patientTemp.getOpenid());
|
|
|
|
content.put("name", patientTemp.getName());
|
|
|
|
content.put("json", json);
|
|
|
|
content.put("code",patientTemp.getCode());
|
|
|
|
msgs.put(patientTemp.getCode(), content);
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
error(e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 保存到数据库
|
|
// 保存到数据库
|