|
@ -943,8 +943,6 @@ public class ImService {
|
|
|
// 查询患者信息
|
|
|
BasePatientDO p = basePatientDao.findById(patient);
|
|
|
|
|
|
|
|
|
|
|
|
if(!"0".equals(wlyyOutpatientDO.getStatus())){
|
|
|
throw new RuntimeException("该就诊记录已被取消,无法接单!");
|
|
|
}
|
|
@ -962,11 +960,15 @@ public class ImService {
|
|
|
//4、创建咨询
|
|
|
JSONObject users = new JSONObject();//咨询参与者
|
|
|
|
|
|
String consultTitle = "";
|
|
|
//协同门诊
|
|
|
if("2".equals(wlyyOutpatientDO.getOutpatientType())){
|
|
|
users.put(wlyyOutpatientDO.getGeneralDoctor(),0);
|
|
|
ct.setType(12);
|
|
|
consultTitle = "申请协同门诊";
|
|
|
}else{
|
|
|
users.put(patient, 0);
|
|
|
consultTitle = "申请复诊";
|
|
|
}
|
|
|
users.put(doctorCode, 0);
|
|
|
//关联业务code
|
|
@ -994,7 +996,7 @@ public class ImService {
|
|
|
// 医生未读数量为1
|
|
|
ct.setDoctorRead(1);
|
|
|
// 添加咨询记录
|
|
|
ConsultDo consult = addConsult(ct.getPatient(), "申请复诊", ct.getSymptoms(), ct.getImages(), ct.getType());
|
|
|
ConsultDo consult = addConsult(ct.getPatient(), consultTitle, ct.getSymptoms(), ct.getImages(), ct.getType());
|
|
|
// 设置关联指导
|
|
|
consult.setGuidance(ct.getGuidance());
|
|
|
//关联业务code
|
|
@ -1005,19 +1007,33 @@ public class ImService {
|
|
|
//推送给IM去创建议题,取得成员消息
|
|
|
|
|
|
JSONObject messages = new JSONObject();
|
|
|
JSONObject obj = new JSONObject();
|
|
|
String sessionId = "";
|
|
|
//协同门诊
|
|
|
if("2".equals(wlyyOutpatientDO.getOutpatientType())){
|
|
|
BaseDoctorDO generalDoctor = baseDoctorDao.findById(wlyyOutpatientDO.getGeneralDoctor());
|
|
|
messages = imUtil.getCreateTopicMessage(generalDoctor.getId(),generalDoctor.getName(), consult.getTitle(), content, consult.getImages(), doctorCode);
|
|
|
//5、(im创建咨询) 续方咨询的sessionid为居民code+就诊code+12(图文,视频,图文+视频)
|
|
|
sessionId = patient + "_" + outpatientCode + "_" + ct.getType();
|
|
|
obj = imUtil.createTopics(sessionId, consult.getId(), p.getName(), users, messages, imUtil.SESSION_TYPE_COLLABORATION_HOSPITAL);
|
|
|
}else{
|
|
|
messages = imUtil.getCreateTopicMessage(patient, p.getName(), consult.getTitle(), content, consult.getImages(), doctorCode);
|
|
|
//5、(im创建咨询) 续方咨询的sessionid为居民code+就诊code+9(图文,视频,图文+视频)
|
|
|
sessionId = patient + "_" + outpatientCode + "_" + ct.getType();
|
|
|
|
|
|
if(1== type){
|
|
|
//图文复诊
|
|
|
obj = imUtil.createTopics(sessionId, consult.getId(), p.getName(), users, messages, imUtil.SESSION_TYPE_EXAMINATION);
|
|
|
}else{
|
|
|
//视频复诊+图文复诊
|
|
|
obj = imUtil.createTopics(sessionId, consult.getId(), p.getName(), users, messages, imUtil.SESSION_TYPE_EXAMINATION_VIDEO);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//5、(im创建咨询) 续方咨询的sessionid为居民code+就诊code+咨询类型(图文,视频,图文+视频)
|
|
|
String sessionId = patient + "_" + outpatientCode + "_" + ct.getType();
|
|
|
JSONObject obj = imUtil.createTopics(sessionId, consult.getId(), p.getName(), users, messages, imUtil.SESSION_TYPE_EXAMINATION);
|
|
|
|
|
|
if (obj == null) {
|
|
|
throw new RuntimeException("IM消息发送异常!");
|
|
|
}
|
|
@ -1681,4 +1697,150 @@ public class ImService {
|
|
|
public String patientGuaidenceAppend(String sender_id, String sender_name, String session_id,String content_type, String content, String business_type)throws Exception {
|
|
|
return imUtil.sendImMsg(sender_id, sender_name,session_id, content_type, content, "1");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 全科医生发起求助专科医生的专家咨询
|
|
|
* @param patient_code
|
|
|
* @param general_doctor
|
|
|
* @param special_doctor
|
|
|
* @param when
|
|
|
* @param symptoms
|
|
|
* @param images
|
|
|
* @param consult
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject generalAddExpertConsult(String patient_code, String general_doctor, String special_doctor, String when, String symptoms, String images, ConsultTeamDo ct) throws Exception {
|
|
|
// 设置咨询类型:15
|
|
|
ct.setType(15);
|
|
|
// 设置发病时间
|
|
|
ct.setWhen(when);
|
|
|
// 设置主要症状
|
|
|
ct.setSymptoms(symptoms);
|
|
|
// 设置咨询图片URL
|
|
|
ct.setImages(images);
|
|
|
// 设置咨询语音URL
|
|
|
ct.setVoice(null);
|
|
|
|
|
|
BaseDoctorDO generalDoctor = baseDoctorDao.findById(general_doctor);
|
|
|
BaseDoctorDO specialDoctor = baseDoctorDao.findById(special_doctor);
|
|
|
// doctorCode = doctor.getCode();
|
|
|
// 查询患者信息
|
|
|
BasePatientDO p = basePatientDao.findById(patient_code);
|
|
|
|
|
|
String consultTitle = "居民:"+p.getName() +"(医生:)-"+specialDoctor.getName()+"发起咨询!";
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("title", consultTitle);
|
|
|
jsonObject.put("content",symptoms);
|
|
|
jsonObject.put("age",DateUtil.getAgeForIdcard(p.getIdcard()));
|
|
|
jsonObject.put("sex",p.getSex());
|
|
|
jsonObject.put("name",p.getName());
|
|
|
|
|
|
String content = jsonObject.toString();
|
|
|
|
|
|
//4、创建咨询
|
|
|
JSONObject users = new JSONObject();//咨询参与者
|
|
|
users.put(general_doctor,0);//全科医生
|
|
|
users.put(special_doctor,0);//专科医生
|
|
|
|
|
|
//关联业务code
|
|
|
// ct.setRelationCode(outpatientCode);
|
|
|
//医生信息
|
|
|
ct.setDoctor(special_doctor);
|
|
|
ct.setDoctorName(specialDoctor.getName());
|
|
|
// 设置患者信息
|
|
|
ct.setPatient(p.getId());
|
|
|
ct.setSymptoms(symptoms);
|
|
|
|
|
|
// 设置患者姓名
|
|
|
ct.setName(p.getName());
|
|
|
// 设置患者生日
|
|
|
ct.setBirthday(p.getBirthday());
|
|
|
//新增性别
|
|
|
ct.setSex(p.getSex());
|
|
|
// 设置患者头像
|
|
|
ct.setPhoto(p.getPhoto());
|
|
|
// 设置操作日期
|
|
|
ct.setCzrq(new Date());
|
|
|
ct.setDel("1");
|
|
|
ct.setStatus(0);
|
|
|
ct.setEvaluate(0);
|
|
|
// 医生未读数量为1
|
|
|
ct.setDoctorRead(1);
|
|
|
// 添加咨询记录
|
|
|
ConsultDo consult = addConsult(ct.getPatient(), consultTitle, ct.getSymptoms(), ct.getImages(), ct.getType());
|
|
|
// 设置关联指导
|
|
|
// consult.setGuidance(ct.getGuidance());
|
|
|
//关联业务code
|
|
|
// consult.setRelationCode(outpatientCode);
|
|
|
// 设置咨询标识
|
|
|
ct.setConsult(consult.getId());
|
|
|
|
|
|
//推送给IM去创建议题,取得成员消息
|
|
|
|
|
|
JSONObject messages = new JSONObject();
|
|
|
JSONObject obj = new JSONObject();
|
|
|
String sessionId = "";
|
|
|
messages = imUtil.getCreateTopicMessage(generalDoctor.getId(),generalDoctor.getName(), consult.getTitle(), content, consult.getImages(), special_doctor);
|
|
|
//5、(im创建咨询) 续方咨询的sessionid为居民code+就诊code+12(图文,视频,图文+视频)
|
|
|
sessionId = patient_code+"_"+general_doctor + "_" + special_doctor + "_" + ct.getType();
|
|
|
obj = imUtil.createTopics(sessionId, consult.getId(), p.getName(), users, messages, imUtil.SESSION_TYPE_GENERAL_EXPERT);
|
|
|
|
|
|
if (obj == null) {
|
|
|
throw new RuntimeException("IM消息发送异常!");
|
|
|
}
|
|
|
if (obj.getInteger("status") == -1) {//im议题创建失败
|
|
|
throw new RuntimeException(obj.getString("message"));
|
|
|
}
|
|
|
ct.setStartMsgId(obj.get("start_msg_id").toString());
|
|
|
consultTeamDao.save(ct);
|
|
|
consultDao.save(consult);
|
|
|
|
|
|
//设置咨询code
|
|
|
// wlyyOutpatientDO.setConsult(consult.getCode());
|
|
|
// prescriptionDao.save(prescription);
|
|
|
|
|
|
//6、记录咨询的医生详情
|
|
|
ConsultTeamDoctorDo cd = new ConsultTeamDoctorDo();
|
|
|
cd.setConsult(consult.getId());
|
|
|
cd.setDel("1");
|
|
|
cd.setCzrq(new Date());
|
|
|
cd.setTo(special_doctor);
|
|
|
consultTeamDoctorDao.save(cd);
|
|
|
|
|
|
//7、发送系统消息提示团队长有未审核的消息
|
|
|
// addCheckMessage(prescription, sessionId, p);
|
|
|
|
|
|
//8、 保存医生咨询信息
|
|
|
// 添加咨询转发记录
|
|
|
// 添加医生咨询日志
|
|
|
addLogs(ct);
|
|
|
|
|
|
JSONObject result = imUtil.getSingleSessionInfo(sessionId,special_doctor);
|
|
|
|
|
|
|
|
|
//外层消息-通知
|
|
|
System.out.println("发送外层SOCKET消息:全科求助专科医生");
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("socket_sms_type",5);
|
|
|
imUtil.sendMessage(special_doctor,general_doctor,"1",object.toString());
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询全科医生与专科医生是否存在未结束的咨询
|
|
|
* @param session_id
|
|
|
* @return
|
|
|
*/
|
|
|
public String isExistsUnfinishedConsult(String session_id) throws Exception{
|
|
|
|
|
|
Boolean re = false;
|
|
|
re = imUtil.sessionIsExist(session_id);
|
|
|
if(re){
|
|
|
return session_id;
|
|
|
}else{
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
}
|