| 
					
				 | 
			
			
				@ -1346,12 +1346,12 @@ public class XzzxEntranceService{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String checkDoctor="<Doctor POSITION=\""+patientAndDoctor.getString("POSITION")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\" NAME=\""+patientAndDoctor.getString("DOCTOR_NAME")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\" DEPT_CODE=\""+patientAndDoctor.getString("DEPT_CODE")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\" DEPT_NAME=\""+patientAndDoctor.getString("DEPT_NAME")+"\" USER_ID=\""+patientAndDoctor.getString("doctorId")+"\" />"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String checkPatient="<Patient NAME=\""+patientAndDoctor.getString("patientName")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\" ID=\""+patientAndDoctor.getString("patientId")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\" DEPT_NAME=\""+patientAndDoctor.getString("DEPT_NAME")+"\" USER_ID=\""+patientAndDoctor.getString("DOCTOR_ID")+"\" />"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String checkPatient="<Patient NAME=\""+patientAndDoctor.getString("PATIENT_NAME")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\" ID=\""+patientAndDoctor.getString("PATIENT_ID")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\" VISIT_ID=\"0\" PATIENT_PRES_ID=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\" BIRTH=\""+patientAndDoctor.getString("birth")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\" HEIGHT=\"0\" WEIGHT=\"0\" GENDER=\""+patientAndDoctor.getString("gender")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\" BIRTH=\""+patientAndDoctor.getString("BIRTH")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\" HEIGHT=\"0\" WEIGHT=\"0\" GENDER=\""+patientAndDoctor.getString("GENDER")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\" PREGNANT=\"\" LACT=\"否\" HEPATICAL=\"是\" RENAL=\"是\" PANCREAS=\"否\" ALERGY_DRUGS=\"青霉素类\" IDENTITY_TYPE=\"\" FEE_TYPE=\""+patientAndDoctor.getString("FEE_TYPE")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\" SCR=\"\" SCR_UNIT=\"umol/L\" GESTATION_AGE=\"\" PRETERM_BIRTH=\"\" DRUG_HISTORY=\"\" FAMILY_DISEASE_HISTORY=\"\" GENETIC_DISEASE=\"\" MEDICARE_01=\"\" MEDICARE_02=\"\" MEDICARE_03=\"\" MEDICARE_04=\"\" MEDICARE_05=\"\" />"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String checkDiagnosises = "<Diagnosises DIAGNOSISES=\""+patientAndDoctor.getString("diagnosises")+"\" >\n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1360,18 +1360,17 @@ public class XzzxEntranceService{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:infos){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            stringBuffer.append("<Advice REPEAT=\"1\" DRUG_LO_NAME=\""+wlyyPrescriptionInfoDO.getDrugName()+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" DRUG_LO_ID=\""+wlyyPrescriptionInfoDO.getHisCode()+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" ADMINISTRATION=\""+wlyyPrescriptionInfoDO.getYpyf()+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" DOSAGE=\""+wlyyPrescriptionInfoDO.getQuantity()+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" DOSAGE_UNIT=\""+wlyyPrescriptionInfoDO.getUnit()+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" ADMINISTRATION=\""+wlyyPrescriptionInfoDO.getSupplyName()+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" DOSAGE=\""+wlyyPrescriptionInfoDO.getDosage()+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" DOSAGE_UNIT=\""+wlyyPrescriptionInfoDO.getUnitName()+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" FREQ_COUNT=\""+wlyyPrescriptionInfoDO.getUsageCode()+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" FREQ_INTERVAL=\"1\" FREQ_INTERVAL_UNIT=\""+wlyyPrescriptionInfoDO.getUsageName()+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" START_DAY=\""+patientAndDoctor.getString("createDate")+"\" END_DAY=\"\" DEPT_CODE=\""+patientAndDoctor.getString("DEPT_CODE")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" FREQ_INTERVAL=\"\" FREQ_INTERVAL_UNIT=\"\" START_DAY=\""+patientAndDoctor.getString("CREATE_DATE")+"\" END_DAY=\"\" DEPT_CODE=\""+patientAndDoctor.getString("DEPT_CODE")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" DOCTOR_NAME=\""+patientAndDoctor.getString("DOCTOR_NAME")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" ORDER_NO=\""+wlyyPrescriptionInfoDO.getFrequency()+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" ORDER_SUB_NO=\""+wlyyPrescriptionInfoDO.getFrequency()+"\" AUTHORITY_LEVELS=\"\" ALERT_LEVELS=\"\" TITLE=\""+patientAndDoctor.getString("POSITION") + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" ORDER_NO=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" ORDER_SUB_NO=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+"\" AUTHORITY_LEVELS=\"\" ALERT_LEVELS=\"\" TITLE=\""+patientAndDoctor.getString("POSITION") + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" GROUP_ID=\""+wlyyPrescriptionInfoDO.getFrequency()+"\" USER_ID=\""+patientAndDoctor.getString("doctorId")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" PRES_ID=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" PRES_DATE=\""+patientAndDoctor.getString("createDate")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" PRES_DATE=\""+patientAndDoctor.getString("CREATE_DATE")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" PRES_SEQ_ID=\""+patientAndDoctor.getString("PATIENT_PRES_ID")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" PK_ORDER_NO=\"\" COURSE=\""+wlyyPrescriptionInfoDO.getDays()+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\" PKG_COUNT=\""+wlyyPrescriptionInfoDO.getPackQuantity()+ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2873,56 +2872,59 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //组装审药参数并发送到entrance 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String checkInputInfo(String prescriptionId) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String checkInputInfo(String prescriptionId,String payType,String doctor,String patient,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,List<WlyyPrescriptionInfoDO> infos) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //药品信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionInfoDO> infos = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //诊断信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //先查询处方获得支付方式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null!=prescriptionDO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            infos = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            diagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId,1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String tjPrescriptionId = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //如果重新审核药品 一定要把返回的orderNo的值拿到赋值到prescriptionId里 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotEmpty(prescriptionId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tjPrescriptionId = prescriptionId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tjPrescriptionId = UUID.randomUUID().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(prescriptionDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //先查询处方获得支付方式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("DOCTOR_NAME", baseDoctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("DEPT_CODE", baseDoctorDO.getVisitDept()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("DEPT_NAME", baseDoctorDO.getVisitDeptName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null != doctorMappingDO && null != baseDoctorDO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("doctorId", doctorMappingDO.getMappingCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("DOCTOR_ID", doctorMappingDO.getMappingCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("POSITION", baseDoctorDO.getJobTitleName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(prescriptionDO.getPatientCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = patientDao.findById(prescriptionDO.getPatientCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("patientName", basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = patientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("PATIENT_NAME", basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null != patientMappingDO && null != basePatientDO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("patientId", patientMappingDO.getMappingCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("gender", basePatientDO.getSex()==1?"男":"女"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("birth", sdf.format(basePatientDO.getBirthday())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("PATIENT_ID", patientMappingDO.getMappingCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("GENDER", basePatientDO.getSex()==1?"男":"女"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("BIRTH", sdf.format(basePatientDO.getBirthday())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null!=infos&&infos.size()>0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null != prescriptionDO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("PATIENT_PRES_ID", prescriptionDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("FEE_TYPE", prescriptionDO.getPayType() == 1 ? "医保" : "自费"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("createDate", sdf.format(prescriptionDO.getCreateTime())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("PATIENT_PRES_ID", tjPrescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("FEE_TYPE", "1".equalsIgnoreCase(payType) ? "医保" : "自费"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("CREATE_DATE", sdf.format(new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //组装诊断参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null != diagnosisDOS && diagnosisDOS.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List diagnosises = new ArrayList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO : diagnosisDOS) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    diagnosises.add(wlyyPrescriptionDiagnosisDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("diagnosises", diagnosises.toArray()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonObject.put("diagnosises", StringUtils.strip(diagnosises.toString(),"[]")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String response = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String returnJson = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String url = entranceUrl + "checkPrescription?infos=" + infos + "&patientAndDoctor=" + jsonObject.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            response = httpClientUtil.get(url, "GBK"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray array = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (WlyyPrescriptionInfoDO infoDO:infos){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                array.add(infoDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String url = entranceUrl + "checkPrescription"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,String> map = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("infos",array.toJSONString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("patientAndDoctor",jsonObject.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            response = httpClientUtil.httpPost(url, map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("请求entrance的参数:"+map.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("请求checkPrescription:" + response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject object = JSONObject.parseObject(response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2934,7 +2936,7 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    List<Map<String,Object>> returnList = transXmlCommen(obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    returnJson = JSONArray.toJSONString(returnList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("返回到互联网医院的解析后的结果:"+returnJson); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyHttpLogDO.setDoctor(prescriptionDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyHttpLogDO.setDoctor(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyHttpLogDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyHttpLogDO.setRequest(infos + jsonObject.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyHttpLogDO.setResponse(returnJson); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2943,7 +2945,7 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    returnJson = "审方返回接口为空请检查参数是否正确"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info(returnJson); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyHttpLogDO.setCode("error"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyHttpLogDO.setDoctor(prescriptionDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyHttpLogDO.setDoctor(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyHttpLogDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyHttpLogDO.setRequest(infos + jsonObject.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyHttpLogDO.setResponse(returnJson); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2952,7 +2954,7 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                returnJson = "entranceUrl接口调用失败"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyHttpLogDO.setCode("error"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyHttpLogDO.setDoctor(prescriptionDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyHttpLogDO.setDoctor(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyHttpLogDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyHttpLogDO.setRequest(infos + jsonObject.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyHttpLogDO.setResponse(returnJson); 
			 |