|  | @ -1,9 +1,12 @@
 | 
	
		
			
				|  |  | package com.yihu.wlyy.service.app.prescription;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.doctor.profile.Doctor;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.organization.Hospital;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.organization.HospitalDept;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.patient.Patient;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.patient.prescription.*;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.doctor.DoctorDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.organization.HospitalDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.patient.PatientDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.prescription.*;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.DateUtil;
 | 
	
	
		
			
				|  | @ -41,6 +44,9 @@ public class PrescriptionExpressageService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private DoctorDao doctorDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private HospitalDao hospitalDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PatientDao patientDao;
 | 
	
		
			
				|  |  |     @Value("${wechat.wechat_base_url}")
 | 
	
	
		
			
				|  | @ -205,11 +211,11 @@ public class PrescriptionExpressageService {
 | 
	
		
			
				|  |  |         prescriptionDispensaryCode.setIsUse(1);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //发送模板消息通知患者药品开始配送
 | 
	
		
			
				|  |  |         String url="prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
 | 
	
		
			
				|  |  |                 "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName() ;
 | 
	
		
			
				|  |  |         String url = "prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
 | 
	
		
			
				|  |  |                 "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         prescriptionNoticesService.sendMessages(userCode,doctor.getName(), DateUtil.dateToStrLong(expressageing),3, 0,url );
 | 
	
		
			
				|  |  |         prescriptionNoticesService.sendMessages(userCode, doctor.getName(), DateUtil.dateToStrLong(expressageing), 3, 0, url);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return prescriptionDispensaryCode.getType();
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -253,11 +259,11 @@ public class PrescriptionExpressageService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //发送模板消息通知患者取药
 | 
	
		
			
				|  |  |         //发送模板消息通知患者药品开始配送
 | 
	
		
			
				|  |  |         String url="prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
 | 
	
		
			
				|  |  |                 "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName() ;
 | 
	
		
			
				|  |  |         String url = "prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
 | 
	
		
			
				|  |  |                 "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         prescriptionNoticesService.sendMessages(prescription.getPatient(),doctor.getName(), DateUtil.dateToStrLong(expressage2hospitalDate),4, 0, url);
 | 
	
		
			
				|  |  |         prescriptionNoticesService.sendMessages(prescription.getPatient(), doctor.getName(), DateUtil.dateToStrLong(expressage2hospitalDate), 4, 0, url);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return prescriptionDispensaryCode.getType();
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -273,7 +279,7 @@ public class PrescriptionExpressageService {
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void updatePrescriptionExpressage(PrescriptionExpressage prescriptionExpressage) throws Exception {
 | 
	
		
			
				|  |  |         //修改处方状态为配送配送中
 | 
	
		
			
				|  |  |         prescriptionDao.updateStatus(prescriptionExpressage.getPrescriptionCode(),65);
 | 
	
		
			
				|  |  |         prescriptionDao.updateStatus(prescriptionExpressage.getPrescriptionCode(), 65);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //保存处方物流记录
 | 
	
		
			
				|  |  |         prescriptionExpressageDao.save(prescriptionExpressage);
 | 
	
	
		
			
				|  | @ -301,11 +307,16 @@ public class PrescriptionExpressageService {
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @Transactional
 | 
	
		
			
				|  |  |     public void updateExpressageJGS(String code, String name, String mobile, String prescriptionCode, String doctorQK) {
 | 
	
		
			
				|  |  |         Doctor doctor = doctorDao.findByCode(code);
 | 
	
		
			
				|  |  |         Hospital hospital = hospitalDao.findByCode(doctor.getHospital());
 | 
	
		
			
				|  |  |         //更新配送表 新增配送人员记录
 | 
	
		
			
				|  |  |         PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionPay(prescriptionCode);
 | 
	
		
			
				|  |  |         prescriptionExpressage.setExpressageCode(code);
 | 
	
		
			
				|  |  |         prescriptionExpressage.setExpressageMobile(mobile);
 | 
	
		
			
				|  |  |         prescriptionExpressage.setExpressageName(name);
 | 
	
		
			
				|  |  |         prescriptionExpressage.setExpressageHospitalAddress(hospital.getAddress());
 | 
	
		
			
				|  |  |         prescriptionExpressage.setExpressageHospitalCode(doctor.getHospital());
 | 
	
		
			
				|  |  |         prescriptionExpressage.setExpressageHospitalName(doctor.getHospitalName());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //新增日志
 | 
	
		
			
				|  |  |         PrescriptionLog prescriptionLog = new PrescriptionLog();
 | 
	
	
		
			
				|  | @ -343,8 +354,8 @@ public class PrescriptionExpressageService {
 | 
	
		
			
				|  |  |         /**
 | 
	
		
			
				|  |  |          * 判断如果服务站和患者填写的服务站一致  那么就修改处方状态为送达服务站
 | 
	
		
			
				|  |  |          */
 | 
	
		
			
				|  |  |         if(hospital.equals(prescriptionExpressage.getPatientHospitalCode())){
 | 
	
		
			
				|  |  |             Prescription prescription=prescriptionDao.findByCode(prescriptionCode);
 | 
	
		
			
				|  |  |         if (hospital.equals(prescriptionExpressage.getPatientHospitalCode())) {
 | 
	
		
			
				|  |  |             Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
 | 
	
		
			
				|  |  |             prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
 | 
	
		
			
				|  |  |             prescription.setExpressageTime(new Date());
 | 
	
		
			
				|  |  | 
 |