Commit bb299a8ddae1a01d2518e10406996a737b73f2b2
1 parent
3e56183b64
Exists in
master
and in
1 other branch
产检节点统计
Showing 1 changed file with 115 additions and 79 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AreaCountFacade.java
View file @
bb299a8
| ... | ... | @@ -33,6 +33,8 @@ |
| 33 | 33 | |
| 34 | 34 | import javax.servlet.http.HttpServletResponse; |
| 35 | 35 | import java.util.*; |
| 36 | +import java.util.concurrent.Callable; | |
| 37 | +import java.util.concurrent.ExecutionException; | |
| 36 | 38 | import java.util.concurrent.Future; |
| 37 | 39 | |
| 38 | 40 | |
| 39 | 41 | |
| 40 | 42 | |
| ... | ... | @@ -465,12 +467,14 @@ |
| 465 | 467 | //居住地 |
| 466 | 468 | String liveAddress = CommonsHelper.getResidence(pat.getProvinceId(), pat.getCityId(), |
| 467 | 469 | pat.getAreaId(), pat.getStreetId(), pat.getAddress(), basicConfigService); |
| 468 | - map.put("HOME_ADDR", liveAddress); | |
| 470 | + map.put("HJ_ADDR", liveAddress); | |
| 469 | 471 | |
| 472 | + | |
| 470 | 473 | //户籍地址 |
| 471 | 474 | String addressRegister = CommonsHelper.getResidence(pat.getProvinceRegisterId(), pat.getCityRegisterId(), |
| 472 | 475 | pat.getAreaRegisterId(), pat.getStreetRegisterId(), pat.getAddressRegister(), basicConfigService); |
| 473 | - map.put("HJ_ADDR", addressRegister); | |
| 476 | + map.put("HOME_ADDR", addressRegister); | |
| 477 | + | |
| 474 | 478 | map.put("NAME", pat.getUsername()); |
| 475 | 479 | map.put("TEL_NO", pat.getPhone()); |
| 476 | 480 | |
| 477 | 481 | |
| 478 | 482 | |
| 479 | 483 | |
| 480 | 484 | |
| 481 | 485 | |
| 482 | 486 | |
| 483 | 487 | |
| 484 | 488 | |
| 485 | 489 | |
| 486 | 490 | |
| 487 | 491 | |
| 488 | 492 | |
| 489 | 493 | |
| 490 | 494 | |
| 491 | 495 | |
| 492 | 496 | |
| 493 | 497 | |
| 494 | 498 | |
| 495 | 499 | |
| 496 | 500 | |
| 497 | 501 | |
| 498 | 502 | |
| ... | ... | @@ -609,96 +613,128 @@ |
| 609 | 613 | antExRecordQuery.setcDueWeekEnd((40 + 1) * 7 - 1); |
| 610 | 614 | } |
| 611 | 615 | |
| 612 | - | |
| 613 | - List<AntExRecordModel> list = recordService.queryAntExRecords(antExRecordQuery); | |
| 614 | - | |
| 616 | + final List<AntExRecordModel> list = recordService.queryAntExRecords(antExRecordQuery); | |
| 617 | + List<Future> futures = new ArrayList<>(); | |
| 615 | 618 | List<Map> results = new ArrayList<>(); |
| 616 | 619 | if (CollectionUtils.isNotEmpty(list)) |
| 617 | 620 | { |
| 618 | - for(AntExRecordModel model : list) | |
| 621 | + int batchSize = 2; | |
| 622 | + for(int i = 0,end = 0 ; i < list.size() ; i+=batchSize) | |
| 619 | 623 | { |
| 620 | - Map<String,Object> map = new HashMap<>(); | |
| 621 | - map.put("EXAMINE_DATE", DateUtil.getyyyy_MM_dd(model.getCheckTime())); //产检日期 | |
| 622 | - map.put("NAME", model.getName()); //姓名 | |
| 623 | - map.put("YZ_NAME", StringUtils.dueWeek(model.getcDay())); //产检孕周 | |
| 624 | + end +=batchSize; | |
| 625 | + end = end > list.size() ? list.size() : end; | |
| 624 | 626 | |
| 625 | - AntExRecordQuery query = new AntExRecordQuery(); | |
| 626 | - query.setParentId(model.getParentId()); | |
| 627 | + final List<AntExRecordModel> tempList = list.subList(i,end); | |
| 628 | + Callable callable = new Callable<List<Map>>() { | |
| 629 | + @Override | |
| 630 | + public List<Map> call() throws Exception { | |
| 631 | + List<Map> results = new ArrayList<>(); | |
| 632 | + for(AntExRecordModel model : tempList) | |
| 633 | + { | |
| 634 | + Map<String,Object> map = new HashMap<>(); | |
| 635 | + map.put("EXAMINE_DATE", DateUtil.getyyyy_MM_dd(model.getCheckTime())); //产检日期 | |
| 636 | + map.put("NAME", model.getName()); //姓名 | |
| 637 | + map.put("YZ_NAME", StringUtils.dueWeek(model.getcDay())); //产检孕周 | |
| 627 | 638 | |
| 628 | - String times = ""; | |
| 629 | - List<AntExRecordModel> antExRecordModels = recordService.queryAntExRecords(antExRecordQuery,Sort.Direction.ASC,"checkTime"); | |
| 630 | - if (CollectionUtils.isNotEmpty(antExRecordModels)) | |
| 631 | - { | |
| 632 | - for (int j = 0 ; j < list.size() ; j++) | |
| 633 | - { | |
| 634 | - AntExRecordModel antExRecordModel = list.get(j); | |
| 639 | + AntExRecordQuery query = new AntExRecordQuery(); | |
| 640 | + query.setParentId(model.getParentId()); | |
| 635 | 641 | |
| 636 | - if (model.getId().equals(antExRecordModel.getId())) | |
| 637 | - { | |
| 638 | - times = String.valueOf(j+1); | |
| 639 | - break; | |
| 640 | - } | |
| 641 | - } | |
| 642 | - } | |
| 642 | + String times = ""; | |
| 643 | + List<AntExRecordModel> antExRecordModels = recordService.queryAntExRecords(query,Sort.Direction.ASC,"checkTime"); | |
| 644 | + if (CollectionUtils.isNotEmpty(antExRecordModels)) | |
| 645 | + { | |
| 646 | + for (int j = 0 ; j < list.size() ; j++) | |
| 647 | + { | |
| 648 | + AntExRecordModel antExRecordModel = list.get(j); | |
| 643 | 649 | |
| 644 | - map.put("EXAMINE_HISTORY_NUM",times); //产检第次 | |
| 650 | + if (model.getId().equals(antExRecordModel.getId())) | |
| 651 | + { | |
| 652 | + times = String.valueOf(j+1); | |
| 653 | + break; | |
| 654 | + } | |
| 655 | + } | |
| 656 | + } | |
| 645 | 657 | |
| 658 | + map.put("EXAMINE_HISTORY_NUM",times); //产检第次 | |
| 646 | 659 | |
| 647 | - String chospital = ""; | |
| 648 | - if (org.apache.commons.lang.StringUtils.isNotEmpty(model.getHospitalId())) { | |
| 649 | - Organization organization = organizationService.getOrganization(Integer.parseInt(model.getHospitalId())); | |
| 650 | - if (organization != null && organization.getYn() == YnEnums.YES.getId()) { | |
| 651 | - chospital = organization.getName(); | |
| 652 | - } | |
| 653 | - } | |
| 654 | 660 | |
| 655 | - map.put("EXAMINE_HOSPITAL",chospital); //产检机构 | |
| 661 | + String chospital = ""; | |
| 662 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(model.getHospitalId())) { | |
| 663 | + Organization organization = organizationService.getOrganization(Integer.parseInt(model.getHospitalId())); | |
| 664 | + if (organization != null && organization.getYn() == YnEnums.YES.getId()) { | |
| 665 | + chospital = organization.getName(); | |
| 666 | + } | |
| 667 | + } | |
| 656 | 668 | |
| 669 | + map.put("EXAMINE_HOSPITAL",chospital); //产检机构 | |
| 657 | 670 | |
| 658 | - //建档医生 | |
| 659 | - String bookbuildingDoctor = ""; | |
| 660 | - if (org.apache.commons.lang.StringUtils.isNotEmpty(model.getBuildDoctor()) && FunvCommonUtil.isNumeric(model.getBuildDoctor())) { | |
| 661 | - Users users = usersService.getUsers(Integer.parseInt(model.getBuildDoctor())); | |
| 662 | - if (users != null && users.getYn() == YnEnums.YES.getId()) { | |
| 663 | - bookbuildingDoctor = users.getName(); | |
| 664 | - } | |
| 665 | - } | |
| 666 | 671 | |
| 667 | - map.put("DOCTOR_NAME",bookbuildingDoctor); //建档医生 | |
| 672 | + //建档医生 | |
| 673 | + String bookbuildingDoctor = ""; | |
| 674 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(model.getBuildDoctor()) && FunvCommonUtil.isNumeric(model.getBuildDoctor())) { | |
| 675 | + Users users = usersService.getUsers(Integer.parseInt(model.getBuildDoctor())); | |
| 676 | + if (users != null && users.getYn() == YnEnums.YES.getId()) { | |
| 677 | + bookbuildingDoctor = users.getName(); | |
| 678 | + } | |
| 679 | + } | |
| 668 | 680 | |
| 681 | + map.put("DOCTOR_NAME",bookbuildingDoctor); //建档医生 | |
| 669 | 682 | |
| 670 | 683 | |
| 671 | - String checkDoctor = ""; | |
| 672 | - if (org.apache.commons.lang.StringUtils.isNotEmpty(model.getCheckDoctor()) && FunvCommonUtil.isNumeric(model.getCheckDoctor())) { | |
| 673 | - Users users = usersService.getUsers(Integer.parseInt(model.getCheckDoctor())); | |
| 674 | - if (users != null && users.getYn() == YnEnums.YES.getId()) { | |
| 675 | - checkDoctor = users.getName(); | |
| 676 | - } | |
| 677 | - } | |
| 678 | 684 | |
| 679 | - map.put("DOCTOR_NAME", checkDoctor); //产检医生 | |
| 685 | + String checkDoctor = ""; | |
| 686 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(model.getCheckDoctor()) && FunvCommonUtil.isNumeric(model.getCheckDoctor())) { | |
| 687 | + Users users = usersService.getUsers(Integer.parseInt(model.getCheckDoctor())); | |
| 688 | + if (users != null && users.getYn() == YnEnums.YES.getId()) { | |
| 689 | + checkDoctor = users.getName(); | |
| 690 | + } | |
| 691 | + } | |
| 680 | 692 | |
| 681 | - PatientsQuery patientsQuery = new PatientsQuery(); | |
| 682 | - patientsQuery.setYn(YnEnums.YES.getId()); | |
| 683 | - patientsQuery.setId(model.getParentId()); | |
| 684 | - List<Patients> patientsList = patientsService.queryPatient(patientsQuery); | |
| 693 | + map.put("DOCTOR_NAME", checkDoctor); //产检医生 | |
| 685 | 694 | |
| 695 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 696 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 697 | + patientsQuery.setId(model.getParentId()); | |
| 698 | + List<Patients> patientsList = patientsService.queryPatient(patientsQuery); | |
| 686 | 699 | |
| 687 | - String buildHosp = ""; | |
| 688 | - if (CollectionUtils.isNotEmpty(patientsList)) | |
| 689 | - { | |
| 690 | - if (org.apache.commons.lang.StringUtils.isNotEmpty(patientsList.get(0).getHospitalId())) { | |
| 691 | - Organization organization = organizationService.getOrganization(Integer.parseInt(patientsList.get(0).getHospitalId())); | |
| 692 | - if (organization != null && organization.getYn() == YnEnums.YES.getId()) { | |
| 693 | - buildHosp = organization.getName(); | |
| 700 | + | |
| 701 | + String buildHosp = ""; | |
| 702 | + if (CollectionUtils.isNotEmpty(patientsList)) | |
| 703 | + { | |
| 704 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(patientsList.get(0).getHospitalId())) { | |
| 705 | + Organization organization = organizationService.getOrganization(Integer.parseInt(patientsList.get(0).getHospitalId())); | |
| 706 | + if (organization != null && organization.getYn() == YnEnums.YES.getId()) { | |
| 707 | + buildHosp = organization.getName(); | |
| 708 | + } | |
| 709 | + } | |
| 710 | + } | |
| 711 | + map.put("JD_HOSPITAL",buildHosp); //建档机构 | |
| 712 | + map.put("TEL_NO", model.getPhone()); //联系电话 | |
| 713 | + results.add(map); | |
| 694 | 714 | } |
| 715 | + | |
| 716 | + return results; | |
| 695 | 717 | } |
| 718 | + }; | |
| 719 | + futures.add(commonThreadPool.submit(callable)); | |
| 720 | + } | |
| 721 | + } | |
| 722 | + | |
| 723 | + | |
| 724 | + if (CollectionUtils.isNotEmpty(futures)) | |
| 725 | + { | |
| 726 | + for (Future f : futures) | |
| 727 | + { | |
| 728 | + try { | |
| 729 | + results.addAll((List) f.get()); | |
| 730 | + } catch (InterruptedException e) { | |
| 731 | + e.printStackTrace(); | |
| 732 | + } catch (ExecutionException e) { | |
| 733 | + e.printStackTrace(); | |
| 696 | 734 | } |
| 697 | - map.put("JD_HOSPITAL",buildHosp); //建档机构 | |
| 698 | - map.put("TEL_NO", model.getPhone()); //联系电话 | |
| 699 | - results.add(map); | |
| 700 | 735 | } |
| 701 | 736 | } |
| 737 | + | |
| 702 | 738 | return new BaseListResponse().setData(results).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION).setPageInfo(antExRecordQuery.getPageInfo()); |
| 703 | 739 | } |
| 704 | 740 | } |