Commit 5054240e9bf8362eb2af39332b47815242528c6b

Authored by liquanyu
1 parent eecd63b3db

code update

Showing 3 changed files with 52 additions and 2 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyCheckDaoImpl.java View file @ 5054240
... ... @@ -42,8 +42,8 @@
42 42 public List<BabyCheckModel> queryLastCheck(List<String> ids) {
43 43  
44 44 AggregationOperation match = Aggregation.match(Criteria.where("buildId").in(ids).and("yn").is(1));
45   - AggregationOperation group = Aggregation.group("_id","diagnose").max("modified").as("modified");
46   - AggregationOperation fields = Aggregation.project("_id", "diagnose");
  45 + AggregationOperation group = Aggregation.group("_id","highRisk").max("created").as("created");
  46 + AggregationOperation fields = Aggregation.project("_id", "highRisk");
47 47 Aggregation aggregation = Aggregation.newAggregation(match, group,fields);
48 48 AggregationResults<BabyCheckModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_babycheck", BabyCheckModel.class);
49 49 return result.getMappedResults();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java View file @ 5054240
... ... @@ -445,6 +445,7 @@
445 445 List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery);
446 446 if (models != null && models.size() > 0) {
447 447 model = models.get(0);
  448 + base.setBabyLastHighRisk(getBabyLastHighRisk(model.getPid()));
448 449 base.setId(id);
449 450 base.setSex(model.getSex());
450 451 base.setName(model.getName());
... ... @@ -515,6 +516,46 @@
515 516 }
516 517 return model;
517 518 }
  519 +
  520 +
  521 + /**
  522 + * 获取儿童最后一次是否高危
  523 + * @param pid
  524 + * @return
  525 + */
  526 + public Integer getBabyLastHighRisk(String pid)
  527 + {
  528 + Integer highRisk = null;
  529 + List<String> ids = new ArrayList<>();
  530 + BabyModelQuery babyQuery = new BabyModelQuery();
  531 + babyQuery.setPid(pid);
  532 + babyQuery.setYn(YnEnums.YES.getId());
  533 + //查询儿童的基本信息
  534 + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery,"created", Sort.Direction.DESC);
  535 + if (CollectionUtils.isNotEmpty(models))
  536 + {
  537 + for(BabyModel model : models)
  538 + {
  539 + ids.add(model.getId());
  540 + }
  541 + if (CollectionUtils.isNotEmpty(ids))
  542 + {
  543 + List<BabyCheckModel> checkModels = babyCheckService.queryLastCheck(ids);
  544 + if (CollectionUtils.isNotEmpty(checkModels) && checkModels.get(0) != null)
  545 + {
  546 + highRisk = checkModels.get(0).getHighRisk();
  547 + }
  548 + else
  549 + {
  550 + highRisk = models.get(0).getHighRisk();
  551 + }
  552 + }
  553 +
  554 + }
  555 +
  556 + return highRisk;
  557 + }
  558 +
518 559  
519 560 /**
520 561 * 查询孕妇最后一次检查的高危因素 全院
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyBasicResult.java View file @ 5054240
... ... @@ -32,7 +32,16 @@
32 32 private String vcCardNo;
33 33 //母亲身份证号
34 34 private String cardNo;
  35 + //是否高危儿童 0 非高危 1高危
  36 + private Integer babyLastHighRisk;
35 37  
  38 + public Integer getBabyLastHighRisk() {
  39 + return babyLastHighRisk;
  40 + }
  41 +
  42 + public void setBabyLastHighRisk(Integer babyLastHighRisk) {
  43 + this.babyLastHighRisk = babyLastHighRisk;
  44 + }
36 45  
37 46 public String getCardNo() {
38 47 return cardNo;