|
@ -1,12 +1,18 @@
|
|
|
package com.yihu.wlyy.service.third.guahao;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.wlyy.entity.doctor.survey.SurveyScreenResult;
|
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.PatientReservation;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.repository.doctor.SurveyScreenResultDao;
|
|
|
import com.yihu.wlyy.repository.message.MessageDao;
|
|
|
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientReservationDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.service.app.consult.ConsultService;
|
|
|
import com.yihu.wlyy.service.common.account.PatientService;
|
|
|
import com.yihu.wlyy.service.third.httplog.LogService;
|
|
@ -30,7 +36,7 @@ import java.util.*;
|
|
|
* 厦门市民健康网挂号服务
|
|
|
*/
|
|
|
@Service
|
|
|
public class GuahaoXMService implements IGuahaoService {
|
|
|
public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
|
|
|
|
private int nextDays = 8; //一周内预约号
|
|
|
private String ORG_LIST = "GetOrgListNew";//获取医院列表
|
|
@ -55,6 +61,13 @@ public class GuahaoXMService implements IGuahaoService {
|
|
|
JwSmjkService jwSmjkService;
|
|
|
@Autowired
|
|
|
SignFamilyDao signFamilyDao;
|
|
|
@Autowired
|
|
|
private MessageDao messageDao;
|
|
|
@Autowired
|
|
|
private SurveyScreenResultDao surveyScreenResultDao;
|
|
|
|
|
|
@Autowired
|
|
|
private PatientDao patientDao;
|
|
|
|
|
|
@Autowired
|
|
|
private LogService logService;
|
|
@ -64,10 +77,12 @@ public class GuahaoXMService implements IGuahaoService {
|
|
|
|
|
|
private ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 解析挂号后
|
|
|
*/
|
|
|
private String CreateOrderAfter(String response, String hospitalId, String hospitalName, String hosDeptId, String hosDeptName, String doctorId, String doctorName, String sectionType, String startTime, String endTime, String patient, String patientName, String cardNo, String clinicCard, String patientPhone, String dname, String dcode) throws Exception {
|
|
|
private String CreateOrderAfter(String response, String hospitalId, String hospitalName, String hosDeptId, String hosDeptName, String doctorId, String doctorName, String sectionType, String startTime, String endTime, String patient, String patientName, String cardNo, String clinicCard, String patientPhone, String dname, String dcode,String surveyCode) throws Exception {
|
|
|
String code = "";
|
|
|
if (response.startsWith("error") || response.startsWith("System-Error")) {
|
|
|
throw new Exception(response);
|
|
@ -80,6 +95,13 @@ public class GuahaoXMService implements IGuahaoService {
|
|
|
throw new Exception(response);
|
|
|
}
|
|
|
|
|
|
Patient patient1 = null;
|
|
|
try {
|
|
|
patient1 = patientDao.findByCode(patient);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
System.out.println("获取病人信息失败");
|
|
|
}
|
|
|
// 查询医生职称和头像
|
|
|
GuahaoDoctor doctor = null;
|
|
|
try{
|
|
@ -128,12 +150,40 @@ public class GuahaoXMService implements IGuahaoService {
|
|
|
|
|
|
}
|
|
|
// 保存预约记录
|
|
|
patientReservationDao.save(reservation);
|
|
|
PatientReservation patientReservation = patientReservationDao.save(reservation);
|
|
|
if(StringUtils.isNotBlank(dcode)){
|
|
|
Patient p = patientService.findByCode(patient);
|
|
|
consultService.sendMucMessageBySingnType(dcode,dname,patient,"我已成功为您预约:" + startTime + "," + hospitalName + hosDeptName + doctorName + "医生的号源。您可直接前往医院就诊</br><a name='guahao' href='javascript:void(0)' data-id='" + reservation.getId() + "'>点击查看详情</a>","1",p.getName());
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNoneBlank(surveyCode)){
|
|
|
SurveyScreenResult surveyScreenResult = surveyScreenResultDao.findByCode(surveyCode);
|
|
|
surveyScreenResult.setOrder(1);
|
|
|
surveyScreenResult.setReservationCode(patientReservation.getCode());
|
|
|
surveyScreenResultDao.save(surveyScreenResult);
|
|
|
|
|
|
//发送消息
|
|
|
Message message = new Message();
|
|
|
message.setCzrq(new Date());
|
|
|
message.setCreateTime(new Date());
|
|
|
message.setContent("您有一个居民开通专科服务");
|
|
|
message.setRead(1);//设置未读
|
|
|
message.setReceiver(doctorId);//设置接受医生的code
|
|
|
message.setSender(patient);//设置发送的用户
|
|
|
message.setSenderName(patientName);
|
|
|
message.setCode(getCode());
|
|
|
message.setSenderPhoto(patient1.getPhoto());
|
|
|
message.setTitle("专科医生共管通知");
|
|
|
message.setType(17);//家庭签约取消信息
|
|
|
message.setReadonly(1);//是否只读消息
|
|
|
message.setSex(patient1.getSex());
|
|
|
message.setOver("1");//未处理
|
|
|
message.setRelationCode(patientReservation.getCode());
|
|
|
message.setDel("1");
|
|
|
message.setState(1);
|
|
|
messageDao.save(message);
|
|
|
}
|
|
|
|
|
|
return code;
|
|
|
}
|
|
|
|
|
@ -653,7 +703,7 @@ public class GuahaoXMService implements IGuahaoService {
|
|
|
verificationXml(response,"获取医生排班表失败!",ORDER_CREATE,content,method,msgBody,res);
|
|
|
//保存http日志
|
|
|
logService.saveHttpLog(true,ORDER_CREATE,content,method,null,msgBody,res,null,logService.archiveType);
|
|
|
re = CreateOrderAfter(response, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, null, null);
|
|
|
re = CreateOrderAfter(response, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, null, null,null);
|
|
|
} else {
|
|
|
throw new Exception("该排班信息错误或者不存在!");
|
|
|
}
|
|
@ -1161,7 +1211,7 @@ public class GuahaoXMService implements IGuahaoService {
|
|
|
/**
|
|
|
* 转诊预约挂号
|
|
|
*/
|
|
|
public String CreateOrderByDoctor(String hospitalId, String hospitalName, String hosDeptId, String hosDeptName, String doctorId, String doctorName, String arrangeDate, String patient, String patientName, String cardNo, String clinicCard, String patientPhone, String dname, String dcode) throws Exception {
|
|
|
public String CreateOrderByDoctor(String hospitalId, String hospitalName, String hosDeptId, String hosDeptName, String doctorId, String doctorName, String arrangeDate, String patient, String patientName, String cardNo, String clinicCard, String patientPhone, String dname, String dcode,String surveyCode) throws Exception {
|
|
|
String re = "";
|
|
|
|
|
|
Patient p = patientService.findByCode(patient);
|
|
@ -1177,7 +1227,7 @@ public class GuahaoXMService implements IGuahaoService {
|
|
|
|
|
|
String response = jwSmjkService.webRegisterByFamily(cardNo, patientName, clinicCard, sectionType, startTime, hospitalId, hosDeptId, hosDeptName, doctorId, doctorName,patientPhone);
|
|
|
|
|
|
re = CreateOrderAfter(response, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode);
|
|
|
re = CreateOrderAfter(response, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode,surveyCode);
|
|
|
} else {
|
|
|
throw new Exception("该排班信息错误或者不存在!");
|
|
|
}
|