Commit 52f6dda56c663dc6d467df5c2cf58c73782ac677
1 parent
41aa23fe5c
Exists in
master
and in
6 other branches
增加排序
Showing 2 changed files with 69 additions and 23 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
52f6dda
... | ... | @@ -61,7 +61,8 @@ |
61 | 61 | * @param childBirth 统计范围 1=孕妇 3=产妇 不传=全部 |
62 | 62 | * @return |
63 | 63 | */ |
64 | - @RequestMapping(method = RequestMethod.GET, value = "/getCheckNumber") | |
64 | +// @RequestMapping(method = RequestMethod.GET, value = "/getCheckNumber") | |
65 | + @RequestMapping(method = RequestMethod.GET, value = "/getCheckStatistics") | |
65 | 66 | @ResponseBody |
66 | 67 | @TokenRequired |
67 | 68 | public BaseObjectResponse getCheckNumber(Date startDate, Date endDate, |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
52f6dda
... | ... | @@ -1170,6 +1170,7 @@ |
1170 | 1170 | } |
1171 | 1171 | List<Patients> patients = mongoUtil.findField(Patients.class, criteria,"id", "bookbuildingDate", "fmDate", "pid"); |
1172 | 1172 | List<String> patientIds = CollectionUtils.getId(patients, "id", String.class); |
1173 | + Map<String, Object> restMap = new HashMap<>(); | |
1173 | 1174 | if(CollectionUtils.isNotEmpty(patientIds)) { |
1174 | 1175 | /** 初诊数据 */ |
1175 | 1176 | Criteria c = Criteria.where("hospitalId").is(hid).and("parentId").in(patientIds); |
1176 | 1177 | |
1177 | 1178 | |
... | ... | @@ -1182,27 +1183,16 @@ |
1182 | 1183 | doMerge(datas, antExChuModels, antExModels, patients); |
1183 | 1184 | |
1184 | 1185 | /** 拼装好产检次数 */ |
1185 | - List<Map<String, Object>> grid = getCheckNumerGrid(datas); | |
1186 | + List<Object> yData = new ArrayList<>(); | |
1187 | + List<Map<String, Object>> grid = getCheckNumerGrid(datas, yData); | |
1188 | + restMap.put("grid", grid); | |
1189 | + restMap.put("xAxis", Arrays.asList("1次", "2次", "3次", "4次", "5次", "6次", "7次", "8次", "9次", "10次", "11次", "12次", "≥13次")); | |
1190 | + restMap.put("yAxis", yData); | |
1186 | 1191 | } |
1187 | - | |
1188 | -// List<AntExChuModel> antExChuModels = mongoTemplate.find(antexcQuery, AntExChuModel.class); | |
1189 | - | |
1190 | -// mongoUtil.findField(AntExChuModel.class, antexcQuery, ""); | |
1191 | - | |
1192 | - /*Map<String, Object> restMap = new HashMap<>(); | |
1193 | - List<Object> params = new ArrayList<>(); | |
1194 | - String hospitalId = autoMatchFacade.getHospitalId(userId); | |
1195 | - List<Map<String, Object>> mapList = reportDao.findList(getAreaCountFacadeSql(startDate, endDate, startWeek, endWeek, childBirth, hospitalId, params), params); | |
1196 | - List<Object> peopleList = createPeoples(mapList); | |
1197 | - restMap.put("grid", createGrid( createPeoples(mapList), createProportion(peopleList))); | |
1198 | - restMap.put("xAxis", Arrays.asList("1次", "2次", "3次", "4次", "5次", "6次", "7次", "8次", "9次", "10次", "11次", "12次", "≥13次")); *//** x轴数据 *//* | |
1199 | - restMap.put("yAxis", createYData(peopleList)); | |
1200 | - | |
1201 | - rest.setData(restMap);*/ | |
1202 | 1192 | return rest; |
1203 | 1193 | } |
1204 | 1194 | |
1205 | - private List<Map<String,Object>> getCheckNumerGrid(List<Map<String, Object>> datas) { | |
1195 | + private List<Map<String,Object>> getCheckNumerGrid(List<Map<String, Object>> datas, List<Object> yData) { | |
1206 | 1196 | /** key = pid, value = 初诊复诊记录 */ |
1207 | 1197 | Map<String, List<Map<String, Object>>> userCheckInfo = new HashMap<>(); |
1208 | 1198 | for (Map<String, Object> data : datas) { |
... | ... | @@ -1216,7 +1206,6 @@ |
1216 | 1206 | userCheckInfo.put(patientId, maps); |
1217 | 1207 | } |
1218 | 1208 | } |
1219 | - System.out.println("==========="); | |
1220 | 1209 | Map<Integer, Integer> countMap = new HashMap<>(); |
1221 | 1210 | for (int i = 1; i < 14; i++) { |
1222 | 1211 | countMap.put(i, 0); |
... | ... | @@ -1231,7 +1220,6 @@ |
1231 | 1220 | /** key=pid value=count */ |
1232 | 1221 | Map<Date, Integer> tempMap = new HashMap<>(); |
1233 | 1222 | Integer other = 0; |
1234 | - Date otherDate = new Date(); | |
1235 | 1223 | for (Map<String, Object> map : value) { |
1236 | 1224 | Date fmDate = (Date) map.get("fmDate"); |
1237 | 1225 | if(fmDate == null) { |
1238 | 1226 | |
1239 | 1227 | |
1240 | 1228 | |
1241 | 1229 | |
... | ... | @@ -1244,16 +1232,73 @@ |
1244 | 1232 | tempMap.put(fmDate, 1); |
1245 | 1233 | } |
1246 | 1234 | } |
1247 | - tempMap.put(otherDate, other); | |
1248 | - System.out.println(">>> " + tempMap + " >>" + other); | |
1235 | + if(other != 0) { /** 处理大于或等于13次 没有分娩时间的数据 */ | |
1236 | + if(other >= 13) { | |
1237 | + countMap.put(13, countMap.get(13) + 1); | |
1238 | + } else { | |
1239 | + countMap.put(other, countMap.get(other) + 1); | |
1240 | + } | |
1241 | + } | |
1242 | + | |
1243 | + Set<Map.Entry<Date, Integer>> entries1 = tempMap.entrySet(); | |
1244 | + for (Map.Entry<Date, Integer> en : entries1) { | |
1245 | + Integer v = en.getValue(); | |
1246 | + if(v >= 13) { | |
1247 | + countMap.put(13, countMap.get(13) + 1); | |
1248 | + } else { | |
1249 | + countMap.put(v, countMap.get(v) + 1); | |
1250 | + } | |
1251 | + | |
1252 | + } | |
1249 | 1253 | } |
1250 | 1254 | } |
1255 | + /** 处理总数 */ | |
1256 | + Integer count = 0; | |
1257 | + for (int i = 1; i < 14; i++) { | |
1258 | + count += countMap.get(i); | |
1259 | + } | |
1260 | + countMap.put(0, count); | |
1251 | 1261 | |
1252 | 1262 | List<Map<String,Object>> restList = new ArrayList<>(); |
1253 | 1263 | Map<String, Object> peoples = new LinkedHashMap<>(); |
1254 | - peoples.put("desc", "产检人数"); | |
1264 | + peoples.put("desc", "产检人数"); /** 产检人数 */ | |
1265 | + peoples.put("count", countMap.get(0));/** 总计 */ | |
1266 | + peoples.put("once", countMap.get(1)); | |
1267 | + peoples.put("twice", countMap.get(2)); | |
1268 | + peoples.put("threeTimes", countMap.get(3)); | |
1269 | + peoples.put("fourTimes", countMap.get(4)); | |
1270 | + peoples.put("fiveTimes", countMap.get(5)); | |
1271 | + peoples.put("sixTimes", countMap.get(6)); | |
1272 | + peoples.put("sevenTimes", countMap.get(7)); | |
1273 | + peoples.put("eightTimes", countMap.get(8)); | |
1274 | + peoples.put("nineTimes", countMap.get(9)); | |
1275 | + peoples.put("tenTimes", countMap.get(10)); | |
1276 | + peoples.put("elevenTimes", countMap.get(11)); | |
1277 | + peoples.put("twelveTimes", countMap.get(12)); | |
1278 | + peoples.put("otherTimes", countMap.get(13)); | |
1279 | + restList.add(peoples); | |
1255 | 1280 | |
1281 | + Map<String, Object> proportion = new LinkedHashMap<>(); | |
1282 | + proportion.put("desc", "占比"); /** 占比 */ | |
1283 | + proportion.put("count", "100%");/** 总计 */ | |
1284 | + proportion.put("once", MathUtil.getProportion(countMap.get(1), count)); | |
1285 | + proportion.put("twice", MathUtil.getProportion(countMap.get(2), count)); | |
1286 | + proportion.put("threeTimes", MathUtil.getProportion(countMap.get(3), count)); | |
1287 | + proportion.put("fourTimes", MathUtil.getProportion(countMap.get(4), count)); | |
1288 | + proportion.put("fiveTimes", MathUtil.getProportion(countMap.get(5), count)); | |
1289 | + proportion.put("sixTimes", MathUtil.getProportion(countMap.get(6), count)); | |
1290 | + proportion.put("sevenTimes", MathUtil.getProportion(countMap.get(7), count)); | |
1291 | + proportion.put("eightTimes", MathUtil.getProportion(countMap.get(8), count)); | |
1292 | + proportion.put("nineTimes", MathUtil.getProportion(countMap.get(9), count)); | |
1293 | + proportion.put("tenTimes", MathUtil.getProportion(countMap.get(10), count)); | |
1294 | + proportion.put("elevenTimes", MathUtil.getProportion(countMap.get(11), count)); | |
1295 | + proportion.put("twelveTimes", MathUtil.getProportion(countMap.get(12), count)); | |
1296 | + proportion.put("otherTimes", MathUtil.getProportion(countMap.get(13), count)); | |
1297 | + restList.add(proportion); | |
1256 | 1298 | |
1299 | + for (int i = 0; i < 12; i++) { | |
1300 | + yData.add(countMap.get(i + 1)); | |
1301 | + } | |
1257 | 1302 | return restList; |
1258 | 1303 | } |
1259 | 1304 |