|  | @ -757,6 +757,157 @@ public class EntranceService {
 | 
	
		
			
				|  |  |                     icdNames += "," + diagFive[0];
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //                String icds = null == jsonObjectMgsInfo.get("icd_name") ? "" : jsonObjectMgsInfo.get("icd_name") + "";
 | 
	
		
			
				|  |  | //                String[] icdcodeAndName = icds.split("&");
 | 
	
		
			
				|  |  | //                wlyyOutpatientVO.setIcd10(icdcodeAndName.length > 1 ? icdcodeAndName[1].toString() : "");
 | 
	
		
			
				|  |  | //                wlyyOutpatientVO.setIcd10Name(icdcodeAndName.length > 0 ? icdcodeAndName[0].toString() : "");
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setIcd10(icdcodes);
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setIcd10Name(icdNames);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 String admDate = null == jsonObjectMgsInfo.get("ADM_DAT") ? "" : jsonObjectMgsInfo.get("ADM_DAT") + "";
 | 
	
		
			
				|  |  |                 String conDate = null == jsonObjectMgsInfo.get("CON_DATE") ? "" : jsonObjectMgsInfo.get("CON_DATE") + "";
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setAdmDate(DateUtil.strToDate(admDate, DateUtil.YYYY_MM_DD_HH_MM_SS_));
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setConDate(DateUtil.strToDate(conDate, DateUtil.YYYY_MM_DD_HH_MM_SS_));
 | 
	
		
			
				|  |  |                 wlyyOutpatientVOS.add(wlyyOutpatientVO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return wlyyOutpatientVOS;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 患者门诊就诊记录
 | 
	
		
			
				|  |  |      * 使用时间查询的话,很可能会超时。时间没有索引,所以超时时间需要加长
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param PAT_NO    居民唯一号 一个居民在该医院只有一个号,该接口必须输入的参数
 | 
	
		
			
				|  |  |      * @param conNo     就诊次数,使用居民唯一号+就诊次数获取唯一一条就诊记录
 | 
	
		
			
				|  |  |      *                  // *  @param admNo 就诊唯一号 每一次就诊都有一个唯一号:居民号+就诊次数,查询确定的一条就诊记录时需要传,否则传null
 | 
	
		
			
				|  |  |      *                  // *  @param registerSn 挂号流水号,查询确定的一条就诊记录时需要传,否则传null
 | 
	
		
			
				|  |  |      * @param startTime 开始时间 (查询一段时间内就诊记录开始时间,查询就诊记录列表时需要传,否则传null)
 | 
	
		
			
				|  |  |      * @param endTime   结束时间 (查询一段时间内就诊记录结束时间,查询就诊记录列表时需要传,否则传null)
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<WlyyOutpatientVO> BS10016(String PAT_NO, String conNo, String startTime, String endTime, boolean demoFlag ,String ksdm) throws Exception {
 | 
	
		
			
				|  |  |         System.out.println("ksdm="+ksdm);
 | 
	
		
			
				|  |  |         String fid = "BS10016";
 | 
	
		
			
				|  |  |         logger.info("EntranceService " + fid + " PAT_NO :" + PAT_NO + " conNo:" + conNo + " startTime:" + startTime + " endTime:" + endTime);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String resp = "";
 | 
	
		
			
				|  |  |         String orgCode = "350211A1002";
 | 
	
		
			
				|  |  |         String orgName = "厦门大学附属中山医院";
 | 
	
		
			
				|  |  |         if (demoFlag) {
 | 
	
		
			
				|  |  |             resp = getJosnFileResullt(fid);
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             StringBuffer sbs = new StringBuffer();
 | 
	
		
			
				|  |  |             //AccessControl :用户、密码、服务id
 | 
	
		
			
				|  |  |             sbs.append("<ESBEntry><AccessControl><Fid>" + fid + "</Fid><UserName>" + mqUser + "</UserName><Password>" + mqPwd + "</Password></AccessControl>");
 | 
	
		
			
				|  |  |             //MessageHeader :固定值 消费方系统编号 S60,提供方系统编号 S01
 | 
	
		
			
				|  |  |             sbs.append("<MessageHeader><Fid>" + fid + "</Fid><MsgDate>" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH_MM_SS) + "</MsgDate><SourceSysCode>" + sourceSysCode + "</SourceSysCode><TargetSysCode>" + targetSysCode + "</TargetSysCode></MessageHeader>");
 | 
	
		
			
				|  |  |             //查询信息拼接
 | 
	
		
			
				|  |  |             sbs.append("<MsgInfo><onceFlag>1</onceFlag><startNum>1</startNum><endNum>50000</endNum><Msg>");
 | 
	
		
			
				|  |  |             if (StringUtils.isNotBlank(PAT_NO)) {
 | 
	
		
			
				|  |  |                 /*sbs.append("<query compy=\"=\" item=\"PAT_NO\" splice=\"and\" value=\"'" + PAT_NO + "'\"/>");*/
 | 
	
		
			
				|  |  |                 sbs.append(" and Pat_Admit_ID = '"+PAT_NO+"' ");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (StringUtils.isNotBlank(startTime)) {
 | 
	
		
			
				|  |  |                 /*sbs.append("<query compy=\">=\" item=\"CON_DATE\" splice=\"and\" value=\"'" + startTime + "'\"/>");*/
 | 
	
		
			
				|  |  |                 sbs.append(" and Discharge_Date >= '"+startTime+"' ");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (StringUtils.isNotBlank(endTime)) {
 | 
	
		
			
				|  |  |                 /*sbs.append("<query compy=\"<\" item=\"CON_DATE\" splice=\"and\" value=\"'" + endTime + "'\"/>");*/
 | 
	
		
			
				|  |  |                 sbs.append(" and Discharge_Date <= '"+endTime+"' ");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (StringUtils.isNotBlank(ksdm)) {
 | 
	
		
			
				|  |  |                 /*      sbs.append("<query compy=\"=\" item=\"ADM_SPEC\" splice=\"and\" value=\"'" + ksdm + "'\"/>");*/
 | 
	
		
			
				|  |  |                 /*sbs.append("<query compy=\"=\" item=\"under_dept\" splice=\"and\" value=\"'" + ksdm + "'\"/>");*/
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 sbs.append(" and Discharge_Dept_Code = '"+ksdm+"' ");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             sbs.append(" order by Admit_Dept_Code desc ");
 | 
	
		
			
				|  |  |             //查询信息结束
 | 
	
		
			
				|  |  |             sbs.append("</Msg> ");
 | 
	
		
			
				|  |  |             sbs.append("</MsgInfo></ESBEntry>");
 | 
	
		
			
				|  |  |             resp = MqSdkUtil.putReqAndGetRespByQueryStr(sbs.toString(), fid);
 | 
	
		
			
				|  |  |             logger.info("resp===" + resp);
 | 
	
		
			
				|  |  |             resp = MqSdkUtil.xml2jsonArrayRootRow(resp);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         JSONArray jsonArray = ConvertUtil.convertListEnvelopInRow(resp);
 | 
	
		
			
				|  |  |         if (null == jsonArray) {
 | 
	
		
			
				|  |  |             return null;        }
 | 
	
		
			
				|  |  |         List<WlyyOutpatientVO> wlyyOutpatientVOS = new ArrayList<>();
 | 
	
		
			
				|  |  |         WlyyOutpatientVO wlyyOutpatientVO;
 | 
	
		
			
				|  |  |         for (Object object : jsonArray) {
 | 
	
		
			
				|  |  |             net.sf.json.JSONObject jsonObjectMgsInfo = (net.sf.json.JSONObject) object;
 | 
	
		
			
				|  |  |             if (null != jsonObjectMgsInfo) {
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO = new WlyyOutpatientVO();
 | 
	
		
			
				|  |  |                 //中山医院固定入参
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setHospital(orgCode);
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setHospitalName(orgName);
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setWinNo("6");
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setAdmNo(null == jsonObjectMgsInfo.get("Admit_Num") ? "" : jsonObjectMgsInfo.get("Admit_Num") + "");
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setRegisterNo(null == jsonObjectMgsInfo.get("REGISTER_SN") ? "" : jsonObjectMgsInfo.get("REGISTER_SN") + "");
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setDept(null == jsonObjectMgsInfo.get("ADM_SPEC") ? "" : jsonObjectMgsInfo.get("ADM_SPEC") + "");
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setDeptName(null == jsonObjectMgsInfo.get("ADM_SPEC_NAME") ? "" : jsonObjectMgsInfo.get("ADM_SPEC_NAME") + "");
 | 
	
		
			
				|  |  |                 String patNo = null != jsonObjectMgsInfo.get("PAT_NO") ? jsonObjectMgsInfo.get("PAT_NO").toString() : "";
 | 
	
		
			
				|  |  |                 String patientName = null != jsonObjectMgsInfo.get("PAT_NAME") ? jsonObjectMgsInfo.get("PAT_NAME").toString() : "";
 | 
	
		
			
				|  |  |                 PatientMappingDO patientMappingDo = new PatientMappingDO();
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotBlank(patNo)) {
 | 
	
		
			
				|  |  |                     patientMappingDo = patientMappingDao.findByMappingCodeAndSource(patNo.trim(), "1");
 | 
	
		
			
				|  |  |                     patNo = null == patientMappingDo ? null : patientMappingDo.getPatient();
 | 
	
		
			
				|  |  |                     patientName = null == patientMappingDo ? null : patientMappingDo.getPatientName();
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setPatient(patNo);
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setPatientName(patientName);
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setConNo(null == jsonObjectMgsInfo.get("CON_NO") ? "" : jsonObjectMgsInfo.get("CON_NO") + "");
 | 
	
		
			
				|  |  |                 String doctor = null == jsonObjectMgsInfo.get("CON_DOC") ? "" : jsonObjectMgsInfo.get("CON_DOC") + "";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //转化医生
 | 
	
		
			
				|  |  |                 String mappingCode = doctor.trim();
 | 
	
		
			
				|  |  |                 String doctorCode = "";
 | 
	
		
			
				|  |  |                 if (StringUtils.isNotBlank(mappingCode)) {
 | 
	
		
			
				|  |  |                     List<DoctorMappingDO> mappingDOs = doctorMappingDao.findByOrgCodeAndMappingCode(orgCode, mappingCode);
 | 
	
		
			
				|  |  |                     if (mappingDOs != null && mappingDOs.size() > 0) {
 | 
	
		
			
				|  |  |                         doctorCode = mappingDOs.get(0).getDoctor();
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setDoctor(doctorCode);
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setDoctorName(null == jsonObjectMgsInfo.get("CON_DOC_NAME") ? "" : jsonObjectMgsInfo.get("CON_DOC_NAME") + "");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //                wlyyOutpatientVO.setIdcard(null == jsonObjectMgsInfo.get("social_no") ? "" : jsonObjectMgsInfo.get("social_no") + "");
 | 
	
		
			
				|  |  |                 wlyyOutpatientVO.setMjz(null == jsonObjectMgsInfo.get("MJZ") ? "" : jsonObjectMgsInfo.get("MJZ") + "");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //主诊断 毒蛇咬伤&T63.001
 | 
	
		
			
				|  |  |                 String[] icdName = jsonObjectMgsInfo.get("icd_name").toString().split("&");
 | 
	
		
			
				|  |  |                 String[] diagTwo = jsonObjectMgsInfo.get("diag_two").toString().split("&");
 | 
	
		
			
				|  |  |                 String[] diagThree = jsonObjectMgsInfo.get("diag_three").toString().split("&");
 | 
	
		
			
				|  |  |                 String[] diagFour = jsonObjectMgsInfo.get("diag_four").toString().split("&");
 | 
	
		
			
				|  |  |                 String[] diagFive = jsonObjectMgsInfo.get("diag_five").toString().split("&");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 String icdcodes = "";
 | 
	
		
			
				|  |  |                 String icdNames = "";
 | 
	
		
			
				|  |  |                 if (icdName.length > 1) {
 | 
	
		
			
				|  |  |                     icdcodes += icdName[1];
 | 
	
		
			
				|  |  |                     icdNames += icdName[0];
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (diagTwo.length > 1) {
 | 
	
		
			
				|  |  |                     icdcodes += "," + diagTwo[1];
 | 
	
		
			
				|  |  |                     icdNames += "," + diagTwo[0];
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (diagThree.length > 1) {
 | 
	
		
			
				|  |  |                     icdcodes += "," + diagThree[1];
 | 
	
		
			
				|  |  |                     icdNames += "," + diagThree[0];
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (diagFour.length > 1) {
 | 
	
		
			
				|  |  |                     icdcodes += "," + diagFour[1];
 | 
	
		
			
				|  |  |                     icdNames += "," + diagFour[0];
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if (diagFive.length > 1) {
 | 
	
		
			
				|  |  |                     icdcodes += "," + diagFive[1];
 | 
	
		
			
				|  |  |                     icdNames += "," + diagFive[0];
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //                String icds = null == jsonObjectMgsInfo.get("icd_name") ? "" : jsonObjectMgsInfo.get("icd_name") + "";
 | 
	
		
			
				|  |  | //                String[] icdcodeAndName = icds.split("&");
 | 
	
		
			
				|  |  | //                wlyyOutpatientVO.setIcd10(icdcodeAndName.length > 1 ? icdcodeAndName[1].toString() : "");
 |