Commit 4d74e61d7a01edc5cba9a567797d48f5d9475731
1 parent
fbd68b80cd
Exists in
master
and in
1 other branch
update
Showing 1 changed file with 50 additions and 1 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java
View file @
4d74e61
| ... | ... | @@ -4068,13 +4068,16 @@ |
| 4068 | 4068 | } |
| 4069 | 4069 | } |
| 4070 | 4070 | |
| 4071 | - public BaseResponse getOrgBabyCount(String checkTime,String hospitalId,String provinceId,String cityId,String areaId, Integer userId) { | |
| 4071 | + public BaseResponse getOrgBabyCount(final String checkTime,String hospitalId,String provinceId,String cityId,String areaId, Integer userId) { | |
| 4072 | 4072 | Map param = new HashMap(); |
| 4073 | 4073 | |
| 4074 | 4074 | param.put("hospitalId",hospitalId); |
| 4075 | 4075 | param.put("provinceId",provinceId); |
| 4076 | 4076 | param.put("cityId",cityId); |
| 4077 | 4077 | param.put("areaId", areaId); |
| 4078 | + | |
| 4079 | + | |
| 4080 | + | |
| 4078 | 4081 | List<BabyCountResult> list = new ArrayList <>(); |
| 4079 | 4082 | List<Organization> organizations = mysqlAntexcService.getOrganizations(param); |
| 4080 | 4083 | if (CollectionUtils.isNotEmpty(organizations)) { |
| 4081 | 4084 | |
| 4082 | 4085 | |
| ... | ... | @@ -4094,9 +4097,55 @@ |
| 4094 | 4097 | List<BabyCountResult> datas = new ArrayList <>(); |
| 4095 | 4098 | if (CollectionUtils.isNotEmpty(orgs)) |
| 4096 | 4099 | { |
| 4100 | + Date startDate = null; | |
| 4101 | + Date endDate = null; | |
| 4102 | + if (StringUtils.isNotEmpty(checkTime)) | |
| 4103 | + { | |
| 4104 | + String[] arrs = checkTime.split(" - "); | |
| 4105 | + startDate = DateUtil.getDayFirstSecond(DateUtil.parseYMD(arrs[0])); | |
| 4106 | + endDate = DateUtil.getDayLastSecond(DateUtil.parseYMD(arrs[1])); | |
| 4107 | + } | |
| 4108 | + | |
| 4097 | 4109 | for(Organization org : orgs) |
| 4098 | 4110 | { |
| 4111 | + String hospitalId = String.valueOf( org.getId()); | |
| 4099 | 4112 | BabyCountResult result = new BabyCountResult(); |
| 4113 | + | |
| 4114 | + Criteria criteria = Criteria.where("hospitalId").is(hospitalId).and("baby.pregnancyOut").is("0").and("baby.babyGender").is("1"); | |
| 4115 | + if (startDate != null) | |
| 4116 | + { | |
| 4117 | + criteria.and("dueDate1").gte(startDate).lte(endDate); | |
| 4118 | + } | |
| 4119 | + int hcsnan = (int)mongoTemplate.count(Query.query(criteria), MaternalDeliverModel.class); | |
| 4120 | + result.setHcsnan(hcsnan); | |
| 4121 | + | |
| 4122 | + | |
| 4123 | + Criteria criteria1 = Criteria.where("hospitalId").is(hospitalId).and("baby.pregnancyOut").is("0").and("baby.babyGender").is("0"); | |
| 4124 | + if (startDate != null) | |
| 4125 | + { | |
| 4126 | + criteria1.and("dueDate1").gte(startDate).lte(endDate); | |
| 4127 | + } | |
| 4128 | + int hcsnv = (int)mongoTemplate.count(Query.query(criteria1), MaternalDeliverModel.class); | |
| 4129 | + result.setHcsnv(hcsnv); | |
| 4130 | + result.setHcshj(hcsnan + hcsnv); | |
| 4131 | + result.setHcsxbum(0); | |
| 4132 | + | |
| 4133 | + | |
| 4134 | + Criteria criteria2 = Criteria.where("hospitalId").is(hospitalId); | |
| 4135 | + criteria2.and("birth").gte(DateUtil.addYear(new Date(), -7)); | |
| 4136 | + int ets7yx = (int)mongoTemplate.count(Query.query(criteria2), BabyModel.class); | |
| 4137 | + result.setEts7yx(ets7yx); | |
| 4138 | + | |
| 4139 | + Criteria criteria3 = Criteria.where("hospitalId").is(hospitalId); | |
| 4140 | + criteria3.and("birth").gte( DateUtil.addYear(new Date(),-5)); | |
| 4141 | + int ets5yx = (int)mongoTemplate.count(Query.query(criteria3), BabyModel.class); | |
| 4142 | + result.setEts5yx(ets5yx); | |
| 4143 | + | |
| 4144 | + Criteria criteria4 = Criteria.where("hospitalId").is(hospitalId); | |
| 4145 | + criteria4.and("birth").gte(DateUtil.addYear(new Date(),-3)); | |
| 4146 | + int ets3yx = (int)mongoTemplate.count(Query.query(criteria4), BabyModel.class); | |
| 4147 | + result.setEts3yx(ets3yx); | |
| 4148 | + | |
| 4100 | 4149 | result.setHospitalId(org.getId()+""); |
| 4101 | 4150 | result.setHospitalName(org.getName()); |
| 4102 | 4151 | datas.add(result); |