Ver código fonte

时间优化2

wangfeng 5 anos atrás
pai
commit
89e6bfe55a

+ 10 - 4
mrman-service/src/main/java/com/diagbot/facade/StdBehospitalInfoFacade.java

@@ -52,10 +52,16 @@ public class StdBehospitalInfoFacade extends StdBehospitalInfoServiceImpl {
     BehospitalInfoHystrixClient behospitalInfoHystrixClient;
 
     public IPage<SthospitalInfoPageDTO> getSthospitalInfoPages(SthospitalInfoPageVO sthospitalInfoPageVO) {
-       Date startDate = sthospitalInfoPageVO.getLeaveHosDateStart();
-        Date endDate = sthospitalInfoPageVO.getLeaveHosDateEnd();
-        if (endDate.getTime() < startDate.getTime()) {
-            throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+        if (null != sthospitalInfoPageVO && null != sthospitalInfoPageVO.getLeaveHosDateStart()) {
+            sthospitalInfoPageVO.setLeaveHosDateStart(DateUtil.getFirstTimeOfDay(sthospitalInfoPageVO.getLeaveHosDateStart()));
+        }
+        if (null != sthospitalInfoPageVO && null != sthospitalInfoPageVO.getLeaveHosDateEnd()) {
+            sthospitalInfoPageVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(sthospitalInfoPageVO.getLeaveHosDateEnd(), 1)));
+        }
+        if (null != sthospitalInfoPageVO && null != sthospitalInfoPageVO.getLeaveHosDateStart() && null != sthospitalInfoPageVO.getLeaveHosDateEnd()) {
+            if (DateUtil.after(sthospitalInfoPageVO.getLeaveHosDateStart(), sthospitalInfoPageVO.getLeaveHosDateEnd())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "入院时间的开始时间必须小于结束时间!");
+            }
         }
         return stdBehospitalInfoService.getStdPage(sthospitalInfoPageVO);
     }