Commit 50cb8af892722757b02c372b968a6fbe6b699d4f

Authored by liquanyu

Merge remote-tracking branch 'origin/master'

Showing 2 changed files

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/StatisticsController.java View file @ 50cb8af
... ... @@ -9,6 +9,7 @@
9 9 import com.lymsh.platform.reportdata.model.AreaDataQuery;
10 10 import com.lymsh.platform.reportdata.model.echarts.*;
11 11 import com.lymsh.platform.reportdata.service.StatisticsService;
  12 +import org.apache.commons.beanutils.BeanUtils;
12 13 import org.apache.commons.lang.StringUtils;
13 14 import org.joda.time.DateTime;
14 15 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -520,6 +521,14 @@
520 521 String cityName = null;
521 522 AreaDataQuery query = new AreaDataQuery();
522 523 query.setCityId(pid);
  524 +
  525 + //区县数据
  526 + Map<String, Option> groupRiskOptionMap = new HashMap<>();
  527 + Map<String, Option> patientMonthOptionMap = new HashMap<>();
  528 + Map<String, Option> reportMonthOptionMap = new HashMap<>();
  529 + Map<String, Option> groupRiskMonthOptionMap = new HashMap<>();
  530 +
  531 +
523 532 // 地图数据
524 533 List<AreaData> provinceRiskList = statisticsService.queryRisksByCity(query);
525 534 List<AreaData> provincePatientList = statisticsService.queryPatientsByCity(query);
526 535  
... ... @@ -599,13 +608,14 @@
599 608 Series series = new Series();
600 609 series.setName("建档及高危数");
601 610 series.setType("map");
602   - series.setMapType(cityPinyinMap.get(cityName.replace("市","").replace("省","")));
  611 + series.setMapType(cityPinyinMap.get(cityName.replace("市", "").replace("省", "")));
603 612 series.setRoam(false);
604 613 series.setData(dataList);
605 614 series.setLabel(label);
606 615 seriesList.add(series);
607 616 option.setSeries(seriesList);
608 617  
  618 + Map<String, Map<String, Integer>> subMapsData = new HashMap<>();
609 619  
610 620 // 高危数据
611 621 List<AreaData> currentRiskList = statisticsService.queryRisks(query);
... ... @@ -618,6 +628,19 @@
618 628 mapsData.clear();
619 629 for (AreaData areaData:currentRiskList) {
620 630 String groupName = areaData.getGroupName().replace("预警", "");
  631 +
  632 + Map<String, Integer> areaMap = subMapsData.get(areaData.getAreaName());
  633 + if (areaMap == null) {
  634 + areaMap = new HashMap<>();
  635 + subMapsData.put(areaData.getAreaName(), areaMap);
  636 + }
  637 +
  638 + if (areaMap.get(areaData.getRiskName()) == null) {
  639 + areaMap.put(areaData.getRiskName(),areaData.getVal());
  640 + } else {
  641 + areaMap.put(areaData.getRiskName(), areaMap.get(areaData.getRiskName()) + areaData.getVal());
  642 + }
  643 +
621 644 if (mapsData.get(areaData.getRiskName()) == null) {
622 645 mapsData.put(areaData.getRiskName(),areaData.getVal());
623 646 if (colormap.get(groupName) != null) {
624 647  
625 648  
626 649  
... ... @@ -657,17 +680,85 @@
657 680 groupRiskDataList.add(entry.getValue());
658 681 }
659 682 }
  683 +
660 684 groupRiskSeries.setData(groupRiskDataList);
661 685 groupRiskSeriesList.add(groupRiskSeries);
662 686 groupRiskOption.setSeries(groupRiskSeriesList);
663 687  
  688 + for (String areaName:subMapsData.keySet()) {
  689 + try {
  690 + Option subGroupRiskOption = buildyBarOption(areaName + "当前高危人数", null);
  691 + groupRiskOption.getTooltip().setShow(true);
  692 + List<Object> subGroupRiskSeriesList = new ArrayList<>();
  693 + Series subGroupRiskSeries = new Series();
  694 + subGroupRiskSeries.setName("高危人数");
  695 + subGroupRiskSeries.setType("bar");
  696 + // 按MAP的value排序
  697 + List<Map.Entry<String, Integer>> subListData = new ArrayList<Map.Entry<String, Integer>>(subMapsData.get(areaName).entrySet());
  698 + Collections.sort(subListData, new Comparator<Map.Entry<String, Integer>>() {
  699 + public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
  700 + if (o2.getValue() != null && o1.getValue() != null && o2.getValue().compareTo(o1.getValue()) > 0) {
  701 + return -1;
  702 + } else {
  703 + return 1;
  704 + }
  705 + }
  706 + });
  707 +
  708 + List<Object> subGroupRiskDataList = new ArrayList<>();
  709 + n = subListData.size();
  710 + for (Map.Entry<String, Integer> entry:subListData) {
  711 + n--;
  712 + if (n>28) {
  713 + continue;
  714 + }
  715 + subGroupRiskOption.getyAxis().getData().add(entry.getKey());
  716 + if (riskColorMap.containsKey(entry.getKey())) {
  717 + Data data = new Data();
  718 + data.setValue(entry.getValue());
  719 + data.setItemStyle(new ItemStyle(new Normal(true,riskColorMap.get(entry.getKey())),null));
  720 + subGroupRiskDataList.add(data);
  721 + } else {
  722 + subGroupRiskDataList.add(entry.getValue());
  723 + }
  724 + }
  725 +
  726 + subGroupRiskSeries.setData(subGroupRiskDataList);
  727 + subGroupRiskSeriesList.add(subGroupRiskSeries);
  728 + subGroupRiskOption.setSeries(subGroupRiskSeriesList);
  729 + groupRiskOptionMap.put(areaName, subGroupRiskOption);
  730 + } catch (Exception e) {
  731 + e.printStackTrace();
  732 + }
  733 + }
  734 +
  735 +
664 736 Map<String, Map<String, Integer>> patientMonthMap = new HashMap<>();
  737 + Map<String, Map<String, Map<String, Integer>>> subPatientMonthMap = new HashMap<>();
665 738 // 6. 按省或市或地区查询区域内近12个自然月每月产检中历史高危人数(按颜色分组)
666 739 query.setDays(12);
667 740 List<AreaData> riskMonthList = statisticsService.queryHrefYearRisks(query);
668 741 Map<String, Integer> rmap = new HashMap<>();
669 742 for (AreaData areaData:riskMonthList) {
670 743 String month = buildMonth(areaData.getYear());
  744 +
  745 + Map<String, Map<String, Integer>> subrmap = subPatientMonthMap.get(areaData.getAreaName());
  746 + if (subrmap == null) {
  747 + subrmap = new HashMap<>();
  748 + subPatientMonthMap.put(areaData.getAreaName(), subrmap);
  749 + }
  750 +
  751 + Map<String, Integer> submap = subrmap.get("高危人数");
  752 + if (submap == null) {
  753 + submap = new HashMap<>();
  754 + subrmap.put("高危人数", submap);
  755 + }
  756 + if (submap.containsKey(month)) {
  757 + submap.put(month, submap.get(month) + areaData.getVal());
  758 + } else {
  759 + submap.put(month, areaData.getVal());
  760 + }
  761 +
671 762 if (rmap.containsKey(month)) {
672 763 rmap.put(month, rmap.get(month) + areaData.getVal());
673 764 } else {
... ... @@ -680,6 +771,24 @@
680 771 Map<String, Integer> pmap = new HashMap<>();
681 772 for (AreaData areaData:patientMonthList) {
682 773 String month = buildMonth(areaData.getYear());
  774 +
  775 + Map<String, Map<String, Integer>> subrmap = subPatientMonthMap.get(areaData.getAreaName());
  776 + if (subrmap == null) {
  777 + subrmap = new HashMap<>();
  778 + subPatientMonthMap.put(areaData.getAreaName(), subrmap);
  779 + }
  780 +
  781 + Map<String, Integer> submap = subrmap.get("建档人数");
  782 + if (submap == null) {
  783 + submap = new HashMap<>();
  784 + subrmap.put("建档人数", submap);
  785 + }
  786 + if (submap.containsKey(month)) {
  787 + submap.put(month, submap.get(month) + areaData.getVal());
  788 + } else {
  789 + submap.put(month, areaData.getVal());
  790 + }
  791 +
683 792 if (pmap.containsKey(month)) {
684 793 pmap.put(month, pmap.get(month) + areaData.getVal());
685 794 } else {
686 795  
687 796  
... ... @@ -689,13 +798,46 @@
689 798 patientMonthMap.put("建档人数", pmap);
690 799 Option patientMonthOption = buildLineOption("建档及高危人数", null, patientMonthMap, buildDefaultMonth(12));
691 800  
  801 + for (String areaName:subPatientMonthMap.keySet()) {
  802 + patientMonthOptionMap.put(areaName, buildLineOption(areaName + "建档及高危人数", null, subPatientMonthMap.get(areaName), buildDefaultMonth(12)));
  803 + }
  804 +
692 805 // 按省或市或地区查询区域内近12个自然月每月初诊人数、复诊人数
693 806 List<AreaData> reportMonthList = statisticsService.queryMonthReports(query);
694 807 Map<String, Map<String, Integer>> reportMonthMap = new HashMap<>();
  808 + Map<String, Map<String, Map<String, Integer>>> subReportMonthMap = new HashMap<>();
695 809 Map<String, Integer> firstmap = new HashMap<>();
696 810 Map<String, Integer> secondmap = new HashMap<>();
697 811 for (AreaData areaData:reportMonthList) {
698 812 String month = buildMonth(areaData.getYear());
  813 +
  814 + Map<String, Map<String, Integer>> subrmap = subReportMonthMap.get(areaData.getAreaName());
  815 + if (subrmap == null) {
  816 + subrmap = new HashMap<>();
  817 + subReportMonthMap.put(areaData.getAreaName(), subrmap);
  818 + }
  819 +
  820 + Map<String, Integer> fmap = subrmap.get("初诊人数");
  821 + if (fmap == null) {
  822 + fmap = new HashMap<>();
  823 + subrmap.put("初诊人数", fmap);
  824 + }
  825 + if (fmap.containsKey(month)) {
  826 + fmap.put(month, fmap.get(month) + areaData.getVal());
  827 + } else {
  828 + fmap.put(month, areaData.getVal());
  829 + }
  830 + Map<String, Integer> smap = subrmap.get("复诊人数");
  831 + if (smap == null) {
  832 + smap = new HashMap<>();
  833 + subrmap.put("复诊人数", smap);
  834 + }
  835 + if (smap.containsKey(month)) {
  836 + smap.put(month, smap.get(month) + areaData.getVal2());
  837 + } else {
  838 + smap.put(month, areaData.getVal2());
  839 + }
  840 +
699 841 if (firstmap.containsKey(month)) {
700 842 firstmap.put(month, firstmap.get(month) + areaData.getVal());
701 843 } else {
702 844  
703 845  
704 846  
705 847  
... ... @@ -711,17 +853,39 @@
711 853 reportMonthMap.put("初诊人数", firstmap);
712 854 Option reportMonthOption = buildLineOption("初诊及复诊人数", null, reportMonthMap, buildDefaultMonth(12));
713 855  
  856 + for (String areaName:subReportMonthMap.keySet()) {
  857 + reportMonthOptionMap.put(areaName, buildLineOption(areaName + "初诊及复诊人数", null, subReportMonthMap.get(areaName), buildDefaultMonth(12)));
  858 + }
714 859  
  860 +
715 861 // 近6个月高危数据(按颜色分组)
716 862 Map<String, Map<String, Integer>> groupRiskMonthMap = new HashMap<>();
  863 + Map<String, Map<String, Map<String, Integer>>> subGroupRiskMonthMap = new HashMap<>();
717 864 for (AreaData areaData:riskMonthList) {
718 865 String groupName = areaData.getGroupName().replace("预警", "");
  866 + String month = buildMonth(areaData.getYear());
  867 +
  868 + Map<String, Map<String, Integer>> subrmap = subGroupRiskMonthMap.get(areaData.getAreaName());
  869 + if (subrmap == null) {
  870 + subrmap = new HashMap<>();
  871 + subGroupRiskMonthMap.put(areaData.getAreaName(), subrmap);
  872 + }
  873 + Map<String, Integer> smap = subrmap.get(groupName);
  874 + if (smap == null) {
  875 + smap = new HashMap<>();
  876 + subrmap.put(groupName, smap);
  877 + }
  878 + if (smap.containsKey(month)) {
  879 + smap.put(month, smap.get(month) + areaData.getVal());
  880 + } else {
  881 + smap.put(month, areaData.getVal());
  882 + }
  883 +
719 884 Map<String, Integer> grmap = groupRiskMonthMap.get(groupName);
720 885 if (grmap == null) {
721 886 grmap = new HashMap<>();
722 887 groupRiskMonthMap.put(groupName, grmap);
723 888 }
724   - String month = buildMonth(areaData.getYear());
725 889 if (grmap.containsKey(month)) {
726 890 grmap.put(month, grmap.get(month) + areaData.getVal());
727 891 } else {
728 892  
... ... @@ -730,7 +894,11 @@
730 894 }
731 895 Option groupRiskMonthOption = buildxBarOption("高危历史人数", null, groupRiskMonthMap, buildDefaultMonth(6), colormap);
732 896  
  897 + for (String areaName:subGroupRiskMonthMap.keySet()) {
  898 + groupRiskMonthOptionMap.put(areaName, buildxBarOption(areaName + "高危历史人数", null, subGroupRiskMonthMap.get(areaName), buildDefaultMonth(6), colormap));
  899 + }
733 900  
  901 +
734 902 result.put("type", 3);
735 903 result.put("provinceId", provinceId);
736 904 result.put("cityName", cityName);
... ... @@ -742,6 +910,12 @@
742 910 result.put("patientMonthOption", patientMonthOption);
743 911 result.put("reportMonthOption", reportMonthOption);
744 912 result.put("groupRiskMonthOption", groupRiskMonthOption);
  913 +
  914 + result.put("riskOptionMap", groupRiskOptionMap);
  915 + result.put("patientMonthOptionMap", patientMonthOptionMap);
  916 + result.put("reportMonthOptionMap", reportMonthOptionMap);
  917 + result.put("groupRiskMonthOptionMap", groupRiskMonthOptionMap);
  918 +
745 919 ResultUtils.buildSuccessResultAndWrite(response, result);
746 920 }
747 921  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java View file @ 50cb8af
... ... @@ -147,6 +147,7 @@
147 147 babyModel.setMjob(patients.getPworkUnit());
148 148 babyModel.setMphone(patients.getPhone());
149 149 babyModel.setMbirth(patients.getBirth());
  150 + babyModel.setMcertNo(patients.getCardNo());
150 151 //父亲信息
151 152 babyModel.setFjob(patients.getHworkUnit());
152 153 babyModel.setFname(patients.getHusbandName());