Commit ff19a3dc738c84fd9c05be70cbee7631375ff954
1 parent
66773b8b9f
Exists in
master
and in
1 other branch
建册统计相关代码
Showing 2 changed files with 44 additions and 19 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
ff19a3d
... | ... | @@ -1135,24 +1135,51 @@ |
1135 | 1135 | reportModel.setxAxis(Arrays.asList("1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月")); |
1136 | 1136 | |
1137 | 1137 | |
1138 | - List<Series> series = createPatientSeries(patients); | |
1139 | 1138 | List<Map<String, Object>> mapList = mongoUtil.getListByGroup(patients); |
1139 | + List<Series> series = createPatientSeries(mapList); | |
1140 | + reportModel.setSeries(series); | |
1140 | 1141 | return RespBuilder.buildSuccess("patients", mapList, "report", reportModel); |
1141 | 1142 | } |
1142 | 1143 | |
1143 | - private List<Series> createPatientSeries(List<Patients> patients) { | |
1144 | + private List<Series> createPatientSeries(List<Map<String, Object>> datas) { | |
1144 | 1145 | List<Series> series = new ArrayList<>(); |
1146 | + | |
1145 | 1147 | Series qhdSeries = new Series(); |
1146 | 1148 | qhdSeries.setName("秦皇岛市"); |
1147 | 1149 | qhdSeries.setType("bar"); |
1148 | - List<Integer> qhdDatas = new ArrayList<>(); | |
1149 | - BasicConfig basicConfig = mongoTemplate.findOne(Query.query(Criteria.where("name").is("河北省")), BasicConfig.class); | |
1150 | - if(basicConfig != null) {} | |
1151 | - for (Patients patient : patients) { | |
1152 | -// if(patient.getProvinceId() == 1) | |
1150 | + qhdSeries.setStack("总计"); | |
1151 | + List<Object> qhdDatas = new ArrayList<>(); | |
1152 | + | |
1153 | + Series otherSeries = new Series(); | |
1154 | + otherSeries.setName("辖区外"); | |
1155 | + otherSeries.setType("bar"); | |
1156 | + otherSeries.setStack("总计"); | |
1157 | + List<Object> otherDatas = new ArrayList<>(); | |
1158 | + Map<String, Integer> temp = new HashMap<>(); | |
1159 | + for(int i = 1; i < 13; i++) { | |
1160 | + temp.put(i + "", 0); | |
1153 | 1161 | } |
1154 | 1162 | |
1163 | + String provinceId = mongoUtil.findId("河北省"); | |
1164 | + if(StringUtils.isNotEmpty(provinceId)) {} | |
1165 | + for (Map<String, Object> data : datas) { | |
1166 | + if(provinceId.equals(data.get("id"))) { | |
1167 | + for(int i = 1; i < 13; i++) { | |
1168 | + qhdDatas.add(data.get(i + "")); | |
1169 | + } | |
1170 | + qhdSeries.setData(qhdDatas); | |
1171 | + } else { | |
1172 | + for(int i = 1; i < 13; i++) { | |
1173 | + temp.put(i + "", temp.get(i + "") + Integer.parseInt(data.get(i + "") + "")); | |
1174 | + } | |
1175 | + } | |
1176 | + } | |
1177 | + List<Integer> integers = CollectionUtils.transValToList(temp); | |
1178 | + otherDatas.addAll(integers); | |
1179 | + otherSeries.setData(otherDatas); | |
1180 | + | |
1155 | 1181 | series.add(qhdSeries); |
1182 | + series.add(otherSeries); | |
1156 | 1183 | return series; |
1157 | 1184 | } |
1158 | 1185 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
View file @
ff19a3d
... | ... | @@ -58,18 +58,6 @@ |
58 | 58 | for (int i = 1; i <= 12; i++) { |
59 | 59 | otherMonthMap.put(i + "", 0); |
60 | 60 | } |
61 | - /*otherMonthMap.put("1", 0); | |
62 | - otherMonthMap.put("2", 0); | |
63 | - otherMonthMap.put("3", 0); | |
64 | - otherMonthMap.put("4", 0); | |
65 | - otherMonthMap.put("5", 0); | |
66 | - otherMonthMap.put("6", 0); | |
67 | - otherMonthMap.put("7", 0); | |
68 | - otherMonthMap.put("8", 0); | |
69 | - otherMonthMap.put("9", 0); | |
70 | - otherMonthMap.put("10", 0); | |
71 | - otherMonthMap.put("11", 0); | |
72 | - otherMonthMap.put("12", 0);*/ | |
73 | 61 | |
74 | 62 | Integer otherCount = 0; |
75 | 63 | /* for (Patients patient : patients) { |
... | ... | @@ -210,6 +198,16 @@ |
210 | 198 | BasicConfig basicConfig = mongoTemplate.findById(id, BasicConfig.class); |
211 | 199 | if(basicConfig != null) { |
212 | 200 | return basicConfig.getName(); |
201 | + } | |
202 | + } | |
203 | + return null; | |
204 | + } | |
205 | + | |
206 | + public String findId(String name) { | |
207 | + if(StringUtils.isNotEmpty(name)) { | |
208 | + BasicConfig basicConfig = mongoTemplate.findOne(Query.query(Criteria.where("name").is(name)), BasicConfig.class); | |
209 | + if(basicConfig != null) { | |
210 | + return basicConfig.getId(); | |
213 | 211 | } |
214 | 212 | } |
215 | 213 | return null; |