Commit 3061d63913eda7760a85fa82b2aa1dd54073e456

Authored by hujiaqi
1 parent 4220a72498

BUG

Showing 1 changed file with 37 additions and 5 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyStatisticsManagerController.java View file @ 3061d63
... ... @@ -200,7 +200,7 @@
200 200 header.put("diagnose", "高危诊断");
201 201 header.put("checkDoctor", "检查医生");
202 202 httpServletResponse.setContentType("application/force-download");
203   - httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + new String(("检查医生统计.xls").getBytes("UTF-8"), "ISO-8859-1"));
  203 + httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + new String(("体检医生统计.xls").getBytes("UTF-8"), "ISO-8859-1"));
204 204 ExcelUtil.toExcel(httpServletResponse.getOutputStream(), list, header);
205 205 } catch (Exception e) {
206 206 ExceptionUtils.catchException(e, "babyStatisticsManagerCheckDoctorListExcel异常");
... ... @@ -285,7 +285,7 @@
285 285 header.put("diagnose", "高危诊断");
286 286 header.put("checkDoctor", "检查医生");
287 287 httpServletResponse.setContentType("application/force-download");
288   - httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + new String(("检查医生统计.xls").getBytes("UTF-8"), "ISO-8859-1"));
  288 + httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + new String(("体检月龄统计.xls").getBytes("UTF-8"), "ISO-8859-1"));
289 289 ExcelUtil.toExcel(httpServletResponse.getOutputStream(), list, header);
290 290 } catch (Exception e) {
291 291 ExceptionUtils.catchException(e, "babyStatisticsManagerWeekAgeListExcel异常");
... ... @@ -299,8 +299,8 @@
299 299 */
300 300 @TokenRequired
301 301 @ResponseBody
302   - @RequestMapping(value = "BabyStatisticsManagerBuildSourceList", method = RequestMethod.POST, consumes = "application/json")
303   - public BaseListResponse BabyStatisticsManagerBuildSourceList(HttpServletRequest httpServletRequest, @RequestBody BabyStatisticsManagerBuildSourceListRequest babyStatisticsManagerBuildSourceListRequest) {
  302 + @RequestMapping(value = "babyStatisticsManagerBuildSourceList", method = RequestMethod.POST, consumes = "application/json")
  303 + public BaseListResponse babyStatisticsManagerBuildSourceList(HttpServletRequest httpServletRequest, @RequestBody BabyStatisticsManagerBuildSourceListRequest babyStatisticsManagerBuildSourceListRequest) {
304 304 BaseListResponse baseListResponse;
305 305 try {
306 306 babyStatisticsManagerBuildSourceListRequest.setOperatorId(((LoginContext) httpServletRequest.getAttribute("loginContext")).getId());
307 307  
... ... @@ -312,9 +312,41 @@
312 312 baseListResponse = new BaseListResponse().setErrorcode(babyStatisticsManagerBuildSourceListResult.getErrorcode()).setErrormsg(babyStatisticsManagerBuildSourceListResult.getErrormsg()).setData(babyStatisticsManagerBuildSourceListResult.getData()).setPageInfo(babyStatisticsManagerBuildSourceListResult.getPageInfo());
313 313 } catch (Exception e) {
314 314 baseListResponse = new BaseListResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION);
315   - ExceptionUtils.catchException(e, "BabyStatisticsManagerBuildSourceList异常");
  315 + ExceptionUtils.catchException(e, "babyStatisticsManagerBuildSourceList异常");
316 316 }
317 317 return baseListResponse;
  318 + }
  319 +
  320 + @TokenRequired
  321 + @RequestMapping(value = "babyStatisticsManagerBuildSourceListExcel", method = RequestMethod.POST)
  322 + public void babyStatisticsManagerBuildSourceListExcel(HttpServletRequest httpServletRequest, @RequestBody BabyStatisticsManagerBuildSourceListRequest babyStatisticsManagerBuildSourceListRequest, HttpServletResponse httpServletResponse) {
  323 + try {
  324 + babyStatisticsManagerBuildSourceListRequest.setOperatorId(((LoginContext) httpServletRequest.getAttribute("loginContext")).getId());
  325 + babyStatisticsManagerBuildSourceListRequest.setExcel(true);
  326 + // 这里返回的结果必然是这个泛型,之所以query返回的结果集没有用泛型是为了更好的传递数据
  327 + @SuppressWarnings("unchecked")
  328 + List<BabyStatisticsManagerBuildSourceListQueryModel> babyStatisticsManagerBuildSourceListQueryModelList = babyStatisticsManagerFacade.babyStatisticsManagerBuildSourceList(babyStatisticsManagerBuildSourceListRequest).getData();
  329 + List<Map<String, Object>> list = new ArrayList<>();
  330 + for (BabyStatisticsManagerBuildSourceListQueryModel babyStatisticsManagerBuildSourceListQueryModel : babyStatisticsManagerBuildSourceListQueryModelList) {
  331 + Map<String, Object> map = BeanUtils.objectToObjectMap(babyStatisticsManagerBuildSourceListQueryModel);
  332 + for (String key : map.keySet()) {
  333 + if (StringUtils.isEmpty(String.valueOf(map.get(key)))) {
  334 + map.put(key, "-");
  335 + }
  336 + }
  337 + list.add(map);
  338 + }
  339 + Map<String, String> header = new LinkedHashMap<>();
  340 + header.put("lbName", "儿童来源");
  341 + header.put("buildCnt", "建档儿童数");
  342 + header.put("highRiskCnt", "高危儿童数");
  343 + header.put("highRiskPercent", "高危儿童比例");
  344 + httpServletResponse.setContentType("application/force-download");
  345 + httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + new String(("建档来源统计.xls").getBytes("UTF-8"), "ISO-8859-1"));
  346 + ExcelUtil.toExcel(httpServletResponse.getOutputStream(), list, header);
  347 + } catch (Exception e) {
  348 + ExceptionUtils.catchException(e, "babyStatisticsManagerBuildSourceListExcel异常");
  349 + }
318 350 }
319 351  
320 352 }