Commit 266f63d194adbc971990cbae718a94bd7d63e42f
1 parent
06cffe2998
Exists in
master
and in
6 other branches
颜色抽取
Showing 2 changed files with 72 additions and 28 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
266f63d
... | ... | @@ -55,12 +55,12 @@ |
55 | 55 | * @param childBirth |
56 | 56 | */ |
57 | 57 | @RequestMapping(value = "/check/export", method = RequestMethod.GET) |
58 | -// @TokenRequired | |
58 | + @TokenRequired | |
59 | 59 | public void exportCheck(String startDate, String endDate, Integer startWeek, Integer endWeek, Integer childBirth, |
60 | 60 | HttpServletRequest request, HttpServletResponse resp) { |
61 | -// LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
62 | -// reportService.exportCheck(startDate, endDate, startWeek, endWeek, childBirth, loginState.getId(), resp); | |
63 | - reportService.exportCheck(startDate, endDate, startWeek, endWeek, childBirth, 753, resp); | |
61 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
62 | + reportService.exportCheck(startDate, endDate, startWeek, endWeek, childBirth, loginState.getId(), resp); | |
63 | +// reportService.exportCheck(startDate, endDate, startWeek, endWeek, childBirth, 753, resp); | |
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | 67 | |
... | ... | @@ -77,13 +77,13 @@ |
77 | 77 | * @return |
78 | 78 | */ |
79 | 79 | @RequestMapping(method = RequestMethod.GET,value = "/checkInfo") |
80 | -// @TokenRequired | |
80 | + @TokenRequired | |
81 | 81 | @ResponseBody |
82 | 82 | public BaseObjectResponse checkInfo(Integer childBirth, String startDate, String endDate, Integer startWeek, Integer endWeek, Integer number, |
83 | 83 | String name, Integer currentPage, Integer pageSize, HttpServletRequest request) { |
84 | -// LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
85 | -// reportService.checkInfo(childBirth, startDate, endDate, startWeek, endWeek, number, name, loginState.getId(), currentPage, pageSize); | |
86 | - return reportService.checkInfo(childBirth, startDate, endDate, startWeek, endWeek, number, name, 753, currentPage, pageSize); | |
84 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
85 | + return reportService.checkInfo(childBirth, startDate, endDate, startWeek, endWeek, number, name, loginState.getId(), currentPage, pageSize); | |
86 | +// return reportService.checkInfo(childBirth, startDate, endDate, startWeek, endWeek, number, name, 753, currentPage, pageSize); | |
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | 90 | |
... | ... | @@ -98,12 +98,12 @@ |
98 | 98 | * @return |
99 | 99 | */ |
100 | 100 | @RequestMapping(method = RequestMethod.GET,value = "/checkInfo/export") |
101 | -// @TokenRequired | |
101 | + @TokenRequired | |
102 | 102 | public void exportCheckInfo(Integer childBirth, String startDate, String endDate, Integer startWeek, Integer endWeek, Integer number, |
103 | 103 | String name, HttpServletRequest request, HttpServletResponse resp) { |
104 | -// LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
105 | -// reportService.exportCheckInfo(childBirth, startDate, endDate, startWeek, endWeek, number, name, loginState.getId(), resp); | |
106 | - reportService.exportCheckInfo(childBirth, startDate, endDate, startWeek, endWeek, number, name, 753, resp); | |
104 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
105 | + reportService.exportCheckInfo(childBirth, startDate, endDate, startWeek, endWeek, number, name, loginState.getId(), resp); | |
106 | +// reportService.exportCheckInfo(childBirth, startDate, endDate, startWeek, endWeek, number, name, 753, resp); | |
107 | 107 | } |
108 | 108 | |
109 | 109 | |
... | ... | @@ -119,8 +119,8 @@ |
119 | 119 | @TokenRequired |
120 | 120 | public BaseObjectResponse doctorMedical(String startDate, String endDate, Integer childBirth, HttpServletRequest request) { |
121 | 121 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
122 | -// return reportService.doctorMedical(startDate, endDate, childBirth, loginState.getId()); | |
123 | - return reportService.doctorMedical(startDate, endDate, childBirth, 753); | |
122 | + return reportService.doctorMedical(startDate, endDate, childBirth, loginState.getId()); | |
123 | +// return reportService.doctorMedical(startDate, endDate, childBirth, 753); | |
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | 127 | |
... | ... | @@ -136,12 +136,12 @@ |
136 | 136 | */ |
137 | 137 | @RequestMapping(method = RequestMethod.GET,value = "/doctorInfo") |
138 | 138 | @ResponseBody |
139 | -// @TokenRequired | |
139 | + @TokenRequired | |
140 | 140 | public BaseObjectResponse doctorInfo(String startDate, String endDate, Integer childBirth, Integer number, String name, |
141 | 141 | Integer currentPage, Integer pageSize, HttpServletRequest request) { |
142 | -// LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
143 | -// return reportService.doctorInfo(startDate, endDate, childBirth, number, name,currentPage, pageSize, loginState.getId()); | |
144 | - return reportService.doctorInfo(startDate, endDate, childBirth, number, name,currentPage, pageSize, 753); | |
142 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
143 | + return reportService.doctorInfo(startDate, endDate, childBirth, number, name,currentPage, pageSize, loginState.getId()); | |
144 | +// return reportService.doctorInfo(startDate, endDate, childBirth, number, name,currentPage, pageSize, 753); | |
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
148 | 148 | |
... | ... | @@ -154,12 +154,12 @@ |
154 | 154 | * @return |
155 | 155 | */ |
156 | 156 | @RequestMapping(method = RequestMethod.GET,value = "/doctorInfo/export") |
157 | -// @TokenRequired | |
157 | + @TokenRequired | |
158 | 158 | public void exportDoctorInfo(String startDate, String endDate, Integer childBirth, Integer number, String name, |
159 | 159 | HttpServletRequest request, HttpServletResponse resp) { |
160 | -// LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
161 | -// reportService.exportDoctorInfo(startDate, endDate, childBirth, number, name, loginState.getId(), resp); | |
162 | - reportService.exportDoctorInfo(startDate, endDate, childBirth, number, name, 753, resp); | |
160 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
161 | + reportService.exportDoctorInfo(startDate, endDate, childBirth, number, name, loginState.getId(), resp); | |
162 | +// reportService.exportDoctorInfo(startDate, endDate, childBirth, number, name, 753, resp); | |
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
... | ... | @@ -173,9 +173,9 @@ |
173 | 173 | @TokenRequired |
174 | 174 | public void exportDoctor(String startDate, String endDate, Integer childBirth, |
175 | 175 | HttpServletRequest request, HttpServletResponse resp) { |
176 | -// LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
177 | -// reportService.exportDoctor(startDate, endDate, childBirth, loginState.getId(), resp); | |
178 | - reportService.exportDoctor(startDate, endDate, childBirth, 753, resp); | |
176 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
177 | + reportService.exportDoctor(startDate, endDate, childBirth, loginState.getId(), resp); | |
178 | +// reportService.exportDoctor(startDate, endDate, childBirth, 753, resp); | |
179 | 179 | } |
180 | 180 | |
181 | 181 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
266f63d
... | ... | @@ -29,6 +29,16 @@ |
29 | 29 | @Autowired |
30 | 30 | AutoMatchFacade autoMatchFacade; |
31 | 31 | |
32 | + private static final Map<String, String> colorMap = new HashMap<>(); | |
33 | + | |
34 | + static { | |
35 | + colorMap.put("绿色预警", "#50e39f"); | |
36 | + colorMap.put("黄色预警", "#ffd84d"); | |
37 | + colorMap.put("橙色预警", "#f17d02"); | |
38 | + colorMap.put("红色预警", "#ff6767"); | |
39 | + colorMap.put("紫色预警", "#be75ff"); | |
40 | + } | |
41 | + | |
32 | 42 | @Override |
33 | 43 | public BaseObjectResponse areaCountFacade(String startDate, String endDate, Integer startWeek, Integer endWeek, Integer childBirth, Integer userId) { |
34 | 44 | BaseObjectResponse rest = new BaseObjectResponse(); |
35 | 45 | |
... | ... | @@ -48,13 +58,14 @@ |
48 | 58 | |
49 | 59 | @Override |
50 | 60 | public BaseObjectResponse doctorMedical(String startDate, String endDate, Integer childBirth, Integer userId) { |
61 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
51 | 62 | BaseObjectResponse rest = new BaseObjectResponse(); |
52 | 63 | ReportModel reportModel = new ReportModel(); |
53 | 64 | List<Object> params = new ArrayList<>(); |
54 | 65 | List<Object> doctorNames = new ArrayList<>(); |
55 | 66 | List<Object> doctorInfo = new ArrayList<>(); |
56 | 67 | |
57 | - List<Map<String, Object>> restList = reportDao.findList(getDoctorMedicalSql(startDate, endDate, childBirth, params), params); | |
68 | + List<Map<String, Object>> restList = reportDao.findList(getDoctorMedicalSql(startDate, endDate, childBirth, hospitalId, params), params); | |
58 | 69 | |
59 | 70 | List<Map<String, Object>> grid = createDoctorGrid(restList, doctorNames, doctorInfo); |
60 | 71 | |
61 | 72 | |
... | ... | @@ -146,10 +157,30 @@ |
146 | 157 | List<Object> params = new ArrayList<>(); |
147 | 158 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
148 | 159 | PageResult page = findPage(getCheckInfoSql(childBirth, startDate, endDate, startWeek, endWeek, number, name, hospitalId, params), currentPage, pageSize, params); |
160 | + List<Map<String, Object>> grid = (List<Map<String, Object>>) page.getGrid(); | |
161 | + setColor(grid); | |
149 | 162 | rest.setData(page); |
150 | 163 | return rest; |
151 | 164 | } |
152 | 165 | |
166 | + private void setColor(List<Map<String, Object>> grid) { | |
167 | + Iterator<Map<String, Object>> iterator = grid.iterator(); | |
168 | + while (iterator.hasNext()) { | |
169 | + Map<String, Object> map = iterator.next(); | |
170 | + List<String> colors = new ArrayList<>(); | |
171 | + Object highRiskGrade = map.get("HIGH_RISK_GRADE"); | |
172 | + if(highRiskGrade != null && StringUtils.isNotBlank(highRiskGrade.toString())) { | |
173 | + List<String> grades = Arrays.asList(highRiskGrade.toString()); | |
174 | + for (String grade : grades) { | |
175 | + if(colorMap.get(grade) != null) { | |
176 | + colors.add(colorMap.get(grade)); | |
177 | + } | |
178 | + } | |
179 | + map.put("HIGH_RISK_GRADE", colors); | |
180 | + } | |
181 | + } | |
182 | + } | |
183 | + | |
153 | 184 | @Override |
154 | 185 | public void exportCheck(String startDate, String endDate, Integer startWeek, Integer endWeek, Integer childBirth, Integer userId, HttpServletResponse resp) { |
155 | 186 | BaseObjectResponse rest = areaCountFacade(startDate, endDate, startWeek, endWeek, childBirth, userId); |
... | ... | @@ -231,6 +262,10 @@ |
231 | 262 | List<Object> params = new ArrayList<>(); |
232 | 263 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
233 | 264 | PageResult page = findPage(getDoctorInfoSql(startDate, endDate, childBirth, number, name, hospitalId, params), currentPage, pageSize, params); |
265 | + List<Map<String, Object>> grid = (List<Map<String, Object>>) page.getGrid(); | |
266 | + System.err.println("1>> " + grid); | |
267 | + setColor(grid); | |
268 | + System.err.println("2>> " + grid); | |
234 | 269 | rest.setData(page); |
235 | 270 | return rest; |
236 | 271 | } |
... | ... | @@ -481,7 +516,7 @@ |
481 | 516 | return sql.toString(); |
482 | 517 | } |
483 | 518 | |
484 | - private String getDoctorMedicalSql(String startDate, String endDate, Integer childBirth, List<Object> params) { | |
519 | + private String getDoctorMedicalSql(String startDate, String endDate, Integer childBirth, String hospitalId, List<Object> params) { | |
485 | 520 | StringBuilder sql = new StringBuilder(); |
486 | 521 | sql.append("SELECT B.DOCTOR_NAME, ") |
487 | 522 | .append("COUNT(B.EXAMINE_ID) AS CJ_RC, ") |
488 | 523 | |
... | ... | @@ -506,13 +541,17 @@ |
506 | 541 | params.add(endDate); |
507 | 542 | } |
508 | 543 | |
544 | + if(StringUtils.isNotBlank(hospitalId)) { | |
545 | + sql.append("AND C.YCY_STSTEM_ID = ? "); | |
546 | + params.add(hospitalId); | |
547 | + } | |
548 | + | |
509 | 549 | /* if(startWeek != null && endWeek != null) { |
510 | 550 | sql.append("AND A.NOW_WEEKS BETWEEN ? AND ? "); |
511 | 551 | params.add(startWeek); |
512 | 552 | params.add(endWeek); |
513 | 553 | }*/ |
514 | 554 | |
515 | - | |
516 | 555 | sql.append("GROUP BY B.DOCTOR_NAME,B.DOCTOR_NO ") |
517 | 556 | .append("UNION ALL ") |
518 | 557 | .append("SELECT '总计', ") |
... | ... | @@ -529,6 +568,11 @@ |
529 | 568 | if(childBirth != null) { |
530 | 569 | sql.append("AND A.IS_CHILDBIRTH = ? "); |
531 | 570 | params.add(childBirth); |
571 | + } | |
572 | + | |
573 | + if(StringUtils.isNotBlank(hospitalId)) { | |
574 | + sql.append("AND C.YCY_STSTEM_ID = ? "); | |
575 | + params.add(hospitalId); | |
532 | 576 | } |
533 | 577 | |
534 | 578 | if(startDate != null && endDate != null) { |