Commit d6034626b23282bba349002149051c489fedf0f1

Authored by shiyang
1 parent d1f2552fc0

隆化儿保-儿童健康检查记录重新整理。

Showing 2 changed files with 35 additions and 49 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyHealthController.java View file @ d603462
... ... @@ -145,16 +145,14 @@
145 145  
146 146 /**
147 147 * 儿童健康检查记录表
148   - * @param id
149   - * @param monthAge
  148 + * @param id //儿童档案id
150 149 * @return
151 150 */
152 151 @ResponseBody
153 152 @TokenRequired
154 153 @RequestMapping(value = "/baby/check/chkRecordLst", method = RequestMethod.GET)
155   - public BaseResponse chkRecordLst(@RequestParam(value = "id", required = false) String id,
156   - @RequestParam(value = "monthAge", required = false) Integer monthAge, HttpServletRequest request) {
157   - return babyHealthFacade.chkRecordLst(id,monthAge);
  154 + public BaseResponse chkRecordLst(String id) {
  155 + return babyHealthFacade.chkRecordLst(id);
158 156 }
159 157  
160 158  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyHealthFacade.java View file @ d603462
... ... @@ -36,6 +36,7 @@
36 36 import org.apache.commons.beanutils.BeanMap;
37 37 import org.springframework.beans.factory.annotation.Autowired;
38 38 import org.springframework.beans.factory.annotation.Qualifier;
  39 +import org.springframework.context.annotation.Bean;
39 40 import org.springframework.data.domain.Sort;
40 41 import org.springframework.data.mongodb.core.MongoTemplate;
41 42 import org.springframework.data.mongodb.core.aggregation.Aggregation;
42 43  
43 44  
... ... @@ -1006,55 +1007,42 @@
1006 1007 * @param checkMonthAge
1007 1008 * @return
1008 1009 */
1009   - public BaseResponse chkRecordLst(String id, Integer monthAge) {
1010   - List<Map<String, Object>> rest = new ArrayList<Map<String, Object>>();
1011   -
1012   - Criteria criteriaCheck = Criteria.where("buildId").in(id);
1013   - criteriaCheck.and("tcType").is(monthAge);//查询的是检查套餐
  1010 + public BaseResponse chkRecordLst(String id) {
  1011 + List<Map> lst=new ArrayList<>();
  1012 + Map<String, Object> rsMap = new HashMap<>();
  1013 + //儿童建档信息
  1014 + BabyModel babyModel = mongoTemplate.findOne(new Query(Criteria.where("_id").in(id)).with(new Sort(Sort.Direction.DESC, "created")), BabyModel.class);
  1015 + Map<String, Object> rsBabyModel = new HashMap<>();
  1016 + rsBabyModel.put("name", babyModel.getName());
  1017 + rsBabyModel.put("sex", babyModel.getSex());
  1018 + rsBabyModel.put("birth", babyModel.getBirth());
  1019 + rsBabyModel.put("cardId", babyModel.getCardId());
  1020 + String liveAddress = CommonsHelper.getResidence(babyModel.getProvinceId(), babyModel.getCityId(),
  1021 + babyModel.getAreaId(), babyModel.getStreetId(), babyModel.getAddress(), basicConfigService);
  1022 + rsBabyModel.put("address", liveAddress);
  1023 + rsBabyModel.put("communityId", babyModel.getCommunityId());//社区id。
  1024 + rsBabyModel.put("fname", babyModel.getFname());
  1025 + rsBabyModel.put("fphone", babyModel.getFphone());
  1026 + rsBabyModel.put("mname", babyModel.getMname());
  1027 + rsBabyModel.put("mphone", babyModel.getMphone());
  1028 + rsMap.put("babyModel",rsBabyModel);
  1029 + //儿保检查所有检查记录
  1030 + Criteria criteriaCheck = Criteria.where("buildId").is(id);
1014 1031 List<BabyCheckModel> babyCheckModelList = mongoTemplate.find(new Query(criteriaCheck).with(new Sort(Sort.Direction.DESC, "created")), BabyCheckModel.class);
1015 1032 if(CollectionUtils.isEmpty(babyCheckModelList)){
1016 1033 return RespBuilder.buildSuccess(null);
1017 1034 }
1018   - List<BabyEyeCheck> babyEyeCheckList = mongoTemplate.find(new Query(criteriaCheck).with(new Sort(Sort.Direction.DESC, "created")), BabyEyeCheck.class);
1019   -
1020   - BabyModel babyModel=mongoTemplate.findOne(new Query( Criteria.where("_id").in(id)).with(new Sort(Sort.Direction.DESC, "created")), BabyModel.class);
1021   -
1022   - Map<String,Object> rs=new HashMap<>();
1023   - Date birthDate=new Date();
1024   -
1025   - rs.putAll(new BeanMap(babyModel));
1026   - if(babyCheckModelList.size()>0){
1027   - BabyCheckModel checkModel=babyCheckModelList.get(0);
1028   - checkModel.getBirth();
1029   -
1030   - rs.putAll(new BeanMap(checkModel));
1031   - rs.put("checkDate",DateUtil.getyyyy_MM_dd(checkModel.getCheckDate()));
  1035 + for (BabyCheckModel babyCheckModel : babyCheckModelList) {
  1036 + Map<String, Object> rs = new HashMap<>();
  1037 + //儿保检查数据
  1038 + rs.put("babyCheckModel",new BeanMap(babyCheckModel));
  1039 + //新生儿访视模型
  1040 + 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);
  1041 + rs.put("babyVisitModel",new BeanMap(babyVisitModel));
  1042 + lst.add(rs);
1032 1043 }
1033   -
1034   - if(babyEyeCheckList.size()>0){//眼检查
1035   - BabyEyeCheck checkModel=babyEyeCheckList.get(0);
1036   -
1037   - rs.putAll(new BeanMap(checkModel));
1038   - }
1039   -
1040   - BabyPatientExtendEarScreenQuery query = new BabyPatientExtendEarScreenQuery();//耳筛
1041   - query.setScreenDate(DateUtil.addMonth(birthDate,monthAge));
1042   - List<BabyPatientExtendEarScreen> babyPatientExtendEarScreens = babyPatientExtendEarScreenService.queryBabyPatientExtendEarScreen(query);
1043   - if(babyPatientExtendEarScreens.size()>0){
1044   - rs.putAll(new BeanMap(babyPatientExtendEarScreens.get(0)));
1045   - }
1046   -
1047   -// 新生儿访视模型
1048   -
1049   -
1050   - 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);
1051   -
1052   - rs.put("birth",DateUtil.getyyyy_MM_dd(babyModel.getBirth()));
1053   - rs.putAll(new BeanMap(babyVisitModel));
1054   -
1055   - List<Map> lst=new ArrayList<>();
1056   - lst.add(rs);
1057   - return RespBuilder.buildSuccess(lst);
  1044 + rsMap.put("checkModel",lst);
  1045 + return RespBuilder.buildSuccess(rsMap);
1058 1046 }
1059 1047  
1060 1048