Commit 77fd8543710c523d520ecc4368a94055de966cc2

Authored by liquanyu
1 parent f6bb02c6e7

code update

Showing 3 changed files with 80 additions and 2 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyCheckService.java View file @ 77fd854
... ... @@ -47,7 +47,7 @@
47 47 }
48 48  
49 49 public List<BabyCheckModel> queryBabyCheckRecord(BabyCheckModelQuery query) {
50   - return babyCheckDao.queryBabyCheckRecord(query.convertToQuery().addOrder(Sort.Direction.DESC,"created"));
  50 + return babyCheckDao.queryBabyCheckRecord(query.convertToQuery().addOrder(Sort.Direction.DESC,"modified"));
51 51 }
52 52  
53 53 public List<HwModel> queryHWByHeight(Double height, Integer sex) {
platform-dal/src/main/java/com/lyms/platform/query/BabyCheckModelQuery.java View file @ 77fd854
... ... @@ -8,6 +8,8 @@
8 8 import org.bson.types.ObjectId;
9 9 import org.springframework.data.mongodb.core.query.Criteria;
10 10  
  11 +import java.lang.reflect.Array;
  12 +import java.util.Arrays;
11 13 import java.util.Date;
12 14  
13 15 /**
... ... @@ -24,6 +26,9 @@
24 26 //建档ID
25 27 private String buildId;
26 28  
  29 + //建档IDs
  30 + private String[] buildIds;
  31 +
27 32 @Override
28 33 public MongoQuery convertToQuery() {
29 34 MongoCondition condition = MongoCondition.newInstance();
... ... @@ -37,6 +42,10 @@
37 42 if(null!=buildId){
38 43 condition=condition.and("buildId", buildId, MongoOper.IS);
39 44 }
  45 + if(null!=buildIds && buildIds.length > 0){
  46 + Criteria c = Criteria.where("buildId").in(Arrays.asList(buildIds));
  47 + condition.andCondition( new MongoCondition(c));
  48 + }
40 49 return condition.toMongoQuery();
41 50 }
42 51  
... ... @@ -62,6 +71,14 @@
62 71  
63 72 public void setBuildId(String buildId) {
64 73 this.buildId = buildId;
  74 + }
  75 +
  76 + public String[] getBuildIds() {
  77 + return buildIds;
  78 + }
  79 +
  80 + public void setBuildIds(String[] buildIds) {
  81 + this.buildIds = buildIds;
65 82 }
66 83 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java View file @ 77fd854
... ... @@ -276,10 +276,27 @@
276 276 Map<String, Object> resMap = new HashMap<>();
277 277 BabyModel model = getBabyModel(id, base);
278 278  
  279 + BabyModelQuery babyQuery = new BabyModelQuery();
  280 + babyQuery.setPid(model.getPid());
  281 + babyQuery.setYn(YnEnums.YES.getId());
  282 +
279 283 List<Map<String, String>> list = new ArrayList<>();
280 284  
281   - getBabyCheckList(id, model, list);
  285 + //查询儿童的基本信息
  286 + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery);
282 287  
  288 + if (CollectionUtils.isNotEmpty(models)) {
  289 + int len = models.size();
  290 + String[] buildIds = new String[len];
  291 + for(int i = 0;i < len ; i++)
  292 + {
  293 + buildIds[i] = models.get(i).getId();
  294 + }
  295 +
  296 + getBabyCheckList(buildIds, model, list);
  297 + }
  298 +
  299 +
283 300 resMap.put("baseInfo", base);
284 301 resMap.put("checkList", list);
285 302 br.setData(resMap);
... ... @@ -288,6 +305,50 @@
288 305  
289 306 return br;
290 307 }
  308 +
  309 + public void getBabyCheckList(String[] ids, BabyModel model, List<Map<String, String>> list) {
  310 + List<BabyCheckModel> checkModels;
  311 + if (model != null) {
  312 + BabyCheckModelQuery query = new BabyCheckModelQuery();
  313 + query.setYn(YnEnums.YES.getId());
  314 + query.setBuildIds(ids);
  315 + //查询儿童的检查记录
  316 + checkModels = babyCheckService.queryBabyCheckRecord(query);
  317 + Date babyBirth = model.getBirth();
  318 + if (CollectionUtils.isNotEmpty(checkModels))
  319 + {
  320 +
  321 + for (BabyCheckModel cmodel : checkModels) {
  322 + Map<String, String> checkRecord = new HashMap<>();
  323 + Date checkDate = cmodel.getCheckDate();
  324 + String monthAge = "";
  325 + if(babyBirth != null && checkDate != null)
  326 + {
  327 + monthAge = DateUtil.getBabyMonthAge(babyBirth, checkDate);
  328 + }
  329 + checkRecord.put("parentId",cmodel.getBuildId());
  330 + checkRecord.put("id", cmodel.getId());
  331 + checkRecord.put("checkDate", DateUtil.getyyyy_MM_dd(checkDate));
  332 + checkRecord.put("monthAge", monthAge);
  333 + checkRecord.put("buildId", cmodel.getBuildId());
  334 + checkRecord.put("type","2");
  335 +
  336 + checkRecord.put("hospitalId",model.getHospitalId());
  337 + //查询建档医院
  338 + Organization org = organizationService.getOrganization(Integer.valueOf(model.getHospitalId()));
  339 + if (org != null) {
  340 + checkRecord.put("hospitalName", org.getName());
  341 + } else {
  342 + checkRecord.put("hospitalName", "");
  343 + }
  344 + list.add(checkRecord);
  345 + }
  346 +
  347 + Collections.reverse(list);
  348 + }
  349 + }
  350 + }
  351 +
291 352  
292 353 public void getBabyCheckList(String id, BabyModel model, List<Map<String, String>> list) {
293 354 List<BabyCheckModel> checkModels;