Commit aed9a6e9bb43abfab62aafc8e10cba1471455011
1 parent
3fd4442d3d
Exists in
master
and in
6 other branches
建册统计修改条件
Showing 3 changed files with 15 additions and 102 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
aed9a6e
| ... | ... | @@ -285,11 +285,11 @@ |
| 285 | 285 | * @return |
| 286 | 286 | */ |
| 287 | 287 | @ResponseBody |
| 288 | -// @TokenRequired | |
| 288 | + @TokenRequired | |
| 289 | 289 | @RequestMapping(value = "/patient", method = RequestMethod.GET) |
| 290 | 290 | public BaseObjectResponse patient(HttpServletRequest request, String year, String provinceId, String cityId, String areaId) { |
| 291 | -// return reportService.patient(getUserId(request), year); | |
| 292 | - return reportService.patient(2144, year, provinceId, cityId, areaId); | |
| 291 | + return reportService.patient(getUserId(request), year, provinceId, cityId, areaId); | |
| 292 | +// return reportService.patient(2144, year, provinceId, cityId, areaId); | |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
aed9a6e
| ... | ... | @@ -20,9 +20,6 @@ |
| 20 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 21 | 21 | import org.springframework.data.domain.Sort; |
| 22 | 22 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 23 | -import org.springframework.data.mongodb.core.aggregation.Aggregation; | |
| 24 | -import org.springframework.data.mongodb.core.aggregation.AggregationOperation; | |
| 25 | -import org.springframework.data.mongodb.core.aggregation.AggregationResults; | |
| 26 | 23 | import org.springframework.data.mongodb.core.query.Criteria; |
| 27 | 24 | import org.springframework.data.mongodb.core.query.Query; |
| 28 | 25 | import org.springframework.stereotype.Service; |
| 29 | 26 | |
| 30 | 27 | |
| ... | ... | @@ -1068,10 +1065,12 @@ |
| 1068 | 1065 | |
| 1069 | 1066 | Set<String> patientIds = new HashSet<>(); |
| 1070 | 1067 | |
| 1071 | - Criteria criteria = Criteria.where("created").gte(DateUtil.getYearDate(year)) | |
| 1068 | + /*Criteria criteria = Criteria.where("created").gte(DateUtil.getYearDate(year)) | |
| 1072 | 1069 | .lt(DateUtil.getNextYearDate(year)) |
| 1073 | - .and("hospitalId").is(hospitalId); | |
| 1070 | + .and("hospitalId").is(hospitalId);*/ | |
| 1074 | 1071 | |
| 1072 | + Criteria criteria = Criteria.where("hospitalId").is(hospitalId); | |
| 1073 | + | |
| 1075 | 1074 | /** 产前检查: lyms_antexc(初诊),lyms_antex(复诊)设置pid */ |
| 1076 | 1075 | List<AntenatalExaminationModel> antenatalExaminationModels = mongoUtil.findField(AntenatalExaminationModel.class, criteria, "parentId"); |
| 1077 | 1076 | for (AntenatalExaminationModel antenatalExaminationModel : antenatalExaminationModels) { |
| ... | ... | @@ -1108,6 +1107,10 @@ |
| 1108 | 1107 | patientIds.add(sieveModel.getParentId()); |
| 1109 | 1108 | } |
| 1110 | 1109 | |
| 1110 | + /** 增加年份条件限制 */ | |
| 1111 | + criteria = Criteria.where("created").gte(DateUtil.getYearDate(year)) | |
| 1112 | + .lt(DateUtil.getNextYearDate(year)) | |
| 1113 | + .and("hospitalId").is(hospitalId); | |
| 1111 | 1114 | if(StringUtils.isNotEmpty(provinceId)) { |
| 1112 | 1115 | criteria.and("provinceId").in(CollectionUtils.asList(provinceId)); |
| 1113 | 1116 | } |
| ... | ... | @@ -1148,7 +1151,8 @@ |
| 1148 | 1151 | qhdSeries.setType("bar"); |
| 1149 | 1152 | qhdSeries.setStack("总计"); |
| 1150 | 1153 | |
| 1151 | - String provinceId = mongoUtil.findId("河北省"); | |
| 1154 | +// String provinceId = mongoUtil.findId("河北省"); | |
| 1155 | + String provinceId = mongoUtil.findId("秦皇岛市"); | |
| 1152 | 1156 | if(StringUtils.isNotEmpty(provinceId)) { |
| 1153 | 1157 | Map<Integer, Integer> qhdTemp = new HashMap<>();/** key = month . value = count*/ |
| 1154 | 1158 | for (int i = 1; i < 13; i++) { |
| ... | ... | @@ -1159,7 +1163,8 @@ |
| 1159 | 1163 | otherTemp.put(i, 0); |
| 1160 | 1164 | } |
| 1161 | 1165 | for (Map<String, Object> data : datas) { |
| 1162 | - if(provinceId.equals(data.get("province_id"))) { | |
| 1166 | +// if(provinceId.equals(data.get("province_id"))) { | |
| 1167 | + if(provinceId.equals(data.get("city_id"))) { | |
| 1163 | 1168 | for(int i = 1; i < 13; i++) { |
| 1164 | 1169 | qhdTemp.put(i, qhdTemp.get(i) + Integer.parseInt(data.get(i + "") + "")); |
| 1165 | 1170 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
View file @
aed9a6e
| ... | ... | @@ -150,99 +150,7 @@ |
| 150 | 150 | } |
| 151 | 151 | tempMap.put("count", count); |
| 152 | 152 | rest.add(tempMap); |
| 153 | - /* List<Map<String, Map<Integer, Integer>>> datas = new ArrayList<>(); | |
| 154 | - Set<Map.Entry<String, Integer>> entries = codeMap.entrySet(); | |
| 155 | - for (Map.Entry<String, Integer> entry : entries) { | |
| 156 | - String key = entry.getKey(); | |
| 157 | - String id = key.split("_")[0]; | |
| 158 | - Integer month = Integer.parseInt(key.split("_")[1]); | |
| 159 | - Integer count = entry.getValue(); | |
| 160 | 153 | |
| 161 | - boolean flag = true; | |
| 162 | - for (Map<String, Map<Integer, Integer>> data : datas) { | |
| 163 | - if(data.containsKey(id)) { | |
| 164 | - Map<Integer, Integer> map = data.get(id); | |
| 165 | - if(map.containsKey(month)) { | |
| 166 | - map.put(month, map.get(month) + count); | |
| 167 | - } else { | |
| 168 | - map.put(month, count); | |
| 169 | - } | |
| 170 | - flag = false; | |
| 171 | - } | |
| 172 | - } | |
| 173 | - | |
| 174 | - if(flag) { | |
| 175 | - Map<String, Map<Integer, Integer>> tempMap = new HashMap<>(); | |
| 176 | - Map<Integer, Integer> map = new HashMap<>(); | |
| 177 | - map.put(month, count); | |
| 178 | - tempMap.put(id, map); | |
| 179 | - datas.add(tempMap); | |
| 180 | - } | |
| 181 | - }*/ | |
| 182 | - | |
| 183 | - /* System.out.println("===================================== codemap ================================="); | |
| 184 | - Set<Map.Entry<String, Integer>> codeMapEntries = codeMap.entrySet(); | |
| 185 | - for (Map.Entry<String, Integer> codeMapEntry : codeMapEntries) { | |
| 186 | - System.out.println(codeMapEntry.getKey() + " : " + codeMapEntry.getValue()); | |
| 187 | - } | |
| 188 | - System.out.println("===================================== datas ================================="); | |
| 189 | - for (Map<String, Map<Integer, Integer>> data : datas) { | |
| 190 | - Set<Map.Entry<String, Map<Integer, Integer>>> set = data.entrySet(); | |
| 191 | - for (Map.Entry<String, Map<Integer, Integer>> mapEntry : set) { | |
| 192 | - System.out.println(mapEntry.getKey() + " : " + mapEntry.getValue()); | |
| 193 | - } | |
| 194 | - }*/ | |
| 195 | - | |
| 196 | - /*List<Map<String, Object>> restMap = new ArrayList<>(); | |
| 197 | - | |
| 198 | - *//** 设置没数据的月份为0 *//* | |
| 199 | - for (Map<String, Map<Integer, Integer>> data : datas) { | |
| 200 | - Integer count = 0; | |
| 201 | - Set<Map.Entry<String, Map<Integer, Integer>>> set = data.entrySet(); | |
| 202 | - for (Map.Entry<String, Map<Integer, Integer>> entry : set) { | |
| 203 | - Map<Integer, Integer> map = entry.getValue(); | |
| 204 | - Map<String, Object> tempMap = new HashMap<>(); | |
| 205 | - for (int i = 1; i <= 12; i++) { | |
| 206 | - if(!map.containsKey(i)) { | |
| 207 | - map.put(i, 0); | |
| 208 | - tempMap.put(i + "", 0); | |
| 209 | - } else { | |
| 210 | - count += map.get(i); | |
| 211 | - tempMap.put(i + "", map.get(i)); | |
| 212 | - } | |
| 213 | - } | |
| 214 | - map.put(0, count); | |
| 215 | - tempMap.put("count", count); | |
| 216 | - tempMap.put("id", entry.getKey()); | |
| 217 | - tempMap.put("parentId", findParentId(entry.getKey())); | |
| 218 | - tempMap.put("name", findName(entry.getKey())); | |
| 219 | - restMap.add(tempMap); | |
| 220 | - } | |
| 221 | - } | |
| 222 | -*/ | |
| 223 | - | |
| 224 | - /** 处理 其他 数据 */ | |
| 225 | - /* Map<String, Object> tempMap = new HashMap<>(); | |
| 226 | - otherMonthMap.put("count", otherCount); | |
| 227 | - tempMap.put("name", "其他"); | |
| 228 | - tempMap.put("id", null); | |
| 229 | - tempMap.put("parentId", -1); | |
| 230 | - for (int i = 1; i <= 12; i++) { | |
| 231 | - if(otherMonthMap.containsKey(i + "")) { | |
| 232 | - tempMap.put(i + "", otherMonthMap.get(i + "")); | |
| 233 | - } else { | |
| 234 | - tempMap.put(i + "", 0); | |
| 235 | - } | |
| 236 | - } | |
| 237 | - restMap.add(tempMap);*/ | |
| 238 | - | |
| 239 | - /* for (Map<String, Map<Integer, Integer>> data : datas) { | |
| 240 | - System.out.println("data>>> " + data); | |
| 241 | - } | |
| 242 | - System.out.println("========================"); | |
| 243 | - for (Map<String, Object> map : restMap) { | |
| 244 | - System.out.println("rest>> " + map); | |
| 245 | - }*/ | |
| 246 | 154 | return rest; |
| 247 | 155 | } |
| 248 | 156 |