|
@ -241,11 +241,12 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据医生和患者获取患者的签约状态
|
|
* 根据医生和患者获取患者的签约状态
|
|
|
|
*
|
|
* @param patient
|
|
* @param patient
|
|
* @param doctor
|
|
* @param doctor
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public List<SignFamily> getSign(String patient,String doctor){
|
|
|
|
|
|
public List<SignFamily> getSign(String patient, String doctor) {
|
|
List<SignFamily> sfList = signFamilyDao.findSSandFamilyByDoctorPatient(patient, doctor);
|
|
List<SignFamily> sfList = signFamilyDao.findSSandFamilyByDoctorPatient(patient, doctor);
|
|
return sfList;
|
|
return sfList;
|
|
}
|
|
}
|
|
@ -528,8 +529,8 @@ public class FamilyContractService extends BaseService {
|
|
/**
|
|
/**
|
|
* 申请签约
|
|
* 申请签约
|
|
*
|
|
*
|
|
* @param doctor 签约医生
|
|
|
|
* @param patient 居民code
|
|
|
|
|
|
* @param doctor 签约医生
|
|
|
|
* @param patient 居民code
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public int sign(String doctor, String patient) throws Exception {
|
|
public int sign(String doctor, String patient) throws Exception {
|
|
@ -996,38 +997,38 @@ 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", ""); //您好,您成功签约家庭医生
|
|
if(StringUtils.isNotBlank(sf.getOpenid())){
|
|
|
|
|
|
if (StringUtils.isNotBlank(sf.getOpenid())) {
|
|
// 添加到发送队列
|
|
// 添加到发送队列
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
|
|
}else{
|
|
|
|
|
|
} else {
|
|
JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(patient.getCode());
|
|
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");
|
|
|
|
|
|
if (j != null) {
|
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
|
if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
|
String first = (String) json.get("first");
|
|
json.remove("first");
|
|
json.remove("first");
|
|
json.put("first",weiXinOpenIdUtils.getTitleMes(patient,j.getInt("relation"),member.getName()));
|
|
|
|
|
|
json.put("first", weiXinOpenIdUtils.getTitleMes(patient, j.getInt("relation"), member.getName()));
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, member.getOpenid(), member.getName(), json);
|
|
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);
|
|
|
|
if(StringUtils.equals(sf.getDoctor(),sf.getDoctorHealth())){//全科和建管同一个人
|
|
|
|
participants.put(sf.getDoctor(),0);
|
|
|
|
}else{//全科和建管不同一个人
|
|
|
|
participants.put(sf.getDoctorHealth(),0);
|
|
|
|
participants.put(sf.getDoctor(),1);
|
|
|
|
|
|
participants.put(sf.getPatient(), 0);
|
|
|
|
if (StringUtils.equals(sf.getDoctor(), sf.getDoctorHealth())) {//全科和建管同一个人
|
|
|
|
participants.put(sf.getDoctor(), 0);
|
|
|
|
} else {//全科和建管不同一个人
|
|
|
|
participants.put(sf.getDoctorHealth(), 0);
|
|
|
|
participants.put(sf.getDoctor(), 1);
|
|
}
|
|
}
|
|
//创建医生会话讨论组
|
|
//创建医生会话讨论组
|
|
JSONObject sessionObj = ImUtill.createSession(participants,ImUtill.SESSION_TYPE_MUC,patient.getName(),patient.getCode()+"_"+sf.getTeamCode()+"_"+2);
|
|
|
|
if(sessionObj.getInt("status")==-1){
|
|
|
|
throw new RuntimeException(sessionObj.getString("message"));
|
|
|
|
|
|
JSONObject sessionObj = ImUtill.createSession(participants, ImUtill.SESSION_TYPE_MUC, patient.getName(), patient.getCode() + "_" + sf.getTeamCode() + "_" + 2);
|
|
|
|
if (sessionObj.getInt("status") == -1) {
|
|
|
|
throw new RuntimeException(sessionObj.getString("message"));
|
|
}
|
|
}
|
|
ImUtill.updateSessionStatus(patient.getCode()+"_"+sf.getTeamCode()+"_"+2,ImUtill.SESSION_STATUS_END);
|
|
|
|
|
|
ImUtill.updateSessionStatus(patient.getCode() + "_" + sf.getTeamCode() + "_" + 2, ImUtill.SESSION_STATUS_END);
|
|
|
|
|
|
ImUtill.sendImMsg(doc.getCode(),doc.getName(),patient.getCode()+"_"+sf.getTeamCode()+"_"+2,"0","家庭医生代理签约成功!","1");
|
|
|
|
|
|
ImUtill.sendImMsg(doc.getCode(), doc.getName(), patient.getCode() + "_" + sf.getTeamCode() + "_" + 2, "0", "家庭医生代理签约成功!", "1");
|
|
}
|
|
}
|
|
BusinessLogs.info(BusinessLogs.BusinessType.sign, signDoctorCode, sf.getPatient(), new JSONObject(sf));
|
|
BusinessLogs.info(BusinessLogs.BusinessType.sign, signDoctorCode, sf.getPatient(), new JSONObject(sf));
|
|
return temp;
|
|
return temp;
|
|
@ -1077,7 +1078,7 @@ public class FamilyContractService extends BaseService {
|
|
result.put("status", 0);
|
|
result.put("status", 0);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
String doctorTeamCode =null;//服务团队的CODE;
|
|
|
|
|
|
String doctorTeamCode = null;//服务团队的CODE;
|
|
if (type == 1) {
|
|
if (type == 1) {
|
|
//判断是否有三师签约 并且判断全科医生一致
|
|
//判断是否有三师签约 并且判断全科医生一致
|
|
SignFamily sssignFamily = signFamilyDao.findSSByIdcard(p.getIdcard());
|
|
SignFamily sssignFamily = signFamilyDao.findSSByIdcard(p.getIdcard());
|
|
@ -1234,17 +1235,17 @@ public class FamilyContractService extends BaseService {
|
|
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", "您好,签约家庭医生失败通知");
|
|
|
|
|
|
if(StringUtils.isNotBlank(sf.getOpenid())){
|
|
|
|
|
|
if (StringUtils.isNotBlank(sf.getOpenid())) {
|
|
// 添加到发送队列
|
|
// 添加到发送队列
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 2, sf.getOpenid(), sf.getName(), json);
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 2, sf.getOpenid(), sf.getName(), json);
|
|
}else{
|
|
|
|
|
|
} else {
|
|
JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
|
|
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);
|
|
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@ -1277,15 +1278,15 @@ public class FamilyContractService extends BaseService {
|
|
json.put("content", content);
|
|
json.put("content", content);
|
|
json.put("remark", ""); //您好,您成功签约家庭医生
|
|
json.put("remark", ""); //您好,您成功签约家庭医生
|
|
// 添加到发送队列
|
|
// 添加到发送队列
|
|
if(StringUtils.isNotBlank(sf.getOpenid())){
|
|
|
|
|
|
if (StringUtils.isNotBlank(sf.getOpenid())) {
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
|
|
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");
|
|
|
|
|
|
} 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.remove("first");
|
|
json.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),member.getName()));
|
|
|
|
|
|
json.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), member.getName()));
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, member.getOpenid(), member.getName(), json);
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 1, member.getOpenid(), member.getName(), json);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@ -1293,20 +1294,20 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
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);
|
|
|
|
if(StringUtils.equals(sf.getDoctor(),sf.getDoctorHealth())){//全科和建管同一个人
|
|
|
|
participants.put(sf.getDoctor(),0);
|
|
|
|
}else{//全科和建管不同一个人
|
|
|
|
participants.put(sf.getDoctorHealth(),0);
|
|
|
|
participants.put(sf.getDoctor(),1);
|
|
|
|
|
|
participants.put(sf.getPatient(), 0);
|
|
|
|
if (StringUtils.equals(sf.getDoctor(), sf.getDoctorHealth())) {//全科和建管同一个人
|
|
|
|
participants.put(sf.getDoctor(), 0);
|
|
|
|
} else {//全科和建管不同一个人
|
|
|
|
participants.put(sf.getDoctorHealth(), 0);
|
|
|
|
participants.put(sf.getDoctor(), 1);
|
|
}
|
|
}
|
|
Patient patient = patientDao.findByCode(sf.getPatient());
|
|
Patient patient = patientDao.findByCode(sf.getPatient());
|
|
//创建医生会话讨论组
|
|
//创建医生会话讨论组
|
|
JSONObject sessionObj = ImUtill.createSession(participants,ImUtill.SESSION_TYPE_MUC,patient.getName(),patient.getCode()+"_"+sf.getTeamCode()+"_"+2);
|
|
|
|
if(sessionObj.getInt("status")==-1){
|
|
|
|
throw new RuntimeException(sessionObj.getString("message"));
|
|
|
|
|
|
JSONObject sessionObj = ImUtill.createSession(participants, ImUtill.SESSION_TYPE_MUC, patient.getName(), patient.getCode() + "_" + sf.getTeamCode() + "_" + 2);
|
|
|
|
if (sessionObj.getInt("status") == -1) {
|
|
|
|
throw new RuntimeException(sessionObj.getString("message"));
|
|
}
|
|
}
|
|
ImUtill.sendImMsg(doc.getCode(),doc.getName(),patient.getCode()+"_"+sf.getTeamCode()+"_"+2,"0","家庭医生签约成功!","1");
|
|
|
|
|
|
ImUtill.sendImMsg(doc.getCode(), doc.getName(), patient.getCode() + "_" + sf.getTeamCode() + "_" + 2, "0", "家庭医生签约成功!", "1");
|
|
}
|
|
}
|
|
result.put("status", 1);
|
|
result.put("status", 1);
|
|
BusinessLogs.info(BusinessLogs.BusinessType.sign, caller, sf.getPatient(), new JSONObject(sf));
|
|
BusinessLogs.info(BusinessLogs.BusinessType.sign, caller, sf.getPatient(), new JSONObject(sf));
|
|
@ -1364,17 +1365,17 @@ public class FamilyContractService extends BaseService {
|
|
json.put("orgName", sf.getHospitalName());
|
|
json.put("orgName", sf.getHospitalName());
|
|
json.put("remark", sf.getName() + ",您好!您的签约医生已同意您的解约申请,解约已生效。");
|
|
json.put("remark", sf.getName() + ",您好!您的签约医生已同意您的解约申请,解约已生效。");
|
|
|
|
|
|
if(StringUtils.isNotBlank(sf.getOpenid())){
|
|
|
|
|
|
if (StringUtils.isNotBlank(sf.getOpenid())) {
|
|
// 添加到发送队列
|
|
// 添加到发送队列
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 5, sf.getOpenid(), sf.getName(), json);
|
|
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");
|
|
|
|
|
|
} 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");
|
|
json.remove("first");
|
|
Patient p = patientDao.findByCode(patient);
|
|
Patient p = patientDao.findByCode(patient);
|
|
json.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),member.getName()));
|
|
|
|
|
|
json.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), member.getName()));
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 5, member.getOpenid(), member.getName(), json);
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 5, member.getOpenid(), member.getName(), json);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@ -1393,17 +1394,17 @@ public class FamilyContractService extends BaseService {
|
|
json.put("orgName", sf.getHospitalName());
|
|
json.put("orgName", sf.getHospitalName());
|
|
json.put("remark", sf.getName() + ",您好!您的签约医生拒绝您的解约申请,解约失败。");
|
|
json.put("remark", sf.getName() + ",您好!您的签约医生拒绝您的解约申请,解约失败。");
|
|
|
|
|
|
if(StringUtils.isNotBlank(sf.getOpenid())){
|
|
|
|
|
|
if (StringUtils.isNotBlank(sf.getOpenid())) {
|
|
// 添加到发送队列
|
|
// 添加到发送队列
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 5, sf.getOpenid(), sf.getName(), json);
|
|
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");
|
|
|
|
|
|
} 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");
|
|
json.remove("first");
|
|
Patient p = patientDao.findByCode(patient);
|
|
Patient p = patientDao.findByCode(patient);
|
|
json.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),member.getName()));
|
|
|
|
|
|
json.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), member.getName()));
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 5, member.getOpenid(), member.getName(), json);
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 5, member.getOpenid(), member.getName(), json);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@ -1853,14 +1854,14 @@ public class FamilyContractService extends BaseService {
|
|
result.put("msg", "与当前健管师有未结束的咨询");
|
|
result.put("msg", "与当前健管师有未结束的咨询");
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
try{
|
|
|
|
if(signFamily.getDoctorHealth().equals(signFamily.getDoctor())){
|
|
|
|
ImUtill.deleteMucUser(healthDoctor,"",patient+"_"+signFamily.getTeamCode()+"_2");
|
|
|
|
}else{
|
|
|
|
ImUtill.deleteMucUser(healthDoctor,signFamily.getDoctorHealth(),patient+"_"+signFamily.getTeamCode()+"_2");
|
|
|
|
|
|
try {
|
|
|
|
if (signFamily.getDoctorHealth().equals(signFamily.getDoctor())) {
|
|
|
|
ImUtill.deleteMucUser(healthDoctor, "", patient + "_" + signFamily.getTeamCode() + "_2");
|
|
|
|
} else {
|
|
|
|
ImUtill.deleteMucUser(healthDoctor, signFamily.getDoctorHealth(), patient + "_" + signFamily.getTeamCode() + "_2");
|
|
}
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
} catch (Exception e) {
|
|
result.put("status", -1);
|
|
result.put("status", -1);
|
|
result.put("msg", e.getMessage());
|
|
result.put("msg", e.getMessage());
|
|
return result;
|
|
return result;
|
|
@ -1903,9 +1904,9 @@ public class FamilyContractService extends BaseService {
|
|
data.put("remark", docHealth.getName() + "医生与" + signFamily.getDoctorName() + "医生一道,为您提供优质健康服务");
|
|
data.put("remark", docHealth.getName() + "医生与" + signFamily.getDoctorName() + "医生一道,为您提供优质健康服务");
|
|
}
|
|
}
|
|
wxMessages.add(data);
|
|
wxMessages.add(data);
|
|
try{
|
|
|
|
ImUtill.deleteMucUser(docHealth.getCode(),"",patient+"_"+signFamily.getTeamCode()+"_2");
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
try {
|
|
|
|
ImUtill.deleteMucUser(docHealth.getCode(), "", patient + "_" + signFamily.getTeamCode() + "_2");
|
|
|
|
} catch (Exception e) {
|
|
result.put("status", -1);
|
|
result.put("status", -1);
|
|
result.put("msg", e.getMessage());
|
|
result.put("msg", e.getMessage());
|
|
return result;
|
|
return result;
|
|
@ -1949,9 +1950,9 @@ public class FamilyContractService extends BaseService {
|
|
String oldDoctorName = signFamily.getDoctorName();
|
|
String oldDoctorName = signFamily.getDoctorName();
|
|
if (StringUtils.isNotEmpty(signFamily.getDoctor())) {
|
|
if (StringUtils.isNotEmpty(signFamily.getDoctor())) {
|
|
DoctorTeamMember teamMember = doctorTeamDoctor.findMemberByTeamAndQkCode(signFamily.getTeamCode(), signFamily.getDoctor());
|
|
DoctorTeamMember teamMember = doctorTeamDoctor.findMemberByTeamAndQkCode(signFamily.getTeamCode(), signFamily.getDoctor());
|
|
try{
|
|
|
|
ImUtill.deleteMucUser(doctor,signFamily.getDoctor(),patient+"_"+signFamily.getTeamCode()+"_2");
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
try {
|
|
|
|
ImUtill.deleteMucUser(doctor, signFamily.getDoctor(), patient + "_" + signFamily.getTeamCode() + "_2");
|
|
|
|
} catch (Exception e) {
|
|
result.put("status", -1);
|
|
result.put("status", -1);
|
|
result.put("msg", e.getMessage());
|
|
result.put("msg", e.getMessage());
|
|
return result;
|
|
return result;
|
|
@ -2014,19 +2015,19 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
for (JSONObject msg : wxMessages) {
|
|
for (JSONObject msg : wxMessages) {
|
|
|
|
|
|
if(StringUtils.isNotBlank(p.getOpenid())){
|
|
|
|
|
|
if (StringUtils.isNotBlank(p.getOpenid())) {
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, p.getOpenid(), p.getName(), msg);
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, p.getOpenid(), p.getName(), msg);
|
|
}else{
|
|
|
|
|
|
} else {
|
|
//如果自己没有绑定,则发给家人
|
|
//如果自己没有绑定,则发给家人
|
|
JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
|
|
JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
|
|
Patient member = (Patient)j.get("member");
|
|
|
|
if(StringUtils.isNotBlank(member.getOpenid())){
|
|
|
|
String first = (String)msg.get("first");
|
|
|
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
|
if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
|
String first = (String) msg.get("first");
|
|
msg.remove("first");
|
|
msg.remove("first");
|
|
|
|
|
|
try{
|
|
|
|
msg.put("first",weiXinOpenIdUtils.getTitleMes(p,j.getInt("relation"),member.getName()));
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
try {
|
|
|
|
msg.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), member.getName()));
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), msg);
|
|
PushMsgTask.getInstance().putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), msg);
|
|
@ -2050,7 +2051,7 @@ public class FamilyContractService extends BaseService {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
public JSONObject findByParamsWithDoctor(String doctorCode, String teamCode, String params,int level) throws Exception {
|
|
|
|
|
|
public JSONObject findByParamsWithDoctor(String doctorCode, String teamCode, String params, int level) throws Exception {
|
|
JSONObject returnMap = new JSONObject();
|
|
JSONObject returnMap = new JSONObject();
|
|
String addressSql = "select a.signcode,a.name,a.address,a.code,a.hasopenid,a.idcard,a.photo from( SELECT " +
|
|
String addressSql = "select a.signcode,a.name,a.address,a.code,a.hasopenid,a.idcard,a.photo from( SELECT " +
|
|
" sf.CODE signcode, " +
|
|
" sf.CODE signcode, " +
|
|
@ -2068,11 +2069,11 @@ public class FamilyContractService extends BaseService {
|
|
" AND sf. STATUS > 0 " +
|
|
" AND sf. STATUS > 0 " +
|
|
// " and sf.doctor = ? " +
|
|
// " and sf.doctor = ? " +
|
|
" and sf.admin_team_code = ? " +
|
|
" and sf.admin_team_code = ? " +
|
|
" AND ( "+(level==2?"sf.doctor =?":"sf.doctor_health =? ")+") ) a where 1=1";
|
|
|
|
|
|
" AND ( " + (level == 2 ? "sf.doctor =?" : "sf.doctor_health =? ") + ") ) a where 1=1";
|
|
if (!org.springframework.util.StringUtils.isEmpty(params)) {
|
|
if (!org.springframework.util.StringUtils.isEmpty(params)) {
|
|
addressSql += " AND a.address like '%" + params + "%'";
|
|
addressSql += " AND a.address like '%" + params + "%'";
|
|
}
|
|
}
|
|
List<Map<String, Object>> datas = jdbcTemplate.queryForList(addressSql, teamCode,doctorCode);
|
|
|
|
|
|
List<Map<String, Object>> datas = jdbcTemplate.queryForList(addressSql, teamCode, doctorCode);
|
|
if (datas != null && datas.size() > 0) {
|
|
if (datas != null && datas.size() > 0) {
|
|
JSONArray jsonArray = new JSONArray();
|
|
JSONArray jsonArray = new JSONArray();
|
|
for (Map<String, Object> map : datas) {
|
|
for (Map<String, Object> map : datas) {
|
|
@ -2105,12 +2106,12 @@ public class FamilyContractService extends BaseService {
|
|
" AND sf. STATUS > 0 " +
|
|
" AND sf. STATUS > 0 " +
|
|
//" and sf.doctor = ? " +
|
|
//" and sf.doctor = ? " +
|
|
" and sf.admin_team_code = ? " +
|
|
" and sf.admin_team_code = ? " +
|
|
" AND ( "+(level==2?"sf.doctor =?":"sf.doctor_health =? ")+") ) a where 1=1";
|
|
|
|
|
|
" AND ( " + (level == 2 ? "sf.doctor =?" : "sf.doctor_health =? ") + ") ) a where 1=1";
|
|
|
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(params)) {
|
|
if (!org.springframework.util.StringUtils.isEmpty(params)) {
|
|
patientNameSql += " AND a.name like '%" + params + "%'";
|
|
patientNameSql += " AND a.name like '%" + params + "%'";
|
|
}
|
|
}
|
|
datas = jdbcTemplate.queryForList(patientNameSql, teamCode,doctorCode);
|
|
|
|
|
|
datas = jdbcTemplate.queryForList(patientNameSql, teamCode, doctorCode);
|
|
if (datas != null && datas.size() > 0) {
|
|
if (datas != null && datas.size() > 0) {
|
|
JSONArray jsonArray = new JSONArray();
|
|
JSONArray jsonArray = new JSONArray();
|
|
for (Map<String, Object> map : datas) {
|
|
for (Map<String, Object> map : datas) {
|
|
@ -2460,12 +2461,13 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据会话信息拉取对应的人员信息
|
|
* 根据会话信息拉取对应的人员信息
|
|
|
|
*
|
|
* @param sessionId
|
|
* @param sessionId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONObject getTeamDoctors(String sessionId,String doctor){
|
|
|
|
|
|
public JSONObject getTeamDoctors(String sessionId, String doctor) {
|
|
String infos[] = sessionId.split("_");
|
|
String infos[] = sessionId.split("_");
|
|
String patient = infos[0];
|
|
|
|
|
|
String patient = infos[0];
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
Map<String, JSONObject> docMap = new HashMap<>();
|
|
Map<String, JSONObject> docMap = new HashMap<>();
|
|
SignFamily ssSign = signFamilyDao.findSignByPatient(patient, 1);
|
|
SignFamily ssSign = signFamilyDao.findSignByPatient(patient, 1);
|
|
@ -2532,7 +2534,7 @@ public class FamilyContractService extends BaseService {
|
|
|
|
|
|
|
|
|
|
public JSONObject getPatientSignDoctorsByTeam(String sessionId) {
|
|
public JSONObject getPatientSignDoctorsByTeam(String sessionId) {
|
|
String infos[] =sessionId.split("_");
|
|
|
|
|
|
String infos[] = sessionId.split("_");
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
Map<String, JSONObject> docMap = new HashMap<>();
|
|
Map<String, JSONObject> docMap = new HashMap<>();
|
|
SignFamily ssSign = signFamilyDao.findSignByPatient(infos[0], 1);
|
|
SignFamily ssSign = signFamilyDao.findSignByPatient(infos[0], 1);
|
|
@ -2631,6 +2633,79 @@ public class FamilyContractService extends BaseService {
|
|
return returnMap;
|
|
return returnMap;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//根据姓名、地址、身份证搜索已分配健管师的居民
|
|
|
|
public List getPatientByLable(String doctorCode, String filter, String level, Long team,int page,int pagesize) throws Exception {
|
|
|
|
List list = new ArrayList();
|
|
|
|
//判断当前用户是健康管理师还是全科
|
|
|
|
List<Map<String, Object>> datas = null;
|
|
|
|
if (level.equals("3")) {
|
|
|
|
//健康管理师
|
|
|
|
String sql = "SELECT DISTINCT " +
|
|
|
|
" p.photo photo, " +
|
|
|
|
" p.name name, " +
|
|
|
|
" p.code code, " +
|
|
|
|
" p.sex sex," +
|
|
|
|
" p.address address," +
|
|
|
|
" p.idcard idcard " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_sign_family sf " +
|
|
|
|
" JOIN wlyy_patient p ON sf.patient = p.CODE " +
|
|
|
|
" left JOIN wlyy_sign_patient_label_info sp ON sf.patient = sp.patient AND sp.`status` = 1 " +
|
|
|
|
" WHERE " +
|
|
|
|
" sf.type = 2 " +
|
|
|
|
" AND sf. STATUS > 0 " +
|
|
|
|
" and sf.doctor_health = ? " +
|
|
|
|
" and sf.admin_team_code = ? " +
|
|
|
|
" AND (p.name like ? or p.address like ? or p.idcard like ? ) " +
|
|
|
|
" ORDER BY p.name DESC,p.address DESC, p.idcard DESC " +
|
|
|
|
" limit "+(page-1)+","+pagesize;
|
|
|
|
|
|
|
|
//查找居民
|
|
|
|
datas = jdbcTemplate.queryForList(sql, doctorCode, team,"%"+filter+"%","%"+filter+"%","%"+filter+"%");
|
|
|
|
} else if (level.equals("2")) {
|
|
|
|
//全科
|
|
|
|
String sql = "SELECT DISTINCT " +
|
|
|
|
" p.photo photo, " +
|
|
|
|
" p.name name, " +
|
|
|
|
" p.code code, " +
|
|
|
|
" p.sex sex," +
|
|
|
|
" p.address address," +
|
|
|
|
" p.idcard idcard " +
|
|
|
|
" FROM " +
|
|
|
|
" wlyy_sign_family sf " +
|
|
|
|
" JOIN wlyy_patient p ON sf.patient = p.CODE " +
|
|
|
|
" left JOIN wlyy_sign_patient_label_info sp ON sf.patient = sp.patient AND sp.`status` = 1 " +
|
|
|
|
" WHERE " +
|
|
|
|
" sf.type = 2 " +
|
|
|
|
" AND sf. STATUS > 0 " +
|
|
|
|
" and sf.doctor = ? " +
|
|
|
|
" and sf.admin_team_code = ? " +
|
|
|
|
" AND (p.name like ? or p.address like ? or p.idcard like ? ) " +
|
|
|
|
" ORDER BY p.name DESC,p.address DESC, p.idcard DESC " +
|
|
|
|
" limit "+(page-1)+","+pagesize;
|
|
|
|
|
|
|
|
//查找居民
|
|
|
|
datas = jdbcTemplate.queryForList(sql, doctorCode, team,"%"+filter+"%","%"+filter+"%","%"+filter+"%");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
throw new Exception("参数错误!");
|
|
|
|
}
|
|
|
|
if (datas != null && datas.size() > 0) {
|
|
|
|
for (Map<String, Object> map : datas) {
|
|
|
|
Map ma = new HashMap();
|
|
|
|
ma.put("age", IdCardUtil.getAgeForIdcard(map.get("idcard")==null?"":map.get("idcard").toString()));
|
|
|
|
ma.put("photo",map.get("photo")==null?"":map.get("photo").toString());
|
|
|
|
ma.put("name",map.get("name")==null?"":map.get("name").toString());
|
|
|
|
ma.put("code",map.get("code")==null?"":map.get("code").toString());
|
|
|
|
ma.put("sex",map.get("sex")==null?"":map.get("sex").toString());
|
|
|
|
ma.put("address",map.get("address")==null?"":map.get("address").toString());
|
|
|
|
ma.put("idcard",map.get("idcard")==null?"":map.get("idcard").toString());
|
|
|
|
list.add(ma);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
public JSONObject getPatientByLable(String doctorCode, String labelType, String level, Long team) throws Exception {
|
|
public JSONObject getPatientByLable(String doctorCode, String labelType, String level, Long team) throws Exception {
|
|
JSONObject returnMap = new JSONObject();
|
|
JSONObject returnMap = new JSONObject();
|
|
//判断当前用户是健康管理师还是全科
|
|
//判断当前用户是健康管理师还是全科
|