| 
															
																@ -22,6 +22,7 @@ import com.yihu.jw.hospital.message.service.SystemMessageService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																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.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.entrance.EntranceService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService; 
															 | 
															
															 | 
															
																import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.ykyy.service.YkyyService; 
															 | 
															
															 | 
															
																import com.yihu.jw.hospital.ykyy.service.YkyyService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.im.dao.ConsultDao; 
															 | 
															
															 | 
															
																import com.yihu.jw.im.dao.ConsultDao; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -127,6 +128,8 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																	private PatientMappingDao patientMappingDao; 
															 | 
															
															 | 
															
																	private PatientMappingDao patientMappingDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																	@Autowired 
															 | 
															
															 | 
															
																	@Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																	private PrescriptionDao prescriptionDao; 
															 | 
															
															 | 
															
																	private PrescriptionDao prescriptionDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																	@Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																	private EntranceService entranceService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																	@Value("${fastDFS.fastdfs_file_url}") 
															 | 
															
															 | 
															
																	@Value("${fastDFS.fastdfs_file_url}") 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -630,36 +633,41 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																		//结束时医生未开处方则发送模板消息结算 
															 | 
															
															 | 
															
																		//结束时医生未开处方则发送模板消息结算 
															 | 
														
													
												
													
														
															| 
															 | 
															
																		ConsultDo cons = consultDao.findOne(consult); 
															 | 
															
															 | 
															
																		ConsultDo cons = consultDao.findOne(consult); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																		if (org.apache.commons.lang3.StringUtils.isNoneBlank(cons.getRelationCode())){ 
															 | 
															
															 | 
															
																		if (org.apache.commons.lang3.StringUtils.isNoneBlank(cons.getRelationCode())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																			Date startTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" 00:00:00"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																			Date endTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" 23:59:59"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																			List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByPatientListNoStatus(cons.getPatient(),startTime,endTime); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																			//发送诊断支付 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																			if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				WlyyOutpatientDO outpatientDO = outpatientDao.findById(cons.getRelationCode()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																				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 (org.apache.commons.lang3.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"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																			WlyyOutpatientDO outpatientDO = outpatientDao.findById(cons.getRelationCode()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																			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 (org.apache.commons.lang3.StringUtils.isNoneBlank(outpatientDO.getCardNo())) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					cardNo = outpatientDO.getCardNo(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				String date=DateUtil.dateToStr(outpatientDO.getRegisterDate(), "yyyyMMddHHmmss"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				net.sf.json.JSONObject object =entranceService.BS15054(patientMappingDO.getMappingCode(),outpatientDO.getRealOrder(),false); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				net.sf.json.JSONObject res = object.getJSONObject("resquest"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				logger.info("获取待结算数据 res: " + res.toString()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				String rsCode = res.getString("@RESULT"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				String free= 0+""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				if ("0".equals(rsCode)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					free = res.getString("@total_charge"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				if (!free.equalsIgnoreCase("0")){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																					ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, outpatientDO.getRealOrder(), outpatientDO.getDeptName(), outpatientDO.getDoctorName(), date, free, "1"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																				logger.info("发送诊查费支付模板消息end"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																			} 
															 | 
															
															 | 
															
																			} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																		} 
															 | 
															
															 | 
															
																		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																		if(1 == resutl){ 
															 | 
															
															 | 
															
																		if(1 == resutl){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																			jsonStr = "{\"id\":\""+UUID.randomUUID().toString()+"\",\"sender_id\":\""+patientCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+new Date().getTime()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}"; 
															 | 
															
															 | 
															
																			jsonStr = "{\"id\":\""+UUID.randomUUID().toString()+"\",\"sender_id\":\""+patientCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+new Date().getTime()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}"; 
															 |