Commit d1765b573aaeac23df079da9db6dde98f1da911d
1 parent
29553a939d
Exists in
master
儿童统计
Showing 2 changed files with 119 additions and 10 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java
View file @
d1765b5
... | ... | @@ -22,6 +22,7 @@ |
22 | 22 | import org.springframework.web.bind.annotation.ResponseBody; |
23 | 23 | |
24 | 24 | import javax.servlet.http.HttpServletRequest; |
25 | +import javax.servlet.http.HttpServletResponse; | |
25 | 26 | import javax.validation.Valid; |
26 | 27 | |
27 | 28 | /** |
28 | 29 | |
29 | 30 | |
... | ... | @@ -181,10 +182,27 @@ |
181 | 182 | @TokenRequired |
182 | 183 | public BaseResponse findAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest,HttpServletRequest request){ |
183 | 184 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
184 | - return antExRecordFacade.findList(antExManagerQueryRequest, loginState.getId(), false); | |
185 | + return antExRecordFacade.findList(antExManagerQueryRequest, loginState.getId(), false, "true"); | |
185 | 186 | } |
186 | 187 | |
188 | + | |
187 | 189 | /** |
190 | + * 导出产检管理接口 | |
191 | + * @param antExManagerQueryRequest | |
192 | + * @param request | |
193 | + * @return | |
194 | + */ | |
195 | + @RequestMapping(method = RequestMethod.GET, value = "/antex/exportAntexrecordlist") | |
196 | + @TokenRequired | |
197 | + public void exportFindAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest,HttpServletRequest request,HttpServletResponse httpServletResponse){ | |
198 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
199 | + antExRecordFacade.exportFindAntEx(antExManagerQueryRequest, loginState.getId(), false, httpServletResponse); | |
200 | + } | |
201 | + | |
202 | + | |
203 | + | |
204 | + | |
205 | + /** | |
188 | 206 | * 产检区域管理接口 |
189 | 207 | * |
190 | 208 | * @return |
... | ... | @@ -194,7 +212,20 @@ |
194 | 212 | @TokenRequired |
195 | 213 | public BaseResponse findRegionAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest,HttpServletRequest request){ |
196 | 214 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
197 | - return antExRecordFacade.findList(antExManagerQueryRequest,loginState.getId(),true); | |
215 | + return antExRecordFacade.findList(antExManagerQueryRequest, loginState.getId(), true, "true"); | |
216 | + } | |
217 | + | |
218 | + | |
219 | + /** | |
220 | + * 产检区域管理接口导出 | |
221 | + * | |
222 | + * @return | |
223 | + */ | |
224 | + @RequestMapping(method = RequestMethod.GET, value = "/antex/exportrantexrecordlist") | |
225 | + @TokenRequired | |
226 | + public void exportfindRegionAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest,HttpServletRequest request,HttpServletResponse httpServletResponse){ | |
227 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
228 | + antExRecordFacade.exportfindRegionAntEx(antExManagerQueryRequest, loginState.getId(), true, "true", httpServletResponse); | |
198 | 229 | } |
199 | 230 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
View file @
d1765b5
... | ... | @@ -6,10 +6,7 @@ |
6 | 6 | import com.lyms.platform.common.enums.YnEnums; |
7 | 7 | import com.lyms.platform.common.result.BaseListResponse; |
8 | 8 | import com.lyms.platform.common.result.BaseResponse; |
9 | -import com.lyms.platform.common.utils.DateUtil; | |
10 | -import com.lyms.platform.common.utils.ExceptionUtils; | |
11 | -import com.lyms.platform.common.utils.JsonUtil; | |
12 | -import com.lyms.platform.common.utils.StringUtils; | |
9 | +import com.lyms.platform.common.utils.*; | |
13 | 10 | import com.lyms.platform.operate.web.request.AntExManagerQueryRequest; |
14 | 11 | import com.lyms.platform.operate.web.request.CjStatisticsQueryRequest; |
15 | 12 | import com.lyms.platform.operate.web.result.AntExManagerResult; |
... | ... | @@ -30,6 +27,9 @@ |
30 | 27 | import org.springframework.data.domain.Sort; |
31 | 28 | import org.springframework.stereotype.Component; |
32 | 29 | |
30 | +import javax.servlet.http.HttpServletResponse; | |
31 | +import java.io.IOException; | |
32 | +import java.io.OutputStream; | |
33 | 33 | import java.util.*; |
34 | 34 | |
35 | 35 | /** |
36 | 36 | |
... | ... | @@ -70,10 +70,10 @@ |
70 | 70 | * @param antExManagerQueryRequest |
71 | 71 | * @param isRegion |
72 | 72 | */ |
73 | - private AntExRecordQuery complayRequest(Integer userId, AntExManagerQueryRequest antExManagerQueryRequest, boolean isRegion) { | |
73 | + private AntExRecordQuery complayRequest(Integer userId, AntExManagerQueryRequest antExManagerQueryRequest, boolean isRegion,String isPage) { | |
74 | 74 | |
75 | 75 | AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); |
76 | - antExRecordQuery.setNeed("1"); | |
76 | + antExRecordQuery.setNeed(isPage); | |
77 | 77 | antExRecordQuery.setPage(antExManagerQueryRequest.getPage()); |
78 | 78 | antExRecordQuery.setLimit(antExManagerQueryRequest.getLimit()); |
79 | 79 | antExRecordQuery.setName(antExManagerQueryRequest.getName()); |
... | ... | @@ -174,8 +174,8 @@ |
174 | 174 | * |
175 | 175 | * @return |
176 | 176 | */ |
177 | - public BaseResponse findList(AntExManagerQueryRequest antExManagerQueryRequest, Integer userId, boolean isRegion) { | |
178 | - AntExRecordQuery antExRecordQuery = complayRequest(userId, antExManagerQueryRequest, isRegion); | |
177 | + public BaseResponse findList(AntExManagerQueryRequest antExManagerQueryRequest, Integer userId, boolean isRegion,String isPage) { | |
178 | + AntExRecordQuery antExRecordQuery = complayRequest(userId, antExManagerQueryRequest, isRegion,isPage); | |
179 | 179 | String hospital = autoMatchFacade.getHospitalId(userId); |
180 | 180 | List<AntExManagerResult> data = new ArrayList<>(); |
181 | 181 | List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery); |
... | ... | @@ -408,6 +408,84 @@ |
408 | 408 | Collections.sort(data, new CjStatisticsResult()); |
409 | 409 | } |
410 | 410 | return baseListResponse.setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(antExRecordQuery.getPageInfo()); |
411 | + } | |
412 | + | |
413 | + public void exportFindAntEx(AntExManagerQueryRequest antExManagerQueryRequest, Integer id, boolean b,HttpServletResponse httpServletResponse) { | |
414 | + | |
415 | + BaseListResponse listRep = (BaseListResponse)findList(antExManagerQueryRequest, id, b, "true"); | |
416 | + List<Map<String, Object>> datas = new ArrayList<>(); | |
417 | + try { | |
418 | + Map<String, Object> data = new HashMap<>(); | |
419 | + if (listRep != null) | |
420 | + { | |
421 | + List<AntExManagerResult> list = listRep.getData(); | |
422 | + if (CollectionUtils.isNotEmpty(list)) | |
423 | + { | |
424 | + for (AntExManagerResult aer : list) | |
425 | + { | |
426 | + data.put("checkTime",aer.getCheckTime()); | |
427 | + data.put("barCode",aer.getBarCode()); | |
428 | + data.put("name",aer.getName()); | |
429 | + data.put("age",aer.getAge()); | |
430 | + data.put("cDueWeek",aer.getcDueWeek()); | |
431 | + data.put("rLevel",getLevel(aer.getrLevel())); | |
432 | + data.put("riskFactor",aer.getRiskFactor()); | |
433 | + data.put("riskScore",aer.getRiskScore()); | |
434 | + data.put("chTimes",aer.getChTimes()); | |
435 | + data.put("tTimes",aer.gettTimes()); | |
436 | + data.put("nextCheckTime",aer.getNextCheckTime()); | |
437 | + data.put("dueDate",aer.getDueDate()); | |
438 | + data.put("checkDoctor",aer.getCheckDoctor()); | |
439 | + data.put("lName",aer.getlName()); | |
440 | + data.put("phone",aer.getPhone()); | |
441 | + } | |
442 | + } | |
443 | + | |
444 | + } | |
445 | + | |
446 | + OutputStream out = httpServletResponse.getOutputStream(); | |
447 | + Map<String, String> cnames = new LinkedHashMap<>(); | |
448 | + cnames.put("checkTime", "产检日期"); | |
449 | + cnames.put("barCode", "条形码"); | |
450 | + cnames.put("name", "姓名"); | |
451 | + cnames.put("age", "年龄"); | |
452 | + cnames.put("cDueWeek", "产检孕周"); | |
453 | + cnames.put("rLevel", "高危等级"); | |
454 | + cnames.put("riskFactor", "高危因素"); | |
455 | + cnames.put("riskScore", "高危评分"); | |
456 | + cnames.put("chTimes", "本院产检次数"); | |
457 | + cnames.put("tTimes", "总产检次数"); | |
458 | + cnames.put("nextCheckTime", "预约产检日期"); | |
459 | + cnames.put("dueDate", "预产期"); | |
460 | + cnames.put("checkDoctor", "产检医生"); | |
461 | + cnames.put("lName", "登记人"); | |
462 | + cnames.put("phone", "联系电话"); | |
463 | + httpServletResponse.setContentType("application/octet-stream"); | |
464 | + httpServletResponse.setCharacterEncoding("UTF-8"); | |
465 | + httpServletResponse.setHeader("Content-Disposition", "attachment;fileName=" + "data.xls"); | |
466 | + ExcelUtil.toExcel(out, datas, cnames); | |
467 | + } catch (IOException e) { | |
468 | + e.printStackTrace(); | |
469 | + } | |
470 | + return null; | |
471 | + } | |
472 | + | |
473 | + | |
474 | + private String getLevel(List<Map> levels) { | |
475 | + | |
476 | + String str = ""; | |
477 | + if (CollectionUtils.isNotEmpty(levels)) { | |
478 | + for (Map map : levels) { | |
479 | + str += map.get("name") + ";"; | |
480 | + } | |
481 | + } | |
482 | + | |
483 | + return str; | |
484 | + } | |
485 | + | |
486 | + public void exportfindRegionAntEx(AntExManagerQueryRequest antExManagerQueryRequest, Integer id, boolean b, String aTrue, HttpServletResponse httpServletResponse) { | |
487 | + | |
488 | + | |
411 | 489 | } |
412 | 490 | } |