|
@ -14,6 +14,7 @@ import com.yihu.wlyy.entity.message.Message;
|
|
|
import com.yihu.wlyy.entity.message.MessageNoticeSetting;
|
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
|
import com.yihu.wlyy.entity.patient.*;
|
|
|
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
|
|
|
import com.yihu.wlyy.logs.BusinessLogs;
|
|
|
import com.yihu.wlyy.repository.consult.ConsultDao;
|
|
|
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
|
|
@ -23,6 +24,7 @@ import com.yihu.wlyy.repository.message.MessageDao;
|
|
|
import com.yihu.wlyy.repository.organization.HospitalDao;
|
|
|
import com.yihu.wlyy.repository.patient.*;
|
|
|
import com.yihu.wlyy.repository.statistics.WlyySignFamilyCodeDao;
|
|
|
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.service.app.disease.PatientDiseaseService;
|
|
|
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
|
|
@ -163,6 +165,8 @@ public class FamilyContractService extends BaseService {
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
@Autowired
|
|
|
private TrackPatientDao trackPatientDao;
|
|
|
@Autowired
|
|
|
private WechatTemplateConfigDao templateConfigDao;
|
|
|
|
|
|
|
|
|
public SignFamily findSignFamilyByCode(String code) {
|
|
@ -1254,17 +1258,24 @@ public class FamilyContractService extends BaseService {
|
|
|
Doctor doc = doctorDao.findByCode(sf.getDoctor());
|
|
|
Hospital hos = hospitalDao.findByCode(doc.getHospital());
|
|
|
|
|
|
String content = sf.getName() + ",您好!祝贺您,成功签约" + sf.getDoctorName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
|
|
|
WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_sign_success", "self");
|
|
|
String first = templateConfig.getFirst();
|
|
|
String keyword4 = templateConfig.getKeyword4();
|
|
|
keyword4 = keyword4.replace("key1",sf.getName()==null?"":sf.getName()).replace("key2",sf.getDoctorName()==null?"":sf.getDoctorName())
|
|
|
.replace("key3",(hos != null ? hos.getName() : "") ).replace("key4",(hos != null ? hos.getAddress() : ""));
|
|
|
|
|
|
|
|
|
/*String content = sf.getName() + ",您好!祝贺您,成功签约" + sf.getDoctorName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
|
|
|
"为了给您提供更好的服务,请尽快完成缴费。您可点击此条消息,跳转缴费页面完成缴费,或进入签约管理,选择待缴费的签约记录进行缴费操作,如需线下缴费,请尽快到" + (hos != null ? hos.getName() : "") + "社区(地址:" +
|
|
|
(hos != null ? hos.getAddress() : "") + ")缴费。";
|
|
|
(hos != null ? hos.getAddress() : "") + ")缴费。";*/
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", "签约成功通知");
|
|
|
json.put("first", first);
|
|
|
json.put("toUser", sf.getPatient());
|
|
|
json.put("represented", sf.getPatient());//被代理人
|
|
|
json.put("doctor", sf.getDoctor());
|
|
|
json.put("doctorName", sf.getDoctorName());
|
|
|
json.put("date", DateUtil.dateToStrShort(sf.getBegin()));
|
|
|
json.put("content", content);
|
|
|
json.put("content", keyword4);
|
|
|
json.put("remark", ""); //您好,您成功签约家庭医生
|
|
|
// 添加签约code by wjj 2017.7.18
|
|
|
json.put("signCode", signCode);
|
|
@ -1272,21 +1283,9 @@ public class FamilyContractService extends BaseService {
|
|
|
if (StringUtils.isNotBlank(sf.getOpenid())) {
|
|
|
// 添加到发送队列
|
|
|
pushMsgTask.putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
|
|
|
}
|
|
|
// else {
|
|
|
// JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(patient.getCode());
|
|
|
// if (j != null) {
|
|
|
// Patient member = (Patient) j.get("member");
|
|
|
// if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
// //String first = (String) json.get("first");
|
|
|
// json.remove("first");
|
|
|
// json.put("first", weiXinOpenIdUtils.getTitleMes(patient, j.getInt("relation"), sf.getName()));
|
|
|
// pushMsgTask.putWxMsg(access_token, 1, member.getOpenid(), sf.getName(), json);
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
} else{
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
@ -1299,17 +1298,22 @@ public class FamilyContractService extends BaseService {
|
|
|
data.put("represented", member.getCode());
|
|
|
data.put("agent", "1");
|
|
|
|
|
|
String ms = sf.getName() + ",您好!祝贺您,成功签约" + sf.getDoctorName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
|
|
|
templateConfig = templateConfigDao.findByScene("template_sign_success", "agent");
|
|
|
keyword4 = templateConfig.getKeyword4();
|
|
|
keyword4 = keyword4.replace("key1",sf.getName()==null?"":sf.getName()).replace("key2",sf.getDoctorName()==null?"":sf.getDoctorName())
|
|
|
.replace("key3",(hos != null ? hos.getName() : "") ).replace("key4",(hos != null ? hos.getAddress() : ""));
|
|
|
/*String ms = sf.getName() + ",您好!祝贺您,成功签约" + sf.getDoctorName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
|
|
|
"为了给您提供更好的服务,请尽快完成缴费。您可登录签约居民的微信账号,进入签约管理,选择待缴费的签约记录进行缴费操作,如需线下缴费,请尽快到" + (hos != null ? hos.getName() : "") + "社区(地址:" +
|
|
|
(hos != null ? hos.getAddress() : "") + ")缴费。";
|
|
|
(hos != null ? hos.getAddress() : "") + ")缴费。";*/
|
|
|
|
|
|
data.put("content", ms);
|
|
|
data.put("content", keyword4);
|
|
|
//String first = (String) json.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(patient, j.getInt("relation"), patient.getName()));
|
|
|
pushMsgTask.putWxMsg(access_token, 1, member.getOpenid(), patient.getName(), data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
new Thread(new SignUploadTask(sf.getCode(), httpUtil, jwUrl)).start();
|
|
|
JSONObject participants = new JSONObject();
|
|
@ -1553,9 +1557,16 @@ public class FamilyContractService extends BaseService {
|
|
|
if (StringUtils.isNotEmpty(refuseReason)){
|
|
|
sf.setRefuseSpeak(refuseReason);
|
|
|
}
|
|
|
|
|
|
WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_sign_failed","self");
|
|
|
String first = templateConfig.getFirst();
|
|
|
String keyword4 = templateConfig.getKeyword4();
|
|
|
keyword4 = keyword4.replace("key1",(sf.getName()==null?"":sf.getName())).replace("key2",(StringUtils.isEmpty(sf.getDoctor()) ? sf.getDoctorHealthName() : sf.getDoctorName()));
|
|
|
String remark = templateConfig.getRemark();
|
|
|
|
|
|
// 拒绝签约
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", "签约失败通知");
|
|
|
json.put("first",first);
|
|
|
json.put("toUser", sf.getPatient());
|
|
|
json.put("represented", sf.getPatient());//被代理人
|
|
|
json.put("doctor", StringUtils.isEmpty(sf.getDoctor()) ? sf.getDoctorHealth() : sf.getDoctor());
|
|
@ -1563,27 +1574,18 @@ public class FamilyContractService extends BaseService {
|
|
|
json.put("signCode", sf.getCode());
|
|
|
json.put("doctorName", StringUtils.isEmpty(sf.getDoctor()) ? sf.getDoctorHealthName() : sf.getDoctorName());
|
|
|
json.put("date", DateUtil.dateToStrShort(new Date()));
|
|
|
json.put("content", sf.getName() + ",您好!您与 " + (StringUtils.isEmpty(sf.getDoctor()) ? sf.getDoctorHealthName() : sf.getDoctorName()) + " 医生建立家庭医生签约关系失败,请查看!");
|
|
|
// json.put("content", sf.getName() + ",您好!您与 " + (StringUtils.isEmpty(sf.getDoctor()) ? sf.getDoctorHealthName() : sf.getDoctorName()) + " 医生建立家庭医生签约关系失败,请查看!");
|
|
|
json.put("content", keyword4);
|
|
|
if (StringUtils.isNotEmpty(refuseReason)){
|
|
|
json.put("remark", refuseReason);
|
|
|
}else {
|
|
|
json.put("remark", "您好,签约家庭医生失败通知");
|
|
|
json.put("remark", remark);
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(sf.getOpenid())) {
|
|
|
// 添加到发送队列
|
|
|
pushMsgTask.putWxMsg(access_token, 2, sf.getOpenid(), sf.getName(), json);
|
|
|
}
|
|
|
// else {
|
|
|
// JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
|
|
|
// Patient member = (Patient) j.get("member");
|
|
|
// if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
// //String first = (String) json.get("first");
|
|
|
// json.remove("first");
|
|
|
// json.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
// pushMsgTask.putWxMsg(access_token, 2, member.getOpenid(), p.getName(), json);
|
|
|
// }
|
|
|
// }
|
|
|
}else{
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
@ -1599,6 +1601,7 @@ public class FamilyContractService extends BaseService {
|
|
|
pushMsgTask.putWxMsg(access_token, 2, member.getOpenid(), p.getName(), data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
result.put("status", 2);
|
|
@ -1616,18 +1619,25 @@ public class FamilyContractService extends BaseService {
|
|
|
Doctor doc = doctorDao.findByCode(StringUtils.isNotEmpty(doctor) ? sf.getDoctorHealth() : sf.getDoctor());
|
|
|
Hospital hos = hospitalDao.findByCode(doc.getHospital());
|
|
|
|
|
|
String content = sf.getName() + ",您好!祝贺您,成功签约" + doc.getName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
|
|
|
WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_sign_success", "self");
|
|
|
String first = templateConfig.getFirst();
|
|
|
String keyword4 = templateConfig.getKeyword4();
|
|
|
keyword4 = keyword4.replace("key1",sf.getName()==null?"":sf.getName()).replace("key2",sf.getDoctorName()==null?"":sf.getDoctorName())
|
|
|
.replace("key3",(hos != null ? hos.getName() : "") ).replace("key4",(hos != null ? hos.getAddress() : ""));
|
|
|
|
|
|
/*String content = sf.getName() + ",您好!祝贺您,成功签约" + doc.getName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
|
|
|
"为了给您提供更好的服务,请尽快完成缴费。您可点击此条消息,跳转缴费页面完成缴费,或进入签约管理,选择待缴费的签约记录进行缴费操作,如需线下缴费,请尽快到" + (hos != null ? hos.getName() : "") + "社区(地址:" +
|
|
|
(hos != null ? hos.getAddress() : "") + ")缴费。";
|
|
|
(hos != null ? hos.getAddress() : "") + ")缴费。";*/
|
|
|
// 同意签约
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", "签约成功通知");
|
|
|
json.put("first", first);
|
|
|
json.put("toUser", sf.getPatient());
|
|
|
json.put("represented", sf.getPatient());//被代理人
|
|
|
json.put("doctor", doc.getCode());
|
|
|
json.put("doctorName", doc.getName());
|
|
|
json.put("date", DateUtil.dateToStrShort(new Date()));
|
|
|
json.put("content", content);
|
|
|
// json.put("content", content);
|
|
|
json.put("content", keyword4);
|
|
|
json.put("remark", ""); //您好,您成功签约家庭医生
|
|
|
// 添加签约code by wjj 2017.7.18
|
|
|
json.put("signCode", sf.getCode()); //签约code
|
|
@ -1635,38 +1645,34 @@ public class FamilyContractService extends BaseService {
|
|
|
// 添加到发送队列
|
|
|
if (StringUtils.isNotBlank(sf.getOpenid())) {
|
|
|
pushMsgTask.putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
|
|
|
}
|
|
|
// else {
|
|
|
// JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
|
|
|
// Patient member = (Patient) j.get("member");
|
|
|
// if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
// //String first = (String) json.get("first");
|
|
|
// json.remove("first");
|
|
|
// json.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
// pushMsgTask.putWxMsg(access_token, 1, member.getOpenid(), p.getName(), json);
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = json;
|
|
|
}else {
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = json;
|
|
|
// data.remove("toUser");
|
|
|
data.remove("agent");
|
|
|
data.remove("agent");
|
|
|
// data.put("toUser", member.getCode());
|
|
|
data.put("agent", "1");
|
|
|
data.remove("represented");
|
|
|
data.put("represented", member.getCode());
|
|
|
String ms = sf.getName() + ",您好!祝贺您,成功签约" + doc.getName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
|
|
|
"为了给您提供更好的服务,请尽快完成缴费。您可登录签约居民的微信账号,进入签约管理,选择待缴费的签约记录进行缴费操作,如需线下缴费,请尽快到" + (hos != null ? hos.getName() : "") + "社区(地址:" +
|
|
|
(hos != null ? hos.getAddress() : "") + ")缴费。";
|
|
|
data.put("content", ms);
|
|
|
//String first = (String) json.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
pushMsgTask.putWxMsg(access_token, 1, member.getOpenid(), p.getName(), data);
|
|
|
data.put("agent", "1");
|
|
|
data.remove("represented");
|
|
|
data.put("represented", member.getCode());
|
|
|
/*String ms = sf.getName() + ",您好!祝贺您,成功签约" + doc.getName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
|
|
|
"为了给您提供更好的服务,请尽快完成缴费。您可登录签约居民的微信账号,进入签约管理,选择待缴费的签约记录进行缴费操作,如需线下缴费,请尽快到" + (hos != null ? hos.getName() : "") + "社区(地址:" +
|
|
|
(hos != null ? hos.getAddress() : "") + ")缴费。";*/
|
|
|
|
|
|
templateConfig = templateConfigDao.findByScene("template_sign_success", "agent");
|
|
|
keyword4 = templateConfig.getKeyword4();
|
|
|
keyword4 = keyword4.replace("key1",sf.getName()==null?"":sf.getName()).replace("key2",sf.getDoctorName()==null?"":sf.getDoctorName())
|
|
|
.replace("key3",(hos != null ? hos.getName() : "") ).replace("key4",(hos != null ? hos.getAddress() : ""));
|
|
|
data.put("content", keyword4);
|
|
|
//String first = (String) json.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
pushMsgTask.putWxMsg(access_token, 1, member.getOpenid(), p.getName(), data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -1737,91 +1743,82 @@ public class FamilyContractService extends BaseService {
|
|
|
//结束患者家庭签约咨询
|
|
|
consultTeamDao.updateStatusByPatient(patient);
|
|
|
|
|
|
WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_termination","jycg");
|
|
|
String first = templateConfig.getFirst();
|
|
|
String remark = templateConfig.getRemark();
|
|
|
remark = remark.replace("key1",(sf.getName()==null?"":sf.getName()));
|
|
|
|
|
|
// 推送消息消息给微信端
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", "解约申请通知");
|
|
|
json.put("first", first);
|
|
|
json.put("toUser", sf.getPatient());
|
|
|
json.put("represented", sf.getPatient());//被代理人
|
|
|
json.put("date", DateUtil.getStringDateShort());
|
|
|
json.put("doctor", sf.getDoctor());
|
|
|
json.put("doctorName", sf.getDoctorName());
|
|
|
json.put("orgName", sf.getHospitalName());
|
|
|
json.put("remark", sf.getName() + ",您好!您的签约医生已同意您的解约申请,解约已生效。");
|
|
|
// json.put("remark", sf.getName() + ",您好!您的签约医生已同意您的解约申请,解约已生效。");
|
|
|
json.put("remark", remark);
|
|
|
|
|
|
if (StringUtils.isNotBlank(sf.getOpenid())) {
|
|
|
// 添加到发送队列
|
|
|
pushMsgTask.putWxMsg(access_token, 5, sf.getOpenid(), sf.getName(), json);
|
|
|
}
|
|
|
// else {
|
|
|
// JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(patient);
|
|
|
// Patient member = (Patient) j.get("member");
|
|
|
// if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
// String first = (String) json.get("first");
|
|
|
// json.remove("first");
|
|
|
// Patient p = patientDao.findByCode(patient);
|
|
|
// json.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
// pushMsgTask.putWxMsg(access_token, 5, member.getOpenid(), member.getName(), json);
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = json;
|
|
|
data.remove("toUser");
|
|
|
data.put("toUser", member.getCode());
|
|
|
//String first = (String) json.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
pushMsgTask.putWxMsg(access_token, 5, member.getOpenid(), p.getName(), data);
|
|
|
}else {
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = json;
|
|
|
data.remove("toUser");
|
|
|
data.put("toUser", member.getCode());
|
|
|
//String first = (String) json.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
pushMsgTask.putWxMsg(access_token, 5, member.getOpenid(), p.getName(), data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
// 更新状态为正常
|
|
|
WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_termination","jysb");
|
|
|
String first = templateConfig.getFirst();
|
|
|
String remark = templateConfig.getRemark();
|
|
|
remark = remark.replace("key1",(sf.getName()==null?"":sf.getName()));
|
|
|
signFamilyDao.refuseSurrender(patient);
|
|
|
// 拒绝解约,推送消息消息给微信端
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("first", "解约申请通知");
|
|
|
json.put("first", first);
|
|
|
json.put("toUser", sf.getPatient());
|
|
|
json.put("represented", sf.getPatient());//被代理人
|
|
|
json.put("date", DateUtil.getStringDateShort());
|
|
|
json.put("doctor", sf.getDoctor());
|
|
|
json.put("doctorName", sf.getDoctorName());
|
|
|
json.put("orgName", sf.getHospitalName());
|
|
|
json.put("remark", sf.getName() + ",您好!您的签约医生拒绝您的解约申请,解约失败。");
|
|
|
// json.put("remark", sf.getName() + ",您好!您的签约医生拒绝您的解约申请,解约失败。");
|
|
|
json.put("remark", remark);
|
|
|
|
|
|
if (StringUtils.isNotBlank(sf.getOpenid())) {
|
|
|
// 添加到发送队列
|
|
|
pushMsgTask.putWxMsg(access_token, 5, sf.getOpenid(), sf.getName(), json);
|
|
|
}
|
|
|
// else {
|
|
|
// JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(patient);
|
|
|
// Patient member = (Patient) j.get("member");
|
|
|
// if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
// String first = (String) json.get("first");
|
|
|
// json.remove("first");
|
|
|
// Patient p = patientDao.findByCode(patient);
|
|
|
// json.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), member.getName()));
|
|
|
// pushMsgTask.putWxMsg(access_token, 5, member.getOpenid(), member.getName(), json);
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = json;
|
|
|
data.remove("toUser");
|
|
|
data.put("toUser", member.getCode());
|
|
|
//String first = (String) json.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
pushMsgTask.putWxMsg(access_token, 5, member.getOpenid(), p.getName(), data);
|
|
|
}else {
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient(), sf.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = json;
|
|
|
data.remove("toUser");
|
|
|
data.put("toUser", member.getCode());
|
|
|
//String first = (String) json.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
pushMsgTask.putWxMsg(access_token, 5, member.getOpenid(), p.getName(), data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -2332,22 +2329,38 @@ public class FamilyContractService extends BaseService {
|
|
|
doctorTeamDoctor.save(teamMember);
|
|
|
}
|
|
|
|
|
|
WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_change","jgsbg");
|
|
|
String first = templateConfig.getFirst();
|
|
|
first = first.replace("key1",(p.getName()==null?"":p.getName()));
|
|
|
String keyword3 = templateConfig.getKeyword3();
|
|
|
String remark = templateConfig.getRemark();
|
|
|
remark = remark.replace("key1",(docHealth.getName()==null?"":docHealth.getName()));
|
|
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("toUser", patient);
|
|
|
data.put("represented", patient);//被代理人
|
|
|
data.put("doctor", docHealth.getCode());
|
|
|
data.put("doctorName", docHealth.getName());
|
|
|
data.put("first", p.getName() + ",您好!您签约团队的健康管理师已变更,您的新健管师信息如下:");
|
|
|
data.put("keyword3", "家庭医生-健康管理师");
|
|
|
// data.put("first", p.getName() + ",您好!您签约团队的健康管理师已变更,您的新健管师信息如下:");
|
|
|
data.put("first", first);
|
|
|
data.put("keyword3", keyword3);
|
|
|
data.put("keyword2", DateUtil.dateToStrNoSecond(new Date()));
|
|
|
data.put("keyword1", docHealth.getName());
|
|
|
if (StringUtils.isEmpty(signFamily.getDoctor()) || docHealth.getCode().equals(signFamily.getDoctor())) {
|
|
|
data.put("remark", remark);
|
|
|
/*if (StringUtils.isEmpty(signFamily.getDoctor()) || docHealth.getCode().equals(signFamily.getDoctor())) {
|
|
|
data.put("remark", docHealth.getName() + "健管师将继续为您提供优质健康服务");
|
|
|
} else {
|
|
|
data.put("remark", docHealth.getName() + "健管师将继续为您提供优质健康服务");
|
|
|
}
|
|
|
}*/
|
|
|
wxMessages.add(data);
|
|
|
} else {
|
|
|
WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_change","jgsxz");
|
|
|
String first = templateConfig.getFirst();
|
|
|
first = first.replace("key1",(p.getName()==null?"":p.getName()));
|
|
|
String keyword3 = templateConfig.getKeyword3();
|
|
|
String remark = templateConfig.getRemark();
|
|
|
remark = remark.replace("key1",(docHealth.getName()==null?"":docHealth.getName()));
|
|
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("toUser", patient);
|
|
|
data.put("represented", patient);//被代理人
|
|
@ -2358,9 +2371,14 @@ public class FamilyContractService extends BaseService {
|
|
|
data.put("keyword2", DateUtil.dateToStrNoSecond(new Date()));
|
|
|
data.put("keyword1", docHealth.getName());
|
|
|
if (StringUtils.isEmpty(signFamily.getDoctor()) || docHealth.getCode().equals(signFamily.getDoctor())) {
|
|
|
data.put("remark", docHealth.getName() + "健管师将继续为您提供优质健康服务");
|
|
|
// data.put("remark", docHealth.getName() + "健管师将继续为您提供优质健康服务");
|
|
|
data.put("remark", remark);
|
|
|
} else {
|
|
|
data.put("remark", docHealth.getName() + "健管师与" + signFamily.getDoctorName() + "医生一道,为您提供优质健康服务");
|
|
|
templateConfig = templateConfigDao.findByScene("template_doctor_change","jgsxzqk");
|
|
|
remark = templateConfig.getRemark();
|
|
|
remark = remark.replace("key1",(docHealth.getName()==null?"":docHealth.getName())).replace("key2",(signFamily.getDoctorName()==null?"":signFamily.getDoctorName()));
|
|
|
data.put("remark", remark);
|
|
|
// data.put("remark", docHealth.getName() + "健管师与" + signFamily.getDoctorName() + "医生一道,为您提供优质健康服务");
|
|
|
}
|
|
|
wxMessages.add(data);
|
|
|
try {
|
|
@ -2448,20 +2466,29 @@ public class FamilyContractService extends BaseService {
|
|
|
signFamily.setDoctorName(docQk.getName());
|
|
|
signFamily.setCzrq(new Date());
|
|
|
|
|
|
WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_change","qkxz");
|
|
|
String first = templateConfig.getFirst();
|
|
|
first = first.replace("key1",(p.getName()==null?"":p.getName()));
|
|
|
String keyword3 = templateConfig.getKeyword3();
|
|
|
String remark = templateConfig.getRemark();
|
|
|
remark = remark.replace("key1",(docQk.getName()==null?"":docQk.getName()));
|
|
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("toUser", patient);
|
|
|
data.put("represented", patient);//被代理人
|
|
|
data.put("doctor", docQk.getCode());
|
|
|
data.put("doctorName", docQk.getName());
|
|
|
data.put("first", p.getName() + ",您好!您签约团队的全科医生已变更,您的新全科医生信息如下:");
|
|
|
data.put("keyword3", "家庭医生-全科医生");
|
|
|
// data.put("first", p.getName() + ",您好!您签约团队的全科医生已变更,您的新全科医生信息如下:");
|
|
|
data.put("first", first);
|
|
|
data.put("keyword3", keyword3);
|
|
|
data.put("keyword2", DateUtil.dateToStrNoSecond(new Date()));
|
|
|
data.put("keyword1", docQk.getName());
|
|
|
if (StringUtils.isEmpty(signFamily.getDoctorHealth()) || signFamily.getDoctor().equals(signFamily.getDoctorHealth())) {
|
|
|
data.put("remark", remark);
|
|
|
/*if (StringUtils.isEmpty(signFamily.getDoctorHealth()) || signFamily.getDoctor().equals(signFamily.getDoctorHealth())) {
|
|
|
data.put("remark", docQk.getName() + "医生将专门为您提供优质健康服务");
|
|
|
} else {
|
|
|
data.put("remark", docQk.getName() + "医生将继续为您提供优质健康服务");
|
|
|
}
|
|
|
}*/
|
|
|
wxMessages.add(data);
|
|
|
}
|
|
|
|
|
@ -2482,36 +2509,21 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
if (StringUtils.isNotBlank(p.getOpenid())) {
|
|
|
pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 10, p.getOpenid(), p.getName(), msg);
|
|
|
}
|
|
|
// else {
|
|
|
// //如果自己没有绑定,则发给家人
|
|
|
// JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
|
|
|
// Patient member = (Patient) j.get("member");
|
|
|
// if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
// String first = (String) msg.get("first");
|
|
|
// msg.remove("first");
|
|
|
//
|
|
|
// try {
|
|
|
// msg.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), member.getName()));
|
|
|
// } catch (Exception e) {
|
|
|
// e.printStackTrace();
|
|
|
// }
|
|
|
// pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), msg);
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = msg;
|
|
|
data.remove("toUser");
|
|
|
data.put("toUser", member.getCode());
|
|
|
String first = (String) data.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), p.getName(), data);
|
|
|
}else {
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid());
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
JSONObject data = msg;
|
|
|
data.remove("toUser");
|
|
|
data.put("toUser", member.getCode());
|
|
|
String first = (String) data.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
|
|
|
pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), p.getName(), data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|