From 50bac61d5ddfb02abf432e151c5335566364728f Mon Sep 17 00:00:00 2001 From: wangbo <184677810@qq.com> Date: Thu, 6 Jun 2019 16:43:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E4=BF=AE=E6=94=B9=E4=B8=8B?= =?UTF-8?q?=E6=AC=A1=E6=A3=80=E6=9F=A5=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/web/facade/AntExRecordFacade.java | 66 +++++++++++++++++++++- .../operate/web/facade/BabyCheckFacade.java | 4 -- 2 files changed, 65 insertions(+), 5 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java index fa40569..691d8e8 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java @@ -875,7 +875,7 @@ public class AntExRecordFacade { WxMeasureInfoModel wxMeasureInfo = new WxMeasureInfoModel(); if (StringUtils.isNotEmpty(pid) && StringUtils.isNotEmpty(hospitalId)) { List listMap = new ArrayList<>(); - Map yumInfosMap = new HashMap<>(); + Map yumInfosMap = new LinkedHashMap<>(); yumInfosMap.put("inputTime", DateUtil.getyyyy_MM_dd(new Date())); yumInfosMap.put("fuh", fuh); yumInfosMap.put("abdominalGirth", abdominalGirth); @@ -889,6 +889,7 @@ public class AntExRecordFacade { wxMeasureInfo.setCreateTime(new Date()); wxMeasureInfo.setPid(pid); wxMeasureInfo.setHospitalId(hospitalId); + this.updateNexCheckTime(pid, yumInfosMap.get("nextTime").toString()); mongoTemplate.insert(wxMeasureInfo); } else { WxMeasureInfoModel wxMeasureInfoModel = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("type").is("1")), WxMeasureInfoModel.class); @@ -899,6 +900,19 @@ public class AntExRecordFacade { String inputTime = map.get("inputTime").toString(); String currentTime = DateUtil.getyyyy_MM_dd(new Date()); if (currentTime.equals(inputTime)) { + if (null == yumInfosMap.get("fuh") || "" == yumInfosMap.get("fuh")) { + yumInfosMap.put("fuh", map.get("fuh")); + } + if (null == yumInfosMap.get("abdominalGirth") || "" == yumInfosMap.get("abdominalGirth")) { + yumInfosMap.put("abdominalGirth", map.get("abdominalGirth")); + } + if (null == yumInfosMap.get("fhr") || "" == yumInfosMap.get("fhr")) { + yumInfosMap.put("fhr", map.get("fhr")); + } + if (null == yumInfosMap.get("nextTime") || "" == yumInfosMap.get("nextTime")) { + yumInfosMap.put("nextTime", map.get("nextTime")); + } + this.updateNexCheckTime(pid, yumInfosMap.get("nextTime").toString()); exist = true; map.putAll(yumInfosMap); break; @@ -948,4 +962,54 @@ public class AntExRecordFacade { } + public void updateNexCheckTime(String pid, String nexCheckTime) { + List antenatalExaminationModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid)), AntenatalExaminationModel.class); + //1.先查询复诊是否为空 + List list2 = new ArrayList(); + if (antenatalExaminationModels != null && antenatalExaminationModels.size() > 0) { + //排序 + Collections.sort(antenatalExaminationModels, new Comparator() { + @Override + public int compare(AntenatalExaminationModel arg0, AntenatalExaminationModel arg1) { + int mark = 1; + try { + Date date0 = arg0.getModified(); + Date date1 = arg1.getModified(); + if (date0.getTime() > date1.getTime()) { + mark = -1; + } + if (date0.equals(date1)) { + mark = 0; + } + } catch (Exception e) { + e.printStackTrace(); + + } + return mark; + + } + }); + //获取排序后对象中的第一条数据 + AntenatalExaminationModel examinationModels = antenatalExaminationModels.get(0); + if (null != examinationModels) { + //萌萌提的需求 任意用户修改下次检查时间 + examinationModels.setNextCheckTime(DateUtil.parseYMD(nexCheckTime)); + Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(examinationModels)); + mongoTemplate.updateFirst(Query.query(Criteria.where("_id").is(examinationModels.getId())), update, AntenatalExaminationModel.class); + } + + } else { + //获取初诊 + AntExChuModel antExChuModel = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid)), AntExChuModel.class); + if (null != antExChuModel) { + //萌萌提的需求 任意用户修改下次检查时间 + antExChuModel.setNextCheckTime(DateUtil.parseYMD(nexCheckTime)); + Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(antExChuModel)); + mongoTemplate.updateFirst(Query.query(Criteria.where("_id").is(antExChuModel.getId())), update, AntExChuModel.class); + + } + } + } + + } \ No newline at end of file diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java index 3e7470c..ec96ded 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java @@ -782,17 +782,13 @@ public class BabyCheckFacade { Map checkRecord = new HashMap<>(); Date checkDate = cmodel.getCheckDate(); String monthAge = ""; - int month = 0; if (babyBirth != null && checkDate != null) { monthAge = DateUtil.getBabyMonthAge(babyBirth, checkDate); - month = DateUtil.getMonth(babyBirth, new Date()); } - checkRecord.put("parentId", cmodel.getBuildId()); checkRecord.put("id", cmodel.getId()); checkRecord.put("checkDate", DateUtil.getyyyy_MM_dd(checkDate)); checkRecord.put("monthAge", monthAge); - checkRecord.put("month", String.valueOf(month)); checkRecord.put("buildId", cmodel.getBuildId()); checkRecord.put("type", "2"); //根据规则完善儿保套餐(处理老数据,没有儿保月龄套餐) -- 1.8.3.1