|  | @ -3,6 +3,7 @@ package com.yihu.jw.hospital.prescription.service.entrance;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
	
		
			
				|  |  | import com.yihu.jw.dict.dao.DictDoctorDutyDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.dict.dao.DictHospitalDeptDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
	
	
		
			
				|  | @ -1189,6 +1190,81 @@ public class XzzxEntranceService{
 | 
	
		
			
				|  |  |         return json;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 互联网医院开处方信息更新到his
 | 
	
		
			
				|  |  |      * @param IoFlag  门诊住院标志
 | 
	
		
			
				|  |  |      * @param PayCardNo 就诊卡号
 | 
	
		
			
				|  |  |      * @param NullahNumber 挂号流水号
 | 
	
		
			
				|  |  |      * @param ApplyDept 执行科室
 | 
	
		
			
				|  |  |      * @param ApplyDoctor 开单医生
 | 
	
		
			
				|  |  |      * @param ExecuteDept 执行科室(药房)
 | 
	
		
			
				|  |  |      * @param prescriptionInfoDOList
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String savePrescriptionToHospital(String IoFlag,String PayCardNo,String NullahNumber,
 | 
	
		
			
				|  |  |                                              String ApplyDept,String ApplyDoctor,String ExecuteDept,List<WlyyPrescriptionInfoDO> prescriptionInfoDOList)throws Exception{
 | 
	
		
			
				|  |  |         String api = "savePrescriptionToHospital";
 | 
	
		
			
				|  |  |         String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
 | 
	
		
			
				|  |  |                 "<root> " +
 | 
	
		
			
				|  |  |                 "   <serverName>"+api+"</serverName>  " +
 | 
	
		
			
				|  |  |                 "   <format>xml</format>" +
 | 
	
		
			
				|  |  |                 "   <callOperator></callOperator> " +
 | 
	
		
			
				|  |  |                 "   <certificate>"+key+"</certificate> " +
 | 
	
		
			
				|  |  |                 "</root>";
 | 
	
		
			
				|  |  |         String condition ="";
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(IoFlag)){
 | 
	
		
			
				|  |  |             condition += "<IoFlag>"+IoFlag+"</IoFlag>";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(PayCardNo)){
 | 
	
		
			
				|  |  |             condition += "<PayCardNo>"+PayCardNo+"</PayCardNo>";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(NullahNumber)){
 | 
	
		
			
				|  |  |             condition += "<NullahNumber>"+NullahNumber+"</NullahNumber>";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(ApplyDept)){
 | 
	
		
			
				|  |  |             condition += "<ApplyDept>"+ApplyDept+"</ApplyDept>";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(ApplyDoctor)){
 | 
	
		
			
				|  |  |             condition += "<ApplyDoctor>"+ApplyDoctor+"</ApplyDoctor>";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(ExecuteDept)){
 | 
	
		
			
				|  |  |             condition += "<ExecuteDept>"+ExecuteDept+"</ExecuteDept>";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         condition +="<PresDetail>";
 | 
	
		
			
				|  |  |         for (WlyyPrescriptionInfoDO prescriptionInfoDO:prescriptionInfoDOList){
 | 
	
		
			
				|  |  |             String condition1 = "";
 | 
	
		
			
				|  |  |             condition1 += "<PhysicCode>"+prescriptionInfoDO.getDrugNo()+"</PhysicCode>";
 | 
	
		
			
				|  |  |             condition1 += "<Doseage>"+prescriptionInfoDO.getDosage()+"</Doseage>";
 | 
	
		
			
				|  |  |             condition1 += "<DoseUnit>"+prescriptionInfoDO.getUnit()+"</DoseUnit>";
 | 
	
		
			
				|  |  |             condition1 += "<Frequency>"+prescriptionInfoDO.getUsageCode()+"</Frequency>";
 | 
	
		
			
				|  |  |             condition1 += "<DayCount>"+prescriptionInfoDO.getDays()+"</DayCount>";
 | 
	
		
			
				|  |  |             condition1 += "<Usage>"+prescriptionInfoDO.getSupplyCode()+"</Usage>";
 | 
	
		
			
				|  |  |             condition1 += "<TotalDoseage>"+prescriptionInfoDO.getQuantity()+"</TotalDoseage>";
 | 
	
		
			
				|  |  |             condition1 += "<TotalUnit>"+prescriptionInfoDO.getPackUnit()+"</TotalUnit>";
 | 
	
		
			
				|  |  |             condition1 += "<PrescribeMemo>"+"</PrescribeMemo>";
 | 
	
		
			
				|  |  |             condition1 += "<FryMode>"+"</FryMode>";
 | 
	
		
			
				|  |  |             condition1 += "<HerbalTakeMethodClass>"+"</HerbalTakeMethodClass>";
 | 
	
		
			
				|  |  |             condition1 += "<HerbalFryMethod>"+"</HerbalFryMethod>";
 | 
	
		
			
				|  |  |             condition1 += "<HerbalFryMethod2>"+"</HerbalFryMethod2>";
 | 
	
		
			
				|  |  |             condition+="<PresInfo>"+condition1+"</PresInfo>";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         condition+="</PresDetail>";
 | 
	
		
			
				|  |  |         String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
 | 
	
		
			
				|  |  |                 "<root>"+condition+"</root>";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Map<String,String> params = new HashedMap();
 | 
	
		
			
				|  |  |         params.put("msgHeader",msgHeader);
 | 
	
		
			
				|  |  |         params.put("msgBody",msgBody);
 | 
	
		
			
				|  |  |         logger.info("savePrescriptionToHospital params:"+params.toString());
 | 
	
		
			
				|  |  |         String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
 | 
	
		
			
				|  |  |         XMLSerializer xmlSerializer = new XMLSerializer();
 | 
	
		
			
				|  |  |         String json = xmlSerializer.read(xml).toString();
 | 
	
		
			
				|  |  |         logger.info(" savePrescriptionToHospital json:"+json);
 | 
	
		
			
				|  |  |         return json;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 组装检查检验项目参数
 | 
	
		
			
				|  |  |      *
 | 
	
	
		
			
				|  | @ -2163,7 +2239,7 @@ public class XzzxEntranceService{
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取icd10字典
 | 
	
		
			
				|  |  |      * 获取药品字典
 | 
	
		
			
				|  |  |      * @param spellCode 拼音码
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
	
		
			
				|  | @ -2185,7 +2261,8 @@ public class XzzxEntranceService{
 | 
	
		
			
				|  |  |                 object1.put("group_no","");
 | 
	
		
			
				|  |  |                 object1.put("drugname",jsonObject.getString("PHYSIC_NAME"));
 | 
	
		
			
				|  |  |                 object1.put("dosage",jsonObject.getString("DOSE_UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("mini_unit",jsonObject.getString("MIN_DOSE"));
 | 
	
		
			
				|  |  |                 object1.put("MIN_DOSE",jsonObject.getString("MIN_DOSE"));
 | 
	
		
			
				|  |  |                 object1.put("mini_unit",jsonObject.getString("PHYSIC_UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("pack_size",jsonObject.getString("PACK_SPEC"));
 | 
	
		
			
				|  |  |                 object1.put("retprice",jsonObject.getString("RETAIL_PRICE"));
 | 
	
		
			
				|  |  |                 object1.put("specification",jsonObject.getString("PHYSIC_SPEC"));
 | 
	
	
		
			
				|  | @ -2194,7 +2271,7 @@ public class XzzxEntranceService{
 | 
	
		
			
				|  |  |                 object1.put("visible_flag",jsonObject.getString("VALID_FLAG"));
 | 
	
		
			
				|  |  |                 object1.put("drug_flag",jsonObject.getString("OTC_FLAG"));
 | 
	
		
			
				|  |  |                 object1.put("py_code",jsonObject.getString("SPELL_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("pack_unit",jsonObject.getString("PACK_SPEC"));
 | 
	
		
			
				|  |  |                 object1.put("pack_unit",jsonObject.getString("PRICE_UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("manu_name",jsonObject.getString("SUPPLIER_NAME"));
 | 
	
		
			
				|  |  |                 object1.put("weigh_unit",jsonObject.getString("DOSE_UNIT"));
 | 
	
		
			
				|  |  |                 object1.put("vol_unit","");
 | 
	
	
		
			
				|  | @ -2272,7 +2349,8 @@ public class XzzxEntranceService{
 | 
	
		
			
				|  |  |                 JSONObject object1 = new JSONObject();
 | 
	
		
			
				|  |  |                 object1.put("@action","select");
 | 
	
		
			
				|  |  |                 object1.put("DAILY_TIMES",jsonObject.getString("FREQ_COUNT"));
 | 
	
		
			
				|  |  |                 object1.put("FREQ_CODE",jsonObject.getString("FREQ_DESCRIBE_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("FREQ_CODE",jsonObject.getString("FREQ_DESCRIBE"));
 | 
	
		
			
				|  |  |                 object1.put("FREQ_DESCRIBE_CODE",jsonObject.getString("FREQ_DESCRIBE_CODE"));
 | 
	
		
			
				|  |  |                 object1.put("FREQ_DESCRIBE",jsonObject.getString("FREQ_DESCRIBE"));
 | 
	
		
			
				|  |  |                 object1.put("PHYSIC_NOTUSE_FLAG",jsonObject.getString("PHYSIC_NOTUSE_FLAG"));
 | 
	
		
			
				|  |  |                 object1.put("FREQ_NAME",jsonObject.getString("FREQ_MEMO"));
 | 
	
	
		
			
				|  | @ -2436,6 +2514,46 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
 | 
	
		
			
				|  |  |     return resultMap;
 | 
	
		
			
				|  |  | }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param ioFlag 门诊住院标志
 | 
	
		
			
				|  |  |      * @param payCardNo 就诊卡号
 | 
	
		
			
				|  |  |      * @param nullahNumber 挂号流水号
 | 
	
		
			
				|  |  |      * @param applyDept 执行科室
 | 
	
		
			
				|  |  |      * @param applyDoctor 开单医生
 | 
	
		
			
				|  |  |      * @param executeDept 执行科室(药房)
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject savePrescriptionToEntrance(String ioFlag,String payCardNo,String nullahNumber,String applyDept,String applyDoctor,String executeDept,List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS) throws Exception {
 | 
	
		
			
				|  |  |         JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |         String response = "";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"savePrescriptionToHospital";
 | 
	
		
			
				|  |  |         ObjectMapper mapper = new ObjectMapper();
 | 
	
		
			
				|  |  |         JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |         for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
 | 
	
		
			
				|  |  |             array.add(wlyyPrescriptionInfoDO);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         Map<String,String> params = new HashedMap();
 | 
	
		
			
				|  |  |         params.put("IoFlag",ioFlag);
 | 
	
		
			
				|  |  |         params.put("PayCardNo",payCardNo);
 | 
	
		
			
				|  |  |         params.put("NullahNumber",nullahNumber);
 | 
	
		
			
				|  |  |         params.put("ApplyDept",applyDept);
 | 
	
		
			
				|  |  |         params.put("ApplyDoctor",applyDoctor);
 | 
	
		
			
				|  |  |         params.put("ExecuteDept",executeDept);
 | 
	
		
			
				|  |  |         params.put("prescriptionInfoDOS", array.toJSONString());
 | 
	
		
			
				|  |  |         logger.info("prescriptionInfoDOS"+params.get("prescriptionInfoDOS"));
 | 
	
		
			
				|  |  |         logger.info("params"+params.toString());
 | 
	
		
			
				|  |  |         response = httpClientUtil.httpPost(url,params);
 | 
	
		
			
				|  |  |         logger.info("开方成功"+response);
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |         if(object.getInteger("status")==200){
 | 
	
		
			
				|  |  |              jsonObject = object.getJSONObject("obj");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return jsonObject;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //=====================hospital应用调用entrance应用============end=================
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 |