Commit 50bac61d5ddfb02abf432e151c5335566364728f

Authored by wangbo
1 parent 2d06c826ec

小程修改下次检查时间

Showing 2 changed files with 65 additions and 5 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java View file @ 50bac61
... ... @@ -875,7 +875,7 @@
875 875 WxMeasureInfoModel wxMeasureInfo = new WxMeasureInfoModel();
876 876 if (StringUtils.isNotEmpty(pid) && StringUtils.isNotEmpty(hospitalId)) {
877 877 List<Map> listMap = new ArrayList<>();
878   - Map<String, Object> yumInfosMap = new HashMap<>();
  878 + Map<String, Object> yumInfosMap = new LinkedHashMap<>();
879 879 yumInfosMap.put("inputTime", DateUtil.getyyyy_MM_dd(new Date()));
880 880 yumInfosMap.put("fuh", fuh);
881 881 yumInfosMap.put("abdominalGirth", abdominalGirth);
... ... @@ -889,6 +889,7 @@
889 889 wxMeasureInfo.setCreateTime(new Date());
890 890 wxMeasureInfo.setPid(pid);
891 891 wxMeasureInfo.setHospitalId(hospitalId);
  892 + this.updateNexCheckTime(pid, yumInfosMap.get("nextTime").toString());
892 893 mongoTemplate.insert(wxMeasureInfo);
893 894 } else {
894 895 WxMeasureInfoModel wxMeasureInfoModel = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("type").is("1")), WxMeasureInfoModel.class);
... ... @@ -899,6 +900,19 @@
899 900 String inputTime = map.get("inputTime").toString();
900 901 String currentTime = DateUtil.getyyyy_MM_dd(new Date());
901 902 if (currentTime.equals(inputTime)) {
  903 + if (null == yumInfosMap.get("fuh") || "" == yumInfosMap.get("fuh")) {
  904 + yumInfosMap.put("fuh", map.get("fuh"));
  905 + }
  906 + if (null == yumInfosMap.get("abdominalGirth") || "" == yumInfosMap.get("abdominalGirth")) {
  907 + yumInfosMap.put("abdominalGirth", map.get("abdominalGirth"));
  908 + }
  909 + if (null == yumInfosMap.get("fhr") || "" == yumInfosMap.get("fhr")) {
  910 + yumInfosMap.put("fhr", map.get("fhr"));
  911 + }
  912 + if (null == yumInfosMap.get("nextTime") || "" == yumInfosMap.get("nextTime")) {
  913 + yumInfosMap.put("nextTime", map.get("nextTime"));
  914 + }
  915 + this.updateNexCheckTime(pid, yumInfosMap.get("nextTime").toString());
902 916 exist = true;
903 917 map.putAll(yumInfosMap);
904 918 break;
... ... @@ -945,6 +959,56 @@
945 959 }
946 960 }
947 961 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setData("").setErrormsg("成功");
  962 + }
  963 +
  964 +
  965 + public void updateNexCheckTime(String pid, String nexCheckTime) {
  966 + List<AntenatalExaminationModel> antenatalExaminationModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid)), AntenatalExaminationModel.class);
  967 + //1.先查询复诊是否为空
  968 + List<Map> list2 = new ArrayList();
  969 + if (antenatalExaminationModels != null && antenatalExaminationModels.size() > 0) {
  970 + //排序
  971 + Collections.sort(antenatalExaminationModels, new Comparator<AntenatalExaminationModel>() {
  972 + @Override
  973 + public int compare(AntenatalExaminationModel arg0, AntenatalExaminationModel arg1) {
  974 + int mark = 1;
  975 + try {
  976 + Date date0 = arg0.getModified();
  977 + Date date1 = arg1.getModified();
  978 + if (date0.getTime() > date1.getTime()) {
  979 + mark = -1;
  980 + }
  981 + if (date0.equals(date1)) {
  982 + mark = 0;
  983 + }
  984 + } catch (Exception e) {
  985 + e.printStackTrace();
  986 +
  987 + }
  988 + return mark;
  989 +
  990 + }
  991 + });
  992 + //获取排序后对象中的第一条数据
  993 + AntenatalExaminationModel examinationModels = antenatalExaminationModels.get(0);
  994 + if (null != examinationModels) {
  995 + //萌萌提的需求 任意用户修改下次检查时间
  996 + examinationModels.setNextCheckTime(DateUtil.parseYMD(nexCheckTime));
  997 + Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(examinationModels));
  998 + mongoTemplate.updateFirst(Query.query(Criteria.where("_id").is(examinationModels.getId())), update, AntenatalExaminationModel.class);
  999 + }
  1000 +
  1001 + } else {
  1002 + //获取初诊
  1003 + AntExChuModel antExChuModel = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid)), AntExChuModel.class);
  1004 + if (null != antExChuModel) {
  1005 + //萌萌提的需求 任意用户修改下次检查时间
  1006 + antExChuModel.setNextCheckTime(DateUtil.parseYMD(nexCheckTime));
  1007 + Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(antExChuModel));
  1008 + mongoTemplate.updateFirst(Query.query(Criteria.where("_id").is(antExChuModel.getId())), update, AntExChuModel.class);
  1009 +
  1010 + }
  1011 + }
948 1012 }
949 1013  
950 1014  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java View file @ 50bac61
... ... @@ -782,17 +782,13 @@
782 782 Map<String, String> checkRecord = new HashMap<>();
783 783 Date checkDate = cmodel.getCheckDate();
784 784 String monthAge = "";
785   - int month = 0;
786 785 if (babyBirth != null && checkDate != null) {
787 786 monthAge = DateUtil.getBabyMonthAge(babyBirth, checkDate);
788   - month = DateUtil.getMonth(babyBirth, new Date());
789 787 }
790   -
791 788 checkRecord.put("parentId", cmodel.getBuildId());
792 789 checkRecord.put("id", cmodel.getId());
793 790 checkRecord.put("checkDate", DateUtil.getyyyy_MM_dd(checkDate));
794 791 checkRecord.put("monthAge", monthAge);
795   - checkRecord.put("month", String.valueOf(month));
796 792 checkRecord.put("buildId", cmodel.getBuildId());
797 793 checkRecord.put("type", "2");
798 794 //根据规则完善儿保套餐(处理老数据,没有儿保月龄套餐)