|
@ -1,7 +1,6 @@
|
|
|
package com.yihu.wlyy.service.app.sign;
|
|
|
|
|
|
import com.yihu.wlyy.entity.consult.ConsultTeam;
|
|
|
import com.yihu.wlyy.entity.dict.SystemDict;
|
|
|
import com.yihu.wlyy.entity.doctor.OperatorLog;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.DoctorService;
|
|
@ -32,11 +31,9 @@ import com.yihu.wlyy.task.SignUploadTask;
|
|
|
import com.yihu.wlyy.util.*;
|
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
|
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
|
|
|
import org.apache.commons.beanutils.BeanUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.CachedIntrospectionResults;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
@ -1412,6 +1409,7 @@ public class FamilyContractService extends BaseService {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("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());
|
|
@ -1421,19 +1419,36 @@ public class FamilyContractService extends BaseService {
|
|
|
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"), p.getName()));
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 5, member.getOpenid(), member.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.getInstance().putWxMsg(access_token, 5, member.getOpenid(), member.getName(), json);
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient());
|
|
|
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");
|
|
|
if(StringUtils.isNotBlank(member.getOpenid())){
|
|
|
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"),member.getName()));
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 5, member.getOpenid(), member.getName(), data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
} else {
|
|
|
// 更新状态为正常
|
|
|
signFamilyDao.refuseSurrender(patient);
|
|
@ -1441,6 +1456,7 @@ public class FamilyContractService extends BaseService {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("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());
|
|
@ -1450,19 +1466,37 @@ public class FamilyContractService extends BaseService {
|
|
|
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 {
|
|
|
// 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);
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(sf.getPatient());
|
|
|
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");
|
|
|
if(StringUtils.isNotBlank(member.getOpenid())){
|
|
|
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"),member.getName()));
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 5, member.getOpenid(), member.getName(), data);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
@ -1871,7 +1905,7 @@ public class FamilyContractService extends BaseService {
|
|
|
* @param healthDoctor 健康管理师code
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject updateSignInfo(String patient, String healthDoctor, String doctor, String expensesType, String loginUser) {
|
|
|
public JSONObject updateSignInfo(String patient, String healthDoctor, String doctor, String expensesType, String loginUser) throws Exception{
|
|
|
JSONObject result = new JSONObject();
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
|
|
@ -2038,6 +2072,7 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
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() + ",您好!因签约团队内分工调整,您的责任医生有变动," + oldDoctorName +
|
|
@ -2070,24 +2105,41 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
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();
|
|
|
}
|
|
|
// 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);
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode());
|
|
|
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");
|
|
|
if(StringUtils.isNotBlank(member.getOpenid())){
|
|
|
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"),member.getName()));
|
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), data);
|
|
|
}
|
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), msg);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
OperatorLog operatorLog = new OperatorLog();
|
|
|
operatorLog.setCreateTime(new Date());
|