|
@ -1,18 +1,16 @@
|
|
|
package com.yihu.wlyy.service.app.account;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
import com.yihu.wlyy.entity.address.City;
|
|
|
import com.yihu.wlyy.entity.address.Province;
|
|
|
import com.yihu.wlyy.entity.address.Town;
|
|
|
import com.yihu.wlyy.entity.consult.Consult;
|
|
|
import com.yihu.wlyy.entity.consult.ConsultTeam;
|
|
|
import com.yihu.wlyy.entity.doctor.OperatorLog;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroup;
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
|
|
|
import com.yihu.wlyy.entity.doctor.OperatorLog;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.entity.patient.WlyyPatientSick;
|
|
@ -22,20 +20,17 @@ import com.yihu.wlyy.repository.address.TownDao;
|
|
|
import com.yihu.wlyy.repository.consult.ConsultDao;
|
|
|
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
|
|
|
import com.yihu.wlyy.repository.consult.ConsultTeamDoctorDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
|
|
|
import com.yihu.wlyy.repository.doctor.OperatorLogDao;
|
|
|
import com.yihu.wlyy.repository.doctor.*;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientSickDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
|
|
|
import com.yihu.wlyy.service.app.talk.TalkGroupService;
|
|
|
import com.yihu.wlyy.service.common.SMSService;
|
|
|
import com.yihu.wlyy.service.common.account.PatientService;
|
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.EncodesUtil;
|
|
|
import com.yihu.wlyy.util.ImUtill;
|
|
|
import com.yihu.wlyy.util.MD5;
|
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
@ -47,7 +42,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.domain.Sort.Direction;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
@ -57,8 +51,7 @@ import org.springside.modules.persistence.DynamicSpecifications;
|
|
|
import org.springside.modules.persistence.SearchFilter;
|
|
|
import org.springside.modules.persistence.SearchFilter.Operator;
|
|
|
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.util.EncodesUtil;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 医生基本信息类.
|
|
@ -864,6 +857,7 @@ public class DoctorInfoService extends BaseService {
|
|
|
}
|
|
|
} else {
|
|
|
data.put("toUser", patient);
|
|
|
data.put("represented",patient);//被代理人
|
|
|
data.put("doctor", newD.getCode());
|
|
|
data.put("doctorName", newD.getName());
|
|
|
data.put("first", p.getName() + ",您好!您的签约团队已为您新增一位责任医生,医生信息如下:");
|
|
@ -880,19 +874,35 @@ public class DoctorInfoService extends BaseService {
|
|
|
//判断是否判定openId,有没有发则查找家人发送
|
|
|
if (StringUtils.isNotBlank(p.getOpenid())) {
|
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, p.getOpenid(), p.getName(), data);
|
|
|
} else {
|
|
|
JSONObject json = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
|
|
|
Patient member = (Patient) json.get("member");
|
|
|
if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
String first = (String) data.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, json.getInt("relation"), member.getName()) + first);
|
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), data);
|
|
|
|
|
|
}
|
|
|
// else {
|
|
|
// JSONObject json = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
|
|
|
// Patient member = (Patient) json.get("member");
|
|
|
// if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
// String first = (String) data.get("first");
|
|
|
// data.remove("first");
|
|
|
// data.put("first", weiXinOpenIdUtils.getTitleMes(p, json.getInt("relation"), member.getName()) + first);
|
|
|
// PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), data);
|
|
|
//
|
|
|
// }
|
|
|
// }
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode());
|
|
|
if(jsonArray!=null&&jsonArray.length()>0){
|
|
|
String first = (String) data.get("first");
|
|
|
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 json = data;
|
|
|
json.remove("toUser");
|
|
|
json.put("toUser",member.getCode());
|
|
|
json.remove("first");
|
|
|
json.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),member.getName())+first);
|
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), json);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@ -981,6 +991,7 @@ public class DoctorInfoService extends BaseService {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("toUser", patient);
|
|
|
data.put("represented",patient);//被代理人
|
|
|
data.put("doctor", newD.getCode());
|
|
|
data.put("doctorName", newD.getName());
|
|
|
data.put("first", p.getName() + ",您好!您的签约团队已为您新增一位责任医生,医生信息如下:");
|
|
@ -995,15 +1006,34 @@ public class DoctorInfoService extends BaseService {
|
|
|
|
|
|
if (StringUtils.isNotBlank(p.getOpenid())) {
|
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, p.getOpenid(), p.getName(), data);
|
|
|
} else {
|
|
|
JSONObject json = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
|
|
|
Patient member = (Patient) json.get("member");
|
|
|
|
|
|
if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
String first = (String) data.get("first");
|
|
|
data.remove("first");
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, json.getInt("relation"), member.getName()) + first);
|
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), data);
|
|
|
}
|
|
|
// else {
|
|
|
// JSONObject json = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
|
|
|
// Patient member = (Patient) json.get("member");
|
|
|
//
|
|
|
// if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
// String first = (String) data.get("first");
|
|
|
// data.remove("first");
|
|
|
// data.put("first", weiXinOpenIdUtils.getTitleMes(p, json.getInt("relation"), member.getName()) + first);
|
|
|
// PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), data);
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
//发送代理人
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode());
|
|
|
if(jsonArray!=null&&jsonArray.length()>0){
|
|
|
String first = (String) data.get("first");
|
|
|
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 json = data;
|
|
|
json.remove("toUser");
|
|
|
json.put("toUser",member.getCode());
|
|
|
json.remove("first");
|
|
|
json.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),member.getName())+first);
|
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), json);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return 1;
|
|
@ -1184,6 +1214,7 @@ public class DoctorInfoService extends BaseService {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("toUser", patient);
|
|
|
data.put("represented",patient);//被代理人
|
|
|
data.put("doctor", newD.getCode());
|
|
|
data.put("doctorName", newD.getName());
|
|
|
data.put("keyword3", "家庭医生");
|
|
@ -1199,16 +1230,34 @@ public class DoctorInfoService extends BaseService {
|
|
|
data.put("first", p.getName() + ",您好!因签约团队内分工调整,您的责任医生有变动," + oldDoctorName +
|
|
|
"医生无法继续为您服务,具体变动如下:");
|
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, p.getOpenid(), p.getName(), data);
|
|
|
} else {
|
|
|
//如果自己没有绑定,则发给家人
|
|
|
JSONObject json = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
|
|
|
Patient member = (Patient) json.get("member");
|
|
|
if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) json.get("relation"), member.getName()) + p.getName() + ",您好!因签约团队内分工调整,您的责任医生有变动," + oldDoctorName +
|
|
|
"医生无法继续为您服务,具体变动如下:");
|
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), data);
|
|
|
}
|
|
|
}
|
|
|
// else {
|
|
|
// //如果自己没有绑定,则发给家人
|
|
|
// JSONObject json = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
|
|
|
// Patient member = (Patient) json.get("member");
|
|
|
// if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
// data.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) json.get("relation"), member.getName()) + p.getName() + ",您好!因签约团队内分工调整,您的责任医生有变动," + oldDoctorName +
|
|
|
// "医生无法继续为您服务,具体变动如下:");
|
|
|
// PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), data);
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
//发送代理人
|
|
|
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 json = data;
|
|
|
json.remove("toUser");
|
|
|
json.put("toUser",member.getCode());
|
|
|
json.remove("first");
|
|
|
json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) json.get("relation"), member.getName()) + p.getName() + ",您好!因签约团队内分工调整,您的责任医生有变动," + oldDoctorName +
|
|
|
"医生无法继续为您服务,具体变动如下:");
|
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), json);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|