|
@ -37,6 +37,7 @@ import com.yihu.wlyy.task.PushMsgTask;
|
|
import com.yihu.wlyy.task.SignUploadTask;
|
|
import com.yihu.wlyy.task.SignUploadTask;
|
|
import com.yihu.wlyy.util.*;
|
|
import com.yihu.wlyy.util.*;
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
|
|
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
@ -118,6 +119,8 @@ public class FamilyContractService extends BaseService {
|
|
private DoctorWorkTimeService doctorWorkTimeService;
|
|
private DoctorWorkTimeService doctorWorkTimeService;
|
|
@Autowired
|
|
@Autowired
|
|
private OperatorLogDao operatorLogDao;
|
|
private OperatorLogDao operatorLogDao;
|
|
|
|
@Autowired
|
|
|
|
private WeiXinOpenIdUtils weiXinOpenIdUtils;
|
|
|
|
|
|
public SignFamily findSignFamilyByCode(String code) {
|
|
public SignFamily findSignFamilyByCode(String code) {
|
|
return signFamilyDao.findByCodeAndType(code, 2);
|
|
return signFamilyDao.findByCodeAndType(code, 2);
|
|
@ -993,8 +996,22 @@ public class FamilyContractService extends BaseService {
|
|
json.put("date", DateUtil.dateToStrShort(sf.getBegin()));
|
|
json.put("date", DateUtil.dateToStrShort(sf.getBegin()));
|
|
json.put("content", content);
|
|
json.put("content", content);
|
|
json.put("remark", ""); //您好,您成功签约家庭医生
|
|
json.put("remark", ""); //您好,您成功签约家庭医生
|
|
// 添加到发送队列
|
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(sf.getOpenid())){
|
|
|
|
// 添加到发送队列
|
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
|
|
|
|
}else{
|
|
|
|
JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(patient.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(patient,j.getInt("relation"),member.getName()));
|
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, member.getOpenid(), member.getName(), json);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new Thread(new SignUploadTask(sf.getCode())).start();
|
|
new Thread(new SignUploadTask(sf.getCode())).start();
|
|
JSONObject participants = new JSONObject();
|
|
JSONObject participants = new JSONObject();
|
|
participants.put(sf.getPatient(),0);
|
|
participants.put(sf.getPatient(),0);
|
|
@ -1217,8 +1234,22 @@ public class FamilyContractService extends BaseService {
|
|
json.put("date", DateUtil.dateToStrShort(new Date()));
|
|
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("remark", "您好,签约家庭医生失败通知");
|
|
json.put("remark", "您好,签约家庭医生失败通知");
|
|
// 添加到发送队列
|
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 2, sf.getOpenid(), sf.getName(), json);
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(sf.getOpenid())){
|
|
|
|
// 添加到发送队列
|
|
|
|
PushMsgTask.getInstance().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"),member.getName()));
|
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 2, member.getOpenid(), member.getName(), json);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.put("status", 2);
|
|
result.put("status", 2);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
@ -1247,7 +1278,20 @@ public class FamilyContractService extends BaseService {
|
|
json.put("content", content);
|
|
json.put("content", content);
|
|
json.put("remark", ""); //您好,您成功签约家庭医生
|
|
json.put("remark", ""); //您好,您成功签约家庭医生
|
|
// 添加到发送队列
|
|
// 添加到发送队列
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
|
|
|
|
|
|
if(StringUtils.isNotBlank(sf.getOpenid())){
|
|
|
|
PushMsgTask.getInstance().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"),member.getName()));
|
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, member.getOpenid(), member.getName(), json);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new Thread(new SignUploadTask(sf.getCode())).start();
|
|
new Thread(new SignUploadTask(sf.getCode())).start();
|
|
JSONObject participants = new JSONObject();
|
|
JSONObject participants = new JSONObject();
|
|
participants.put(sf.getPatient(),0);
|
|
participants.put(sf.getPatient(),0);
|
|
@ -1320,8 +1364,23 @@ public class FamilyContractService extends BaseService {
|
|
json.put("doctorName", sf.getDoctorName());
|
|
json.put("doctorName", sf.getDoctorName());
|
|
json.put("orgName", sf.getHospitalName());
|
|
json.put("orgName", sf.getHospitalName());
|
|
json.put("remark", sf.getName() + ",您好!您的签约医生已同意您的解约申请,解约已生效。");
|
|
json.put("remark", sf.getName() + ",您好!您的签约医生已同意您的解约申请,解约已生效。");
|
|
// 添加到发送队列
|
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 5, sf.getOpenid(), sf.getName(), json);
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(sf.getOpenid())){
|
|
|
|
// 添加到发送队列
|
|
|
|
PushMsgTask.getInstance().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.getInstance().putWxMsg(access_token, 5, member.getOpenid(), member.getName(), json);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
// 更新状态为正常
|
|
// 更新状态为正常
|
|
signFamilyDao.refuseSurrender(patient);
|
|
signFamilyDao.refuseSurrender(patient);
|
|
@ -1334,8 +1393,23 @@ public class FamilyContractService extends BaseService {
|
|
json.put("doctorName", sf.getDoctorName());
|
|
json.put("doctorName", sf.getDoctorName());
|
|
json.put("orgName", sf.getHospitalName());
|
|
json.put("orgName", sf.getHospitalName());
|
|
json.put("remark", sf.getName() + ",您好!您的签约医生拒绝您的解约申请,解约失败。");
|
|
json.put("remark", sf.getName() + ",您好!您的签约医生拒绝您的解约申请,解约失败。");
|
|
// 添加到发送队列
|
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 5, sf.getOpenid(), sf.getName(), json);
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(sf.getOpenid())){
|
|
|
|
// 添加到发送队列
|
|
|
|
PushMsgTask.getInstance().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.getInstance().putWxMsg(access_token, 5, member.getOpenid(), member.getName(), json);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
@ -1940,7 +2014,27 @@ public class FamilyContractService extends BaseService {
|
|
result.put("msg", "更新成功");
|
|
result.put("msg", "更新成功");
|
|
|
|
|
|
for (JSONObject msg : wxMessages) {
|
|
for (JSONObject msg : wxMessages) {
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, p.getOpenid(), p.getName(), msg);
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(p.getOpenid())){
|
|
|
|
PushMsgTask.getInstance().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.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
OperatorLog operatorLog = new OperatorLog();
|
|
OperatorLog operatorLog = new OperatorLog();
|
|
operatorLog.setCreateTime(new Date());
|
|
operatorLog.setCreateTime(new Date());
|