| 
															
																@ -206,7 +206,7 @@ public class PatientRecordService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 获取检查检验列表 
															 | 
															
															 | 
															
																     * 获取检查检验列表 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public List<Map<String, String>> getExamAndLabReport(String patientCode, String page, String pageSize) throws Exception { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public List<Map<String, String>> getExamAndLabReport(String patientCode, String page, String pageSize, String lastTime) throws Exception { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String, String>> re = new ArrayList<>(); 
															 | 
															
															 | 
															
																        List<Map<String, String>> re = new ArrayList<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //获取患者 
															 | 
															
															 | 
															
																        //获取患者 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -227,12 +227,22 @@ public class PatientRecordService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String, Object>> appList = jdbcTemplate.queryForList(sql); 
															 | 
															
															 | 
															
																        List<Map<String, Object>> appList = jdbcTemplate.queryForList(sql); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if (!StringUtils.isEmpty(response)) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if (!StringUtils.isEmpty(response) && !"[{}]".equals(response)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            JSONArray array = new JSONArray(response); 
															 | 
															
															 | 
															
																            JSONArray array = new JSONArray(response); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            String max = ""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            String min = ""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            for (int i = 0; i < array.length(); i++) { 
															 | 
															
															 | 
															
																            for (int i = 0; i < array.length(); i++) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                JSONObject item = array.getJSONObject(i); 
															 | 
															
															 | 
															
																                JSONObject item = array.getJSONObject(i); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                Map<String, String> map = new HashMap<>(); 
															 | 
															
															 | 
															
																                Map<String, String> map = new HashMap<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if (i == 0) //最大值 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    max = item.optString("END_TIME"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } else if (i == array.length() - 1) //最小值 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    min = item.optString("END_TIME"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("id", item.optString("EVENT")); 
															 | 
															
															 | 
															
																                map.put("id", item.optString("EVENT")); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("patient", patientCode); 
															 | 
															
															 | 
															
																                map.put("patient", patientCode); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("eventDate", item.optString("END_TIME")); 
															 | 
															
															 | 
															
																                map.put("eventDate", item.optString("END_TIME")); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -257,46 +267,72 @@ public class PatientRecordService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            //过滤 
															 | 
															
															 | 
															
																            //过滤 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            for (Map<String, Object> item : appList) { 
															 | 
															
															 | 
															
																            for (Map<String, Object> item : appList) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                Map<String, String> map = new HashMap<>(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("id", item.get("id").toString()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("patient", patientCode); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("eventDate", DateUtil.dateToStrLong((Date) item.get("event_date"))); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                String type = ""; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                if ("检验报告".equals(item.get("catalog"))) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    type = "检验"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                } else if ("检查报告".equals(item.get("catalog"))) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    type = "检查"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                String eventDate = DateUtil.dateToStrLong((Date) item.get("event_date")); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                int maxCompare = eventDate.compareTo(max); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                int minCompare = eventDate.compareTo(min); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                Boolean contain = false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if (maxCompare < 0 && minCompare >= 0)       //时间范围内 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    contain = true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                //第一页特殊处理 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if ("1".equals(page) && maxCompare >= 0) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    contain = true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                //最后一页特殊处理 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if (!"1".equals(page) && (array.length() == 0 || "[{}]".equals(response)) && !StringUtils.isEmpty(lastTime)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    int lastTimeCompare = eventDate.compareTo(lastTime); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    if (lastTimeCompare < 0) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        contain = true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if (contain) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    Map<String, String> map = new HashMap<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("id", item.get("id").toString()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("patient", patientCode); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("eventDate", eventDate); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    String type = ""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    if ("检验报告".equals(item.get("catalog"))) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        type = "检验"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    } else if ("检查报告".equals(item.get("catalog"))) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        type = "检查"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("type", type); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("catalogCode", ""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("serial", ""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("orgName", String.valueOf(item.get("org_name"))); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("label", String.valueOf(item.get("label"))); //检测项目 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("dataFrom", "2");//基卫数据 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    re.add(map); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                } 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("type", type); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("catalogCode", ""); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("serial", ""); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("orgName", String.valueOf(item.get("org_name"))); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("label", String.valueOf(item.get("label"))); //检测项目 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("dataFrom", "2");//基卫数据 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                re.add(map); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            //排序 
															 | 
															
															 | 
															
																            //排序 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            re = sortMapList(re, "eventDate", "DESC"); 
															 | 
															
															 | 
															
																            re = sortMapList(re, "eventDate", "DESC"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } else { 
															 | 
															
															 | 
															
																        } else { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            for (Map<String, Object> item : appList) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                Map<String, String> map = new HashMap<>(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("id", String.valueOf(item.get("id"))); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("patient", patientCode); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("eventDate", DateUtil.dateToStrLong((Date) item.get("event_date"))); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                String type = ""; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                if ("检验报告".equals(item.get("catalog"))) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    type = "检验"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                } else if ("检查报告".equals(item.get("catalog"))) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    type = "检查"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if ("1".equals(page)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                for (Map<String, Object> item : appList) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    Map<String, String> map = new HashMap<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("id", String.valueOf(item.get("id"))); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("patient", patientCode); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("eventDate", DateUtil.dateToStrLong((Date) item.get("event_date"))); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    String type = ""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    if ("检验报告".equals(item.get("catalog"))) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        type = "检验"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    } else if ("检查报告".equals(item.get("catalog"))) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        type = "检查"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("type", type); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("catalogCode", ""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("serial", ""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("orgName", String.valueOf(item.get("org_name"))); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("label", String.valueOf(item.get("label"))); //检测项目 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    map.put("dataFrom", "2");//基卫数据 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    re.add(map); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                } 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("type", type); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("catalogCode", ""); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("serial", ""); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("orgName", String.valueOf(item.get("org_name"))); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("label", String.valueOf(item.get("label"))); //检测项目 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                map.put("dataFrom", "2");//基卫数据 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                re.add(map); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -310,7 +346,12 @@ public class PatientRecordService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public String getDrugsListPage(String patientCode, String page, String pageSize) throws Exception { 
															 | 
															
															 | 
															
																    public String getDrugsListPage(String patientCode, String page, String pageSize) throws Exception { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //获取患者 
															 | 
															
															 | 
															
																        //获取患者 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Patient patient = patientDao.findByCode(patientCode); 
															 | 
															
															 | 
															
																        Patient patient = patientDao.findByCode(patientCode); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        return jwSmjkService.getDrugsListPage(patient.getSsc(), page, pageSize); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        String response = jwSmjkService.getDrugsListPage(patient.getSsc(), page, pageSize); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if ("[{}]".equals(response)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            response = "[]"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        return response; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 |