|
@ -879,14 +879,14 @@ public class ConsultTeamService extends ConsultService {
|
|
|
// 查询患者信息
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
|
|
|
//获取基位处方详情
|
|
|
//1、获取基位处方详情(保存续方表、药品续方信息表、续方疾病类型表)
|
|
|
Prescription prescription = new Prescription();
|
|
|
savePrescription(prescription,jwCode,doctor,p,ct,reason);
|
|
|
String symptoms = savePrescription(prescription,jwCode,doctor,p,ct,reason);
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("title",p.getName()+"申请续方");
|
|
|
|
|
|
//获取体征记录
|
|
|
//2、获取体征记录
|
|
|
Iterable<PatientDevice> devices = patientDeviceDao.findByUser(patient);
|
|
|
if(devices!=null||devices.iterator().hasNext()){
|
|
|
int count = messageDao.findTzMessage(patient);
|
|
@ -894,11 +894,11 @@ public class ConsultTeamService extends ConsultService {
|
|
|
}else{
|
|
|
jsonObject.put("tzMsg","居民未绑定体征设备");
|
|
|
}
|
|
|
//获取上次续方时间:与平安的“智慧医保的审方系统”对接,判断居民上次续方时间,点击跳转上次续方记录。(此功能需与第三方系统对接,如果本次版本无法实现,则消息中不显示此条信息)
|
|
|
//3、获取上次续方时间:与平安的“智慧医保的审方系统”对接,判断居民上次续方时间,点击跳转上次续方记录。(此功能需与第三方系统对接,如果本次版本无法实现,则消息中不显示此条信息)
|
|
|
jsonObject.put("lastTime","");
|
|
|
String symptoms = jsonObject.toString();
|
|
|
String content = jsonObject.toString();
|
|
|
|
|
|
//创建咨询
|
|
|
//4、创建咨询
|
|
|
JSONObject users = new JSONObject();//咨询参与者
|
|
|
users.put(patient, 0);
|
|
|
users.put(doctorCode, 0);
|
|
@ -925,10 +925,11 @@ public class ConsultTeamService extends ConsultService {
|
|
|
ct.setCzrq(new Date());
|
|
|
ct.setDel("1");
|
|
|
ct.setStatus(0);
|
|
|
ct.setEvaluate(0);
|
|
|
// 医生未读数量为1
|
|
|
ct.setDoctorRead(1);
|
|
|
// 添加咨询记录
|
|
|
Consult consult = addConsult(ct.getPatient(), null, ct.getSymptoms(), ct.getImages(), ct.getType());
|
|
|
Consult consult = addConsult(ct.getPatient(), "申请续方", ct.getSymptoms(), ct.getImages(), ct.getType());
|
|
|
// 设置关联指导
|
|
|
consult.setGuidance(ct.getGuidance());
|
|
|
//关联业务code
|
|
@ -937,9 +938,9 @@ public class ConsultTeamService extends ConsultService {
|
|
|
ct.setConsult(consult.getCode());
|
|
|
|
|
|
//推送给IM去创建议题,取得成员消息
|
|
|
JSONObject messages = ImUtill.getCreateTopicMessage(patient, p.getName(), consult.getTitle(), consult.getSymptoms(), consult.getImages(),agent);
|
|
|
JSONObject messages = ImUtill.getCreateTopicMessage(patient, p.getName(), consult.getTitle(), content, consult.getImages(),agent);
|
|
|
|
|
|
//续方咨询的sessionid为居民code+续方code+咨询类型
|
|
|
//5、(im创建咨询) 续方咨询的sessionid为居民code+续方code+咨询类型
|
|
|
JSONObject obj = ImUtill.createTopics(patient + "_" + prescription.getCode() + "_" + ct.getType(), consult.getCode(), p.getName(), users, messages, ImUtill.SESSION_TYPE_PRESCRIPTION);
|
|
|
if (obj == null) {
|
|
|
throw new RuntimeException("IM消息发送异常!");
|
|
@ -951,7 +952,7 @@ public class ConsultTeamService extends ConsultService {
|
|
|
consultTeamDao.save(ct);
|
|
|
consultDao.save(consult);
|
|
|
|
|
|
//记录咨询的医生详情
|
|
|
//6、记录咨询的医生详情
|
|
|
ConsultTeamDoctor cd = new ConsultTeamDoctor();
|
|
|
cd.setConsult(consult.getCode());
|
|
|
cd.setDel("1");
|
|
@ -959,13 +960,13 @@ public class ConsultTeamService extends ConsultService {
|
|
|
cd.setTo(doctorCode);
|
|
|
consultTeamDoctorDao.save(cd);
|
|
|
|
|
|
//发送系统消息提示团队长有未审核的消息
|
|
|
//7、发送系统消息提示团队长有未审核的消息
|
|
|
addCheckMessage(prescription,p);
|
|
|
|
|
|
// 保存医生咨询信息
|
|
|
//8、 保存医生咨询信息
|
|
|
// 添加咨询转发记录
|
|
|
// 添加医生咨询日志
|
|
|
String content = addLogs(ct);
|
|
|
addLogs(ct);
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
@ -1007,7 +1008,8 @@ public class ConsultTeamService extends ConsultService {
|
|
|
* @param reason
|
|
|
* @return
|
|
|
*/
|
|
|
public Prescription savePrescription(Prescription prescription,String jwCode,Doctor doctor,Patient p,ConsultTeam ct,String reason){
|
|
|
public String savePrescription(Prescription prescription,String jwCode,Doctor doctor,Patient p,ConsultTeam ct,String reason){
|
|
|
String re = "";
|
|
|
prescription.setCode(getCode());
|
|
|
prescription.setParentCode(jwCode);
|
|
|
prescription.setHospitalName(doctor.getHospitalName());
|
|
@ -1049,9 +1051,11 @@ public class ConsultTeamService extends ConsultService {
|
|
|
diagnosis.setUpdateTime(new Date());
|
|
|
prescriptionDiagnosisDao.save(diagnosis);
|
|
|
|
|
|
re +=diagnosis.getName();
|
|
|
|
|
|
prescriptionLogService.addLog(prescription,3,1,1);
|
|
|
|
|
|
return prescription;
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
/**
|