Commit 90001fa7e58348757cf8beccb731b3124c698b35

Authored by liquanyu
1 parent a8f3d41663
Exists in master

导出

Showing 2 changed files with 50 additions and 4 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java View file @ 90001fa
... ... @@ -225,7 +225,7 @@
225 225 @TokenRequired
226 226 public void exportfindRegionAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest,HttpServletRequest request,HttpServletResponse httpServletResponse){
227 227 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
228   - antExRecordFacade.exportfindRegionAntEx(antExManagerQueryRequest, loginState.getId(), true, "true", httpServletResponse);
  228 + antExRecordFacade.exportfindRegionAntEx(antExManagerQueryRequest, loginState.getId(), true, httpServletResponse);
229 229 }
230 230 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java View file @ 90001fa
... ... @@ -412,7 +412,7 @@
412 412  
413 413 public void exportFindAntEx(AntExManagerQueryRequest antExManagerQueryRequest, Integer id, boolean b,HttpServletResponse httpServletResponse) {
414 414  
415   - BaseListResponse listRep = (BaseListResponse)findList(antExManagerQueryRequest, id, b, "true");
  415 + BaseListResponse listRep = (BaseListResponse)findList(antExManagerQueryRequest, id, b, null);
416 416 List<Map<String, Object>> datas = new ArrayList<>();
417 417 try {
418 418 Map<String, Object> data = new HashMap<>();
... ... @@ -467,7 +467,6 @@
467 467 } catch (IOException e) {
468 468 e.printStackTrace();
469 469 }
470   - return null;
471 470 }
472 471  
473 472  
474 473  
... ... @@ -483,8 +482,55 @@
483 482 return str;
484 483 }
485 484  
486   - public void exportfindRegionAntEx(AntExManagerQueryRequest antExManagerQueryRequest, Integer id, boolean b, String aTrue, HttpServletResponse httpServletResponse) {
  485 + public void exportfindRegionAntEx(AntExManagerQueryRequest antExManagerQueryRequest, Integer id, boolean b, HttpServletResponse httpServletResponse) {
  486 + BaseListResponse listRep = (BaseListResponse)findList(antExManagerQueryRequest, id, b, null);
  487 + List<Map<String, Object>> datas = new ArrayList<>();
  488 + try {
  489 + Map<String, Object> data = new HashMap<>();
  490 + if (listRep != null)
  491 + {
  492 + List<AntExManagerResult> list = listRep.getData();
  493 + if (CollectionUtils.isNotEmpty(list))
  494 + {
  495 + for (AntExManagerResult aer : list)
  496 + {
  497 + data.put("checkTime",aer.getCheckTime());
  498 + data.put("barCode",aer.getBarCode());
  499 + data.put("name",aer.getName());
  500 + data.put("age",aer.getAge());
  501 + data.put("cDueWeek",aer.getcDueWeek());
  502 + data.put("rLevel",getLevel(aer.getrLevel()));
  503 + data.put("riskFactor",aer.getRiskFactor());
  504 + data.put("riskScore",aer.getRiskScore());
  505 + data.put("cTimes",aer.getcTimes());
  506 + data.put("dueDate",aer.getDueDate());
  507 + data.put("addr",aer.getAddr());
  508 + data.put("checkHospital",aer.getCheckHospital());
  509 + }
  510 + }
  511 + }
487 512  
  513 + OutputStream out = httpServletResponse.getOutputStream();
  514 + Map<String, String> cnames = new LinkedHashMap<>();
  515 + cnames.put("checkTime", "产检日期");
  516 + cnames.put("barCode", "条形码");
  517 + cnames.put("name", "姓名");
  518 + cnames.put("age", "年龄");
  519 + cnames.put("cDueWeek", "产检孕周");
  520 + cnames.put("rLevel", "高危等级");
  521 + cnames.put("riskFactor", "高危因素");
  522 + cnames.put("riskScore", "高危评分");
  523 + cnames.put("cTimes", "产检第次");
  524 + cnames.put("dueDate", "预产期");
  525 + cnames.put("addr", "居住地");
  526 + cnames.put("checkHospital", "产检医院");
  527 + httpServletResponse.setContentType("application/octet-stream");
  528 + httpServletResponse.setCharacterEncoding("UTF-8");
  529 + httpServletResponse.setHeader("Content-Disposition", "attachment;fileName=" + "data.xls");
  530 + ExcelUtil.toExcel(out, datas, cnames);
  531 + } catch (IOException e) {
  532 + e.printStackTrace();
  533 + }
488 534  
489 535 }
490 536 }