Commit 05ff6ec0e7b62b5fddbdb04de58a9f66d533dc4e
1 parent
11ffc85fbb
Exists in
master
and in
6 other branches
update
Showing 1 changed file with 9 additions and 3 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PreEugebicsServiceImpl.java
View file @
05ff6ec
... | ... | @@ -1238,7 +1238,7 @@ |
1238 | 1238 | query.setCreatedStart(DateUtil.parseYMD(arrs[0])); |
1239 | 1239 | query.setCreatedEnd(new Date(DateUtil.parseYMD(arrs[1]).getTime() + 24 * 60 * 60 * 1000 - 1)); |
1240 | 1240 | } |
1241 | - //分组查询 | |
1241 | + //分组查询-按地区 | |
1242 | 1242 | AggregationOperation match = Aggregation.match(query.convertToQuery().getCriteria()); |
1243 | 1243 | AggregationOperation group = Aggregation.group("areaId"); |
1244 | 1244 | Aggregation aggregation= Aggregation.newAggregation(match, group); |
... | ... | @@ -1253,8 +1253,14 @@ |
1253 | 1253 | if (null!=mappedResult.get("_id")){ |
1254 | 1254 | map.put("name", CommonsHelper.getName1(mappedResult.get("_id").toString(),basicConfigService)); |
1255 | 1255 | query.setAreaId(mappedResult.get("_id").toString()); |
1256 | - List <CancerScreeningModel> modelList = cancerScreenService.queryCancerScreList(query); | |
1257 | - for (CancerScreeningModel cancerScreeningModel : modelList) { | |
1256 | + //分组查询-按档案去重 | |
1257 | + AggregationOperation match2 = Aggregation.match(query.convertToQuery().getCriteria()); | |
1258 | + AggregationOperation group2 = Aggregation.group("residentId").max("created").as("created").last("zhJd").as("zhJd"); | |
1259 | + AggregationOperation fields2 = Aggregation.project("zhJd"); | |
1260 | +// AggregationOperation sort2 = Aggregation.sort(Sort.Direction.DESC,"created"); | |
1261 | + Aggregation aggregation2= Aggregation.newAggregation(match2,group2,fields2); | |
1262 | + AggregationResults<CancerScreeningModel> result2 = mongoTemplate.aggregate(aggregation2,"lyms_cancer_screen", CancerScreeningModel.class); | |
1263 | + for (CancerScreeningModel cancerScreeningModel : result2.getMappedResults()) { | |
1258 | 1264 | if(MapUtils.isNotEmpty(cancerScreeningModel.getZhJd())){ |
1259 | 1265 | if("0".equals(cancerScreeningModel.getZhJd().get("yn"))){ |
1260 | 1266 | zc++; |