From 573187da1b8c568fdc1e980629cc3c8f342565f1 Mon Sep 17 00:00:00 2001 From: "litao@lymsh.com" Date: Wed, 27 Sep 2017 19:07:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/lyms/platform/common/utils/DateUtil.java | 2 +- .../platform/operate/web/service/impl/PatientWeightServiceImpl.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java b/platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java index f5a386f..698f081 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java +++ b/platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java @@ -1190,7 +1190,7 @@ public class DateUtil { * 主要用于年龄查询 * Date start = DateUtil.getBeforeAge(age); Date end = DateUtil.getBeforeAge(age + 1); - pCriteria.and("birth").gte(end).lt(start); + pCriteria.and("birth").gte(end).lte(start); * @param age * @return */ diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java index 718d79e..e4fc9bc 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java @@ -146,7 +146,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient if(age != null) { Date start = DateUtil.getBeforeAge(age); Date end = DateUtil.getBeforeAge(age + 1); - pCriteria.and("birth").gte(end).lt(start); + pCriteria.and("birth").gte(end).lte(start); } List patients = mongoTemplate.find(Query.query(pCriteria), Patients.class); List ids = new ArrayList<>(); @@ -973,6 +973,9 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient * 获取两个体重之间相差的数值 */ private Double getDiff(String before, String now) { + if(StringUtils.isEmpty(before) || StringUtils.isEmpty(now)) { + return 0D; + } Double b = Double.parseDouble(before); Double n = Double.parseDouble(now); return MathUtil.doubleFormat2(n - b); -- 1.8.3.1