Commit 9fddec0fb42b519401c9d09fc292f9f08dd01d0e
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 2 changed files
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBuildController.java
View file @
9fddec0
... | ... | @@ -303,7 +303,7 @@ |
303 | 303 | return new BaseResponse().setErrormsg("babyid不能为空").setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); |
304 | 304 | } |
305 | 305 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
306 | - return babyBookbuildingFacade.bookBuildList(babyId,loginState.getId()); | |
306 | + return babyBookbuildingFacade.bookBuildList(babyId, loginState.getId()); | |
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
310 | 310 | |
... | ... | @@ -398,7 +398,24 @@ |
398 | 398 | @RequestParam("page") Integer page, |
399 | 399 | @RequestParam("limit") Integer limit){ |
400 | 400 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
401 | - return babyBookbuildingFacade.getBabyGrowthRightList(babyManageRequest,loginState.getId(),page,limit); | |
401 | + return babyBookbuildingFacade.getBabyGrowthRightList(babyManageRequest, loginState.getId(), page, limit,"true"); | |
402 | 402 | } |
403 | + | |
404 | + | |
405 | + /** | |
406 | + * 导出儿童生长发育统计 | |
407 | + * @param babyManageRequest | |
408 | + * @param request | |
409 | + * @param httpServletResponse | |
410 | + */ | |
411 | + @RequestMapping(value = "/exportBabyGrowthRightList", method = RequestMethod.GET) | |
412 | + @TokenRequired | |
413 | + public void exportBabyGrowthRightList(@Valid BabyManageRequest babyManageRequest,HttpServletRequest request,HttpServletResponse httpServletResponse){ | |
414 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
415 | + babyBookbuildingFacade.exportBabyGrowthRightList(babyManageRequest, loginState.getId(), httpServletResponse); | |
416 | + } | |
417 | + | |
418 | + | |
419 | + | |
403 | 420 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
9fddec0
... | ... | @@ -1815,7 +1815,7 @@ |
1815 | 1815 | String birthStr = request.getBirth(); |
1816 | 1816 | String[] dates = birthStr.split(" - "); |
1817 | 1817 | babyQuery.setBirthStart(DateUtil.parseYMD(dates[0])); |
1818 | - babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1])); | |
1818 | + babyQuery.setBirthEnd(new Date(DateUtil.parseYMD(dates[1]).getTime()+24*60*60*1000 -1 )); | |
1819 | 1819 | } |
1820 | 1820 | else if (request.getMonthAgeStart() != null && request.getMonthAgeEnd() != null) |
1821 | 1821 | { |
... | ... | @@ -2316,7 +2316,7 @@ |
2316 | 2316 | * @param userId |
2317 | 2317 | * @return |
2318 | 2318 | */ |
2319 | - public BaseResponse getBabyGrowthRightList(BabyManageRequest request, Integer userId,Integer page,Integer limit) { | |
2319 | + public BaseListResponse getBabyGrowthRightList(BabyManageRequest request, Integer userId,Integer page,Integer limit,String isPage) { | |
2320 | 2320 | String hospitalId = ""; |
2321 | 2321 | //得到当前登录的医院id |
2322 | 2322 | if (userId != null) { |
2323 | 2323 | |
... | ... | @@ -2347,10 +2347,14 @@ |
2347 | 2347 | babyQuery.setCheckMonthEnd(request.getMonthAgeEnd()); |
2348 | 2348 | } |
2349 | 2349 | |
2350 | - babyQuery.setPage(page); | |
2351 | - babyQuery.setLimit(limit); | |
2352 | - babyQuery.setNeed("true"); | |
2350 | + if (isPage != null) | |
2351 | + { | |
2352 | + babyQuery.setPage(page); | |
2353 | + babyQuery.setLimit(limit); | |
2354 | + babyQuery.setNeed(isPage); | |
2355 | + } | |
2353 | 2356 | |
2357 | + | |
2354 | 2358 | if (StringUtils.isNotEmpty(request.getItemType()) && "1".equals(request.getItemType())) |
2355 | 2359 | { |
2356 | 2360 | babyQuery.setHeightEvaluate(request.getEvaluate()); |
... | ... | @@ -2558,6 +2562,50 @@ |
2558 | 2562 | map1.put("体重",list2); |
2559 | 2563 | |
2560 | 2564 | return map1; |
2565 | + } | |
2566 | + | |
2567 | + public void exportBabyGrowthRightList(BabyManageRequest babyManageRequest, Integer userId, HttpServletResponse httpServletResponse) { | |
2568 | + BaseListResponse listRespones = getBabyGrowthRightList( babyManageRequest, userId,null,null,null); | |
2569 | + List<Map<String,Object>> results = new ArrayList<>(); | |
2570 | + try{ | |
2571 | + List<Map<String,String>> list = listRespones.getData(); | |
2572 | + if (CollectionUtils.isNotEmpty(list)) | |
2573 | + { | |
2574 | + for (Map<String,String> map : list) | |
2575 | + { | |
2576 | + Map<String,Object> result = new HashMap<>(); | |
2577 | + result.put("babyName", map.get("babyName")); //姓名 | |
2578 | + result.put("sex", map.get("sex")); //性别 | |
2579 | + result.put("age", map.get("age")); //检查月龄 | |
2580 | + result.put("birthday", map.get("birthday")); //生日 | |
2581 | + result.put("height",map.get("height")); //身长 | |
2582 | + result.put("weight", map.get("weight")); //体重 | |
2583 | + result.put("growthEvaluate",map.get("growthEvaluate")); //体格发育评价 | |
2584 | + result.put("checkDate",map.get("checkDate")); //检查日期 | |
2585 | + result.put("checkDoctor",map.get("checkDoctor"));//检查医生 | |
2586 | + results.add(result); | |
2587 | + } | |
2588 | + } | |
2589 | + | |
2590 | + OutputStream out = httpServletResponse.getOutputStream(); | |
2591 | + Map<String, String> cnames = new LinkedHashMap<>(); | |
2592 | + cnames.put("babyName", "姓名"); //姓名 | |
2593 | + cnames.put("sex", "性别"); //性别 | |
2594 | + cnames.put("age", "检查月龄"); //检查月龄 | |
2595 | + cnames.put("birthday", "出生日期"); //生日 | |
2596 | + cnames.put("height","身长"); //身长 | |
2597 | + cnames.put("weight", "体重"); //体重 | |
2598 | + cnames.put("growthEvaluate","体格发育评价"); //体格发育评价 | |
2599 | + cnames.put("checkDate","检查日期"); //检查日期 | |
2600 | + cnames.put("checkDoctor","检查医生");//检查医生 | |
2601 | + httpServletResponse.setContentType("application/octet-stream"); | |
2602 | + httpServletResponse.setCharacterEncoding("UTF-8"); | |
2603 | + httpServletResponse.setHeader("Content-Disposition", "attachment;fileName=" + "data.xls"); | |
2604 | + ExcelUtil.toExcel(out, results, cnames); | |
2605 | + } catch (IOException e) { | |
2606 | + e.printStackTrace(); | |
2607 | + ExceptionUtils.catchException(e,"儿童生长发育统计异常"); | |
2608 | + } | |
2561 | 2609 | } |
2562 | 2610 | } |