| 
					
				 | 
			
			
				@ -119,6 +119,8 @@ import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.net.MalformedURLException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.net.URL; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.text.DecimalFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.text.ParseException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Base64; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -826,24 +828,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        businessOrderService.recharge(outpatient.getId(), "复诊-诊查费", "2", "复诊-诊查费", patientDO.getId(), patientDO.getName(), outpatient.getDoctor(), price); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BusinessOrderDO businessOrderDO = businessOrderService.recharge(outpatient.getId(), "复诊-诊查费", "2", "复诊-诊查费", patientDO.getId(), patientDO.getName(), outpatient.getDoctor(), price); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPatientRegisterTimeDO registerTimeDO = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPatientRegisterTimeDO wlyyPatientRegisterTimeDO =new WlyyPatientRegisterTimeDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //如果是视频预约咨询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(registerJson)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO = objectMapper.readValue(registerJson, WlyyPatientRegisterTimeDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO.setOutpatientId(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientRegisterTimeDao.save(registerTimeDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyPatientRegisterTimeDO = patientRegisterTimeDao.save(registerTimeDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 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()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientRegisterTimeDao.delete(wlyyPatientRegisterTimeDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("您今日发起过复诊,不允许更改取药方式"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (0==expressageDO.getOneselfPickupFlg()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            /*if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String drugCode= expressageDO.getHospitalCode()==null?"5550":expressageDO.getHospitalCode(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -881,7 +889,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return outpatient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyPrescriptionExpressageDO checkOutPatientPre(String patientId) throws ParseException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select t.id as \"id\",t.adm_no as \"admNo\",t.create_time as \"createTime\" from wlyy_outpatient t where 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String startDate = DateUtil.getStringDateShort()+" 00:00:00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String endDate = DateUtil.getStringDateShort()+" 23:59:59"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and t.create_time >= '" +startDate+"' "+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " and t.create_time <= '" +endDate+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and  t.create_time >= to_char('"+startDate+"','yyyy-mm-dd hh:mm:ss')\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "and t.create_time < to_char('"+endDate+"','yyyy-mm-dd hh:mm:ss')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and  t.create_time >= to_char('"+startDate+"','yyyy-mm-dd hh:mm:ss')\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "and t.create_time < to_char('"+endDate+"','yyyy-mm-dd hh:mm:ss')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(patientId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and t.patient = '"+patientId+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql +=" and t.outpatient_type = 1  order by t.create_time desc"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        System.out.println(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> listPrescript = hibenateUtils.createSQLQuery(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String outPatientId=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (listPrescript.size()>1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,Object> mapPrescript = listPrescript.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outPatientId = mapPrescript.get("id").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionExpressageDO> list =  prescriptionExpressageDao.findByOutpatientId(outPatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO wlyyPrescriptionExpressageDO = new WlyyPrescriptionExpressageDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             wlyyPrescriptionExpressageDO = list.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return wlyyPrescriptionExpressageDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 创建候诊室 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4019,7 +4058,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("发送失败,error="+e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //保存发送模板记录, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                WxPushLogDO wxPushLogDO = new WxPushLogDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wxPushLogDO.setCreateTime(new Date()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5657,7 +5695,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param admNo     门诊唯一号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param realOrder 处方号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Object getSFExpressInfo(String admNo, String realOrder, String wxId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -8256,10 +8294,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 电子病历签名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param prescriptionEmrDO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void SOF_SignDataWithExtraInfoEmr(WlyyPrescriptionEmrDO prescriptionEmrDO) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionEmrDO.getPrescriptionId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionEmrDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseDoctorDO doctorDO = baseDoctorDao.findById(prescriptionDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(prescriptionDO.getPatientCode()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -8267,6 +8306,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PKIService_ServiceLocator locator = new PKIService_ServiceLocator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        URL portAddress = new URL("http://192.0.33.91:8080/pkis/services/v1?wsdl"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PKIService_PortType service = locator.getPKIServiceImplPort(portAddress); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionDO.getId(), 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionDO.getId(), 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //电子病历签名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        com.alibaba.fastjson.JSONObject jsonData = new com.alibaba.fastjson.JSONObject(); 
			 |