Commit b85632fe61b76138977edf746d0987fe5d365431
1 parent
b9d7a9f4bc
Exists in
master
and in
6 other branches
写bug
Showing 2 changed files with 23 additions and 16 deletions
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
b85632f
... | ... | @@ -1216,19 +1216,22 @@ |
1216 | 1216 | return time; |
1217 | 1217 | } |
1218 | 1218 | |
1219 | - public static List<Map<String, Object>> getRange(Date start, Date end) { | |
1220 | - List<Map<String, Object>> restList = new ArrayList<>(); | |
1219 | + public static List<Map<String, Date>> getRange(Date start, Date end) { | |
1220 | + List<Map<String, Date>> restList = new ArrayList<>(); | |
1221 | 1221 | if(start != null && end != null) { |
1222 | 1222 | List<Date> dates = getMonthBetween(start, end); |
1223 | 1223 | for (int i = 0; i < dates.size(); i++) { |
1224 | - Map<String, Object> temp = new HashMap<>(); | |
1225 | - temp.put("cname", getyyyy_mm(dates.get(i))); | |
1224 | + Map<String, Date> temp = new HashMap<>(); | |
1225 | + temp.put("cname", dates.get(i)); | |
1226 | 1226 | if(i == 0) { |
1227 | - temp.put("condition", Arrays.asList(start, dates.get(i))); | |
1227 | + temp.put("start", start); | |
1228 | + temp.put("end", dates.get(i + 1)); | |
1228 | 1229 | } else if(i == dates.size() - 1) { |
1229 | - temp.put("condition", Arrays.asList(dates.get(dates.size() - 1), end)); | |
1230 | + temp.put("start", dates.get(dates.size() - 1)); | |
1231 | + temp.put("end", end); | |
1230 | 1232 | } else { |
1231 | - temp.put("condition", Arrays.asList(dates.get(i), dates.get(i + 1))); | |
1233 | + temp.put("start", dates.get(i)); | |
1234 | + temp.put("end", dates.get(i + 1)); | |
1232 | 1235 | } |
1233 | 1236 | restList.add(temp); |
1234 | 1237 | } |
... | ... | @@ -1254,13 +1257,11 @@ |
1254 | 1257 | } |
1255 | 1258 | |
1256 | 1259 | public static void main(String[] args) { |
1257 | - List<Map<String, Object>> monthBetween = getRange(parseYMD("2017-1-11"), parseYMD("2017-3-11")); | |
1258 | - for (Map<String, Object> map : monthBetween) { | |
1259 | - System.out.println(map.get("cname")); | |
1260 | - List<Date> conditions = (List<Date>) map.get("condition"); | |
1261 | - for (Date condition : conditions) { | |
1262 | - System.out.println(condition.toLocaleString()); | |
1263 | - } | |
1260 | + List<Map<String, Date>> monthBetween = getRange(parseYMD("2017-1-11"), parseYMD("2017-3-11")); | |
1261 | + for (Map<String, Date> map : monthBetween) { | |
1262 | + System.out.print("cname>> " + getyyyy_mm(map.get("cname"))); | |
1263 | + System.out.print(" start>> " + getyyyy_MM_dd(map.get("start"))); | |
1264 | + System.out.println(" end>> " + getyyyy_MM_dd(map.get("end"))); | |
1264 | 1265 | } |
1265 | 1266 | |
1266 | 1267 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
b85632f
... | ... | @@ -194,6 +194,7 @@ |
194 | 194 | Integer statistType, Integer ageType, Integer patientType, Date startDate, Date endDate, Integer userId) { |
195 | 195 | List<Patients> patients = getPatients(provinceId, cityId, aredId, streetId, ageType, patientType, startDate, endDate, userId); |
196 | 196 | Map<String, Object> restMap = new HashMap<>(); |
197 | + List<Map<String, Object>> tabList = new ArrayList<>(); | |
197 | 198 | List<String> xDatas = new ArrayList<>(); |
198 | 199 | List<Map<String, Object>> series = new ArrayList<>(); |
199 | 200 | List<String> legend = Arrays.asList("建档总数"); |
200 | 201 | |
... | ... | @@ -246,9 +247,13 @@ |
246 | 247 | barMap.put("name", "建档总数"); |
247 | 248 | series.add(barMap); |
248 | 249 | |
249 | - for (Integer count : bar) { | |
250 | - | |
250 | + Integer count = 0; | |
251 | + for (Integer num : bar) { | |
252 | + count += num; | |
251 | 253 | } |
254 | + for (Integer num : bar) { | |
255 | + line.add(MathUtil.getProportion(num, count)); | |
256 | + } | |
252 | 257 | lineMap.put("data", line); |
253 | 258 | lineMap.put("type", "line"); |
254 | 259 | lineMap.put("name", "建档总数"); |
... | ... | @@ -258,6 +263,7 @@ |
258 | 263 | restMap.put("legend", legend); |
259 | 264 | restMap.put("series", series); |
260 | 265 | restMap.put("xDatas", xDatas); |
266 | + restMap.put("tabList", tabList); | |
261 | 267 | |
262 | 268 | return RespBuilder.buildSuccess(restMap); |
263 | 269 | } |