|
@ -1,6 +1,7 @@
|
|
package com.yihu.wlyy.service.app.consult;
|
|
package com.yihu.wlyy.service.app.consult;
|
|
|
|
|
|
import com.yihu.wlyy.adapter.PresModeAdapter;
|
|
import com.yihu.wlyy.adapter.PresModeAdapter;
|
|
|
|
import com.yihu.wlyy.entity.concern.ConcernDO;
|
|
import com.yihu.wlyy.entity.consult.Consult;
|
|
import com.yihu.wlyy.entity.consult.Consult;
|
|
import com.yihu.wlyy.entity.consult.ConsultTeam;
|
|
import com.yihu.wlyy.entity.consult.ConsultTeam;
|
|
import com.yihu.wlyy.entity.consult.ConsultTeamDoctor;
|
|
import com.yihu.wlyy.entity.consult.ConsultTeamDoctor;
|
|
@ -8,18 +9,16 @@ import com.yihu.wlyy.entity.consult.ConsultTeamLog;
|
|
import com.yihu.wlyy.entity.device.PatientDevice;
|
|
import com.yihu.wlyy.entity.device.PatientDevice;
|
|
import com.yihu.wlyy.entity.discussion.WlyyTalkGroup;
|
|
import com.yihu.wlyy.entity.discussion.WlyyTalkGroup;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
|
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
|
|
|
|
import com.yihu.wlyy.entity.education.HealthEduArticle;
|
|
import com.yihu.wlyy.entity.education.HealthEduArticle;
|
|
import com.yihu.wlyy.entity.followup.Followup;
|
|
import com.yihu.wlyy.entity.followup.Followup;
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
import com.yihu.wlyy.entity.message.MessageNoticeSetting;
|
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.PatientFamilyMember;
|
|
import com.yihu.wlyy.entity.patient.PatientFamilyMember;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.entity.patient.prescription.*;
|
|
import com.yihu.wlyy.entity.patient.prescription.*;
|
|
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
|
|
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
|
|
import com.yihu.wlyy.entity.zydict.ZyIvPhysicDict;
|
|
import com.yihu.wlyy.entity.zydict.ZyIvPhysicDict;
|
|
|
|
import com.yihu.wlyy.repository.concern.ConcernDao;
|
|
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
|
|
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
|
|
import com.yihu.wlyy.repository.consult.ConsultTeamDoctorDao;
|
|
import com.yihu.wlyy.repository.consult.ConsultTeamDoctorDao;
|
|
import com.yihu.wlyy.repository.consult.ConsultTeamLogDao;
|
|
import com.yihu.wlyy.repository.consult.ConsultTeamLogDao;
|
|
@ -34,6 +33,8 @@ import com.yihu.wlyy.repository.patient.PatientFamilyMemberDao;
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
import com.yihu.wlyy.repository.prescription.*;
|
|
import com.yihu.wlyy.repository.prescription.*;
|
|
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
|
|
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
|
|
|
|
import com.yihu.wlyy.service.app.account.DoctorInfoService;
|
|
|
|
import com.yihu.wlyy.service.app.concern.ConcernService;
|
|
import com.yihu.wlyy.service.app.health.HealthEduArticleService;
|
|
import com.yihu.wlyy.service.app.health.HealthEduArticleService;
|
|
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
|
|
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
|
|
import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
|
|
import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
|
|
@ -130,7 +131,7 @@ public class ConsultTeamService extends ConsultService {
|
|
@Autowired
|
|
@Autowired
|
|
private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
|
|
private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
|
|
@Autowired
|
|
@Autowired
|
|
private ImUtill ImUtill;
|
|
|
|
|
|
private ImUtill imUtill;
|
|
@Autowired
|
|
@Autowired
|
|
private HttpClientUtil HttpClientUtil;
|
|
private HttpClientUtil HttpClientUtil;
|
|
@Autowired
|
|
@Autowired
|
|
@ -177,6 +178,12 @@ public class ConsultTeamService extends ConsultService {
|
|
private PushMsgTask pushMsgTask;
|
|
private PushMsgTask pushMsgTask;
|
|
@Autowired
|
|
@Autowired
|
|
private PrescriptionExplainDao prescriptionExplainDao;
|
|
private PrescriptionExplainDao prescriptionExplainDao;
|
|
|
|
@Autowired
|
|
|
|
private ConcernService concernService;
|
|
|
|
@Autowired
|
|
|
|
private ConcernDao concernDao;
|
|
|
|
@Autowired
|
|
|
|
private DoctorInfoService doctorInfoService;
|
|
|
|
|
|
@PostConstruct
|
|
@PostConstruct
|
|
public void init() {
|
|
public void init() {
|
|
@ -203,29 +210,6 @@ public class ConsultTeamService extends ConsultService {
|
|
json.put("msg","您还未签约,不能发起续方咨询");
|
|
json.put("msg","您还未签约,不能发起续方咨询");
|
|
return json;
|
|
return json;
|
|
}
|
|
}
|
|
//点击后判断,如果用户当前存在可申请续方的处方记录,则进入续方申请流程,若不存在可续方记录,alert“当前没有可以申请续方的处方记录”
|
|
|
|
// 智业接口没有返回列表,是单条 所以先不处理
|
|
|
|
// int num = 0;
|
|
|
|
// Patient p = patientDao.findByCode(patient);
|
|
|
|
// String rp= jwPrescriptionService.getRecipeList(p.getSsc(),null,null,null);
|
|
|
|
// com.alibaba.fastjson.JSONArray pres =presModeAdapter.modeToPrescription(rp);
|
|
|
|
// Iterator iterator = pres.iterator();
|
|
|
|
// while (iterator.hasNext()){
|
|
|
|
// com.alibaba.fastjson.JSONObject r = ( com.alibaba.fastjson.JSONObject)iterator.next();
|
|
|
|
// com.alibaba.fastjson.JSONArray des = r.getJSONArray("prescriptionDt");
|
|
|
|
// for(int i=0 ;i<des.size();i++){
|
|
|
|
// PrescriptionDiagnosis ds = des.getObject(i,PrescriptionDiagnosis.class);
|
|
|
|
// if(gxy.equals(ds.getHealthProblem())||tnb.equals(ds.getHealthProblem())){
|
|
|
|
// //为糖尿病高血压
|
|
|
|
// num++;
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// if(num==0){
|
|
|
|
// json.put("msg","当前没有可以申请续方的处方记录");
|
|
|
|
// return json;
|
|
|
|
// }
|
|
|
|
|
|
|
|
//续方说明
|
|
//续方说明
|
|
List<PrescriptionExplain> list = prescriptionExplainDao.findList();
|
|
List<PrescriptionExplain> list = prescriptionExplainDao.findList();
|
|
@ -246,57 +230,13 @@ public class ConsultTeamService extends ConsultService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询患者是否还有未结束的三师咨询
|
|
|
|
|
|
* 查询患者与医生是否还有未结束的关注咨询
|
|
*
|
|
*
|
|
* @param patient
|
|
* @param patient
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public boolean exist(String patient, Integer type) throws Exception {
|
|
|
|
DoctorTeamMember member = null;
|
|
|
|
String memberCode=null;
|
|
|
|
// 咨询三师
|
|
|
|
if (type == 1) {
|
|
|
|
// 查询三师签约信息
|
|
|
|
SignFamily sc = signFamilyDao.findBySanshiPatientYes(patient);
|
|
|
|
if (sc == null) {
|
|
|
|
throw new Exception("不存在三师签约");
|
|
|
|
}
|
|
|
|
// 设置健康管理师,三师咨询默认给健康管理师处理
|
|
|
|
//查找病人所在的团队
|
|
|
|
DoctorTeam doctorTeam = doctorTeamDao.findBySanshiParientCode(patient);
|
|
|
|
//得到团队的健康管理师
|
|
|
|
member = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 3);
|
|
|
|
|
|
|
|
if (member == null) {
|
|
|
|
member = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 2);
|
|
|
|
}
|
|
|
|
memberCode= member.getCode();
|
|
|
|
} else if (type == 2) {
|
|
|
|
// 咨询家庭医生
|
|
|
|
SignFamily sf = signFamilyDao.findByjiatingPatient(patient);
|
|
|
|
if (sf == null) {
|
|
|
|
throw new Exception("不存在家庭签约");
|
|
|
|
}
|
|
|
|
if (StringUtils.isEmpty(sf.getDoctorHealth())){
|
|
|
|
memberCode = sf.getDoctor();
|
|
|
|
}else {
|
|
|
|
memberCode = sf.getDoctorHealth();
|
|
|
|
}
|
|
|
|
|
|
|
|
// 设置健康管理师,家庭医生咨询默认给健康管理师处理
|
|
|
|
//查找病人所在的团队
|
|
|
|
// DoctorTeam doctorTeam = doctorTeamDao.findByParientCode(patient);
|
|
|
|
// //得到团队的健康管理师
|
|
|
|
// member = doctorTeamDoctor.findDoctorJiating2ByTeam(doctorTeam.getCode(), 3);
|
|
|
|
//
|
|
|
|
// if (member == null) {
|
|
|
|
// member = doctorTeamDoctor.findDoctorJiating2ByTeam(doctorTeam.getCode(), 2);
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// if (member == null) {
|
|
|
|
// throw new Exception("找不到签约服务团队医生");
|
|
|
|
// }
|
|
|
|
int count = consultTeamDao.countByPatient(patient, memberCode);
|
|
|
|
|
|
public boolean exist(String patient,Integer type, String doctor) throws Exception {
|
|
|
|
int count = consultTeamDao.countByPatient(patient, doctor,type);
|
|
return count > 0;
|
|
return count > 0;
|
|
}
|
|
}
|
|
|
|
|
|
@ -815,17 +755,26 @@ public class ConsultTeamService extends ConsultService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 患者端
|
|
* 患者端
|
|
* 添加三师咨询
|
|
|
|
|
|
* 添加咨询
|
|
*
|
|
*
|
|
* @param ct 三师咨询对象
|
|
|
|
|
|
* @param ct 咨询对象
|
|
* @param patient 患者标识
|
|
* @param patient 患者标识
|
|
|
|
* @param doctorCode 咨询医生
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
public JSONObject addTeamConsult(ConsultTeam ct, String patient,String agent) throws Exception {
|
|
|
|
|
|
public JSONObject addTeamConsult(ConsultTeam ct, String patient,String agent,String doctorCode) throws Exception {
|
|
JSONObject re = new JSONObject();
|
|
JSONObject re = new JSONObject();
|
|
if (exist(patient, ct.getType())) {//判断是否有未结束的咨询移到同步方法中
|
|
|
|
re.put("status",-3);
|
|
|
|
|
|
|
|
|
|
//自动关注 咨询关注
|
|
|
|
ConcernDO concernDO = concernDao.findByPatientAndDoctor(patient,doctorCode);
|
|
|
|
if(concernDO==null){
|
|
|
|
concernService.addConcern(patient,doctorCode,3);
|
|
|
|
concernDO = concernDao.findByPatientAndDoctor(patient,doctorCode);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (exist(patient, ct.getType(),doctorCode)) {
|
|
|
|
re.put("status",-1);
|
|
return re;
|
|
return re;
|
|
}
|
|
}
|
|
|
|
|
|
@ -834,90 +783,8 @@ public class ConsultTeamService extends ConsultService {
|
|
if(patient.equals(agent)){
|
|
if(patient.equals(agent)){
|
|
agent = null;
|
|
agent = null;
|
|
}
|
|
}
|
|
|
|
users.put(doctorCode, 0);
|
|
|
|
|
|
// 咨询三师
|
|
|
|
if (ct.getType() == 1) {
|
|
|
|
// 查询三师签约信息
|
|
|
|
SignFamily sc = signFamilyDao.findBySanshiPatientYes(patient);
|
|
|
|
if (sc == null) {
|
|
|
|
// 不存在三师签约
|
|
|
|
re.put("status",-2);
|
|
|
|
return re;
|
|
|
|
}
|
|
|
|
ct.setTeam(sc.getTeamCode());
|
|
|
|
// 设置健康管理师,三师咨询默认给健康管理师处理
|
|
|
|
//查找病人所在的团队
|
|
|
|
DoctorTeam doctorTeam = doctorTeamDao.findBySanshiParientCode(patient);
|
|
|
|
//得到团队的健康管理师
|
|
|
|
DoctorTeamMember doctorTeamMemberHealthy = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 3);
|
|
|
|
DoctorTeamMember doctorTeamMember = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 2);
|
|
|
|
if (doctorTeamMemberHealthy == null) {
|
|
|
|
ct.setDoctor(doctorTeamMember.getMemberCode());
|
|
|
|
users.put(doctorTeamMember.getMemberCode(), 0);
|
|
|
|
} else {
|
|
|
|
users.put(doctorTeamMemberHealthy.getMemberCode(), 0);
|
|
|
|
if (doctorTeamMember != null) {
|
|
|
|
if (users.isNull(doctorTeamMember.getMemberCode())) {
|
|
|
|
users.put(doctorTeamMember.getMemberCode(), 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ct.setDoctor(doctorTeamMemberHealthy.getMemberCode());
|
|
|
|
}
|
|
|
|
// 设置家庭医生
|
|
|
|
|
|
|
|
ct.setAdminTeamId(sc.getAdminTeamId());
|
|
|
|
} else if (ct.getType() == 2) {
|
|
|
|
// 咨询家庭医生
|
|
|
|
SignFamily sf = signFamilyDao.findByjiatingPatient(patient);
|
|
|
|
|
|
|
|
if (sf == null) {
|
|
|
|
// 不存在家庭签约
|
|
|
|
re.put("status",-1);
|
|
|
|
return re;
|
|
|
|
}
|
|
|
|
ct.setTeam(sf.getTeamCode());
|
|
|
|
// 设置健康管理师,家庭医生咨询默认给健康管理师处理
|
|
|
|
//查找病人所在的团队
|
|
|
|
//1.3.3.2 更改从签约记录判断团队成员,分配建管师
|
|
|
|
if(StringUtils.isNotBlank(sf.getDoctorHealth())) {
|
|
|
|
users.put(sf.getDoctorHealth(), 0);
|
|
|
|
ct.setDoctor(sf.getDoctorHealth());
|
|
|
|
if (StringUtils.isNotBlank(sf.getDoctor())) {
|
|
|
|
if (users.isNull(sf.getDoctor())) {
|
|
|
|
//全科需要判断是否开启健管师邀请后在接收消息
|
|
|
|
int isGetMessage = 1;
|
|
|
|
if(!messageService.getMessageNoticeSettingByMessageType(sf.getDoctor(),"1", MessageNoticeSetting.MessageTypeEnum.familyTopicSwitch.getValue())){
|
|
|
|
isGetMessage = 0;
|
|
|
|
}
|
|
|
|
users.put(sf.getDoctor(), isGetMessage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ct.setDoctor(sf.getDoctor());
|
|
|
|
users.put(sf.getDoctor(), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// DoctorTeam doctorTeam = doctorTeamDao.findByParientCode(patient);
|
|
|
|
// //得到团队的健康管理师
|
|
|
|
// DoctorTeamMember doctorTeamMemberHealthy = doctorTeamDoctor.findDoctorJiating2ByTeam(doctorTeam.getCode(), 3);
|
|
|
|
// DoctorTeamMember doctorTeamMember = doctorTeamDoctor.findDoctorJiating2ByTeam(doctorTeam.getCode(), 2);
|
|
|
|
// if (doctorTeamMemberHealthy == null) {
|
|
|
|
// ct.setDoctor(doctorTeamMember.getMemberCode());
|
|
|
|
// users.put(doctorTeamMember.getMemberCode(), 0);
|
|
|
|
// } else {
|
|
|
|
// users.put(doctorTeamMemberHealthy.getMemberCode(), 0);
|
|
|
|
// if (doctorTeamMember != null) {
|
|
|
|
// //全健同一个人导致会话成员状态问题处理
|
|
|
|
// if (users.isNull(doctorTeamMember.getMemberCode())) {
|
|
|
|
// users.put(doctorTeamMember.getMemberCode(), 1);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// ct.setDoctor(doctorTeamMemberHealthy.getMemberCode());
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 设置家庭医生
|
|
|
|
ct.setAdminTeamId(sf.getAdminTeamId());
|
|
|
|
}
|
|
|
|
// 设置患者信息
|
|
// 设置患者信息
|
|
ct.setPatient(patient);
|
|
ct.setPatient(patient);
|
|
// 查询患者信息
|
|
// 查询患者信息
|
|
@ -943,12 +810,13 @@ public class ConsultTeamService extends ConsultService {
|
|
consult.setGuidance(ct.getGuidance());
|
|
consult.setGuidance(ct.getGuidance());
|
|
// 设置咨询标识
|
|
// 设置咨询标识
|
|
ct.setConsult(consult.getCode());
|
|
ct.setConsult(consult.getCode());
|
|
|
|
//设置服务团队
|
|
|
|
ct.setTeam(concernDO.getTeamCode());
|
|
|
|
|
|
//推送给IM去创建议题,取得成员消息
|
|
//推送给IM去创建议题,取得成员消息
|
|
// JSONObject messages = ImUtill.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), "咨询问题:"+consult.getSymptoms(), consult.getImages());
|
|
|
|
JSONObject messages = ImUtill.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), consult.getSymptoms(), consult.getImages(),agent);
|
|
|
|
users.put(patient, 0);//+ " "+(tempPatient.getSex()==1?"(男 ":"(女 ") + IdCardUtil.getAgeForIdcard(tempPatient.getIdcard())+")"
|
|
|
|
JSONObject obj = ImUtill.createTopics(patient + "_" + ct.getTeam() + "_" + ct.getType(), consult.getCode(), tempPatient.getName(), users, messages, ImUtill.SESSION_TYPE_MUC);
|
|
|
|
|
|
JSONObject messages = imUtill.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), consult.getSymptoms(), consult.getImages(),agent);
|
|
|
|
users.put(patient, 0);
|
|
|
|
JSONObject obj = imUtill.createTopics(patient + "_" + ct.getTeam() + "_" + ct.getType(), consult.getCode(), tempPatient.getName(), users, messages, ImUtill.SESSION_TYPE_MUC);
|
|
if (obj == null) {
|
|
if (obj == null) {
|
|
throw new RuntimeException("IM消息发送异常!");
|
|
throw new RuntimeException("IM消息发送异常!");
|
|
}
|
|
}
|
|
@ -959,6 +827,9 @@ public class ConsultTeamService extends ConsultService {
|
|
consultTeamDao.save(ct);
|
|
consultTeamDao.save(ct);
|
|
consultDao.save(consult);
|
|
consultDao.save(consult);
|
|
|
|
|
|
|
|
//新增咨询数
|
|
|
|
doctorInfoService.addConsultNum(ct.getDoctor());
|
|
|
|
|
|
JSONArray doctor = new JSONArray();
|
|
JSONArray doctor = new JSONArray();
|
|
for (String key : users.keySet()) {
|
|
for (String key : users.keySet()) {
|
|
if (patient.equals(key)) {
|
|
if (patient.equals(key)) {
|
|
@ -978,7 +849,6 @@ public class ConsultTeamService extends ConsultService {
|
|
// 添加咨询转发记录
|
|
// 添加咨询转发记录
|
|
// 添加医生咨询日志
|
|
// 添加医生咨询日志
|
|
String content = addLogs(ct);
|
|
String content = addLogs(ct);
|
|
re.put("doctor",doctor);
|
|
|
|
re.put("status",1);
|
|
re.put("status",1);
|
|
return re;
|
|
return re;
|
|
|
|
|
|
@ -1006,10 +876,7 @@ public class ConsultTeamService extends ConsultService {
|
|
return -2;
|
|
return -2;
|
|
}
|
|
}
|
|
|
|
|
|
// String checkPre = prescriptionInfoService.checkPre(patient,DateUtil.getStringDateShort()+" 00:00:00");
|
|
|
|
// if("0".equals(checkPre)){//存在未结算的续方
|
|
|
|
// return -3;
|
|
|
|
// }
|
|
|
|
|
|
|
|
ct.setAdminTeamId(signFamily.getAdminTeamId());
|
|
ct.setAdminTeamId(signFamily.getAdminTeamId());
|
|
Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
|
|
Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
|
|
doctorCode = doctor.getCode();
|
|
doctorCode = doctor.getCode();
|
|
@ -1033,41 +900,6 @@ public class ConsultTeamService extends ConsultService {
|
|
}
|
|
}
|
|
//3、获取上次续方时间:与平安的“智慧医保的审方系统”对接,判断居民上次续方时间,点击跳转上次续方记录。(此功能需与第三方系统对接,如果本次版本无法实现,则消息中不显示此条信息)
|
|
//3、获取上次续方时间:与平安的“智慧医保的审方系统”对接,判断居民上次续方时间,点击跳转上次续方记录。(此功能需与第三方系统对接,如果本次版本无法实现,则消息中不显示此条信息)
|
|
jsonObject.put("lastTime","");
|
|
jsonObject.put("lastTime","");
|
|
|
|
|
|
// //--增加问卷填写情况---huangwenjie--2017.11.01---已和产品确认,这块消息不在续方咨询消息中添加
|
|
|
|
// List<PrescriptionFollowupContent> prescriptionFollowupContents =prescriptionFollowupContentDao.findByPrescriptionCode(prescription.getCode());
|
|
|
|
// boolean zzFlag = false;//是否填写症状问卷
|
|
|
|
// boolean tzssFlag = false;//是否填写体征和生活问卷
|
|
|
|
// for (PrescriptionFollowupContent prescriptionFollowupContent: prescriptionFollowupContents) {
|
|
|
|
// if(!zzFlag && "1".equals(prescriptionFollowupContent.getFollowupProject())){
|
|
|
|
// zzFlag = true;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// if(!tzssFlag &&
|
|
|
|
// ("2".equals(prescriptionFollowupContent.getFollowupProject())
|
|
|
|
// || "4".equals(prescriptionFollowupContent.getFollowupProject()))
|
|
|
|
// ){
|
|
|
|
// zzFlag = true;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// if(zzFlag && tzssFlag){
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// if(zzFlag){
|
|
|
|
// jsonObject.put("zzMsg","居民已填写问卷");
|
|
|
|
// }else{
|
|
|
|
// jsonObject.put("zzMsg","居民未填写问卷");
|
|
|
|
// }
|
|
|
|
// if(tzssFlag){
|
|
|
|
// jsonObject.put("tzssMsg","居民已填写问卷");
|
|
|
|
// }else{
|
|
|
|
// jsonObject.put("tzssMsg","居民未填写问卷");
|
|
|
|
// }
|
|
|
|
// jsonObject.put("zzFlag",zzFlag);
|
|
|
|
// jsonObject.put("tzssFlag",tzssFlag);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String content = jsonObject.toString();
|
|
String content = jsonObject.toString();
|
|
|
|
|
|
@ -1118,11 +950,11 @@ public class ConsultTeamService extends ConsultService {
|
|
ct.setConsult(consult.getCode());
|
|
ct.setConsult(consult.getCode());
|
|
|
|
|
|
//推送给IM去创建议题,取得成员消息
|
|
//推送给IM去创建议题,取得成员消息
|
|
JSONObject messages = ImUtill.getCreateTopicMessage(patient, p.getName(), consult.getTitle(), content, consult.getImages(),agent);
|
|
|
|
|
|
JSONObject messages = imUtill.getCreateTopicMessage(patient, p.getName(), consult.getTitle(), content, consult.getImages(),agent);
|
|
|
|
|
|
//5、(im创建咨询) 续方咨询的sessionid为居民code+续方code+咨询类型
|
|
//5、(im创建咨询) 续方咨询的sessionid为居民code+续方code+咨询类型
|
|
String sessionId = patient + "_" + consult.getCode() + "_" + ct.getType();
|
|
String sessionId = patient + "_" + consult.getCode() + "_" + ct.getType();
|
|
JSONObject obj = ImUtill.createTopics(sessionId, consult.getCode(), p.getName(), users, messages, ImUtill.SESSION_TYPE_PRESCRIPTION);
|
|
|
|
|
|
JSONObject obj = imUtill.createTopics(sessionId, consult.getCode(), p.getName(), users, messages, ImUtill.SESSION_TYPE_PRESCRIPTION);
|
|
if (obj == null) {
|
|
if (obj == null) {
|
|
throw new RuntimeException("IM消息发送异常!");
|
|
throw new RuntimeException("IM消息发送异常!");
|
|
}
|
|
}
|
|
@ -1885,8 +1717,8 @@ public class ConsultTeamService extends ConsultService {
|
|
return consultTeamLogDao.findOne(logId);
|
|
return consultTeamLogDao.findOne(logId);
|
|
}
|
|
}
|
|
|
|
|
|
public boolean isExistConsult(String uid, String doctor) {
|
|
|
|
int consultTeam = consultTeamDao.countByPatient(uid, doctor);
|
|
|
|
|
|
public boolean isExistConsult(String uid,Integer type, String doctor) {
|
|
|
|
int consultTeam = consultTeamDao.countByPatient(uid, doctor,type);
|
|
if (consultTeam > 0) {
|
|
if (consultTeam > 0) {
|
|
return true;
|
|
return true;
|
|
} else {
|
|
} else {
|
|
@ -1918,7 +1750,7 @@ public class ConsultTeamService extends ConsultService {
|
|
content = member.getName() + "("+relations.get(familyMember.getFamilyRelation())+")"+content;
|
|
content = member.getName() + "("+relations.get(familyMember.getFamilyRelation())+")"+content;
|
|
}
|
|
}
|
|
|
|
|
|
ImUtill.sendIntoTopicIM(ct.getPatient(),ct.getPatient(),ct.getConsult(),content,agent,intoUserName);
|
|
|
|
|
|
imUtill.sendIntoTopicIM(ct.getPatient(),ct.getPatient(),ct.getConsult(),content,agent,intoUserName);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@ -2215,7 +2047,7 @@ public class ConsultTeamService extends ConsultService {
|
|
participants.put(ct.getPatient(), 0);
|
|
participants.put(ct.getPatient(), 0);
|
|
participants.put(ct.getDoctor(), 0);
|
|
participants.put(ct.getDoctor(), 0);
|
|
Doctor doctor = doctorService.findDoctorByCode(uid);
|
|
Doctor doctor = doctorService.findDoctorByCode(uid);
|
|
JSONObject sessionJson = ImUtill.createSession(participants, ImUtill.SESSION_TYPE_P2P, doctor.getName() + "发起求助!", "");
|
|
|
|
|
|
JSONObject sessionJson = imUtill.createSession(participants, ImUtill.SESSION_TYPE_P2P, doctor.getName() + "发起求助!", "");
|
|
if (sessionJson.getInt("status") == -1) {
|
|
if (sessionJson.getInt("status") == -1) {
|
|
throw new RuntimeException(sessionJson.getString("message"));
|
|
throw new RuntimeException(sessionJson.getString("message"));
|
|
}
|
|
}
|
|
@ -2224,13 +2056,13 @@ public class ConsultTeamService extends ConsultService {
|
|
ct.setTeam(oldConsultCode);
|
|
ct.setTeam(oldConsultCode);
|
|
ConsultTeam oldConsult = consultTeamDao.findByConsult(oldConsultCode);
|
|
ConsultTeam oldConsult = consultTeamDao.findByConsult(oldConsultCode);
|
|
if (oldConsult != null && isSend == 1) {
|
|
if (oldConsult != null && isSend == 1) {
|
|
ImUtill.sendImMsg(ct.getPatient(), ct.getDoctor(), session.getString("id"), "1", "居民问题:" + oldConsult.getSymptoms(), "1");
|
|
|
|
|
|
imUtill.sendImMsg(ct.getPatient(), ct.getDoctor(), session.getString("id"), "1", "居民问题:" + oldConsult.getSymptoms(), "1");
|
|
//推送给IM图片
|
|
//推送给IM图片
|
|
if (StringUtils.isNotEmpty(oldConsult.getImages())) {
|
|
if (StringUtils.isNotEmpty(oldConsult.getImages())) {
|
|
String[] images = oldConsult.getImages().split(",");
|
|
String[] images = oldConsult.getImages().split(",");
|
|
for (String image : images) {
|
|
for (String image : images) {
|
|
if (StringUtils.isNoneEmpty(image)) {
|
|
if (StringUtils.isNoneEmpty(image)) {
|
|
ImUtill.sendImMsg(ct.getPatient(), ct.getDoctor(), session.getString("id"), "2", image, "1");
|
|
|
|
|
|
imUtill.sendImMsg(ct.getPatient(), ct.getDoctor(), session.getString("id"), "2", image, "1");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@ -2242,17 +2074,17 @@ public class ConsultTeamService extends ConsultService {
|
|
qiuzuObj.put("old_consult_code", oldConsultCode);
|
|
qiuzuObj.put("old_consult_code", oldConsultCode);
|
|
qiuzuObj.put("doctor", ct.getDoctor());
|
|
qiuzuObj.put("doctor", ct.getDoctor());
|
|
qiuzuObj.put("doctor_name", doctorTemp.getName());
|
|
qiuzuObj.put("doctor_name", doctorTemp.getName());
|
|
ImUtill.sendTopicIM(doctor.getCode(), doctor.getName(), oldConsultCode, "5", qiuzuObj.toString(),null);
|
|
|
|
|
|
imUtill.sendTopicIM(doctor.getCode(), doctor.getName(), oldConsultCode, "5", qiuzuObj.toString(),null);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
ImUtill.sendImMsg(ct.getPatient(), ct.getDoctor(), session.getString("id"), "1", "咨询问题:" + ct.getSymptoms(), "1");
|
|
|
|
|
|
imUtill.sendImMsg(ct.getPatient(), ct.getDoctor(), session.getString("id"), "1", "咨询问题:" + ct.getSymptoms(), "1");
|
|
//推送给IM图片
|
|
//推送给IM图片
|
|
if (StringUtils.isNotEmpty(ct.getImages())) {
|
|
if (StringUtils.isNotEmpty(ct.getImages())) {
|
|
String[] images = ct.getImages().split(",");
|
|
String[] images = ct.getImages().split(",");
|
|
for (String image : images) {
|
|
for (String image : images) {
|
|
if (StringUtils.isNoneEmpty(image)) {
|
|
if (StringUtils.isNoneEmpty(image)) {
|
|
ImUtill.sendImMsg(ct.getPatient(), ct.getDoctor(), session.getString("id"), "2", image, "1");
|
|
|
|
|
|
imUtill.sendImMsg(ct.getPatient(), ct.getDoctor(), session.getString("id"), "2", image, "1");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@ -2299,12 +2131,12 @@ public class ConsultTeamService extends ConsultService {
|
|
// 添加医生咨询日志
|
|
// 添加医生咨询日志
|
|
String content = addLogs(ct);
|
|
String content = addLogs(ct);
|
|
if (StringUtils.isBlank(oldConsultCode)) {
|
|
if (StringUtils.isBlank(oldConsultCode)) {
|
|
JSONObject messages = ImUtill.getCreateTopicMessage(doctorTemp.getCode(), doctorTemp.getName(), consult.getTitle(), content, consult.getImages(),null);
|
|
|
|
|
|
JSONObject messages = imUtill.getCreateTopicMessage(doctorTemp.getCode(), doctorTemp.getName(), consult.getTitle(), content, consult.getImages(),null);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.put(ct.getPatient(), 0);
|
|
jsonObject.put(ct.getPatient(), 0);
|
|
jsonObject.put(ct.getDoctor(), 0);
|
|
jsonObject.put(ct.getDoctor(), 0);
|
|
//设置消息ID
|
|
//设置消息ID
|
|
JSONObject obj = ImUtill.createTopics(null, consult.getCode(), doctorTemp.getName(), jsonObject, messages, ImUtill.SESSION_TYPE_P2P);
|
|
|
|
|
|
JSONObject obj = imUtill.createTopics(null, consult.getCode(), doctorTemp.getName(), jsonObject, messages, ImUtill.SESSION_TYPE_P2P);
|
|
if (obj == null || obj.getInt("status") == -1) {
|
|
if (obj == null || obj.getInt("status") == -1) {
|
|
throw new RuntimeException("im消息创建异常!" + obj == null ? "" : obj.getString("message"));
|
|
throw new RuntimeException("im消息创建异常!" + obj == null ? "" : obj.getString("message"));
|
|
}
|
|
}
|
|
@ -2315,28 +2147,28 @@ public class ConsultTeamService extends ConsultService {
|
|
ConsultTeam consultTeam = consultTeamDao.findByConsult(oldConsultCode);
|
|
ConsultTeam consultTeam = consultTeamDao.findByConsult(oldConsultCode);
|
|
ct.setTeam(oldConsultCode);
|
|
ct.setTeam(oldConsultCode);
|
|
if (oldConsult != null && isSend == 1) {
|
|
if (oldConsult != null && isSend == 1) {
|
|
JSONObject messages = ImUtill.getCreateTopicMessage(doctorTemp.getCode(), doctorTemp.getName(), consult.getTitle(), "居民问题:" + oldConsult.getSymptoms(), oldConsult.getImages(),null);
|
|
|
|
|
|
JSONObject messages = imUtill.getCreateTopicMessage(doctorTemp.getCode(), doctorTemp.getName(), consult.getTitle(), "居民问题:" + oldConsult.getSymptoms(), oldConsult.getImages(),null);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.put(ct.getPatient(), 0);
|
|
jsonObject.put(ct.getPatient(), 0);
|
|
jsonObject.put(ct.getDoctor(), 0);
|
|
jsonObject.put(ct.getDoctor(), 0);
|
|
JSONObject obj = ImUtill.createTopics(null, consult.getCode(), doctorTemp.getName(), jsonObject, messages, ImUtill.SESSION_TYPE_P2P);
|
|
|
|
|
|
JSONObject obj = imUtill.createTopics(null, consult.getCode(), doctorTemp.getName(), jsonObject, messages, ImUtill.SESSION_TYPE_P2P);
|
|
if (obj == null || obj.getInt("status") == -1) {
|
|
if (obj == null || obj.getInt("status") == -1) {
|
|
throw new RuntimeException("im消息创建异常!" + obj == null ? "" : obj.getString("message"));
|
|
throw new RuntimeException("im消息创建异常!" + obj == null ? "" : obj.getString("message"));
|
|
}
|
|
}
|
|
ct.setStartMsgId(obj.get("start_msg_id").toString());
|
|
ct.setStartMsgId(obj.get("start_msg_id").toString());
|
|
Thread.sleep(100);//消息发送顺序问题处理
|
|
Thread.sleep(100);//消息发送顺序问题处理
|
|
ImUtill.sendTopicIM(doctorTemp.getCode(), doctorTemp.getName(), consult.getCode(), "6", content, null);
|
|
|
|
|
|
imUtill.sendTopicIM(doctorTemp.getCode(), doctorTemp.getName(), consult.getCode(), "6", content, null);
|
|
if (StringUtils.isNotBlank(consult.getImages())) {
|
|
if (StringUtils.isNotBlank(consult.getImages())) {
|
|
String imgs[] = consult.getImages().split(",");
|
|
String imgs[] = consult.getImages().split(",");
|
|
for (String url : imgs)
|
|
for (String url : imgs)
|
|
ImUtill.sendTopicIM(doctorTemp.getCode(), doctorTemp.getName(), consult.getCode(), "2", url, null);
|
|
|
|
|
|
imUtill.sendTopicIM(doctorTemp.getCode(), doctorTemp.getName(), consult.getCode(), "2", url, null);
|
|
}
|
|
}
|
|
} else if (oldConsult != null && isSend == 0) {
|
|
} else if (oldConsult != null && isSend == 0) {
|
|
JSONObject messages = ImUtill.getCreateTopicMessage(doctorTemp.getCode(), doctorTemp.getName(), consult.getTitle(), content, oldConsult.getImages(),null);
|
|
|
|
|
|
JSONObject messages = imUtill.getCreateTopicMessage(doctorTemp.getCode(), doctorTemp.getName(), consult.getTitle(), content, oldConsult.getImages(),null);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.put(ct.getPatient(), 0);
|
|
jsonObject.put(ct.getPatient(), 0);
|
|
jsonObject.put(ct.getDoctor(), 0);
|
|
jsonObject.put(ct.getDoctor(), 0);
|
|
JSONObject obj = ImUtill.createTopics(null, consult.getCode(), doctorTemp.getName(), jsonObject, messages, ImUtill.SESSION_TYPE_P2P);
|
|
|
|
|
|
JSONObject obj = imUtill.createTopics(null, consult.getCode(), doctorTemp.getName(), jsonObject, messages, ImUtill.SESSION_TYPE_P2P);
|
|
if (obj == null || obj.getInt("status") == -1) {
|
|
if (obj == null || obj.getInt("status") == -1) {
|
|
throw new RuntimeException("im消息创建异常!" + obj == null ? "" : obj.getString("message"));
|
|
throw new RuntimeException("im消息创建异常!" + obj == null ? "" : obj.getString("message"));
|
|
}
|
|
}
|
|
@ -2347,7 +2179,7 @@ public class ConsultTeamService extends ConsultService {
|
|
qiuzuObj.put("old_consult_code", oldConsultCode);
|
|
qiuzuObj.put("old_consult_code", oldConsultCode);
|
|
qiuzuObj.put("doctor", ct.getDoctor());
|
|
qiuzuObj.put("doctor", ct.getDoctor());
|
|
qiuzuObj.put("doctor_name", doctor.getName());
|
|
qiuzuObj.put("doctor_name", doctor.getName());
|
|
ImUtill.sendTopicIM(doctorTemp.getCode(), doctorTemp.getName(), oldConsultCode, "5", qiuzuObj.toString(), null);
|
|
|
|
|
|
imUtill.sendTopicIM(doctorTemp.getCode(), doctorTemp.getName(), oldConsultCode, "5", qiuzuObj.toString(), null);
|
|
}
|
|
}
|
|
consultTeamDao.save(ct); // 保存医生咨询信息
|
|
consultTeamDao.save(ct); // 保存医生咨询信息
|
|
consultTeamDoctorDao.save(cd);
|
|
consultTeamDoctorDao.save(cd);
|
|
@ -2388,7 +2220,7 @@ public class ConsultTeamService extends ConsultService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
JSONObject obj = ImUtill.endTopics(consultTeam.getPatient(), endId, endName, consultTeam.getConsult());
|
|
|
|
|
|
JSONObject obj = imUtill.endTopics(consultTeam.getPatient(), endId, endName, consultTeam.getConsult());
|
|
if (obj == null) {
|
|
if (obj == null) {
|
|
throw new RuntimeException("IM消息结束异常!");
|
|
throw new RuntimeException("IM消息结束异常!");
|
|
}
|
|
}
|
|
@ -2583,9 +2415,9 @@ public class ConsultTeamService extends ConsultService {
|
|
jsonObject.put(ct.getPatient(), 0);
|
|
jsonObject.put(ct.getPatient(), 0);
|
|
jsonObject.put(ct.getDoctor(), 0);
|
|
jsonObject.put(ct.getDoctor(), 0);
|
|
|
|
|
|
JSONObject messages = ImUtill.getCreateTopicMessage(senderId, senderName, senderName + "发起咨询", content, ct.getImages(),agent);
|
|
|
|
|
|
JSONObject messages = imUtill.getCreateTopicMessage(senderId, senderName, senderName + "发起咨询", content, ct.getImages(),agent);
|
|
|
|
|
|
JSONObject obj = ImUtill.createTopics(null, consult.getCode(), consult.getSymptoms(), jsonObject, messages, ImUtill.SESSION_TYPE_P2P);
|
|
|
|
|
|
JSONObject obj = imUtill.createTopics(null, consult.getCode(), consult.getSymptoms(), jsonObject, messages, ImUtill.SESSION_TYPE_P2P);
|
|
if (obj == null) {
|
|
if (obj == null) {
|
|
throw new RuntimeException("im消息创建异常!");
|
|
throw new RuntimeException("im消息创建异常!");
|
|
}
|
|
}
|
|
@ -2594,7 +2426,7 @@ public class ConsultTeamService extends ConsultService {
|
|
}
|
|
}
|
|
//设置消息ID
|
|
//设置消息ID
|
|
ct.setStartMsgId(obj.getString("start_msg_id"));
|
|
ct.setStartMsgId(obj.getString("start_msg_id"));
|
|
JSONObject object = ImUtill.getTopic(ct.getConsult());
|
|
|
|
|
|
JSONObject object = imUtill.getTopic(ct.getConsult());
|
|
JSONArray array = new JSONArray(object.get("data").toString());
|
|
JSONArray array = new JSONArray(object.get("data").toString());
|
|
consultTeamDao.save(ct); // 保存医生咨询信息
|
|
consultTeamDao.save(ct); // 保存医生咨询信息
|
|
consultTeamDoctorDao.save(cd);
|
|
consultTeamDoctorDao.save(cd);
|
|
@ -2604,7 +2436,7 @@ public class ConsultTeamService extends ConsultService {
|
|
//获取会话ID。休眠1秒后继续获取相应信息
|
|
//获取会话ID。休眠1秒后继续获取相应信息
|
|
// PS:可以通过前端请求两次去解决,由于离职,就不挖坑了,后来者可以改善、
|
|
// PS:可以通过前端请求两次去解决,由于离职,就不挖坑了,后来者可以改善、
|
|
Thread.sleep(1000);
|
|
Thread.sleep(1000);
|
|
object = ImUtill.getTopic(ct.getConsult());
|
|
|
|
|
|
object = imUtill.getTopic(ct.getConsult());
|
|
array = new JSONArray(object.get("data").toString());
|
|
array = new JSONArray(object.get("data").toString());
|
|
}
|
|
}
|
|
return array.getJSONObject(0);
|
|
return array.getJSONObject(0);
|
|
@ -2709,7 +2541,7 @@ public class ConsultTeamService extends ConsultService {
|
|
contentobj.put("msgType",type);
|
|
contentobj.put("msgType",type);
|
|
contentobj.put("isSendWxTemplate",true);//是否发送咨询回复的微信模板
|
|
contentobj.put("isSendWxTemplate",true);//是否发送咨询回复的微信模板
|
|
//医生发送Im消息
|
|
//医生发送Im消息
|
|
ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "17", contentobj.toString(), null);
|
|
|
|
|
|
imUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "17", contentobj.toString(), null);
|
|
// contentobj.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
|
|
// contentobj.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
|
|
// //居民发送Im消息
|
|
// //居民发送Im消息
|
|
// ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "17", contentobj.toString(), null);
|
|
// ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "17", contentobj.toString(), null);
|