| 
					
				 | 
			
			
				@ -130,6 +130,8 @@ public class HcyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private static String caKey = "bvvsf3JA0mUXMU+mVnMaOQ=="; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private static String checkKey = "ydxtMEQmPymRtfz15lW76Tne88pHcuAU8WygMu/TrTKPRY5G7jttcg=="; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //发送微信模板消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /*@Value("${wechat.url}")*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String sendMessageUrl="http://172.16.100.37:8090/hospitalPortal-sms/sms/sendMessage"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2449,10 +2451,12 @@ public class HcyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String initParams(String serviceCode,String payType,String patient,String doctor,List<WlyyPrescriptionInfoDO> infos,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String initParams(String hisId,String serviceCode,String payType,String patient,String doctor,List<WlyyPrescriptionInfoDO> infos,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String xml =""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String hisId = UUID.randomUUID().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isNoneBlank(hisId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            hisId = UUID.randomUUID().toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientMappingDO == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "患者信息映射表为空"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2605,7 +2609,7 @@ public class HcyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "   </opt_diagnosis>  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDiagnoses += prescriptionDiagnose; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String cancelPrescription = "<opt_prescriptions>  \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String savePrescription = "<opt_prescriptions>  \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "       <opt_prescription>  \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "           <opt_prescription_info>  \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "               <recipe_id><![CDATA["+hisId+"]]></recipe_id>  \n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2632,11 +2636,14 @@ public class HcyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (serviceCode.equals("GY_V4_FLEXIBLE") || serviceCode.equals("GY_SF_V4")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            xml = "<root>" + base + optPatient + prescriptions + diagnoses + "</root>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (serviceCode.equalsIgnoreCase("submitRecipe")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            xml ="<root>"+ base+ savePrescription+" </root>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        else if (serviceCode.equals("SF_V4_VALID_FLAG")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            xml = "<root>" + base + cancelPrescription + "</root>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            xml = "<root>" + base + savePrescription + "</root>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        else if (serviceCode.equals("CANCEL_GROUP_DRUG_V4")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            xml = "<root>" + base + doctors + cancelPrescription + "</root>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            xml = "<root>" + base + doctors + savePrescription + "</root>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /*   else if (serviceCode.equals("SF_V4_DOUBLE_SIGN")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            xml = "<root>" + base + doctors + feedback + "</root>"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2662,7 +2669,7 @@ public class HcyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   <serverName>"+serviceCode+"</serverName>  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   <format>xml</format>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   <callOperator></callOperator> " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   <certificate>"+caKey+"</certificate> " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "   <certificate>"+checkKey+"</certificate> " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "</root>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonData; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2696,12 +2703,27 @@ public class HcyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "诊断信息为空"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String xml = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            xml = initParams("GY_SF_V4",payType, patient, doctor, infos, diagnosisDOS,outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            xml = initParams(hisId,"GY_SF_V4",payType, patient, doctor, infos, diagnosisDOS,outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String response = checkPrescription("GY_SF_V4", xml, "合理用药审查"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return response; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String saveCheckPrescriptions(String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null == infos || infos.size() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "药品信息为空"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (diagnosisDOS == null || diagnosisDOS.size() == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "诊断信息为空"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String xml = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        xml = initParams(hisId,"submitRecipe",payType, patient, doctor, infos, diagnosisDOS,outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String response = checkPrescription("submitRecipe", xml, "合理用药审查"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return response; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //处方在医生站系统成功保存后调用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String saveCheck(String outpatient, String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (infos == null || infos.size() == 0) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2712,7 +2734,7 @@ public class HcyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String xml = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                xml = initParams("GY_SF_V4", payType, patient, doctor, infos, diagnosisDOS,outpatient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                xml = initParams("","GY_SF_V4", payType, patient, doctor, infos, diagnosisDOS,outpatient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2730,7 +2752,7 @@ public class HcyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String xml = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                xml = initParams("SF_V4_VALID_FLAG",payType, patient, doctor, infos, diagnosisDOS,outpatient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                xml = initParams("","SF_V4_VALID_FLAG",payType, patient, doctor, infos, diagnosisDOS,outpatient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2748,7 +2770,7 @@ public class HcyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String xml = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                xml = initParams("CANCEL_GROUP_DRUG_V4",payType, patient, doctor, infos, diagnosisDOS,outpatient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                xml = initParams("","CANCEL_GROUP_DRUG_V4",payType, patient, doctor, infos, diagnosisDOS,outpatient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2766,7 +2788,7 @@ public class HcyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String xml = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                xml = initParams("SF_V4_DOUBLE_SIGN",payType, patient, doctor, infos, diagnosisDOS,outpatient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                xml = initParams("","SF_V4_DOUBLE_SIGN",payType, patient, doctor, infos, diagnosisDOS,outpatient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 |