Commit 321c214e1ffee5abfbea6f1db891faabd35ab0a9
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 5 changed files
- platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyFmService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyFmService.java
View file @
321c214
... | ... | @@ -301,6 +301,9 @@ |
301 | 301 | deliverAddRequest.setTireNumber(1);// 胎数 |
302 | 302 | deliverAddRequest.setPlacenta("1");// 胎盘 |
303 | 303 | |
304 | + deliverAddRequest.setFmType("1"); //默认住院分娩 | |
305 | + | |
306 | + | |
304 | 307 | if ("完好".equals(item.getHyqk()) || "无".equals(item.getHyqk())) { |
305 | 308 | deliverAddRequest.setPerinealCondition("full"); |
306 | 309 | } else if ("会阴切开".equals(item.getHyqk()) || "侧切".equals(item.getHyqk())) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
321c214
... | ... | @@ -700,16 +700,14 @@ |
700 | 700 | return new BaseResponse().setErrormsg("该孕妇还未在本院建档不能进行分娩").setErrorcode(ErrorCodeConstants.NO_DATA); |
701 | 701 | } |
702 | 702 | |
703 | - if (patients3 == null || !StringUtils.isNotEmpty(patients3.getId())) | |
704 | - { | |
705 | - int days = DateUtil.daysBetween(patients.getLastMenses(), new Date()); | |
706 | 703 | |
707 | - if (days < 168 && patients.getFmDate() == null) { | |
708 | - return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR1).setErrormsg("当前孕妇的孕周小于24孕周,不能进行分娩"); | |
709 | - } | |
710 | - if (null != patients.getDueStatus() && 1 == patients.getDueStatus()) { | |
711 | - return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg(" 该孕妇在系统中已终止妊娠不能再进行分娩,请重新建档"); | |
712 | - } | |
704 | + int days = DateUtil.daysBetween(patients.getLastMenses(), new Date()); | |
705 | + | |
706 | + if (days < 168 && patients.getFmDate() == null) { | |
707 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR1).setErrormsg("当前孕妇的孕周小于24孕周,不能进行分娩"); | |
708 | + } | |
709 | + if (null != patients.getDueStatus() && 1 == patients.getDueStatus()) { | |
710 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg(" 该孕妇在系统中已终止妊娠不能再进行分娩,请重新建档"); | |
713 | 711 | } |
714 | 712 | |
715 | 713 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
View file @
321c214
... | ... | @@ -204,40 +204,44 @@ |
204 | 204 | highScoreResult = ResolveUtils.queryRisk(ids, true, basicConfigService); |
205 | 205 | } |
206 | 206 | } |
207 | - Integer score = 0; | |
208 | - if (highScoreResult != null) { | |
209 | - if (highScoreResult.getScore() != null) { | |
207 | + Integer score = 0; | |
208 | + if (highScoreResult != null && highScoreResult.getScore() != null) { | |
210 | 209 | score = highScoreResult.getScore(); |
211 | 210 | } |
212 | - List<Map<String, Object>> list = ResolveUtils.queryHighRisk(highScoreResult); | |
213 | - | |
214 | - Map<String, Object> otherRisk = null; | |
211 | + List<Map<String, Object>> list = new ArrayList<>(); | |
212 | + List<Map<String, Object>> checkList = ResolveUtils.queryHighRisk(highScoreResult); | |
213 | + if (CollectionUtils.isNotEmpty(checkList)) | |
214 | + { | |
215 | + list.addAll(checkList); | |
216 | + } | |
215 | 217 | if (StringUtils.isNotEmpty(oRisk) && !"{}".equals(oRisk)) { |
216 | - otherRisk = new HashMap<>(); | |
218 | + Map<String, Object> otherRisk = new HashMap<>(); | |
217 | 219 | ResolveUtils.queryOtherRisk(oRisk, otherRisk, basicConfigService); |
218 | - } | |
219 | 220 | |
220 | - Map<String, Object> otherMap = new HashMap<>(); | |
221 | + Map<String, Object> otherMap = new HashMap<>(); | |
221 | 222 | |
222 | - if (otherRisk != null) { | |
223 | - if (otherRisk.get("name") != null) { | |
224 | - otherMap.put("name", otherRisk.get("name")); | |
225 | - } | |
226 | - if (otherRisk.get("color") != null) { | |
227 | - otherMap.put("color", otherRisk.get("color")); | |
228 | - } | |
229 | - if (otherRisk.get("score") != null) { | |
230 | - String s = (String) otherRisk.get("score"); | |
231 | - if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(s) && FunvCommonUtil.isNumeric(s)) { | |
232 | - score = score + Integer.parseInt(s); | |
223 | + if (otherRisk != null) { | |
224 | + if (otherRisk.get("name") != null && StringUtils.isNotEmpty(otherRisk.get("name").toString())) { | |
225 | + otherMap.put("name", otherRisk.get("name")); | |
233 | 226 | } |
227 | + if (otherRisk.get("color") != null && StringUtils.isNotEmpty(otherRisk.get("color").toString()) && !"risk_".equals(otherRisk.get("color").toString())) { | |
228 | + otherMap.put("color", otherRisk.get("color")); | |
229 | + } | |
230 | + if (otherRisk.get("score") != null && StringUtils.isNotEmpty(otherRisk.get("score").toString()) ) { | |
231 | + String s = (String) otherRisk.get("score"); | |
232 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(s) && FunvCommonUtil.isNumeric(s)) { | |
233 | + score += Integer.parseInt(s); | |
234 | + } | |
235 | + } | |
236 | + if (otherMap.size() > 0) | |
237 | + { | |
238 | + list.add(otherMap); | |
239 | + } | |
240 | + | |
234 | 241 | } |
235 | - list.add(otherMap); | |
236 | 242 | } |
237 | - | |
238 | 243 | map.put("score", UnitUtils.unitSplice(score, UnitConstants.FEN)); |
239 | 244 | map.put("highRisk", list); |
240 | - } | |
241 | 245 | } |
242 | 246 | |
243 | 247 | /** |
244 | 248 | |
245 | 249 | |
246 | 250 | |
247 | 251 | |
248 | 252 | |
... | ... | @@ -399,22 +403,26 @@ |
399 | 403 | map.put("gongwaiyun", UnitUtils.unitSplice(data.getGongwaiyun(), UnitConstants.CI)); |
400 | 404 | //流产 |
401 | 405 | StringBuffer abortion = new StringBuffer(); |
402 | - abortion.append(UnitUtils.unitSplice(data.getAbortion(), UnitConstants.CI) == null ? "" : UnitUtils.unitSplice(data.getAbortion(), UnitConstants.CI)); | |
403 | - abortion.append("("); | |
406 | + if (data.getAbortion() != null) | |
407 | + { | |
408 | + abortion.append(UnitUtils.unitSplice(data.getAbortion(), UnitConstants.CI) == null ? "" : UnitUtils.unitSplice(data.getAbortion(), UnitConstants.CI)); | |
409 | + abortion.append("("); | |
404 | 410 | |
405 | - if (data.getAbortionZR() != null) { | |
406 | - abortion.append("自然:" + data.getAbortionZR() + UnitConstants.CI ); | |
407 | - } | |
411 | + if (data.getAbortionZR() != null) { | |
412 | + abortion.append("自然:" + data.getAbortionZR() + UnitConstants.CI ); | |
413 | + } | |
408 | 414 | |
409 | - if(data.getAbortionRG() != null){ | |
410 | - abortion.append(" 人工:" + data.getAbortionRG() + UnitConstants.CI + ""); | |
411 | - } | |
415 | + if(data.getAbortionRG() != null){ | |
416 | + abortion.append(" 人工:" + data.getAbortionRG() + UnitConstants.CI + ""); | |
417 | + } | |
412 | 418 | |
413 | - if(data.getYaowu()!=null){ | |
414 | - abortion.append(" 药物:" + data.getYaowu() + UnitConstants.CI + ""); | |
419 | + if(data.getYaowu()!=null){ | |
420 | + abortion.append(" 药物:" + data.getYaowu() + UnitConstants.CI + ""); | |
421 | + } | |
422 | + abortion.append(")"); | |
415 | 423 | } |
416 | - abortion.append(")"); | |
417 | 424 | |
425 | + | |
418 | 426 | map.put("abortion", abortion); |
419 | 427 | |
420 | 428 | /*map.put("abortion", UnitUtils.unitSplice(data.getAbortion(),UnitConstants.CI) + " (自然:" + data.getAbortionZR() + UnitConstants.CI + " 人工:" + |
... | ... | @@ -1993,7 +2001,7 @@ |
1993 | 2001 | } |
1994 | 2002 | |
1995 | 2003 | model.setNextCheckDate(DateUtil.getyyyy_MM_dd(checkModel.getNextDate())); |
1996 | - model.setHighRisk(checkModel.getHighRisk() == 1 ? "是" : "否"); | |
2004 | + model.setHighRisk(checkModel.getHighRisk() == null ? "否" : checkModel.getHighRisk() == 1 ? "是" : "否"); | |
1997 | 2005 | model.setCheckDate(DateUtil.getyyyy_MM_dd(checkModel.getCheckDate())); |
1998 | 2006 | |
1999 | 2007 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
321c214
... | ... | @@ -1113,31 +1113,30 @@ |
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | List<Patients> patients = mongoTemplate.find(Query.query(criteria), Patients.class); |
1116 | - | |
1117 | - /* AggregationOperation match = Aggregation.match( | |
1118 | - Criteria.where("hospitalId").is(hospitalId) | |
1119 | -// .and("bookbuildingDate").gte(DateUtil.getYearDate(year)).lt(DateUtil.getNextYearDate(year)) | |
1120 | - .and("id").in(patientIds)); | |
1121 | - AggregationOperation provinceGroup = Aggregation.group("bookbuildingDate").count().as("provinceCount"); | |
1122 | -// AggregationOperation cityGroup = Aggregation.group("cityId").count().as("cityCount"); | |
1123 | -// AggregationOperation areaGroup = Aggregation.group("areaId").count().as("areaCount"); | |
1124 | - Aggregation aggregation = Aggregation.newAggregation(match, provinceGroup); | |
1125 | - AggregationResults<HashMap> result = mongoTemplate.aggregate(aggregation, Patients.class, HashMap.class); | |
1126 | - List<HashMap> mappedResults = result.getMappedResults(); | |
1127 | - | |
1128 | - for (HashMap mappedResult : mappedResults) { | |
1129 | - System.out.println(mappedResult); | |
1130 | - } | |
1131 | -*/ | |
1132 | 1116 | ReportModel reportModel = new ReportModel(); |
1133 | 1117 | reportModel.setLegend(Arrays.asList("秦皇岛市", "辖区外")); |
1134 | 1118 | |
1135 | 1119 | reportModel.setxAxis(Arrays.asList("1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月")); |
1136 | 1120 | |
1137 | - | |
1138 | 1121 | List<Map<String, Object>> mapList = mongoUtil.getListByGroup(patients); |
1122 | + | |
1139 | 1123 | List<Series> series = createPatientSeries(mapList); |
1140 | 1124 | reportModel.setSeries(series); |
1125 | + | |
1126 | + /*Map<String, Object> countMap = new HashMap<>(); | |
1127 | + countMap.put("id", -1); | |
1128 | + countMap.put("parentId", null); | |
1129 | + countMap.put("name", "建册人数(按居住地)"); | |
1130 | + List<Object> qhdData = series.get(0).getData(); | |
1131 | + List<Object> otherData = series.get(0).getData(); | |
1132 | + Integer count = 0; | |
1133 | + for(int i = 0; i< 12; i++) { | |
1134 | + countMap.put(i + 1 + "", Integer.parseInt(qhdData.get(i) + "") + Integer.parseInt(otherData.get(i) + "")); | |
1135 | + count += Integer.parseInt(qhdData.get(i) + "") + Integer.parseInt(otherData.get(i) + ""); | |
1136 | + } | |
1137 | + countMap.put("count", count); | |
1138 | + mapList.add(countMap);*/ | |
1139 | + | |
1141 | 1140 | return RespBuilder.buildSuccess("patients", mapList, "report", reportModel); |
1142 | 1141 | } |
1143 | 1142 | |
1144 | 1143 | |
1145 | 1144 | |
1146 | 1145 | |
1147 | 1146 | |
1148 | 1147 | |
1149 | 1148 | |
... | ... | @@ -1148,38 +1147,52 @@ |
1148 | 1147 | qhdSeries.setName("秦皇岛市"); |
1149 | 1148 | qhdSeries.setType("bar"); |
1150 | 1149 | qhdSeries.setStack("总计"); |
1151 | - List<Object> qhdDatas = new ArrayList<>(); | |
1152 | 1150 | |
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); | |
1161 | - } | |
1162 | - | |
1163 | 1151 | 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 + "")); | |
1152 | + if(StringUtils.isNotEmpty(provinceId)) { | |
1153 | + Map<Integer, Integer> qhdTemp = new HashMap<>();/** key = month . value = count*/ | |
1154 | + for (int i = 1; i < 13; i++) { | |
1155 | + qhdTemp.put(i, 0); | |
1156 | + } | |
1157 | + Map<Integer, Integer> otherTemp = new HashMap<>();/** key = month . value = count*/ | |
1158 | + for (int i = 1; i < 13; i++) { | |
1159 | + otherTemp.put(i, 0); | |
1160 | + } | |
1161 | + for (Map<String, Object> data : datas) { | |
1162 | + if(provinceId.equals(data.get("province_id"))) { | |
1163 | + for(int i = 1; i < 13; i++) { | |
1164 | + qhdTemp.put(i, qhdTemp.get(i) + Integer.parseInt(data.get(i + "") + "")); | |
1165 | + } | |
1166 | + } else { | |
1167 | + for(int i = 1; i < 13; i++) { | |
1168 | + otherTemp.put(i, otherTemp.get(i) + Integer.parseInt(data.get(i + "") + "")); | |
1169 | + } | |
1169 | 1170 | } |
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 | 1171 | } |
1172 | + List<Object> qhdDatas = new ArrayList<>(); | |
1173 | + Set<Map.Entry<Integer, Integer>> entries = qhdTemp.entrySet(); | |
1174 | + for (Map.Entry<Integer, Integer> entry : entries) { | |
1175 | + qhdDatas.add(entry.getValue()); | |
1176 | + } | |
1177 | + qhdSeries.setData(qhdDatas); | |
1178 | + | |
1179 | + /** 设置其他辖区 */ | |
1180 | + Series otherSeries = new Series(); | |
1181 | + otherSeries.setName("辖区外"); | |
1182 | + otherSeries.setType("bar"); | |
1183 | + otherSeries.setStack("总计"); | |
1184 | + List<Object> otherDatas = new ArrayList<>(); | |
1185 | + | |
1186 | + Set<Map.Entry<Integer, Integer>> entries2 = otherTemp.entrySet(); | |
1187 | + for (Map.Entry<Integer, Integer> entry : entries2) { | |
1188 | + otherDatas.add(entry.getValue()); | |
1189 | + } | |
1190 | + otherSeries.setData(otherDatas); | |
1191 | + | |
1192 | + series.add(qhdSeries); | |
1193 | + series.add(otherSeries); | |
1176 | 1194 | } |
1177 | - List<Integer> integers = CollectionUtils.transValToList(temp); | |
1178 | - otherDatas.addAll(integers); | |
1179 | - otherSeries.setData(otherDatas); | |
1180 | 1195 | |
1181 | - series.add(qhdSeries); | |
1182 | - series.add(otherSeries); | |
1183 | 1196 | return series; |
1184 | 1197 | } |
1185 | 1198 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
View file @
321c214
... | ... | @@ -51,19 +51,9 @@ |
51 | 51 | * @return |
52 | 52 | */ |
53 | 53 | public List<Map<String, Object>> getListByGroup(List<Patients> patients) { |
54 | - Map<String, Integer> codeMap = new HashMap<>(); /** key为 id_month */ | |
54 | + Map<String, Integer> codeMap = new HashMap<>(); /** key为 provinceId_cityId_areaId_month */ | |
55 | + Map<Integer, Integer> otherMap = new HashMap<>(); /** key为 month */ | |
55 | 56 | |
56 | - Map<String, Integer> otherCountMap = new HashMap<>(); | |
57 | - Map<String, Integer> otherMonthMap = new HashMap<>(); | |
58 | - for (int i = 1; i <= 12; i++) { | |
59 | - otherMonthMap.put(i + "", 0); | |
60 | - } | |
61 | - | |
62 | - Integer otherCount = 0; | |
63 | - /* for (Patients patient : patients) { | |
64 | - System.out.println("month:" + DateUtil.getMonth(patient.getBookbuildingDate()) + "\tprovinceId: " + patient.getProvinceId() | |
65 | - + "\tcityId: " + patient.getCityId() + "\tareaId:" + patient.getAreaId()); | |
66 | - }*/ | |
67 | 57 | for (Patients patient : patients) { |
68 | 58 | Date bookbuildingDate = patient.getBookbuildingDate(); |
69 | 59 | if(bookbuildingDate == null) { |
70 | 60 | |
71 | 61 | |
72 | 62 | |
73 | 63 | |
74 | 64 | |
75 | 65 | |
76 | 66 | |
... | ... | @@ -76,30 +66,91 @@ |
76 | 66 | Integer month = DateUtil.getMonth(bookbuildingDate); |
77 | 67 | |
78 | 68 | if (StringUtils.isEmpty(provinceId) || StringUtils.isEmpty(cityId) || StringUtils.isEmpty(areaId)) { |
79 | - otherMonthMap.put(month + "", otherMonthMap.get(month + "") + 1); | |
80 | - ++otherCount; | |
69 | + if(otherMap.containsKey(month)) { | |
70 | + otherMap.put(month, otherMap.get(month) + 1); | |
71 | + } else { | |
72 | + otherMap.put(month, 1); | |
73 | + } | |
81 | 74 | continue; |
82 | 75 | } |
83 | 76 | |
84 | - if(codeMap.containsKey(provinceId + "_" + month)) { | |
85 | - codeMap.put(provinceId + "_" + month, codeMap.get(provinceId + "_" + month) + 1); | |
77 | + String key = provinceId + "_" + cityId + "_" + areaId + "_" + month; | |
78 | + if(codeMap.containsKey(key)) { | |
79 | + codeMap.put(key, codeMap.get(key) + 1); | |
86 | 80 | } else { |
87 | - codeMap.put(provinceId + "_" + month, 1); | |
81 | + codeMap.put(key, 1); | |
88 | 82 | } |
89 | - if(codeMap.containsKey(cityId + "_" + month)) { | |
90 | - codeMap.put(cityId + "_" + month, codeMap.get(cityId + "_" + month) + 1); | |
91 | - } else { | |
92 | - codeMap.put(cityId + "_" + month, 1); | |
83 | +// | |
84 | + } | |
85 | + } | |
86 | + | |
87 | + Set<Map.Entry<String, Integer>> entrySet = codeMap.entrySet(); | |
88 | + List<Map<String, Object>> rest = new ArrayList<>(); | |
89 | + for (Map.Entry<String, Integer> map : entrySet) { | |
90 | + String[] keys = map.getKey().split("_"); | |
91 | + String provinceId = keys[0]; | |
92 | + String cityId = keys[1]; | |
93 | + String areaId = keys[2]; | |
94 | + String month = keys[3]; | |
95 | + | |
96 | + boolean flag = true; | |
97 | + for (Map<String,Object> data : rest) { | |
98 | + if(areaId.equals(data.get("area_id"))) { /** 合并相同省市区月份数据 */ | |
99 | + data.put(month, map.getValue()); | |
100 | + flag = false; | |
101 | + continue; | |
93 | 102 | } |
94 | - if(codeMap.containsKey(areaId + "_" + month)) { | |
95 | - codeMap.put(areaId + "_" + month, codeMap.get(areaId + "_" + month) + 1); | |
103 | + } | |
104 | + | |
105 | + if(flag) { | |
106 | + Map<String, Object> tempMap = new HashMap<>(); | |
107 | + tempMap.put("province_id", provinceId); | |
108 | + tempMap.put("province_name", findName(provinceId)); | |
109 | + tempMap.put("city_id", cityId); | |
110 | + tempMap.put("city_name", findName(cityId)); | |
111 | + tempMap.put("area_id", areaId); | |
112 | + tempMap.put("area_name", findName(areaId)); | |
113 | + tempMap.put("level", "建册人数"); | |
114 | + tempMap.put(month, map.getValue()); | |
115 | + rest.add(tempMap); | |
116 | + } | |
117 | + } | |
118 | + | |
119 | + | |
120 | + /** 把没有月份的数据设置为0 并且设置count */ | |
121 | + for (Map<String, Object> map : rest) { | |
122 | + Integer count = 0; | |
123 | + for (int i = 1; i < 13; i++) { | |
124 | + if(!map.containsKey(i + "")) { | |
125 | + map.put(i + "", 0); | |
96 | 126 | } else { |
97 | - codeMap.put(areaId + "_" + month, 1); | |
127 | + count += Integer.parseInt(map.get(i + "") + ""); | |
98 | 128 | } |
99 | 129 | } |
130 | + map.put("count", count); | |
100 | 131 | } |
101 | 132 | |
102 | - List<Map<String, Map<Integer, Integer>>> datas = new ArrayList<>(); | |
133 | + /** 处理其他 */ | |
134 | + Set<Map.Entry<Integer, Integer>> otherDatas = otherMap.entrySet(); | |
135 | + Map<String, Object> tempMap = new HashMap<>(); | |
136 | + tempMap.put("province_id", null); | |
137 | + tempMap.put("province_name", "其他"); | |
138 | + tempMap.put("city_id", null); | |
139 | + tempMap.put("city_name", "其他"); | |
140 | + tempMap.put("area_id", null); | |
141 | + tempMap.put("area_name", "其他"); | |
142 | + tempMap.put("level", "建册人数"); | |
143 | + Integer count = 0; | |
144 | + for (int i = 1; i < 13; i++) { | |
145 | + tempMap.put(i + "", 0); | |
146 | + } | |
147 | + for (Map.Entry<Integer, Integer> data : otherDatas) { | |
148 | + tempMap.put(data.getKey() + "", data.getValue()); | |
149 | + count += Integer.parseInt(data.getValue() + ""); | |
150 | + } | |
151 | + tempMap.put("count", count); | |
152 | + rest.add(tempMap); | |
153 | + /* List<Map<String, Map<Integer, Integer>>> datas = new ArrayList<>(); | |
103 | 154 | Set<Map.Entry<String, Integer>> entries = codeMap.entrySet(); |
104 | 155 | for (Map.Entry<String, Integer> entry : entries) { |
105 | 156 | String key = entry.getKey(); |
106 | 157 | |
... | ... | @@ -127,9 +178,9 @@ |
127 | 178 | tempMap.put(id, map); |
128 | 179 | datas.add(tempMap); |
129 | 180 | } |
130 | - } | |
181 | + }*/ | |
131 | 182 | |
132 | - System.out.println("===================================== codemap ================================="); | |
183 | + /* System.out.println("===================================== codemap ================================="); | |
133 | 184 | Set<Map.Entry<String, Integer>> codeMapEntries = codeMap.entrySet(); |
134 | 185 | for (Map.Entry<String, Integer> codeMapEntry : codeMapEntries) { |
135 | 186 | System.out.println(codeMapEntry.getKey() + " : " + codeMapEntry.getValue()); |
136 | 187 | |
137 | 188 | |
... | ... | @@ -140,11 +191,11 @@ |
140 | 191 | for (Map.Entry<String, Map<Integer, Integer>> mapEntry : set) { |
141 | 192 | System.out.println(mapEntry.getKey() + " : " + mapEntry.getValue()); |
142 | 193 | } |
143 | - } | |
194 | + }*/ | |
144 | 195 | |
145 | - List<Map<String, Object>> restMap = new ArrayList<>(); | |
196 | + /*List<Map<String, Object>> restMap = new ArrayList<>(); | |
146 | 197 | |
147 | - /** 设置没数据的月份为0 */ | |
198 | + *//** 设置没数据的月份为0 *//* | |
148 | 199 | for (Map<String, Map<Integer, Integer>> data : datas) { |
149 | 200 | Integer count = 0; |
150 | 201 | Set<Map.Entry<String, Map<Integer, Integer>>> set = data.entrySet(); |
151 | 202 | |
152 | 203 | |
153 | 204 | |
154 | 205 | |
... | ... | @@ -163,17 +214,19 @@ |
163 | 214 | map.put(0, count); |
164 | 215 | tempMap.put("count", count); |
165 | 216 | tempMap.put("id", entry.getKey()); |
217 | + tempMap.put("parentId", findParentId(entry.getKey())); | |
166 | 218 | tempMap.put("name", findName(entry.getKey())); |
167 | 219 | restMap.add(tempMap); |
168 | 220 | } |
169 | 221 | } |
222 | +*/ | |
170 | 223 | |
171 | - | |
172 | 224 | /** 处理 其他 数据 */ |
173 | - Map<String, Object> tempMap = new HashMap<>(); | |
174 | - tempMap.put("count", otherCount); | |
225 | + /* Map<String, Object> tempMap = new HashMap<>(); | |
226 | + otherMonthMap.put("count", otherCount); | |
175 | 227 | tempMap.put("name", "其他"); |
176 | 228 | tempMap.put("id", null); |
229 | + tempMap.put("parentId", -1); | |
177 | 230 | for (int i = 1; i <= 12; i++) { |
178 | 231 | if(otherMonthMap.containsKey(i + "")) { |
179 | 232 | tempMap.put(i + "", otherMonthMap.get(i + "")); |
... | ... | @@ -181,7 +234,7 @@ |
181 | 234 | tempMap.put(i + "", 0); |
182 | 235 | } |
183 | 236 | } |
184 | - restMap.add(tempMap); | |
237 | + restMap.add(tempMap);*/ | |
185 | 238 | |
186 | 239 | /* for (Map<String, Map<Integer, Integer>> data : datas) { |
187 | 240 | System.out.println("data>>> " + data); |
... | ... | @@ -190,7 +243,17 @@ |
190 | 243 | for (Map<String, Object> map : restMap) { |
191 | 244 | System.out.println("rest>> " + map); |
192 | 245 | }*/ |
193 | - return restMap; | |
246 | + return rest; | |
247 | + } | |
248 | + | |
249 | + private String findParentId(String key) { | |
250 | + if(key != null) { | |
251 | + BasicConfig basicConfig = mongoTemplate.findById(key, BasicConfig.class); | |
252 | + if(basicConfig != null) { | |
253 | + return basicConfig.getParentId(); | |
254 | + } | |
255 | + } | |
256 | + return null; | |
194 | 257 | } |
195 | 258 | |
196 | 259 | public String findName(Object id) { |