Commit 63332bc36aec14fe84c816a678b2845bf179047e
1 parent
b9132f25c4
Exists in
master
and in
6 other branches
儿童
Showing 1 changed file with 19 additions and 3 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
63332bc
| ... | ... | @@ -26,11 +26,14 @@ |
| 26 | 26 | import com.lyms.platform.permission.service.*; |
| 27 | 27 | import com.lyms.platform.pojo.*; |
| 28 | 28 | import com.lyms.platform.query.*; |
| 29 | +import com.mongodb.BasicDBObject; | |
| 29 | 30 | import org.apache.commons.collections.CollectionUtils; |
| 30 | 31 | import org.apache.commons.lang.*; |
| 31 | 32 | import org.springframework.beans.factory.annotation.Autowired; |
| 32 | 33 | import org.springframework.data.domain.Sort; |
| 33 | 34 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 35 | +import org.springframework.data.mongodb.core.aggregation.Aggregation; | |
| 36 | +import org.springframework.data.mongodb.core.aggregation.AggregationResults; | |
| 34 | 37 | import org.springframework.data.mongodb.core.query.Criteria; |
| 35 | 38 | import org.springframework.data.mongodb.core.query.Query; |
| 36 | 39 | import org.springframework.data.mongodb.core.query.Update; |
| 37 | 40 | |
| ... | ... | @@ -3262,12 +3265,12 @@ |
| 3262 | 3265 | String[] arrs = orderTime.split(" - "); |
| 3263 | 3266 | Date start = DateUtil.parseYMD(arrs[0]); |
| 3264 | 3267 | Date end = DateUtil.parseYMD(arrs[1]); |
| 3265 | - long count = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("type").is(2).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end))), CheckItemOrder.class); | |
| 3268 | + long count = getCount(hospitalId, start, end); | |
| 3266 | 3269 | data.put("allCount", String.valueOf(count)); |
| 3267 | 3270 | |
| 3268 | 3271 | Map param = new HashMap(); |
| 3269 | - param.put("type",null); | |
| 3270 | - param.put("hospitalId",hospitalId); | |
| 3272 | + param.put("type",2); | |
| 3273 | + param.put("hospitalId", hospitalId); | |
| 3271 | 3274 | List<CheckItem> checkItems = checkItemService.getCheckItemList(param); |
| 3272 | 3275 | if (CollectionUtils.isNotEmpty(checkItems)) { |
| 3273 | 3276 | List<Map> list = new ArrayList<>(); |
| ... | ... | @@ -3287,6 +3290,19 @@ |
| 3287 | 3290 | } |
| 3288 | 3291 | } |
| 3289 | 3292 | return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setErrormsg("成功"); |
| 3293 | + } | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + private int getCount(String hospitalId,Date start,Date end) | |
| 3297 | + { | |
| 3298 | + Aggregation aggregation4 = | |
| 3299 | + Aggregation.newAggregation( | |
| 3300 | + Aggregation.match(Criteria.where("hospitalId").is(hospitalId).and("type") | |
| 3301 | + .is(2).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end))), | |
| 3302 | + Aggregation.group("patientId").count().as("总人数")); | |
| 3303 | + AggregationResults<BasicDBObject> outputTypeCount4 = | |
| 3304 | + mongoTemplate.aggregate(aggregation4, "lyms_check_item_order", BasicDBObject.class); | |
| 3305 | + return outputTypeCount4.getMappedResults().size(); | |
| 3290 | 3306 | } |
| 3291 | 3307 | |
| 3292 | 3308 | public BaseResponse getBabyActualReport(String checkTime, Integer userId) { |