| 
															
																@ -9,11 +9,14 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.base.im.ConsultDo; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.base.im.ConsultDo; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.base.im.ConsultTeamDo; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.base.im.ConsultTeamDo; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.base.patient.BasePatientDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.base.patient.BasePatientDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.hospital.mapping.PatientMappingDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.hospital.message.SystemMessageDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.hospital.message.SystemMessageDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionEmrDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionEmrDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.mapping.dao.PatientMappingDao; 
															 | 
															
															 | 
															
																import com.yihu.jw.hospital.mapping.dao.PatientMappingDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.prescription.dao.OutpatientDao; 
															 | 
															
															 | 
															
																import com.yihu.jw.hospital.prescription.dao.OutpatientDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.jw.hospital.prescription.dao.PrescriptionDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.prescription.service.PrescriptionService; 
															 | 
															
															 | 
															
																import com.yihu.jw.hospital.prescription.service.PrescriptionService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.prescription.service.XzyyPrescriptionService; 
															 | 
															
															 | 
															
																import com.yihu.jw.hospital.prescription.service.XzyyPrescriptionService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService; 
															 | 
															
															 | 
															
																import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -102,6 +105,8 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																	private YlzPayService ylzPayService; 
															 | 
															
															 | 
															
																	private YlzPayService ylzPayService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																	@Autowired 
															 | 
															
															 | 
															
																	@Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																	private PatientMappingDao patientMappingDao; 
															 | 
															
															 | 
															
																	private PatientMappingDao patientMappingDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																	@Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																	private PrescriptionDao prescriptionDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																	 
															 | 
															
															 | 
															
																	 
															 | 
														
													
												
													
														
															| 
															 | 
															
																	@Value("${wechat.id}") 
															 | 
															
															 | 
															
																	@Value("${wechat.id}") 
															 | 
														
													
												
													
														
															| 
															 | 
															
																	private String wxId; 
															 | 
															
															 | 
															
																	private String wxId; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -413,32 +418,38 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																		msgObj.put("msg",baseDoctorDO.getName()+"结束了咨询"); 
															 | 
															
															 | 
															
																		msgObj.put("msg",baseDoctorDO.getName()+"结束了咨询"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																		msgObj.put("consultcode",consult); 
															 | 
															
															 | 
															
																		msgObj.put("consultcode",consult); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																		String jsonStr = ""; 
															 | 
															
															 | 
															
																		String jsonStr = ""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																		/*ConsultDo cons = consultDao.findOne(consult); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																		//结束时医生未开处方则发送模板消息结算 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																		ConsultDo cons = consultDao.findOne(consult); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																		if (StringUtils.isNoneBlank(cons.getRelationCode())){ 
															 | 
															
															 | 
															
																		if (StringUtils.isNoneBlank(cons.getRelationCode())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																			List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByPatientListNoStatus(cons.getPatient()); 
															 | 
															
															 | 
															
																			List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByPatientListNoStatus(cons.getPatient()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																			//发送诊断消息 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																			if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																			//发送诊断支付 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																			if (wlyyOutpatientDOList!=null&&wlyyOutpatientDOList.size()==1){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				WlyyOutpatientDO outpatientDO = wlyyOutpatientDOList.get(0); 
															 | 
															
															 | 
															
																				WlyyOutpatientDO outpatientDO = wlyyOutpatientDOList.get(0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				String userName = null; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				String idcard = null; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				if (patientDO != null) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																					userName = patientDO.getName(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																					idcard = patientDO.getIdcard(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				} 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				String userNo = null; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				if (patientMappingDO != null) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																					userNo = patientMappingDO.getMappingCode(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				} 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				String cardNo = null; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				if (StringUtils.isNoneBlank(outpatientDO.getCardNo())) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																					cardNo = outpatientDO.getCardNo(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutpatientId(outpatientDO.getId()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				if (wlyyPrescriptionDOS==null||wlyyPrescriptionDOS.size()==0){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					logger.info("发送诊查费支付模板消息start"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					String userName = null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					String idcard = null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					if (patientDO != null) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																						userName = patientDO.getName(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																						idcard = patientDO.getIdcard(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getConsumer()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					String userNo = null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					if (patientMappingDO != null) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																						userNo = patientMappingDO.getMappingCode(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					String cardNo = null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					if (StringUtils.isNoneBlank(outpatientDO.getCardNo())) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																						cardNo = outpatientDO.getCardNo(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					String date=DateUtil.dateToStr(outpatientDO.getRegisterDate(), "yyyyMMddHHmmss"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, outpatientDO.getRealOrder(), outpatientDO.getDeptName(), outpatientDO.getDoctorName(), date, "15", "1"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					logger.info("发送诊查费支付模板消息end"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				} 
															 | 
															
															 | 
															
																				} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				String date=DateUtil.dateToStr(outpatientDO.getRegisterDate(), "yyyyMMddHHmmss"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, null, outpatientDO.getDeptName(), outpatientDO.getDoctorName(), date, "15", "1"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																			} 
															 | 
															
															 | 
															
																			} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																		}*/ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																		if(1 == resutl){ 
															 | 
															
															 | 
															
																		if(1 == resutl){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																			jsonStr = "{\"id\":\""+ UUID.randomUUID().toString()+"\",\"sender_id\":\""+doctorCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+new Date().getTime()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}"; 
															 | 
															
															 | 
															
																			jsonStr = "{\"id\":\""+ UUID.randomUUID().toString()+"\",\"sender_id\":\""+doctorCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+new Date().getTime()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																		} 
															 | 
															
															 | 
															
																		} 
															 |