Commit 570b44c2adb69fd76f3bf5d2c50495cc72285d6f
1 parent
dffdd11079
Exists in
master
and in
6 other branches
逗号改括号
Showing 3 changed files with 84 additions and 72 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
570b44c
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 | @ResponseBody |
43 | 43 | @TokenRequired |
44 | 44 | @RequestMapping(value = "/patients", method = RequestMethod.GET) |
45 | - public BaseObjectResponse patients(String provinceId, String cityId, String areaId, String streetId, Integer statistType, Integer statistVal, | |
45 | + public BaseObjectResponse patients(String provinceId, String cityId, String areaId, String streetId, @RequestParam Integer statistType, Integer statistVal, | |
46 | 46 | Integer ageType, Integer patientType, Date startDate, Date endDate, HttpServletRequest request) { |
47 | 47 | return reportService.patients(provinceId, cityId, areaId, streetId, statistType, statistVal, ageType, patientType, startDate, endDate, getUserId(request)); |
48 | 48 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
View file @
570b44c
... | ... | @@ -1488,7 +1488,7 @@ |
1488 | 1488 | if (antExcAddOther.getFitness() != null) { |
1489 | 1489 | String fitness = FitnessEnums.getTitle(Integer.parseInt(antExcAddOther.getFitness().toString())); |
1490 | 1490 | if (antExcAddOther.getFitnessRemark() != null) { |
1491 | - mapData.put("fitness", fitness + "(," + antExcAddOther.getFitnessRemark() + ")"); | |
1491 | + mapData.put("fitness", fitness + "(" + antExcAddOther.getFitnessRemark() + ")"); | |
1492 | 1492 | } else { |
1493 | 1493 | mapData.put("fitness", fitness); |
1494 | 1494 | } |
... | ... | @@ -1515,7 +1515,7 @@ |
1515 | 1515 | if (otherMap.containsKey("fmType")) { |
1516 | 1516 | String fmType = CZFmTypeEnums.getTitle(Integer.parseInt(otherMap.get("fmType").toString())); |
1517 | 1517 | if (otherMap.get("fmTypeRemark") != null) { |
1518 | - mapData.put("fmType", fmType + "," + otherMap.get("fmTypeRemark")); | |
1518 | + mapData.put("fmType", fmType + "(" + otherMap.get("fmTypeRemark") + ")"); | |
1519 | 1519 | } else { |
1520 | 1520 | mapData.put("fmType", fmType); |
1521 | 1521 | } |
... | ... | @@ -1525,7 +1525,7 @@ |
1525 | 1525 | if (otherMap.containsKey("fitness")) { |
1526 | 1526 | String fitness = FitnessEnums.getTitle(Integer.parseInt(otherMap.get("fitness").toString())); |
1527 | 1527 | if (otherMap.get("fitnessRemark") != null) { |
1528 | - mapData.put("fitness", fitness + "," + otherMap.get("fitnessRemark")); | |
1528 | + mapData.put("fitness", fitness + "(" + otherMap.get("fitnessRemark") + ")"); | |
1529 | 1529 | } else { |
1530 | 1530 | mapData.put("fitness", fitness); |
1531 | 1531 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
570b44c
... | ... | @@ -184,7 +184,7 @@ |
184 | 184 | |
185 | 185 | /** |
186 | 186 | * 建档统计 |
187 | - * @param statistType 统计环比 1=周 2=月 3=季度 4=半年 5=年 | |
187 | + * @param statistType 1=占比 2=环比 | |
188 | 188 | * @param ageType 1=全部年龄 2=20岁以下 3=20-30岁 4=30-40岁 5=40岁以上 |
189 | 189 | * @param patientType 建档孕周 1=孕早期 2=孕中期 3=孕晚期 |
190 | 190 | * @return |
191 | 191 | |
192 | 192 | |
193 | 193 | |
194 | 194 | |
195 | 195 | |
196 | 196 | |
... | ... | @@ -243,78 +243,77 @@ |
243 | 243 | |
244 | 244 | // 拼装tab数据 |
245 | 245 | List<Map<String, Date>> range = DateUtil.getRange(startDate, endDate); |
246 | - if(StringUtils.isNotEmpty(cityId)) { // 按照区县来 | |
247 | - titleList.add(""); | |
248 | - titleList.add(""); | |
249 | - titleList.add(""); | |
250 | - for (Map<String, Date> map : range) { | |
251 | - titleList.add(DateUtil.getyyyy_mm(map.get("cname"))); | |
252 | - } | |
253 | - } else { // 按照城市来 | |
254 | - titleList.add("城市名称"); | |
255 | - titleList.add("机构数"); | |
256 | - titleList.add("统计指标(人)"); | |
257 | - for (Map<String, Date> map : range) { | |
258 | - titleList.add(DateUtil.getyyyy_mm(map.get("cname"))); | |
259 | - } | |
260 | - tabList.add(titleList); | |
261 | - List<Map<String, Object>> infos = new ArrayList<>(); | |
262 | - for (Patients patient : patients) { | |
263 | - for (Map<String, Object> map : hospitals) { | |
264 | - if(patient.getHospitalId().equals(map.get("id").toString())) { | |
265 | - boolean flag = true; | |
266 | - for (Map<String, Object> info : infos) { | |
267 | - if(map.get("cityId").equals(info.get("id"))) { | |
268 | - Set<String> hids = (Set<String>) info.get("hids"); | |
269 | - hids.add(patient.getHospitalId()); | |
270 | - for (Map<String, Date> dateMap : range) { | |
271 | - if(patient.getBookbuildingDate().getTime() >= dateMap.get("start").getTime() | |
272 | - && patient.getBookbuildingDate().getTime() < dateMap.get("end").getTime()) { | |
273 | - String monthKey = DateUtil.getyyyy_mm(dateMap.get("cname")); | |
274 | - if(info.containsKey(monthKey)) { | |
275 | - info.put(monthKey, (Integer) info.get(monthKey) + 1); | |
276 | - flag = false; | |
277 | - } else { | |
278 | - info.put(monthKey, 1); | |
279 | - flag = false; | |
280 | - } | |
281 | - } | |
282 | - } | |
283 | - } | |
284 | - } | |
285 | - if(flag) { | |
246 | + titleList.add((StringUtils.isNotEmpty(cityId) ? "区县" : "城市") + "名称"); | |
247 | + titleList.add("机构数"); | |
248 | + titleList.add("统计指标(人)"); | |
249 | + for (Map<String, Date> map : range) { | |
250 | + titleList.add(DateUtil.getyyyy_mm(map.get("cname"))); | |
251 | + } | |
252 | + tabList.add(titleList); | |
253 | + | |
254 | + List<Map<String, Object>> infos = new ArrayList<>(); | |
255 | + for (Patients patient : patients) { | |
256 | + for (Map<String, Object> map : hospitals) { | |
257 | + if(patient.getHospitalId().equals(map.get("id").toString())) { | |
258 | + boolean flag = true; | |
259 | + for (Map<String, Object> info : infos) { | |
260 | + if(map.get("cityId").equals(info.get("id"))) { | |
261 | + Set<String> hids = (Set<String>) info.get("hids"); | |
262 | + hids.add(patient.getHospitalId()); | |
286 | 263 | for (Map<String, Date> dateMap : range) { |
287 | 264 | if(patient.getBookbuildingDate().getTime() >= dateMap.get("start").getTime() |
288 | 265 | && patient.getBookbuildingDate().getTime() < dateMap.get("end").getTime()) { |
289 | 266 | String monthKey = DateUtil.getyyyy_mm(dateMap.get("cname")); |
290 | - Map<String, Object> info = new HashMap<>(); | |
291 | - Set<String> hids = new HashSet<>(); | |
292 | - hids.add(patient.getHospitalId()); | |
293 | - info.put(monthKey, 1); | |
294 | - info.put("id", map.get("cityId")); | |
295 | - info.put("hids", hids); | |
296 | - infos.add(info); | |
267 | + if(info.containsKey(monthKey)) { | |
268 | + info.put(monthKey, (Integer) info.get(monthKey) + 1); | |
269 | + flag = false; | |
270 | + } else { | |
271 | + info.put(monthKey, 1); | |
272 | + flag = false; | |
273 | + } | |
297 | 274 | } |
298 | 275 | } |
299 | 276 | } |
300 | 277 | } |
278 | + if(flag) { | |
279 | + for (Map<String, Date> dateMap : range) { | |
280 | + if(patient.getBookbuildingDate().getTime() >= dateMap.get("start").getTime() | |
281 | + && patient.getBookbuildingDate().getTime() < dateMap.get("end").getTime()) { | |
282 | + String monthKey = DateUtil.getyyyy_mm(dateMap.get("cname")); | |
283 | + Map<String, Object> info = new HashMap<>(); | |
284 | + Set<String> hids = new HashSet<>(); | |
285 | + hids.add(patient.getHospitalId()); | |
286 | + info.put(monthKey, 1); | |
287 | +// info.put("id", map.get("cityId")); | |
288 | + info.put("id", map.get((StringUtils.isNotEmpty(cityId) ? "areaId" : "cityId"))); | |
289 | + info.put("hids", hids); | |
290 | + infos.add(info); | |
291 | + } | |
292 | + } | |
293 | + } | |
301 | 294 | } |
302 | 295 | } |
296 | + } | |
303 | 297 | |
304 | - for (Map<String, Object> info : infos) { | |
305 | - List<String> tempList = new ArrayList<>(); | |
306 | - tempList.add(findName(info.get("id"))); | |
307 | - tempList.add(((Set<String>) info.get("hids")).size() + ""); | |
308 | - tempList.add("建档总数"); | |
309 | - for (Map<String, Date> map : range) { | |
310 | - tempList.add(info.containsKey(DateUtil.getyyyy_mm(map.get("cname"))) ? | |
311 | - info.get(DateUtil.getyyyy_mm(map.get("cname"))) + "" : "0"); | |
312 | - } | |
313 | - tabList.add(tempList); | |
298 | + for (Map<String, Object> info : infos) { | |
299 | + List<String> tempList = new ArrayList<>(); | |
300 | + tempList.add(findName(info.get("id"))); | |
301 | + tempList.add(((Set<String>) info.get("hids")).size() + ""); | |
302 | + tempList.add("建档总数"); | |
303 | + for (Map<String, Date> map : range) { | |
304 | + tempList.add(info.containsKey(DateUtil.getyyyy_mm(map.get("cname"))) ? | |
305 | + info.get(DateUtil.getyyyy_mm(map.get("cname"))) + "" : "0"); | |
314 | 306 | } |
315 | - System.out.println(tabList); | |
316 | - } | |
307 | + tabList.add(tempList); | |
317 | 308 | } |
309 | + System.out.println(tabList); | |
310 | + } | |
311 | +// | |
312 | +// if(StringUtils.isNotEmpty(cityId)) { // 按照区县来 对应孕妇建档统计-市 | |
313 | +// | |
314 | +// } else { // 按照城市来 对应孕妇建档统计-省 | |
315 | +// | |
316 | +// } | |
318 | 317 | |
319 | 318 | setTabListInfo(tabList); |
320 | 319 | |
321 | 320 | |
... | ... | @@ -323,13 +322,17 @@ |
323 | 322 | barMap.put("name", "建档总数"); |
324 | 323 | series.add(barMap); |
325 | 324 | |
326 | - Integer count = 0; | |
327 | - for (Integer num : bar) { | |
328 | - count += num; | |
325 | + if(statistType == 1) { | |
326 | + Integer count = 0; | |
327 | + for (Integer num : bar) { | |
328 | + count += num; | |
329 | + } | |
330 | + for (Integer num : bar) { | |
331 | + line.add(MathUtil.getProportion(num, count)); | |
332 | + } | |
333 | + } else if(statistType == 2) { | |
334 | + | |
329 | 335 | } |
330 | - for (Integer num : bar) { | |
331 | - line.add(MathUtil.getProportion(num, count)); | |
332 | - } | |
333 | 336 | lineMap.put("data", line); |
334 | 337 | lineMap.put("type", "line"); |
335 | 338 | lineMap.put("name", "建档总数"); |
336 | 339 | |
... | ... | @@ -464,12 +467,21 @@ |
464 | 467 | return patients; |
465 | 468 | } |
466 | 469 | |
467 | - // 建档孕周 1=孕早期 2=孕中期 3=孕晚期 | |
470 | + // 建档孕周 1=孕早期(0~12周) 2=孕中期(13-27) 3=孕晚期(28~42) | |
468 | 471 | private void doFilter(List<Patients> patients, Integer ageType, Integer patientType) { |
469 | 472 | if(patientType != null) { |
470 | 473 | Iterator<Patients> iterator = patients.iterator(); |
471 | 474 | while (iterator.hasNext()) { |
472 | - | |
475 | + Integer week = DateUtil.getWeek(iterator.next().getLastMenses(), new Date()); | |
476 | + if(week != null) { | |
477 | + if(patientType == 1 && week > 12) { | |
478 | + iterator.remove(); | |
479 | + } else if(patientType == 2 && (week < 13 || week > 27)) { | |
480 | + iterator.remove(); | |
481 | + } else if(patientType == 3 && week < 28) { | |
482 | + iterator.remove(); | |
483 | + } | |
484 | + } | |
473 | 485 | } |
474 | 486 | } |
475 | 487 | if (ageType != null) { |