From 2ffa98d2e3bf58d8935975bce980f93945de688a Mon Sep 17 00:00:00 2001 From: dongqin <123456> Date: Tue, 30 Jul 2019 11:08:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/BabyEvaluationCriterionServiceImpl.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java index 1a523e8..1a3582a 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java @@ -285,6 +285,8 @@ public class BabyEvaluationCriterionServiceImpl implements BabyEvaluationCriteri List models = mongoTemplate.find(Query.query(Criteria.where("babyId").is(babyId).and("hospitalId").is(hospitalId).and("yn").is(YnEnums.YES.getId())). with(new Sort(new Sort.Order(Sort.Direction.ASC, "createTime"))), BabyNeuroPsychologicalModel.class); List objectList = new ArrayList<>(); + Integer checkMonth = null; + String checkMonthStr = ""; if (CollectionUtils.isNotEmpty(models)) { // 若该儿童做过该项检查,一次查出 @@ -295,6 +297,12 @@ public class BabyEvaluationCriterionServiceImpl implements BabyEvaluationCriteri return itemListByBabyId; } Map objectMap = (Map) itemListByBabyId.getObject(); + objectMap.put("checkTimeStr", DateUtil.getyyyy_MM_dd(model.getCreateTime())); + BabyModel babyModel = mongoTemplate.findOne(Query.query(Criteria.where("id").is(babyId)), BabyModel.class); + if (babyModel != null) { + checkMonthStr = DateUtil.getBabyMonthAge(babyModel.getBirth(), model.getCreateTime()); + } + objectMap.put("checkMonth", checkMonthStr); objectList.add(objectMap); } @@ -303,7 +311,9 @@ public class BabyEvaluationCriterionServiceImpl implements BabyEvaluationCriteri } else { // 根据当前儿童显示项目领域的配置信息,以供save - Map objectMap = (Map) getItemListByBabyId(babyId, null).getObject(); + Map objectMap = (Map) getItemListByBabyId(babyId, checkMonth).getObject(); + objectMap.put("checkTimeStr", ""); + objectMap.put("checkMonth", checkMonthStr); objectList.add(objectMap); baseResponse.setObject(objectList); return baseResponse; @@ -336,8 +346,9 @@ public class BabyEvaluationCriterionServiceImpl implements BabyEvaluationCriteri // 更新 update(userId, configId, id); } else { - BabyNeuroPsychologicalModel model = mongoTemplate.findOne(Query.query(Criteria.where("babyId").is(babyId).and("checkMonth").is(checkMonth).and("yn").is(YnEnums.YES.getId())), - BabyNeuroPsychologicalModel.class); + + BabyNeuroPsychologicalModel model = mongoTemplate.findOne(Query.query(Criteria.where("babyId").is(babyId).and("createTime") + .gte(DateUtil.getDayFirstSecond(new Date())).lte(DateUtil.getDayLastSecond(new Date())).and("yn").is(YnEnums.YES.getId())), BabyNeuroPsychologicalModel.class); if (model != null) { // 更新 update(userId, configId, model.getId()); -- 1.8.3.1