| 
					
				 | 
			
			
				@ -26,7 +26,10 @@ import com.yihu.jw.hospital.mapping.dao.PatientMappingDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.dao.OutpatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.dao.PrescriptionDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -167,6 +170,84 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return "success"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 患者门诊就诊记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 使用时间查询的话,很可能会超时。时间没有索引,所以超时时间需要加长 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param PAT_NO    居民唯一号 一个居民在该医院只有一个号,该接口必须输入的参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param conNo     就诊次数,使用居民唯一号+就诊次数获取唯一一条就诊记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *                  // *  @param admNo 就诊唯一号 每一次就诊都有一个唯一号:居民号+就诊次数,查询确定的一条就诊记录时需要传,否则传null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *                  // *  @param registerSn 挂号流水号,查询确定的一条就诊记录时需要传,否则传null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startTime 开始时间 (查询一段时间内就诊记录开始时间,查询就诊记录列表时需要传,否则传null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endTime   结束时间 (查询一段时间内就诊记录结束时间,查询就诊记录列表时需要传,否则传null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyOutpatientVO> BS30025(String PAT_NO, String conNo, String startTime, String endTime, boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String fid = "BS30025"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("EntranceService " + fid + " PAT_NO :" + PAT_NO + " conNo:" + conNo + " startTime:" + startTime + " endTime:" + endTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String resp = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String orgCode = "350211A5004"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String orgName = "厦门大学附属厦门眼科中心"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //居民id转化 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(PAT_NO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(patientMappingDO == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //查找眼科数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray jsonArray = findV_ZKSG_HZCX_HIS(patientMappingDO.getMappingCode(),conNo,startTime,endTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (jsonArray.size() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> wlyyOutpatientVOS = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientVO wlyyOutpatientVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (int i = 0; i < jsonArray.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject jsonObjectMgsInfo = jsonArray.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null != jsonObjectMgsInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO = new WlyyOutpatientVO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setHospital(orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setHospitalName(orgName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setWinNo("6"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setAdmNo(null == jsonObjectMgsInfo.get("JZXH") ? "" : jsonObjectMgsInfo.get("JZXH") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //wlyyOutpatientVO.setRegisterNo(null == jsonObjectMgsInfo.get("REGISTER_SN") ? "" : jsonObjectMgsInfo.get("REGISTER_SN") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setDept(null == jsonObjectMgsInfo.get("KSDM") ? "" : jsonObjectMgsInfo.get("KSDM") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setDeptName(null == jsonObjectMgsInfo.get("KSMC") ? "" : jsonObjectMgsInfo.get("KSMC") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setPatient(patientMappingDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setPatientName(patientMappingDO.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //wlyyOutpatientVO.setConNo(null == jsonObjectMgsInfo.get("CON_NO") ? "" : jsonObjectMgsInfo.get("CON_NO") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String doctor = null == jsonObjectMgsInfo.get("YSDM") ? "" : jsonObjectMgsInfo.get("YSDM") + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //转化医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                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("KDYS") ? "" : jsonObjectMgsInfo.get("KDYS") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                wlyyOutpatientVO.setMjz(null == jsonObjectMgsInfo.get("MJZ") ? "" : jsonObjectMgsInfo.get("MJZ") + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String icdName = null == jsonObjectMgsInfo.get("ZDMC") ? "" : jsonObjectMgsInfo.get("ZDMC") + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                wlyyOutpatientVO.setIcd10(icdcodes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientVO.setIcd10Name(icdName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                String admDate = null == jsonObjectMgsInfo.get("ADM_DAT") ? "" : jsonObjectMgsInfo.get("ADM_DAT") + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String conDate = null == jsonObjectMgsInfo.get("KSSJ") ? "" : jsonObjectMgsInfo.get("KSSJ") + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                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; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查找眼科his 已审核未付款的处方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -186,6 +267,38 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * HIS就诊患者历史查询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray findV_ZKSG_HZCX_HIS(String brid,String conNo,String startTime,String endTime) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT to_char(h.KSSJ ,'yyyy-MM-dd hh24:mi:ss' ) as KSSJ,h.BRID,h.BRXM,h.SJHM,h.JZKH,h.SFZH,h.BRXZ,h.YSDM,h.KDYS" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ",h.KSDM,h.KSMC,h.ZDMC,h.JZXH from V_ZKSG_HZCX_HIS h WHERE h.BRID = "+brid+" "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(!StringUtil.isBlank(conNo)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and h.JZXH = " + conNo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(!StringUtil.isBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and h.KSSJ >= to_date('"+startTime+"', 'YYYY-MM-DD HH24:MI:SS')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(!StringUtil.isBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " and h.KSSJ <= to_date('"+endTime+"', 'YYYY-MM-DD HH24:MI:SS')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " order by h.KSSJ desc"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> params = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("sql",sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpResponse response = HttpUtils.doGet(url,params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String content = response.getContent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("response:"+content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject rs = JSON.parseObject(content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer status = rs.getInteger("status"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(status!=null&&status == 200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return rs.getJSONArray("detailModelList"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String updateYkyyDoctor()throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="select y.code AS \"code\",y.name AS \"name\",y.expertise AS \"expertise\",y.introduce AS \"introduce\",y.mobile AS \"mobile\",y.idCard AS \"idcard\",y.jobtitlecode AS \"jobTitleCode\",y.jobTitleName AS \"jobTitleName\",y.dept AS \"dept\",y.deptName AS \"deptName\" from v_Hlw_Ysxx y where y.idcard is not null"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> params = new HashedMap(); 
			 |