|
@ -1,11 +1,13 @@
|
|
package com.yihu.wlyy.service.third.guahao;
|
|
package com.yihu.wlyy.service.third.guahao;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.survey.SurveyScreenResult;
|
|
import com.yihu.wlyy.entity.doctor.survey.SurveyScreenResult;
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.PatientReservation;
|
|
import com.yihu.wlyy.entity.patient.PatientReservation;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.doctor.SurveyScreenResultDao;
|
|
import com.yihu.wlyy.repository.doctor.SurveyScreenResultDao;
|
|
import com.yihu.wlyy.repository.message.MessageDao;
|
|
import com.yihu.wlyy.repository.message.MessageDao;
|
|
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
|
|
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
|
|
@ -26,6 +28,7 @@ import org.dom4j.Element;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
@ -75,6 +78,12 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
@Autowired
|
|
@Autowired
|
|
private ConsultService consultService;
|
|
private ConsultService consultService;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private DoctorDao doctorDao;
|
|
|
|
|
|
private ObjectMapper objectMapper = new ObjectMapper();
|
|
private ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
|
|
|
|
|
@ -83,8 +92,8 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
* 解析挂号后
|
|
* 解析挂号后
|
|
*/
|
|
*/
|
|
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 {
|
|
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")) {
|
|
|
|
|
|
String code = "321321321";
|
|
|
|
/* if (response.startsWith("error") || response.startsWith("System-Error")) {
|
|
throw new Exception(response);
|
|
throw new Exception(response);
|
|
} else if (response.toLowerCase().startsWith("ok")) { //预约成功
|
|
} else if (response.toLowerCase().startsWith("ok")) { //预约成功
|
|
// 预约成功,获取预约号
|
|
// 预约成功,获取预约号
|
|
@ -93,7 +102,7 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
code = response.split("\\|")[0];
|
|
code = response.split("\\|")[0];
|
|
} else {
|
|
} else {
|
|
throw new Exception(response);
|
|
throw new Exception(response);
|
|
}
|
|
|
|
|
|
}*/
|
|
|
|
|
|
Patient patient1 = null;
|
|
Patient patient1 = null;
|
|
try {
|
|
try {
|
|
@ -104,12 +113,12 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
}
|
|
}
|
|
// 查询医生职称和头像
|
|
// 查询医生职称和头像
|
|
GuahaoDoctor doctor = null;
|
|
GuahaoDoctor doctor = null;
|
|
try{
|
|
|
|
|
|
/*try{
|
|
doctor = jwSmjkService.getGuahaoDoctor(doctorId, hospitalId, hosDeptId);
|
|
doctor = jwSmjkService.getGuahaoDoctor(doctorId, hospitalId, hosDeptId);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
System.out.println("获取医生信息失败");
|
|
System.out.println("获取医生信息失败");
|
|
}
|
|
|
|
|
|
}*/
|
|
// 保存预约记录
|
|
// 保存预约记录
|
|
PatientReservation reservation = new PatientReservation();
|
|
PatientReservation reservation = new PatientReservation();
|
|
reservation.setCode(code);
|
|
reservation.setCode(code);
|
|
@ -121,10 +130,10 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
reservation.setDeptName(hosDeptName);
|
|
reservation.setDeptName(hosDeptName);
|
|
reservation.setDoctorCode(doctorId);
|
|
reservation.setDoctorCode(doctorId);
|
|
reservation.setDoctorName(doctorName);
|
|
reservation.setDoctorName(doctorName);
|
|
if(doctor!=null){
|
|
|
|
|
|
/*if(doctor!=null){
|
|
reservation.setDoctorJob(doctor.getTitle());
|
|
reservation.setDoctorJob(doctor.getTitle());
|
|
reservation.setDoctorPhoto(doctor.getPhoto());
|
|
reservation.setDoctorPhoto(doctor.getPhoto());
|
|
}
|
|
|
|
|
|
}*/
|
|
reservation.setIdcard(cardNo);
|
|
reservation.setIdcard(cardNo);
|
|
reservation.setName(patientName);
|
|
reservation.setName(patientName);
|
|
reservation.setPatient(patient);
|
|
reservation.setPatient(patient);
|
|
@ -157,10 +166,12 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
}
|
|
}
|
|
|
|
|
|
if (StringUtils.isNoneBlank(surveyCode)){
|
|
if (StringUtils.isNoneBlank(surveyCode)){
|
|
SurveyScreenResult surveyScreenResult = surveyScreenResultDao.findByCode(surveyCode);
|
|
|
|
|
|
SurveyScreenResult surveyScreenResult = surveyScreenResultDao.getSurveyScreenResultByCode(surveyCode);
|
|
surveyScreenResult.setOrder(1);
|
|
surveyScreenResult.setOrder(1);
|
|
surveyScreenResult.setReservationCode(patientReservation.getCode());
|
|
surveyScreenResult.setReservationCode(patientReservation.getCode());
|
|
surveyScreenResultDao.save(surveyScreenResult);
|
|
|
|
|
|
String sql = "update wlyy_survey_screen_result ssr set ssr.is_order = "+surveyScreenResult.getOrder()+"," +
|
|
|
|
"reservation_code = '"+surveyScreenResult.getReservationCode()+"' where ssr.id = '"+surveyScreenResult.getId()+"'";
|
|
|
|
jdbcTemplate.update(sql);
|
|
|
|
|
|
//发送消息
|
|
//发送消息
|
|
Message message = new Message();
|
|
Message message = new Message();
|
|
@ -181,9 +192,14 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
message.setRelationCode(patientReservation.getCode());
|
|
message.setRelationCode(patientReservation.getCode());
|
|
message.setDel("1");
|
|
message.setDel("1");
|
|
message.setState(1);
|
|
message.setState(1);
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
object.put("name",patient1.getName());
|
|
|
|
object.put("carq",patientReservation.getCzrq());
|
|
|
|
object.put("title",surveyScreenResult.getTemplateTitle());
|
|
|
|
object.put("screenResult",surveyScreenResult.getScreenResult());
|
|
|
|
message.setReason(object.toString());
|
|
messageDao.save(message);
|
|
messageDao.save(message);
|
|
}
|
|
}
|
|
|
|
|
|
return code;
|
|
return code;
|
|
}
|
|
}
|
|
|
|
|
|
@ -1225,9 +1241,9 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
String startTime = map.get("startTime");
|
|
String startTime = map.get("startTime");
|
|
String endTime = map.get("endTime");
|
|
String endTime = map.get("endTime");
|
|
|
|
|
|
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,surveyCode);
|
|
|
|
|
|
/* String response = jwSmjkService.webRegisterByFamily(cardNo, patientName, clinicCard, sectionType, startTime, hospitalId, hosDeptId, hosDeptName, doctorId, doctorName,patientPhone);
|
|
|
|
*/
|
|
|
|
re = CreateOrderAfter(null, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode,surveyCode);
|
|
} else {
|
|
} else {
|
|
throw new Exception("该排班信息错误或者不存在!");
|
|
throw new Exception("该排班信息错误或者不存在!");
|
|
}
|
|
}
|
|
@ -1235,4 +1251,48 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
return re;
|
|
return re;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取转诊信息
|
|
|
|
*
|
|
|
|
* @param relationCode 关联code
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public com.alibaba.fastjson.JSONObject getPatientReservationInfo(String relationCode){
|
|
|
|
PatientReservation patientReservation = patientReservationDao.findByCode(relationCode);
|
|
|
|
List<SurveyScreenResult> surveyScreenResults = null;
|
|
|
|
Patient patient = null;
|
|
|
|
SignFamily signFamily = null;
|
|
|
|
Doctor doctor = null;
|
|
|
|
int age = 0;
|
|
|
|
if (patientReservation != null){
|
|
|
|
surveyScreenResults = surveyScreenResultDao.getByReservationCode(relationCode);
|
|
|
|
patient = patientDao.findByCode(patientReservation.getPatient());
|
|
|
|
age = DateUtil.getAgeByBirthday(patient.getBirthday());
|
|
|
|
signFamily = signFamilyDao.findByPatient(patientReservation.getPatient());
|
|
|
|
doctor = doctorDao.findByCode(signFamily.getDoctor());
|
|
|
|
}
|
|
|
|
com.alibaba.fastjson.JSONObject object = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(patientReservation);
|
|
|
|
object.put("surveyScreenResults",surveyScreenResults);
|
|
|
|
object.put("patient",patient);
|
|
|
|
object.put("age",age);
|
|
|
|
object.put("signFamily",signFamily);
|
|
|
|
object.put("doctor",doctor);
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONObject updateRecode(String messageCode,String surveyCode){
|
|
|
|
Message message = messageDao.findByCode(messageCode);
|
|
|
|
message.setOver("0");
|
|
|
|
messageDao.save(message);
|
|
|
|
SurveyScreenResult surveyScreenResult = surveyScreenResultDao.getSurveyScreenResultByCode(surveyCode);
|
|
|
|
surveyScreenResult.setOrder(2);
|
|
|
|
surveyScreenResultDao.save(surveyScreenResult);
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
object.put("message",message);
|
|
|
|
object.put("surveyScreenResult",surveyScreenResult);
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|