| 
					
				 | 
			
			
				@ -76,10 +76,12 @@ import com.yihu.jw.util.common.IdCardUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.common.LatitudeUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.wechat.WeixinMessagePushUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.AdminException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.Pkis.PKIService_PortType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.WebserviceUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.hibernate.HibenateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.sfutils.MyErrorCode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.wechat.dao.BasePatientWechatDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.wechat.dao.WechatDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.wechat.dao.WxPushLogDao; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -281,14 +283,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag,String ksdm) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patient:" + patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patNo " + patNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS30025(patNo, null, startTime, endTime, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS30025(patNo, null, startTime, endTime, demoFlag,ksdm); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -305,7 +307,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patNo:" + patNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> list = entranceService.BS30025(patNo, conNo, null, null, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> list = entranceService.BS30025(patNo, conNo, null, null, demoFlag,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyOutpatientVO outpatientVO = list.get(0); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -794,6 +796,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyOutpatientDO appointmentRevisit(String outpatientJson, String expressageJson, String registerJson, String chargeType) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.保存就诊实体 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -812,7 +815,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (outpatientDO.getRegisterDate() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setRegisterDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO previous = checkOutPatientPre(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.物流信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null!=previous.getId()&&previous.getOneselfPickupFlg()!=expressageDO.getOneselfPickupFlg()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new AdminException(MyErrorCode.take_control); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("WX_MONEY"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Double price = 0.0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -843,19 +851,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new RuntimeException("号源已经被预约,请选择其他号源"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO previous = checkOutPatientPre(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.物流信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      /*  if (null!=previous&&previous.getOneselfPickupFlg()!=expressageDO.getOneselfPickupFlg()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDao.delete(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            businessOrderDao.delete(businessOrderDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("您今日发起过复诊,不允许更改取药方式"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (0==expressageDO.getOneselfPickupFlg()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            /*if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String drugCode= expressageDO.getHospitalCode()==null?"5550":expressageDO.getHospitalCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setHospitalCode(drugCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            System.out.println("进入物流信息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            expressageDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            expressageDO.setCreateTime(new Date()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3659,7 +3660,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if("outPatientTimeOutRemind".equalsIgnoreCase(titelType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            contentMsg = "您邀请的医师暂无应答,您可以选择继续等待或者取消邀请。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            first = outpatientDO.getPatientName() + ",您好!"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId=    "+outpatientId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("outPatientTimeOutRemind:outpatientId="+outpatientId+"contentMsg"+contentMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if ("payRemind".equalsIgnoreCase(titelType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("9".equals(type)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3689,7 +3691,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            first = outpatientDO.getPatientName() + ",您好! 医生已为您开具处方,请及时支付。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            contentMsg = "医生已为您开具处方,请及时支付。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            remark = "点击完成支付,如您已支付请忽略本条信息"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msgUrl="/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msgUrl="/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId+"&id="+remindMsg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("处方支付微信消息模板推送开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if ("msgRemind".equalsIgnoreCase(titelType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            first = outpatientDO.getPatientName() + ",您好!"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3994,6 +3996,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("XZZX_Msg_" + titelType + "=" + responseMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String responseMsg=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String prefix="https://hlwyy.xmzsh.com"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotEmpty(outpatientId)){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4006,6 +4009,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        contentMsg, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        remark 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                System.out.println("结束发送模板消息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (consultTeam!=null&&consPatientDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                responseMsg = entranceService.ehospitalNotice( 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -7210,7 +7214,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ykyyService.pushNotificationToYktPatient(patient.getYktId(), messageDO.getTitle(), data.get("msg").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sendWxTemplateMsg(wxId, outpatientDO.getId(), null,"", "prescriptionPayRemind", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sendWxTemplateMsg(wxId, outpatientDO.getId(), null,"", "prescriptionPayRemind", wlyyPrescriptionDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyPrescriptionDO.setId(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyPrescriptionDO.setCheckStatus(status); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -8224,7 +8228,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void SOF_SignDataWithExtraInfoEmr(WlyyPrescriptionEmrDO prescriptionEmrDO) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionEmrDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionEmrDO.getPrescriptionId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseDoctorDO doctorDO = baseDoctorDao.findById(prescriptionDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(prescriptionDO.getPatientCode()); 
			 |