Commit 476fab92ec3f6f3756b4bdfd0cd8842dbc4b21d5

Authored by wtt
1 parent b7686bd9db

update

Showing 3 changed files with 59 additions and 50 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyStatisticsController.java View file @ 476fab9
... ... @@ -22,17 +22,17 @@
22 22 @Autowired
23 23 private BabyStatisticsFacade babyStatisticsFacade;
24 24  
25   - /**
  25 + /* *//**
26 26 儿童统计
27 27 * @Author: 武涛涛
28 28 * @Date: 2021/3/20 13:55
29   - */
  29 + *//*
30 30 @ResponseBody
31 31 @TokenRequired
32 32 @RequestMapping(value = "/statistics", method = RequestMethod.POST)
33 33 public BaseResponse statistics(@RequestBody BabyStatisticsQueryRequest babyStatisticsQueryRequest) {
34 34 return babyStatisticsFacade.statistics(babyStatisticsQueryRequest);
35   - }
  35 + }*/
36 36 /**
37 37 儿童统计
38 38 * @Author: 武涛涛
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsFacade.java View file @ 476fab9
... ... @@ -77,7 +77,7 @@
77 77 儿童统计:
78 78 1:高危儿管理率、2:儿童建册率、3:低出生体重儿百分比、
79 79 4:3岁以下儿童系统管理率、5.1:中重度贫血率、5.2:5岁以下儿童肥胖率、6:听力确诊率、7:听力筛查率
80   - */
  80 +
81 81 public BaseResponse statistics(BabyStatisticsQueryRequest queryRequest) {
82 82 Map <String, Object> staMaps = new HashMap <>();
83 83 long startTime=System.currentTimeMillis(); //获取开始时间
... ... @@ -116,7 +116,7 @@
116 116 System.out.println("程序运行毫秒: "+(endTime-startTime)+"ms");
117 117 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(staMaps);
118 118 }
119   - /*
  119 + *//*
120 120 1 定义 接口 抽象方法
121 121 2 实现 接口 抽象方法,不同对象的实现抽象方法,
122 122 3 不同对象的实现抽象方法,存储在list<map>集合中。
123 123  
124 124  
125 125  
126 126  
127 127  
128 128  
129 129  
... ... @@ -155,54 +155,54 @@
155 155  
156 156  
157 157 public interface Statistic {
158   - abstract Map <String, String> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid);
  158 + abstract Map <String, Map <String, String>> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid);
159 159 }
160 160 //1:高危儿管理率
161 161 class GwMap implements Statistic{
162 162 @Override
163   - public Map <String, String> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  163 + public Map <String, Map <String, String>> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
164 164 return getGwMap(queryRequest, provinceCityAreaHid);
165 165 }
166 166 }
167 167 //2:儿童建册率
168 168 class BabyMap implements Statistic{
169 169 @Override
170   - public Map <String, String> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  170 + public Map <String, Map <String, String>> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
171 171 return getBabyMap(queryRequest, provinceCityAreaHid);
172 172 }
173 173 }
174 174 //3:低出生体重儿百分比
175 175 class DtzMap implements Statistic{
176 176 @Override
177   - public Map <String, String> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  177 + public Map <String, Map <String, String>> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
178 178 return getDtzMap(queryRequest, provinceCityAreaHid);
179 179 }
180 180 }
181 181 //4 :中重度贫血率
182 182 class ZdpxMap implements Statistic{
183 183 @Override
184   - public Map <String, String> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  184 + public Map <String, Map <String, String>> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
185 185 return getZdpxMap(queryRequest, provinceCityAreaHid);
186 186 }
187 187 }
188 188 //5 :5岁以下儿童肥胖率
189 189 class FplMap implements Statistic{
190 190 @Override
191   - public Map <String, String> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  191 + public Map <String, Map <String, String>> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
192 192 return getFplMap(queryRequest, provinceCityAreaHid);
193 193 }
194 194 }
195 195 //6:听力确诊率
196 196 class TlqzMap implements Statistic{
197 197 @Override
198   - public Map <String, String> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  198 + public Map <String, Map <String, String>> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
199 199 return getTlqzMap(queryRequest, provinceCityAreaHid);
200 200 }
201 201 }
202 202 //7:听力筛查率
203 203 class TlscMap implements Statistic{
204 204 @Override
205   - public Map <String, String> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  205 + public Map <String, Map <String, String>> statisticMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
206 206 return getTlscMap(queryRequest, provinceCityAreaHid);
207 207 }
208 208 }
... ... @@ -214,7 +214,8 @@
214 214 * @Author: 武涛涛
215 215 * @Date: 2021/3/20 14:09
216 216 */
217   - private Map <String, String> getTlscMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  217 + private Map <String, Map <String, String>> getTlscMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  218 + Map <String, Map <String, String>> maps = new HashMap <>();
218 219 Map <String, String> map = new HashMap <>();
219 220  
220 221 try {
... ... @@ -235,7 +236,7 @@
235 236 //分率
236 237 if(fz !=null && fm !=null){
237 238 Double fld = (double)fz/fm * 100;
238   - if(fld <=0.01 ){
  239 + if(fld <=0.01 || Double.isInfinite(fld) || Double.isNaN(fld)){
239 240 fld = 0.01;
240 241 }
241 242 map.put("fl", new DecimalFormat("0.00").format(fld)+"%");
242 243  
... ... @@ -244,14 +245,16 @@
244 245 } catch (Exception e) {
245 246 e.printStackTrace();
246 247 }
247   - return map;
  248 + maps.put("tlscMap", map);
  249 + return maps;
248 250 }
249 251 /**
250 252 6:听力确诊率
251 253 * @Author: 武涛涛
252 254 * @Date: 2021/3/20 14:09
253 255 */
254   - private Map <String, String> getTlqzMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  256 + private Map <String, Map <String, String>> getTlqzMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  257 + Map <String, Map <String, String>> maps = new HashMap <>();
255 258 Map <String, String> map = new HashMap <>();
256 259  
257 260 try {
... ... @@ -278,7 +281,7 @@
278 281 //分率
279 282 if(fz !=null && fm !=null){
280 283 Double fld = (double)fz/fm * 100;
281   - if(fld <=0.01 ){
  284 + if(fld <=0.01 || Double.isNaN(fld) || Double.isInfinite(fld) ){
282 285 fld = 0.01;
283 286 }
284 287 map.put("fl", new DecimalFormat("0.00").format(fld)+"%");
... ... @@ -287,7 +290,8 @@
287 290 } catch (Exception e) {
288 291 e.printStackTrace();
289 292 }
290   - return map;
  293 + maps.put("tlqzMap", map);
  294 + return maps;
291 295 }
292 296  
293 297 /**
... ... @@ -295,7 +299,8 @@
295 299 * @Author: 武涛涛
296 300 * @Date: 2021/3/20 14:09
297 301 */
298   - private Map <String, String> getFplMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  302 + private Map <String, Map <String, String>> getFplMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  303 + Map <String, Map <String, String>> maps = new HashMap <>();
299 304 Map <String, String> map = new HashMap <>();
300 305  
301 306 try {
... ... @@ -303,7 +308,7 @@
303 308 Criteria cz = Criteria.where("hospitalId").in(provinceCityAreaHid).and("yn").ne(YnEnums.NO.getId())
304 309 .and("checkMonth").gte(6).lte(59).and("weightEvaluate").is("上");
305 310 if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){
306   - cz = cz.and("checkDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd());
  311 + cz = cz.and("checkDate").gte(DateUtil.parseYMD(queryRequest.getTimeStart())).lte(DateUtil.parseYMDEnd(queryRequest.getTimeEnd()));
307 312 }
308 313 Query queryZ = new Query();
309 314 queryZ.addCriteria(cz);
... ... @@ -314,7 +319,7 @@
314 319 Criteria cm = Criteria.where("hospitalId").in(provinceCityAreaHid).and("yn").ne(YnEnums.NO.getId())
315 320 .and("checkMonth").gte(6).lte(59);
316 321 if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){
317   - cm = cm.and("checkDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd());
  322 + cm = cm.and("checkDate").gte(DateUtil.parseYMD(queryRequest.getTimeStart())).lte(DateUtil.parseYMDEnd(queryRequest.getTimeEnd()));
318 323 }
319 324 Query queryM = new Query();
320 325 queryM.addCriteria(cm);
... ... @@ -324,7 +329,7 @@
324 329 //分率
325 330 if(countZ !=null && countM !=null){
326 331 Double fld = (double)countZ/countM * 100;
327   - if(fld <=0.01 ){
  332 + if(fld <=0.01 || Double.isNaN(fld) || Double.isInfinite(fld) ){
328 333 fld = 0.01;
329 334 }
330 335 map.put("fl", new DecimalFormat("0.00").format(fld)+"%");
... ... @@ -333,7 +338,8 @@
333 338 } catch (Exception e) {
334 339 e.printStackTrace();
335 340 }
336   - return map;
  341 + maps.put("fplMap", map);
  342 + return maps;
337 343 }
338 344  
339 345 /**
... ... @@ -341,7 +347,8 @@
341 347 * @Author: 武涛涛
342 348 * @Date: 2021/3/20 14:09
343 349 */
344   - private Map <String, String> getZdpxMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  350 + private Map <String, Map <String, String>> getZdpxMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  351 + Map <String, Map <String, String>> maps = new HashMap <>();
345 352 Map <String, String> map = new HashMap <>();
346 353  
347 354 try {
... ... @@ -349,7 +356,7 @@
349 356 Criteria cz = Criteria.where("hospitalId").in(provinceCityAreaHid).and("yn").ne(YnEnums.NO.getId())
350 357 .and("checkMonth").gte(6).lte(59).and("$where").is(String.format("function(){ var hemoglobin = this.hemoglobin; if( hemoglobin > 90){return true;}}"));
351 358 if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){
352   - cz = cz.and("checkDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd());
  359 + cz = cz.and("checkDate").gte(DateUtil.parseYMD(queryRequest.getTimeStart())).lte(DateUtil.parseYMDEnd(queryRequest.getTimeEnd()));
353 360 }
354 361 Query queryZ = new Query();
355 362 queryZ.addCriteria(cz);
... ... @@ -364,7 +371,8 @@
364 371 } catch (Exception e) {
365 372 e.printStackTrace();
366 373 }
367   - return map;
  374 + maps.put("zdpxMap", map);
  375 + return maps;
368 376 }
369 377  
370 378  
... ... @@ -373,7 +381,8 @@
373 381 * @Author: 武涛涛
374 382 * @Date: 2021/3/20 14:09
375 383 */
376   - private Map <String, String> getDtzMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  384 + private Map <String, Map <String, String>> getDtzMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  385 + Map <String, Map <String, String>> maps = new HashMap <>();
377 386 Map <String, String> map = new HashMap <>();
378 387  
379 388 try {
... ... @@ -381,7 +390,7 @@
381 390 Criteria cz = Criteria.where("hospitalId").in(provinceCityAreaHid).and("buildType").is(2)
382 391 .and("$where").is(String.format("function(){ var babyWeight = this.babyWeight; if( babyWeight > 2.5){return true;}}"));
383 392 if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){
384   - cz = cz.and("buildDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd());
  393 + cz = cz.and("buildDate").gte(DateUtil.parseYMD(queryRequest.getTimeStart())).lte(DateUtil.parseYMDEnd(queryRequest.getTimeEnd()));
385 394 }
386 395 Criteria criteria2z= Criteria.where("yn").is(YnEnums.YES.getId());
387 396 Criteria criteria1z= Criteria.where("dataStatus").in(1).and("yn").is(YnEnums.NO.getId());
... ... @@ -398,7 +407,7 @@
398 407 //分率
399 408 if(countZ !=null && countM !=null){
400 409 Double fld = (double)countZ/countM * 100;
401   - if(fld <=0.01 ){
  410 + if(fld <=0.01 || Double.isNaN(fld)){
402 411 fld = 0.01;
403 412 }
404 413 map.put("fl", new DecimalFormat("0.00").format(fld)+"%");
... ... @@ -406,7 +415,8 @@
406 415 } catch (Exception e) {
407 416 e.printStackTrace();
408 417 }
409   - return map;
  418 + maps.put("dtzMap", map);
  419 + return maps;
410 420 }
411 421  
412 422  
413 423  
414 424  
... ... @@ -415,15 +425,15 @@
415 425 * @Author: 武涛涛
416 426 * @Date: 2021/3/20 14:09
417 427 */
418   - private Map <String, String> getBabyMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  428 + private Map <String, Map <String, String>> getBabyMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  429 + Map <String, Map <String, String>> maps = new HashMap <>();
419 430 Map <String, String> map = new HashMap <>();
420   -
421 431 try {
422 432 // 分子 区域妇幼管理 - 全部儿童管理,建档人数
423 433 Criteria cz = Criteria.where("hospitalId").in(provinceCityAreaHid).and("yn").ne(YnEnums.NO.getId())
424 434 .and("enable").nin(Arrays.asList("1", "2") );
425 435 if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){
426   - cz = cz.and("buildDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd());
  436 + cz = cz.and("buildDate").gte(DateUtil.parseYMD(queryRequest.getTimeStart())).lte(DateUtil.parseYMDEnd(queryRequest.getTimeEnd()));
427 437 }
428 438 Criteria criteria2Z= Criteria.where("buildType").is(3).and("enable").is("1");
429 439 Criteria criteria1Z= Criteria.where("buildType").in(Arrays.asList(1,2));
... ... @@ -436,7 +446,7 @@
436 446 //分母 新生儿活产的人数(分娩儿童)
437 447 Criteria cm = Criteria.where("hospitalId").in(provinceCityAreaHid).and("buildType").is(2).and("yn").is(YnEnums.YES.getId());
438 448 if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){
439   - cm = cm.and("buildDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd());
  449 + cm = cm.and("buildDate").gte(DateUtil.parseYMD(queryRequest.getTimeStart())).lte(DateUtil.parseYMDEnd(queryRequest.getTimeEnd()));
440 450 }
441 451 Query queryM = new Query();
442 452 queryM.addCriteria(cm);
... ... @@ -447,7 +457,7 @@
447 457 //分率
448 458 if(countZ !=null && countM !=null){
449 459 Double fld = (double)countZ/countM * 100;
450   - if(fld <=0.01 ){
  460 + if(fld <=0.01 || Double.isNaN(fld) || Double.isInfinite(fld) ){
451 461 fld = 0.01;
452 462 }
453 463 map.put("fl", new DecimalFormat("0.00").format(fld)+"%");
... ... @@ -455,7 +465,8 @@
455 465 } catch (Exception e) {
456 466 e.printStackTrace();
457 467 }
458   - return map;
  468 + maps.put("babyMap", map);
  469 + return maps;
459 470 }
460 471  
461 472 /**
462 473  
463 474  
... ... @@ -463,14 +474,14 @@
463 474 * @Author: 武涛涛
464 475 * @Date: 2021/3/20 14:09
465 476 */
466   - private Map <String, String> getGwMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  477 + private Map <String, Map <String, String>> getGwMap(BabyStatisticsQueryRequest queryRequest, List <String> provinceCityAreaHid) {
  478 + Map <String, Map <String, String>> maps = new HashMap <>();
467 479 Map <String, String> map = new HashMap <>();
468   -
469 480 try {
470 481 //分子
471 482 Criteria cz = Criteria.where("hospitalId").in(provinceCityAreaHid).and("yn").ne(YnEnums.NO.getId());
472 483 if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){
473   - cz = cz.and("checkDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd());
  484 + cz = cz.and("checkDate").gte(DateUtil.parseYMD(queryRequest.getTimeStart())).lte(DateUtil.parseYMDEnd(queryRequest.getTimeEnd()));
474 485 }
475 486 Integer fzsize = 0;
476 487 Integer fmsize = 0;
... ... @@ -487,7 +498,7 @@
487 498 //分母
488 499 Criteria cm = Criteria.where("hospitalId").in(provinceCityAreaHid).and("yn").ne(YnEnums.NO.getId());
489 500 if(StringUtils.isNotEmpty(queryRequest.getTimeStart()) && StringUtils.isNotEmpty(queryRequest.getTimeEnd())){
490   - cm = cm.and("checkDate").gte(queryRequest.getTimeStart()).lte(queryRequest.getTimeEnd());
  501 + cm = cm.and("checkDate").gte(DateUtil.parseYMD(queryRequest.getTimeStart())).lte(DateUtil.parseYMDEnd(queryRequest.getTimeEnd()));
491 502 }
492 503 AggregationOperation matchM = Aggregation.match(cm);
493 504 AggregationOperation groupM = Aggregation.group("buildId");//.count().as("gwegllCount");
... ... @@ -501,7 +512,7 @@
501 512 //分率
502 513 if(fmsize !=null && fzsize !=null){
503 514 Double fld = (float)fzsize/fmsize * 100.00;
504   - if(fld <=0.01 ){
  515 + if(fld <=0.01 || Double.isNaN(fld) || Double.isInfinite(fld)){
505 516 fld = 0.01;
506 517 }
507 518 map.put("fl", new DecimalFormat("0.00").format(fld)+"%");
... ... @@ -509,7 +520,8 @@
509 520 } catch (Exception e) {
510 521 e.printStackTrace();
511 522 }
512   - return map;
  523 + maps.put("gwMap",map);
  524 + return maps;
513 525 }
514 526  
515 527  
516 528  
517 529  
518 530  
... ... @@ -575,17 +587,14 @@
575 587 map3.put(3, new ZdpxMap());
576 588 listMaps.add(map3);
577 589 Map<Integer,Statistic> map4 = new HashMap();
578   - map4.put(4, new ZdpxMap());
  590 + map4.put(4, new FplMap());
579 591 listMaps.add(map4);
580 592 Map<Integer,Statistic> map5 = new HashMap();
581   - map5.put(5, new FplMap());
  593 + map5.put(5, new TlqzMap());
582 594 listMaps.add(map5);
583 595 Map<Integer,Statistic> map6 = new HashMap();
584   - map6.put(6, new TlqzMap());
  596 + map6.put(6, new TlscMap());
585 597 listMaps.add(map6);
586   - Map<Integer,Statistic> map7 = new HashMap();
587   - map7.put(7, new TlscMap());
588   - listMaps.add(map7);
589 598 return listMaps;
590 599 }
591 600  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/BabyStatisticsWorker.java View file @ 476fab9
... ... @@ -51,7 +51,7 @@
51 51 if(statistic == null){
52 52 continue;
53 53 }
54   - Map <String, String> map = statistic.statisticMap(babyStatisticsQueryRequest, provinceCityAreaHid);
  54 + Map <String, Map <String, String>> map = statistic.statisticMap(babyStatisticsQueryRequest, provinceCityAreaHid);
55 55 data.add(map);
56 56 }
57 57