Commit e3c1fbcb1cf3e10cce91d0cbc06bb45cc3d49c81

Authored by jiangjiazhi

Merge remote-tracking branch 'origin/master'

Showing 4 changed files

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyBookbuildingService.java View file @ e3c1fbc
... ... @@ -46,7 +46,7 @@
46 46 babyQuery.mysqlBuild(babyBookBuildingDao.queryBabyManageCount(babyQuery.convertToQuery()));
47 47 query.start(babyQuery.getOffset()).end(babyQuery.getLimit());
48 48 }
49   - return babyBookBuildingDao.queryBabyWithQuery(query.addOrder(Sort.Direction.DESC, "modified"));
  49 + return babyBookBuildingDao.queryBabyWithQuery(query.addOrder(Sort.Direction.DESC, "created"));
50 50 }
51 51  
52 52 public List<BabyModel> queryBabyBuildByCond(BabyModelQuery babyQuery,String sortkey,Sort.Direction sort) {
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyCheckService.java View file @ e3c1fbc
... ... @@ -47,7 +47,11 @@
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 + }
  52 +
  53 + public List<BabyCheckModel> queryBabyCheckRecord(BabyCheckModelQuery query,String sortkey,Sort.Direction sort) {
  54 + return babyCheckDao.queryBabyCheckRecord(query.convertToQuery().addOrder(sort,sortkey));
51 55 }
52 56  
53 57 public List<HwModel> queryHWByHeight(Double height, Integer sex) {
platform-dal/src/main/java/com/lyms/platform/query/BabyCheckModelQuery.java View file @ e3c1fbc
... ... @@ -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 @ e3c1fbc
... ... @@ -19,6 +19,7 @@
19 19 import com.lyms.platform.query.*;
20 20 import org.apache.commons.collections.CollectionUtils;
21 21 import org.springframework.beans.factory.annotation.Autowired;
  22 +import org.springframework.data.domain.Sort;
22 23 import org.springframework.stereotype.Component;
23 24  
24 25 import java.util.*;
25 26  
26 27  
... ... @@ -276,10 +277,27 @@
276 277 Map<String, Object> resMap = new HashMap<>();
277 278 BabyModel model = getBabyModel(id, base);
278 279  
  280 + BabyModelQuery babyQuery = new BabyModelQuery();
  281 + babyQuery.setPid(model.getPid());
  282 + babyQuery.setYn(YnEnums.YES.getId());
  283 +
279 284 List<Map<String, String>> list = new ArrayList<>();
280 285  
281   - getBabyCheckList(id, model, list);
  286 + //查询儿童的基本信息
  287 + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery);
282 288  
  289 + if (CollectionUtils.isNotEmpty(models)) {
  290 + int len = models.size();
  291 + String[] buildIds = new String[len];
  292 + for(int i = 0;i < len ; i++)
  293 + {
  294 + buildIds[i] = models.get(i).getId();
  295 + }
  296 +
  297 + getBabyCheckList(buildIds, model, list);
  298 + }
  299 +
  300 +
283 301 resMap.put("baseInfo", base);
284 302 resMap.put("checkList", list);
285 303 br.setData(resMap);
... ... @@ -288,6 +306,50 @@
288 306  
289 307 return br;
290 308 }
  309 +
  310 + public void getBabyCheckList(String[] ids, BabyModel model, List<Map<String, String>> list) {
  311 + List<BabyCheckModel> checkModels;
  312 + if (model != null) {
  313 + BabyCheckModelQuery query = new BabyCheckModelQuery();
  314 + query.setYn(YnEnums.YES.getId());
  315 + query.setBuildIds(ids);
  316 + //查询儿童的检查记录
  317 + checkModels = babyCheckService.queryBabyCheckRecord(query,"checkDate", Sort.Direction.DESC);
  318 + Date babyBirth = model.getBirth();
  319 + if (CollectionUtils.isNotEmpty(checkModels))
  320 + {
  321 +
  322 + for (BabyCheckModel cmodel : checkModels) {
  323 + Map<String, String> checkRecord = new HashMap<>();
  324 + Date checkDate = cmodel.getCheckDate();
  325 + String monthAge = "";
  326 + if(babyBirth != null && checkDate != null)
  327 + {
  328 + monthAge = DateUtil.getBabyMonthAge(babyBirth, checkDate);
  329 + }
  330 + checkRecord.put("parentId",cmodel.getBuildId());
  331 + checkRecord.put("id", cmodel.getId());
  332 + checkRecord.put("checkDate", DateUtil.getyyyy_MM_dd(checkDate));
  333 + checkRecord.put("monthAge", monthAge);
  334 + checkRecord.put("buildId", cmodel.getBuildId());
  335 + checkRecord.put("type","2");
  336 +
  337 + checkRecord.put("hospitalId",model.getHospitalId());
  338 + //查询建档医院
  339 + Organization org = organizationService.getOrganization(Integer.valueOf(model.getHospitalId()));
  340 + if (org != null) {
  341 + checkRecord.put("hospitalName", org.getName());
  342 + } else {
  343 + checkRecord.put("hospitalName", "");
  344 + }
  345 + list.add(checkRecord);
  346 + }
  347 +
  348 + Collections.reverse(list);
  349 + }
  350 + }
  351 + }
  352 +
291 353  
292 354 public void getBabyCheckList(String id, BabyModel model, List<Map<String, String>> list) {
293 355 List<BabyCheckModel> checkModels;