|  | @ -276,6 +276,38 @@ public class XzzxEntranceService{
 | 
	
		
			
				|  |  |         return json;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询医生信息
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String selectDoctorInfo(String idcard)throws Exception{
 | 
	
		
			
				|  |  |         String api = "GetDoctorInfo";
 | 
	
		
			
				|  |  |         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.isNoneBlank(idcard)){
 | 
	
		
			
				|  |  |             condition = "<Idcard>"+idcard+"</Idcard>";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         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("getDoctorInfo params:"+params.toString());
 | 
	
		
			
				|  |  |         String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         XMLSerializer xmlSerializer = new XMLSerializer();
 | 
	
		
			
				|  |  |         String json = xmlSerializer.read(xml).toString();
 | 
	
		
			
				|  |  |         logger.info("getDoctorInfo json:"+json);
 | 
	
		
			
				|  |  |         return json;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String findWlyyDoctor(JSONArray doctors)throws Exception{
 | 
	
		
			
				|  |  |         logger.info("doctors size:"+doctors.size());
 | 
	
		
			
				|  |  |         if(doctors!=null&&doctors.size()>0){
 | 
	
	
		
			
				|  | @ -1335,12 +1367,12 @@ public class XzzxEntranceService{
 | 
	
		
			
				|  |  |         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(NullahNumber)){
 | 
	
		
			
				|  |  |             condition += "<NullahNumber>"+NullahNumber+"</NullahNumber>";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (!StringUtils.isEmpty(ApplyDoctor)){
 | 
	
		
			
				|  |  |             condition += "<ApplyDoctor>"+ApplyDoctor+"</ApplyDoctor>";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -2278,7 +2310,7 @@ public class XzzxEntranceService{
 | 
	
		
			
				|  |  |      * @param patient 居民id
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<WlyyOutpatientVO> selectOutpatientList(String patient,String startTime,String endTime){
 | 
	
		
			
				|  |  |     public List<WlyyOutpatientVO> selectOutpatientList(String patient,String startTime,String endTime) throws Exception {
 | 
	
		
			
				|  |  |         List<WlyyOutpatientVO> wlyyOutpatientVOList = new ArrayList<>();
 | 
	
		
			
				|  |  |         JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |         String response="";
 | 
	
	
		
			
				|  | @ -2286,7 +2318,8 @@ public class XzzxEntranceService{
 | 
	
		
			
				|  |  |         if (patientMappingDO!=null){
 | 
	
		
			
				|  |  |             patient = patientMappingDO.getMappingCode();
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             patient = savePatientMapping(patient);
 | 
	
		
			
				|  |  |             //patient = savePatientMapping(patient);
 | 
	
		
			
				|  |  |             throw new Exception("患者id不存在");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String url = entranceUrl+"findOutpatientInfo?patient="+patient+"&startTime="+startTime+"&endTime="+endTime;
 | 
	
		
			
				|  |  |         response = httpClientUtil.get(url,"GBK");
 | 
	
	
		
			
				|  | @ -3261,12 +3294,12 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
 | 
	
		
			
				|  |  |             WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
 | 
	
		
			
				|  |  |             if (null!=wlyyOutpatientDO){
 | 
	
		
			
				|  |  |                 params.put("PayCardNo",wlyyOutpatientDO.getCardNo());
 | 
	
		
			
				|  |  |                 params.put("NullahNumber",wlyyOutpatientDO.getRegisterNo());
 | 
	
		
			
				|  |  |                 params.put("ApplyDept",wlyyOutpatientDO.getDept());
 | 
	
		
			
				|  |  |                 params.put("NullahNumber",wlyyOutpatientDO.getRegisterNo());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(wlyyPrescriptionDO.getDoctor());
 | 
	
		
			
				|  |  |             if (null!=doctorMappingDO){
 | 
	
		
			
				|  |  |                 params.put("ApplyDoctor",doctorMappingDO.getMappingCode());
 | 
	
		
			
				|  |  |                 params.put("ApplyDoctor",doctorMappingDO.getDoctorName()+"/"+doctorMappingDO.getMappingCode());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             params.put("ExecuteDept","50100");
 | 
	
		
			
				|  |  |             params.put("PresNo",realOrder);
 | 
	
	
		
			
				|  | @ -3302,8 +3335,24 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
 | 
	
		
			
				|  |  |             if(null!=patientMappingDO){
 | 
	
		
			
				|  |  |                 paramRequest.put("patientid",patientMappingDO.getMappingCode());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //获取医生编号
 | 
	
		
			
				|  |  |             BaseDoctorDO doctorDO = doctorDao.findById(wlyyOutpatientDO.getDoctor());
 | 
	
		
			
				|  |  |             String operatorId = null;
 | 
	
		
			
				|  |  |             if (doctorDO!=null){
 | 
	
		
			
				|  |  |                 String url = entranceUrl+"selectDoctorInfo?idCard="+doctorDO.getIdcard();
 | 
	
		
			
				|  |  |                 String response = httpClientUtil.get(url,"GBK");
 | 
	
		
			
				|  |  |                 JSONObject object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |                 if(object.getInteger("status")==200){
 | 
	
		
			
				|  |  |                     String obj = object.getString("obj");
 | 
	
		
			
				|  |  |                     JSONArray array = JSONArray.parseArray(obj);
 | 
	
		
			
				|  |  |                     if (array!=null&&array.size()!=0){
 | 
	
		
			
				|  |  |                         JSONObject jsonObject = array.getJSONObject(0);
 | 
	
		
			
				|  |  |                         operatorId = jsonObject.getString("staffNo");
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if(null!=doctorMappingDO){
 | 
	
		
			
				|  |  |                 paramRequest.put("operatorid",doctorMappingDO.getMappingCode());
 | 
	
		
			
				|  |  |                 paramRequest.put("operatorid",operatorId);
 | 
	
		
			
				|  |  |                 paramRequest.put("operatorname",wlyyPrescriptionDO.getDoctorName());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             paramRequest.put("type","2");
 | 
	
	
		
			
				|  | @ -3322,31 +3371,23 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
 | 
	
		
			
				|  |  |                 paramRequest.put("outpatientCode","R"+wlyyOutpatientDO.getRegisterNo());
 | 
	
		
			
				|  |  |                 paramRequest.put("eventno","R"+wlyyOutpatientDO.getRegisterNo());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             paramRequest.put("templateid","662");
 | 
	
		
			
				|  |  |             paramRequest.put("templateid","1158");
 | 
	
		
			
				|  |  |             paramRequest.put("catalogid","50");
 | 
	
		
			
				|  |  |             paramRequest.put("emrtype","0");
 | 
	
		
			
				|  |  |             paramRequest.put("emrtype","93");
 | 
	
		
			
				|  |  |             paramRequest.put("emrtitle","互联网医院");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         params.put("jsonInfo",paramRequest.toJSONString());
 | 
	
		
			
				|  |  |         JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |         String response = "";
 | 
	
		
			
				|  |  |         String url = entranceUrl+"returnEmrHtmlByHLW";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         logger.info("params"+params.toString());
 | 
	
		
			
				|  |  |         response = httpClientUtil.httpPost(url,params);
 | 
	
		
			
				|  |  |         JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |         logger.info("保存电子病历"+response);
 | 
	
		
			
				|  |  |         if (response.contains("error")){
 | 
	
		
			
				|  |  |             logger.info("保存失败:"+response);
 | 
	
		
			
				|  |  |         if (response.contains("error")||response.contains("ERROR")){
 | 
	
		
			
				|  |  |             return "faild";
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             object = JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |             if(object.getInteger("status")==200){
 | 
	
		
			
				|  |  |                 jsonObject = object.getJSONObject("obj");
 | 
	
		
			
				|  |  |                 logger.info("保存成功:"+jsonObject);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             return "success";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 |