Commit 2be282c47f8f06b1cde2f26fb622a86791d9941c

Authored by litao@lymsh.com
1 parent b01039e036

改buig

Showing 4 changed files with 37 additions and 12 deletions

platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java View file @ 2be282c
... ... @@ -1077,12 +1077,38 @@
1077 1077 }
1078 1078  
1079 1079 /**
1080   - * 获取从现在到xx月之后的时间
1081   - * @param currentMonthStart
  1080 + * 获取当前时间加上xx月后的年月日时间
  1081 + * @param month
1082 1082 * @return
1083 1083 */
1084   - public static Date getMonthDate(Integer currentMonthStart) {
  1084 + public static Date getMonth(Integer month) {
  1085 + Calendar calendar = Calendar.getInstance();
  1086 + calendar.setTime(new Date());
  1087 + calendar.add(Calendar.MONTH, month);
  1088 + try {
  1089 + return ymd.parse(ymd.format(calendar.getTime()));
  1090 + } catch (ParseException e) {
  1091 + e.printStackTrace();
  1092 + }
1085 1093 return null;
1086 1094 }
  1095 +
  1096 + /**
  1097 + * 用于月龄查询
  1098 + *
  1099 + * Date start = DateUtil.getBirthStart(endMonth);
  1100 + * Date end = DateUtil.getBirthEnd(startMonth);
  1101 + * criteria.and("birth").gte(start).lt(end);
  1102 + *
  1103 + * @param end
  1104 + * @return
  1105 + */
  1106 + public static Date getBirthStart(Integer end) {
  1107 + return getMonth(-end);
  1108 + }
  1109 + public static Date getBirthEnd(Integer start) {
  1110 + return addDay(getMonth(-start), 1);
  1111 + }
  1112 +
1087 1113 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyEyeCheckController.java View file @ 2be282c
... ... @@ -93,8 +93,8 @@
93 93 @ResponseBody
94 94 @TokenRequired
95 95 @RequestMapping(value = "/export", method = RequestMethod.GET)
96   - public void export(Date startDate, Date endDate, String doctor, String key, String currentMonth, String chechMonth, boolean positive, String positiveIds, HttpServletRequest request, HttpServletResponse response) {
97   - babyEyeCheckService.export(getUserId(request), startDate, endDate, doctor, key, currentMonth, chechMonth, positive, positiveIds, response);
  96 + public void export(Date startDate, Date endDate, String doctor, String key, Integer currentMonthStart, Integer currentMonthEnd, String chechMonth, boolean positive, String positiveIds, HttpServletRequest request, HttpServletResponse response) {
  97 + babyEyeCheckService.export(getUserId(request), startDate, endDate, doctor, key, currentMonthStart, currentMonthEnd, chechMonth, positive, positiveIds, response);
98 98 }
99 99  
100 100 @ResponseBody
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/BabyEyeCheckService.java View file @ 2be282c
... ... @@ -27,6 +27,6 @@
27 27  
28 28 BaseResponse listInit();
29 29  
30   - void export(Integer userId, Date startDate, Date endDate, String doctor, String key, String currentMonth, String chechMonth, boolean positive, String positiveIds, HttpServletResponse response);
  30 + void export(Integer userId, Date startDate, Date endDate, String doctor, String key, Integer currentMonthStart, Integer currentMonthEnd, String chechMonth, boolean positive, String positiveIds, HttpServletResponse response);
31 31 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEyeCheckServiceImpl.java View file @ 2be282c
... ... @@ -274,9 +274,9 @@
274 274 criteria.and("checkMonthId").is(chechMonth);
275 275 }
276 276 if(currentMonthStart != null && currentMonthEnd != null) {
277   - Date start = DateUtil.getMonthDate(currentMonthStart);
278   - Date end = DateUtil.getMonthDate(currentMonthEnd);
279   - criteria.and("birth").gte(start).lt(DateUtil.addDay(end, 1));
  277 + Date start = DateUtil.getBirthStart(currentMonthEnd);
  278 + Date end = DateUtil.getBirthEnd(currentMonthStart);
  279 + criteria.and("birth").gte(start).lt(end);
280 280 }
281 281  
282 282 if(org.apache.commons.lang.StringUtils.isNotBlank(key)) {
... ... @@ -532,9 +532,8 @@
532 532 }
533 533  
534 534 @Override
535   - public void export(Integer userId, Date startDate, Date endDate, String doctor, String key, String currentMonth, String chechMonth, boolean positive, String positiveIds, HttpServletResponse response) {
536   -// BaseResponse rest = list(userId, startDate, endDate, doctor, key, currentMonth, chechMonth, positive, positiveIds, 1, Integer.MAX_VALUE);
537   - BaseResponse rest = null;
  535 + public void export(Integer userId, Date startDate, Date endDate, String doctor, String key, Integer currentMonthStart, Integer currentMonthEnd, String chechMonth, boolean positive, String positiveIds, HttpServletResponse response) {
  536 + BaseResponse rest = list(userId, startDate, endDate, doctor, key, currentMonthStart, currentMonthEnd, chechMonth, positive, positiveIds, 1, Integer.MAX_VALUE);
538 537 PageResult pageResult = (PageResult) rest.getObject();
539 538 List<Map<String, Object>> datas = (List<Map<String, Object>>) pageResult.getGrid();
540 539 Map<String, String> cnames = new LinkedHashMap<>();