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());