Commit e263984ff4f2b211d99a58ebfdb9447c2a8f67a8
1 parent
89c2fb49dc
Exists in
master
and in
6 other branches
产检节点统计
Showing 2 changed files with 101 additions and 74 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
e263984
... | ... | @@ -358,16 +358,20 @@ |
358 | 358 | |
359 | 359 | /** |
360 | 360 | * 计算产检是不是对应孕周断中的第一次 |
361 | - * @param hospitalId | |
361 | + * @param pid | |
362 | 362 | * @return |
363 | 363 | */ |
364 | 364 | @RequestMapping(value = "/updateCheckRecord", method = RequestMethod.GET) |
365 | 365 | @ResponseBody |
366 | - public String updateCheckRecord(@RequestParam(required = false) String hospitalId) | |
366 | + public String updateCheckRecord(@RequestParam(required = false) String pid) | |
367 | 367 | { |
368 | 368 | |
369 | 369 | PersonModelQuery personModelQuery = new PersonModelQuery(); |
370 | 370 | personModelQuery.setYn(YnEnums.YES.getId()); |
371 | + if (StringUtils.isNotEmpty(pid)) | |
372 | + { | |
373 | + personModelQuery.setId(pid); | |
374 | + } | |
371 | 375 | |
372 | 376 | List<PersonModel> personModels = personService.queryPersons(personModelQuery); |
373 | 377 | if (CollectionUtils.isNotEmpty(personModels)) |
374 | 378 | |
375 | 379 | |
376 | 380 | |
377 | 381 | |
378 | 382 | |
379 | 383 | |
380 | 384 | |
381 | 385 | |
382 | 386 | |
383 | 387 | |
... | ... | @@ -377,92 +381,110 @@ |
377 | 381 | { |
378 | 382 | end += batchSize; |
379 | 383 | end = end > personModels.size() ? personModels.size() : end; |
380 | - final List<PersonModel> models = personModels.subList(i,batchSize); | |
384 | + final List<PersonModel> models = personModels.subList(i,end); | |
381 | 385 | |
382 | 386 | commonThreadPool.execute(new Runnable() { |
383 | 387 | @Override |
384 | 388 | public void run() { |
385 | - for(PersonModel model : models) | |
389 | + for(PersonModel person : models) | |
386 | 390 | { |
387 | - PatientsQuery patientsQuery1 = new PatientsQuery(); | |
388 | - patientsQuery1.setYn(YnEnums.YES.getId()); | |
389 | - patientsQuery1.setPid(model.getId()); | |
390 | - List<Patients> pats = patientsService.queryPatient(patientsQuery1); | |
391 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
392 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
393 | + patientsQuery.setPid(person.getId()); | |
394 | + List<Patients> pats = patientsService.queryPatient1(patientsQuery,"created"); | |
391 | 395 | |
392 | - int batchSize = 1000; | |
393 | - int end = 0; | |
394 | - for (int i = 0; i < pats.size(); i += batchSize) { | |
395 | - end = (end + batchSize); | |
396 | - if (end > pats.size()) { | |
397 | - end = pats.size(); | |
396 | + Map<String,List<Patients>> temps = new HashMap<String, List<Patients>>(); | |
397 | + | |
398 | + if (CollectionUtils.isNotEmpty(pats)) | |
399 | + { | |
400 | + for(Patients pat : pats) | |
401 | + { | |
402 | + if (pat.getLastMenses() != null) | |
403 | + { | |
404 | + Object obj = temps.get(DateUtil.getyyyy_MM_dd(pat.getLastMenses())); | |
405 | + if (obj != null) | |
406 | + { | |
407 | + List<Patients> cc = (List<Patients>)obj; | |
408 | + cc.add(pat); | |
409 | + temps.put(DateUtil.getyyyy_MM_dd(pat.getLastMenses()),cc); | |
410 | + } | |
411 | + else | |
412 | + { | |
413 | + List<Patients> cc = new ArrayList<Patients>(); | |
414 | + cc.add(pat); | |
415 | + temps.put(DateUtil.getyyyy_MM_dd(pat.getLastMenses()),cc); | |
416 | + } | |
417 | + } | |
398 | 418 | } |
399 | - System.out.println("start:" + i + ",end:" + end); | |
400 | - final List<Patients> tempList = pats.subList(i, end); | |
419 | + } | |
401 | 420 | |
402 | - commonThreadPool.execute(new Runnable() { | |
403 | - @Override | |
404 | - public void run() { | |
405 | - if (CollectionUtils.isNotEmpty(tempList)) { | |
406 | - AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
407 | - for (Patients pat : tempList) { | |
408 | - antExRecordQuery.setParentId(pat.getId()); | |
409 | - if (StringUtils.isNotEmpty(pat.getId())) | |
410 | - { | |
421 | + if (!temps.isEmpty()) | |
422 | + { | |
423 | + for(String key : temps.keySet()) | |
424 | + { | |
425 | + List<String> ids = new ArrayList<String>(); | |
426 | + List<Patients> patientses = temps.get(key); | |
427 | + if (CollectionUtils.isNotEmpty(patientses)) | |
428 | + { | |
429 | + for(Patients patients : patientses) | |
430 | + { | |
431 | + ids.add(patients.getId()); | |
432 | + } | |
433 | + } | |
411 | 434 | |
412 | - for (int i = 0 ; i < 5 ; i++) | |
413 | - { | |
414 | - if (i == 0) | |
415 | - { | |
416 | - antExRecordQuery.setcDueWeekStart(0); | |
417 | - antExRecordQuery.setcDueWeekEnd((12 + 1) * 7 - 1); | |
418 | - } | |
419 | - else if (i == 1) | |
420 | - { | |
421 | - antExRecordQuery.setcDueWeekStart(16*7); | |
422 | - antExRecordQuery.setcDueWeekEnd((20 + 1) * 7 - 1); | |
423 | - } | |
424 | - else if (i == 2) | |
425 | - { | |
426 | - antExRecordQuery.setcDueWeekStart(21*7); | |
427 | - antExRecordQuery.setcDueWeekEnd((24 + 1) * 7 - 1); | |
428 | - } | |
429 | - else if (i == 3) | |
430 | - { | |
431 | - antExRecordQuery.setcDueWeekStart(28*7); | |
432 | - antExRecordQuery.setcDueWeekEnd((36 + 1) * 7 - 1); | |
433 | - } | |
434 | - else if (i == 4) | |
435 | - { | |
436 | - antExRecordQuery.setcDueWeekStart(37*7); | |
437 | - antExRecordQuery.setcDueWeekEnd((40 + 1) * 7 - 1); | |
438 | - } | |
435 | + if (CollectionUtils.isNotEmpty(ids)) | |
436 | + { | |
437 | + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
438 | + antExRecordQuery.setParentIds(ids); | |
439 | + for (int i = 0 ; i < 5 ; i++) | |
440 | + { | |
441 | + if (i == 0) | |
442 | + { | |
443 | + antExRecordQuery.setcDueWeekStart(0); | |
444 | + antExRecordQuery.setcDueWeekEnd((12 + 1) * 7 - 1); | |
445 | + } | |
446 | + else if (i == 1) | |
447 | + { | |
448 | + antExRecordQuery.setcDueWeekStart(16*7); | |
449 | + antExRecordQuery.setcDueWeekEnd((20 + 1) * 7 - 1); | |
450 | + } | |
451 | + else if (i == 2) | |
452 | + { | |
453 | + antExRecordQuery.setcDueWeekStart(21*7); | |
454 | + antExRecordQuery.setcDueWeekEnd((24 + 1) * 7 - 1); | |
455 | + } | |
456 | + else if (i == 3) | |
457 | + { | |
458 | + antExRecordQuery.setcDueWeekStart(28*7); | |
459 | + antExRecordQuery.setcDueWeekEnd((36 + 1) * 7 - 1); | |
460 | + } | |
461 | + else if (i == 4) | |
462 | + { | |
463 | + antExRecordQuery.setcDueWeekStart(37*7); | |
464 | + antExRecordQuery.setcDueWeekEnd((40 + 1) * 7 - 1); | |
465 | + } | |
439 | 466 | |
440 | - List<AntExRecordModel> list = recordService.queryAntExRecords(antExRecordQuery); | |
441 | - if (CollectionUtils.isNotEmpty(list)) | |
442 | - { | |
443 | - for (int j = 0 ; j < list.size() ; j++) | |
444 | - { | |
445 | - AntExRecordModel m = list.get(j); | |
446 | - if (j == (list.size() - 1)) | |
447 | - { | |
448 | - m.setIsFirst(1); | |
449 | - } | |
450 | - else | |
451 | - { | |
452 | - m.setIsFirst(2); | |
453 | - } | |
454 | - recordService.updateOne(m,m.getId()); | |
455 | - } | |
456 | - | |
457 | - } | |
467 | + List<AntExRecordModel> list = recordService.queryAntExRecords(antExRecordQuery); | |
468 | + if (CollectionUtils.isNotEmpty(list)) | |
469 | + { | |
470 | + for (int j = 0 ; j < list.size() ; j++) | |
471 | + { | |
472 | + AntExRecordModel m = list.get(j); | |
473 | + if (j == (list.size() - 1)) | |
474 | + { | |
475 | + m.setIsFirst(1); | |
458 | 476 | } |
477 | + else | |
478 | + { | |
479 | + m.setIsFirst(2); | |
480 | + } | |
481 | + recordService.updateOne(m,m.getId()); | |
459 | 482 | } |
460 | 483 | } |
461 | 484 | } |
462 | 485 | } |
463 | - }); | |
486 | + } | |
464 | 487 | } |
465 | - | |
466 | 488 | } |
467 | 489 | } |
468 | 490 | }); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AreaCountFacade.java
View file @
e263984
... | ... | @@ -518,7 +518,7 @@ |
518 | 518 | cnames.put("name", "姓名"); //姓名 |
519 | 519 | cnames.put("buildWeek", "建档孕周"); //建档孕周 |
520 | 520 | cnames.put("hospitalName", "建档机构"); //建档机构 |
521 | - cnames.put("doctor","建档医生"); //建档医生 | |
521 | + cnames.put("doctor", "建档医生"); //建档医生 | |
522 | 522 | cnames.put("homeAddr","居住地"); //居住地 |
523 | 523 | cnames.put("hjAddr","户籍地"); //户籍地 |
524 | 524 | cnames.put("telNo","联系电话"); //联系电话 |
... | ... | @@ -640,6 +640,8 @@ |
640 | 640 | |
641 | 641 | AntExRecordQuery query = new AntExRecordQuery(); |
642 | 642 | query.setPid(model.getPid()); |
643 | + query.setLastMensesStart(model.getLastMenses()); | |
644 | + query.setLastMensesEnd(model.getLastMenses()); | |
643 | 645 | |
644 | 646 | String times = ""; |
645 | 647 | List<AntExRecordModel> antExRecordModels = recordService.queryAntExRecords(query,Sort.Direction.ASC,"checkTime"); |
646 | 648 | |
... | ... | @@ -739,7 +741,10 @@ |
739 | 741 | |
740 | 742 | return new BaseListResponse().setData(results).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION).setPageInfo(antExRecordQuery.getPageInfo()); |
741 | 743 | } |
744 | + | |
742 | 745 | } |
746 | + | |
747 | + | |
743 | 748 | |
744 | 749 | |
745 | 750 |