Commit b8c646597c061c076fdca313533379d7866a986a
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 1 changed file
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/StatisticsController.java
View file @
b8c6465
... | ... | @@ -71,15 +71,16 @@ |
71 | 71 | List<AreaData> provincePatientList = statisticsService.queryProvincePatients(); |
72 | 72 | Map<String, String> kvData = new HashMap<>(); |
73 | 73 | Map<String, Integer> mapsData = new HashMap<>(); |
74 | + Map<String, String> riskColorMap = new HashMap<>(); | |
74 | 75 | |
75 | 76 | Option areaBarOption = buildBarOption("建档&高危人数", null); |
76 | 77 | areaBarOption.getLegend().getData().add("近30天建档人数"); |
77 | 78 | areaBarOption.getLegend().getData().add("当前高危总人数"); |
78 | 79 | areaBarOption.getLegend().setOrient("horizontal"); |
79 | 80 | areaBarOption.getLegend().setLeft("3%"); |
80 | - areaBarOption.getLegend().setTop("50px"); | |
81 | + areaBarOption.getLegend().setTop("55px"); | |
81 | 82 | areaBarOption.getTooltip().setShow(true); |
82 | - areaBarOption.getGrid().setTop("80px"); | |
83 | + areaBarOption.getGrid().setTop("90px"); | |
83 | 84 | List<Object> areaBarSeriesList = new ArrayList<>(); |
84 | 85 | Series patientSeries = new Series(); |
85 | 86 | patientSeries.setName("近30天建档人数"); |
... | ... | @@ -147,6 +148,7 @@ |
147 | 148 | // 高危数据 |
148 | 149 | List<AreaData> currentRiskList = statisticsService.queryRisks(new AreaDataQuery()); |
149 | 150 | Option groupRiskOption = buildBarOption("当前高危人数", null); |
151 | + groupRiskOption.getTooltip().setShow(true); | |
150 | 152 | List<Object> groupRiskSeriesList = new ArrayList<>(); |
151 | 153 | Series groupRiskSeries = new Series(); |
152 | 154 | groupRiskSeries.setName("高危人数"); |
153 | 155 | |
154 | 156 | |
155 | 157 | |
156 | 158 | |
157 | 159 | |
... | ... | @@ -154,21 +156,39 @@ |
154 | 156 | mapsData.clear(); |
155 | 157 | for (AreaData areaData:currentRiskList) { |
156 | 158 | String groupName = areaData.getGroupName().replace("预警", ""); |
157 | - if (mapsData.get(groupName) == null) { | |
158 | - mapsData.put(groupName,areaData.getVal()); | |
159 | + if (mapsData.get(areaData.getRiskName()) == null) { | |
160 | + mapsData.put(areaData.getRiskName(),areaData.getVal()); | |
161 | + if (colormap.get(groupName) != null) { | |
162 | + riskColorMap.put(areaData.getRiskName(),colormap.get(groupName)); | |
163 | + } | |
159 | 164 | } else { |
160 | - mapsData.put(groupName, mapsData.get(groupName) + areaData.getVal()); | |
165 | + mapsData.put(areaData.getRiskName(), mapsData.get(areaData.getRiskName()) + areaData.getVal()); | |
161 | 166 | } |
162 | 167 | } |
168 | + | |
169 | + // 按MAP的value排序 | |
170 | + List<Map.Entry<String, Integer>> listData = new ArrayList<Map.Entry<String, Integer>>(mapsData.entrySet()); | |
171 | + Collections.sort(listData, new Comparator<Map.Entry<String, Integer>>() { | |
172 | + public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) { | |
173 | + if (o2.getValue() != null && o1.getValue() != null && o2.getValue().compareTo(o1.getValue()) > 0) { | |
174 | + return -1; | |
175 | + } else { | |
176 | + return 1; | |
177 | + } | |
178 | + | |
179 | + } | |
180 | + }); | |
181 | + | |
163 | 182 | List<Object> groupRiskDataList = new ArrayList<>(); |
164 | - for (Object key:groupRiskOption.getyAxis().getData()) { | |
165 | - if (mapsData.containsKey(key)) { | |
183 | + for (Map.Entry<String, Integer> entry:listData) { | |
184 | + groupRiskOption.getyAxis().getData().add(entry.getKey()); | |
185 | + if (riskColorMap.containsKey(entry.getKey())) { | |
166 | 186 | Data data = new Data(); |
167 | - data.setValue(mapsData.get(key)); | |
168 | - data.setItemStyle(new ItemStyle(new Normal(null,colormap.get(key)),null)); | |
187 | + data.setValue(entry.getValue()); | |
188 | + data.setItemStyle(new ItemStyle(new Normal(null,colormap.get(entry.getKey())),null)); | |
169 | 189 | groupRiskDataList.add(data); |
170 | 190 | } else { |
171 | - groupRiskDataList.add(0); | |
191 | + groupRiskDataList.add(entry.getValue()); | |
172 | 192 | } |
173 | 193 | } |
174 | 194 | groupRiskSeries.setData(groupRiskDataList); |
... | ... | @@ -181,7 +201,7 @@ |
181 | 201 | result.put("kvData", kvData); |
182 | 202 | result.put("mapsOption", option); |
183 | 203 | result.put("areaBarOption", areaBarOption); |
184 | - result.put("groupRiskOption", groupRiskOption); | |
204 | + result.put("riskOption", groupRiskOption); | |
185 | 205 | ResultUtils.buildSuccessResultAndWrite(response, result); |
186 | 206 | } |
187 | 207 |