From d6034626b23282bba349002149051c489fedf0f1 Mon Sep 17 00:00:00 2001 From: shiyang <316555390@qq.com> Date: Wed, 24 Nov 2021 10:51:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=86=E5=8C=96=E5=84=BF=E4=BF=9D-=E5=84=BF?= =?UTF-8?q?=E7=AB=A5=E5=81=A5=E5=BA=B7=E6=A3=80=E6=9F=A5=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=95=B4=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/BabyHealthController.java | 8 +-- .../operate/web/facade/BabyHealthFacade.java | 76 +++++++++------------- 2 files changed, 35 insertions(+), 49 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyHealthController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyHealthController.java index e89d751..cedbe49 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyHealthController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyHealthController.java @@ -145,16 +145,14 @@ public class BabyHealthController extends BaseController { /** * 儿童健康检查记录表 - * @param id - * @param monthAge + * @param id //儿童档案id * @return */ @ResponseBody @TokenRequired @RequestMapping(value = "/baby/check/chkRecordLst", method = RequestMethod.GET) - public BaseResponse chkRecordLst(@RequestParam(value = "id", required = false) String id, - @RequestParam(value = "monthAge", required = false) Integer monthAge, HttpServletRequest request) { - return babyHealthFacade.chkRecordLst(id,monthAge); + public BaseResponse chkRecordLst(String id) { + return babyHealthFacade.chkRecordLst(id); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyHealthFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyHealthFacade.java index a305d62..1f17d44 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyHealthFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyHealthFacade.java @@ -36,6 +36,7 @@ import jxl.write.WritableWorkbook; import org.apache.commons.beanutils.BeanMap; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; import org.springframework.data.domain.Sort; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.aggregation.Aggregation; @@ -1006,55 +1007,42 @@ public class BabyHealthFacade extends BaseServiceImpl { * @param checkMonthAge * @return */ - public BaseResponse chkRecordLst(String id, Integer monthAge) { - List> rest = new ArrayList>(); - - Criteria criteriaCheck = Criteria.where("buildId").in(id); - criteriaCheck.and("tcType").is(monthAge);//查询的是检查套餐 + public BaseResponse chkRecordLst(String id) { + List lst=new ArrayList<>(); + Map rsMap = new HashMap<>(); + //儿童建档信息 + BabyModel babyModel = mongoTemplate.findOne(new Query(Criteria.where("_id").in(id)).with(new Sort(Sort.Direction.DESC, "created")), BabyModel.class); + Map rsBabyModel = new HashMap<>(); + rsBabyModel.put("name", babyModel.getName()); + rsBabyModel.put("sex", babyModel.getSex()); + rsBabyModel.put("birth", babyModel.getBirth()); + rsBabyModel.put("cardId", babyModel.getCardId()); + String liveAddress = CommonsHelper.getResidence(babyModel.getProvinceId(), babyModel.getCityId(), + babyModel.getAreaId(), babyModel.getStreetId(), babyModel.getAddress(), basicConfigService); + rsBabyModel.put("address", liveAddress); + rsBabyModel.put("communityId", babyModel.getCommunityId());//社区id。 + rsBabyModel.put("fname", babyModel.getFname()); + rsBabyModel.put("fphone", babyModel.getFphone()); + rsBabyModel.put("mname", babyModel.getMname()); + rsBabyModel.put("mphone", babyModel.getMphone()); + rsMap.put("babyModel",rsBabyModel); + //儿保检查所有检查记录 + Criteria criteriaCheck = Criteria.where("buildId").is(id); List babyCheckModelList = mongoTemplate.find(new Query(criteriaCheck).with(new Sort(Sort.Direction.DESC, "created")), BabyCheckModel.class); if(CollectionUtils.isEmpty(babyCheckModelList)){ return RespBuilder.buildSuccess(null); } - List babyEyeCheckList = mongoTemplate.find(new Query(criteriaCheck).with(new Sort(Sort.Direction.DESC, "created")), BabyEyeCheck.class); - - BabyModel babyModel=mongoTemplate.findOne(new Query( Criteria.where("_id").in(id)).with(new Sort(Sort.Direction.DESC, "created")), BabyModel.class); - - Map rs=new HashMap<>(); - Date birthDate=new Date(); - - rs.putAll(new BeanMap(babyModel)); - if(babyCheckModelList.size()>0){ - BabyCheckModel checkModel=babyCheckModelList.get(0); - checkModel.getBirth(); - - rs.putAll(new BeanMap(checkModel)); - rs.put("checkDate",DateUtil.getyyyy_MM_dd(checkModel.getCheckDate())); - } - - if(babyEyeCheckList.size()>0){//眼检查 - BabyEyeCheck checkModel=babyEyeCheckList.get(0); - - rs.putAll(new BeanMap(checkModel)); + for (BabyCheckModel babyCheckModel : babyCheckModelList) { + Map rs = new HashMap<>(); + //儿保检查数据 + rs.put("babyCheckModel",new BeanMap(babyCheckModel)); + //新生儿访视模型 + BabyVisitModel babyVisitModel = mongoTemplate.findOne(new Query(Criteria.where("parentid").is(id).and("created").is(DateUtil.addMonth(new Date(), babyCheckModel.getTcType()))).with(new Sort(Sort.Direction.DESC, "created")), BabyVisitModel.class); + rs.put("babyVisitModel",new BeanMap(babyVisitModel)); + lst.add(rs); } - - BabyPatientExtendEarScreenQuery query = new BabyPatientExtendEarScreenQuery();//耳筛 - query.setScreenDate(DateUtil.addMonth(birthDate,monthAge)); - List babyPatientExtendEarScreens = babyPatientExtendEarScreenService.queryBabyPatientExtendEarScreen(query); - if(babyPatientExtendEarScreens.size()>0){ - rs.putAll(new BeanMap(babyPatientExtendEarScreens.get(0))); - } - -// 新生儿访视模型 - - - BabyVisitModel babyVisitModel=mongoTemplate.findOne(new Query( Criteria.where("parentid").in(id).and("created").is(DateUtil.addMonth(birthDate,monthAge))).with(new Sort(Sort.Direction.DESC, "created")), BabyVisitModel.class); - - rs.put("birth",DateUtil.getyyyy_MM_dd(babyModel.getBirth())); - rs.putAll(new BeanMap(babyVisitModel)); - - List lst=new ArrayList<>(); - lst.add(rs); - return RespBuilder.buildSuccess(lst); + rsMap.put("checkModel",lst); + return RespBuilder.buildSuccess(rsMap); } -- 1.8.3.1