|
@ -1,6 +1,7 @@
|
|
|
package com.yihu.wlyy.service.third.guahao;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.wlyy.entity.doctor.DoctorMapping;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.survey.SurveyScreenResult;
|
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
@ -8,6 +9,7 @@ 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.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorMappingDao;
|
|
|
import com.yihu.wlyy.repository.doctor.SurveyScreenResultDao;
|
|
|
import com.yihu.wlyy.repository.message.MessageDao;
|
|
|
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
|
|
@ -84,6 +86,9 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
|
@Autowired
|
|
|
private DoctorDao doctorDao;
|
|
|
|
|
|
@Autowired
|
|
|
private DoctorMappingDao doctorMappingDao;
|
|
|
|
|
|
private ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
|
|
|
@ -119,6 +124,13 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
|
e.printStackTrace();
|
|
|
System.out.println("获取医生信息失败");
|
|
|
}
|
|
|
DoctorMapping doctorMapping = null;
|
|
|
try{
|
|
|
doctorMapping = doctorMappingDao.findByJwDoctorHospitalAndJwDoctor(doctor.getHospitalName(),doctorId);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
System.out.println("获取系统医生信息失败");
|
|
|
}
|
|
|
// 保存预约记录
|
|
|
PatientReservation reservation = new PatientReservation();
|
|
|
reservation.setCode(code);
|
|
@ -169,17 +181,21 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
|
SurveyScreenResult surveyScreenResult = surveyScreenResultDao.getSurveyScreenResultByCode(surveyCode);
|
|
|
surveyScreenResult.setIsOrder(1);
|
|
|
surveyScreenResult.setReservationCode(patientReservation.getCode());
|
|
|
surveyScreenResult.setFollowing(0);
|
|
|
String sql = "update wlyy_survey_screen_result ssr set ssr.is_order = "+surveyScreenResult.getIsOrder()+"," +
|
|
|
"reservation_code = '"+surveyScreenResult.getReservationCode()+"' where ssr.id = '"+surveyScreenResult.getId()+"'";
|
|
|
jdbcTemplate.update(sql);
|
|
|
|
|
|
|
|
|
//发送消息
|
|
|
Message message = new Message();
|
|
|
message.setCzrq(new Date());
|
|
|
message.setCreateTime(new Date());
|
|
|
message.setContent("您有一个居民开通专科服务");
|
|
|
message.setRead(1);//设置未读
|
|
|
message.setReceiver(doctorId);//设置接受医生的code
|
|
|
if (doctorMapping!=null){
|
|
|
message.setReceiver(doctorMapping.getDoctorCode());//设置接受医生的code
|
|
|
}
|
|
|
message.setSender(patient);//设置发送的用户
|
|
|
message.setSenderName(patientName);
|
|
|
message.setCode(getCode());
|
|
@ -1288,6 +1304,7 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
|
|
|
messageDao.save(message);
|
|
|
SurveyScreenResult surveyScreenResult = surveyScreenResultDao.getSurveyScreenResultByCode(surveyCode);
|
|
|
surveyScreenResult.setIsOrder(2);
|
|
|
surveyScreenResult.setFollowing(0);
|
|
|
surveyScreenResultDao.save(surveyScreenResult);
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("message",message);
|