Commit 4accc453e13c85dd58a795838a44a148d97347d6
1 parent
bf4d2e3ecf
Exists in
nobuildprocess
儿童统计
Showing 10 changed files with 376 additions and 75 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBabyCheckDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyCheckDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyCheckService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/BabyCheckModel.java
- platform-dal/src/main/java/com/lyms/platform/query/BabyCheckModelQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBuildController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/GrowthCountTask.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBabyCheckDao.java
View file @
4accc45
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyCheckDaoImpl.java
View file @
4accc45
| ... | ... | @@ -53,7 +53,7 @@ |
| 53 | 53 | AggregationResults<BabyCheckModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_babycheck", BabyCheckModel.class); |
| 54 | 54 | return result.getMappedResults(); |
| 55 | 55 | } |
| 56 | - @Override | |
| 56 | + @Override | |
| 57 | 57 | public List<BabyCheckModel> queryLastDiagnoseCheck(List<String> ids) { |
| 58 | 58 | |
| 59 | 59 | AggregationOperation match = Aggregation.match(Criteria.where("buildId").in(ids).and("yn").is(1)); |
| ... | ... | @@ -64,6 +64,9 @@ |
| 64 | 64 | return result.getMappedResults(); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - | |
| 67 | + @Override | |
| 68 | + public int queryBabyCheckCount(MongoQuery mongoQuery) { | |
| 69 | + return (int) count(mongoQuery.convertToMongoQuery()); | |
| 70 | + } | |
| 68 | 71 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyCheckService.java
View file @
4accc45
platform-dal/src/main/java/com/lyms/platform/pojo/BabyCheckModel.java
View file @
4accc45
| ... | ... | @@ -232,6 +232,16 @@ |
| 232 | 232 | //头围评价 |
| 233 | 233 | private String headEvaluate; |
| 234 | 234 | |
| 235 | + private Date birth; | |
| 236 | + | |
| 237 | + public Date getBirth() { | |
| 238 | + return birth; | |
| 239 | + } | |
| 240 | + | |
| 241 | + public void setBirth(Date birth) { | |
| 242 | + this.birth = birth; | |
| 243 | + } | |
| 244 | + | |
| 235 | 245 | public String getWeightEvaluate() { |
| 236 | 246 | return weightEvaluate; |
| 237 | 247 | } |
platform-dal/src/main/java/com/lyms/platform/query/BabyCheckModelQuery.java
View file @
4accc45
| ... | ... | @@ -31,6 +31,31 @@ |
| 31 | 31 | |
| 32 | 32 | private String hospitalId; |
| 33 | 33 | |
| 34 | + //体重评价 | |
| 35 | + private String weightEvaluate; | |
| 36 | + //身长评价 | |
| 37 | + private String heightEvaluate; | |
| 38 | + //头围评价 | |
| 39 | + private String headEvaluate; | |
| 40 | + | |
| 41 | + //身长别体重 | |
| 42 | + private String heightWeight; | |
| 43 | + | |
| 44 | + /** | |
| 45 | + * 生日 | |
| 46 | + */ | |
| 47 | + private Date birthStart; | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 生日 | |
| 51 | + */ | |
| 52 | + private Date birthEnd; | |
| 53 | + | |
| 54 | + private Date checkDateStart; | |
| 55 | + private Date checkDateEnd; | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 34 | 59 | @Override |
| 35 | 60 | public MongoQuery convertToQuery() { |
| 36 | 61 | MongoCondition condition = MongoCondition.newInstance(); |
| 37 | 62 | |
| 38 | 63 | |
| ... | ... | @@ -41,16 +66,65 @@ |
| 41 | 66 | if(null!=yn){ |
| 42 | 67 | condition=condition.and("yn", yn, MongoOper.IS); |
| 43 | 68 | } |
| 69 | + | |
| 70 | + if (null != weightEvaluate) { | |
| 71 | + condition = condition.and("weightEvaluate", weightEvaluate, MongoOper.IS); | |
| 72 | + } | |
| 73 | + if (null != heightEvaluate) { | |
| 74 | + condition = condition.and("heightEvaluate", heightEvaluate, MongoOper.IS); | |
| 75 | + } | |
| 76 | + if (null != headEvaluate) { | |
| 77 | + condition = condition.and("headEvaluate", headEvaluate, MongoOper.IS); | |
| 78 | + } | |
| 79 | + if (null != heightWeight) { | |
| 80 | + condition = condition.and("heightWeight", heightWeight, MongoOper.IS); | |
| 81 | + } | |
| 82 | + | |
| 44 | 83 | if(null!=buildId){ |
| 45 | 84 | condition=condition.and("buildId", buildId, MongoOper.IS); |
| 46 | 85 | } |
| 47 | 86 | if(null!=hospitalId){ |
| 48 | - condition=condition.and("hospitalId",hospitalId,MongoOper.IS); | |
| 87 | + condition=condition.and("hospitalId", hospitalId, MongoOper.IS); | |
| 49 | 88 | } |
| 50 | 89 | if(null!=buildIds && buildIds.length > 0){ |
| 51 | 90 | Criteria c = Criteria.where("buildId").in(Arrays.asList(buildIds)); |
| 52 | 91 | condition.andCondition( new MongoCondition(c)); |
| 53 | 92 | } |
| 93 | + | |
| 94 | + | |
| 95 | + Criteria c = null; | |
| 96 | + if (null != birthStart) { | |
| 97 | + c = Criteria.where("birth").gte(birthStart); | |
| 98 | + } | |
| 99 | + | |
| 100 | + if (null != birthEnd) { | |
| 101 | + if (null != c) { | |
| 102 | + c = c.lte(birthEnd); | |
| 103 | + } else { | |
| 104 | + c = Criteria.where("birth").lte(birthEnd); | |
| 105 | + } | |
| 106 | + } | |
| 107 | + | |
| 108 | + if (null != checkDateStart) { | |
| 109 | + if (null != c) { | |
| 110 | + c = c.and("checkDate").gte(checkDateStart); | |
| 111 | + } else { | |
| 112 | + c = Criteria.where("checkDate").gte(checkDateStart); | |
| 113 | + } | |
| 114 | + } | |
| 115 | + | |
| 116 | + if (null != checkDateEnd) { | |
| 117 | + if (null != c) { | |
| 118 | + c = c.lte(checkDateEnd); | |
| 119 | + } else { | |
| 120 | + c = Criteria.where("checkDate").lte(checkDateEnd); | |
| 121 | + } | |
| 122 | + } | |
| 123 | + | |
| 124 | + if (c != null) { | |
| 125 | + return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); | |
| 126 | + } | |
| 127 | + | |
| 54 | 128 | return condition.toMongoQuery(); |
| 55 | 129 | } |
| 56 | 130 | |
| ... | ... | @@ -92,6 +166,70 @@ |
| 92 | 166 | |
| 93 | 167 | public void setBuildIds(String[] buildIds) { |
| 94 | 168 | this.buildIds = buildIds; |
| 169 | + } | |
| 170 | + | |
| 171 | + public String getWeightEvaluate() { | |
| 172 | + return weightEvaluate; | |
| 173 | + } | |
| 174 | + | |
| 175 | + public void setWeightEvaluate(String weightEvaluate) { | |
| 176 | + this.weightEvaluate = weightEvaluate; | |
| 177 | + } | |
| 178 | + | |
| 179 | + public String getHeightEvaluate() { | |
| 180 | + return heightEvaluate; | |
| 181 | + } | |
| 182 | + | |
| 183 | + public void setHeightEvaluate(String heightEvaluate) { | |
| 184 | + this.heightEvaluate = heightEvaluate; | |
| 185 | + } | |
| 186 | + | |
| 187 | + public String getHeadEvaluate() { | |
| 188 | + return headEvaluate; | |
| 189 | + } | |
| 190 | + | |
| 191 | + public void setHeadEvaluate(String headEvaluate) { | |
| 192 | + this.headEvaluate = headEvaluate; | |
| 193 | + } | |
| 194 | + | |
| 195 | + public String getHeightWeight() { | |
| 196 | + return heightWeight; | |
| 197 | + } | |
| 198 | + | |
| 199 | + public void setHeightWeight(String heightWeight) { | |
| 200 | + this.heightWeight = heightWeight; | |
| 201 | + } | |
| 202 | + | |
| 203 | + public Date getBirthStart() { | |
| 204 | + return birthStart; | |
| 205 | + } | |
| 206 | + | |
| 207 | + public void setBirthStart(Date birthStart) { | |
| 208 | + this.birthStart = birthStart; | |
| 209 | + } | |
| 210 | + | |
| 211 | + public Date getBirthEnd() { | |
| 212 | + return birthEnd; | |
| 213 | + } | |
| 214 | + | |
| 215 | + public void setBirthEnd(Date birthEnd) { | |
| 216 | + this.birthEnd = birthEnd; | |
| 217 | + } | |
| 218 | + | |
| 219 | + public Date getCheckDateStart() { | |
| 220 | + return checkDateStart; | |
| 221 | + } | |
| 222 | + | |
| 223 | + public void setCheckDateStart(Date checkDateStart) { | |
| 224 | + this.checkDateStart = checkDateStart; | |
| 225 | + } | |
| 226 | + | |
| 227 | + public Date getCheckDateEnd() { | |
| 228 | + return checkDateEnd; | |
| 229 | + } | |
| 230 | + | |
| 231 | + public void setCheckDateEnd(Date checkDateEnd) { | |
| 232 | + this.checkDateEnd = checkDateEnd; | |
| 95 | 233 | } |
| 96 | 234 | } |
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
View file @
4accc45
| ... | ... | @@ -498,10 +498,10 @@ |
| 498 | 498 | condition = condition.and("heightEvaluate", heightEvaluate, MongoOper.IS); |
| 499 | 499 | } |
| 500 | 500 | if (null != headEvaluate) { |
| 501 | - condition = condition.and("pregnancyOut", headEvaluate, MongoOper.IS); | |
| 501 | + condition = condition.and("headEvaluate", headEvaluate, MongoOper.IS); | |
| 502 | 502 | } |
| 503 | 503 | if (null != heightWeight) { |
| 504 | - condition = condition.and("pregnancyOut", heightWeight, MongoOper.IS); | |
| 504 | + condition = condition.and("heightWeight", heightWeight, MongoOper.IS); | |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBuildController.java
View file @
4accc45
| ... | ... | @@ -381,8 +381,21 @@ |
| 381 | 381 | public BaseResponse getBabyGroupCount(@Valid @RequestBody BabyManageRequest babyManageRequest, |
| 382 | 382 | HttpServletRequest request) { |
| 383 | 383 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 384 | - return babyBookbuildingFacade.getBabyGroupCount(babyManageRequest,loginState.getId()); | |
| 384 | + return babyBookbuildingFacade.getBabyGroupCount(babyManageRequest, loginState.getId()); | |
| 385 | 385 | } |
| 386 | + | |
| 387 | + /** | |
| 388 | + * 儿童生长统计右边列表 | |
| 389 | + * @return | |
| 390 | + */ | |
| 391 | + @RequestMapping(method = RequestMethod.GET, value = "/getBabyGroupRightCount") | |
| 392 | + @ResponseBody | |
| 393 | + public BaseResponse getBabyGroupRightCount(@Valid @RequestBody BabyManageRequest babyManageRequest, | |
| 394 | + HttpServletRequest request) { | |
| 395 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 396 | + return babyBookbuildingFacade.getBabyGroupRightCount(babyManageRequest,loginState.getId()); | |
| 397 | + } | |
| 398 | + | |
| 386 | 399 | |
| 387 | 400 | |
| 388 | 401 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
4accc45
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
4accc45
| ... | ... | @@ -2130,103 +2130,174 @@ |
| 2130 | 2130 | } |
| 2131 | 2131 | } |
| 2132 | 2132 | |
| 2133 | - BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 2134 | - List buildType = new ArrayList(); | |
| 2135 | - buildType.add(1); | |
| 2136 | - buildType.add(2); | |
| 2137 | - babyQuery.setBuildTypeList(buildType); | |
| 2133 | + BabyCheckModelQuery babyQuery = new BabyCheckModelQuery(); | |
| 2138 | 2134 | babyQuery.setHospitalId(hospitalId); |
| 2139 | 2135 | |
| 2140 | 2136 | babyQuery.setYn(YnEnums.YES.getId()); |
| 2141 | 2137 | Date currentDate = DateUtil.formatDate(new Date()); |
| 2142 | 2138 | |
| 2143 | - if(StringUtils.isNotEmpty(request.getBirth()) && request.getMonthAgeStart() != null && request.getMonthAgeEnd() != null) | |
| 2139 | + if (StringUtils.isNotEmpty(request.getBirth())) | |
| 2144 | 2140 | { |
| 2145 | - | |
| 2146 | - Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart()); | |
| 2147 | 2141 | String birthStr = request.getBirth(); |
| 2148 | 2142 | String[] dates = birthStr.split(" - "); |
| 2143 | + babyQuery.setBirthStart(DateUtil.parseYMD(dates[0])); | |
| 2144 | + babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1])); | |
| 2145 | + } | |
| 2146 | + if (request.getMonthAgeStart() != null) | |
| 2147 | + { | |
| 2148 | + Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart()); | |
| 2149 | + babyQuery.setCheckDateEnd(start); | |
| 2150 | + } | |
| 2151 | + if (request.getMonthAgeEnd() != null) | |
| 2152 | + { | |
| 2153 | + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1); | |
| 2154 | + babyQuery.setCheckDateStart(end); | |
| 2155 | + } | |
| 2156 | + Map<String,List<BabyGrowthCountResult>> result = new HashMap<>(); | |
| 2149 | 2157 | |
| 2150 | - if (DateUtil.parseYMD(dates[1]).getTime() < start.getTime()) | |
| 2151 | - { | |
| 2152 | - babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1])); | |
| 2158 | + Map<String,List<BabyGrowthCountResult>> mapItems = getCountGroupItemMaps(); | |
| 2159 | + for(String key : mapItems.keySet()) | |
| 2160 | + { | |
| 2161 | + List<BabyGrowthCountResult> groups = mapItems.get(key); | |
| 2162 | + GrowthCountTask task = new GrowthCountTask(groups,babyQuery,babyCheckService,key); | |
| 2163 | + result.put(key,task.getResults()); | |
| 2164 | + } | |
| 2153 | 2165 | |
| 2154 | - } | |
| 2155 | - else | |
| 2156 | - { | |
| 2157 | - babyQuery.setBirthEnd(start); | |
| 2158 | - } | |
| 2166 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
| 2167 | + objectResponse.setData(result); | |
| 2168 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 2169 | + objectResponse.setErrormsg("成功"); | |
| 2170 | + return objectResponse; | |
| 2171 | + } | |
| 2159 | 2172 | |
| 2160 | - Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1); | |
| 2161 | 2173 | |
| 2162 | - if (DateUtil.parseYMD(dates[0]).getTime() < end.getTime()) | |
| 2163 | - { | |
| 2164 | - babyQuery.setBirthStart(end); | |
| 2165 | - } | |
| 2166 | - else | |
| 2167 | - { | |
| 2168 | - babyQuery.setBirthStart(DateUtil.parseYMD(dates[0])); | |
| 2169 | - } | |
| 2170 | - } | |
| 2171 | - else if (StringUtils.isNotEmpty(request.getBirth()) && request.getMonthAgeStart() != null ) | |
| 2172 | - { | |
| 2173 | 2174 | |
| 2174 | - Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart()); | |
| 2175 | - String birthStr = request.getBirth(); | |
| 2176 | - String[] dates = birthStr.split(" - "); | |
| 2177 | 2175 | |
| 2178 | - if (DateUtil.parseYMD(dates[1]).getTime() < start.getTime()) | |
| 2179 | - { | |
| 2180 | - babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1])); | |
| 2176 | + /** | |
| 2177 | + * 儿童生长发育统计右边统计列表 | |
| 2178 | + * @param request | |
| 2179 | + * @param userId | |
| 2180 | + * @return | |
| 2181 | + */ | |
| 2182 | + public BaseResponse getBabyGroupRightCount(BabyManageRequest request, Integer userId) { | |
| 2183 | + String hospitalId = ""; | |
| 2184 | + //得到当前登录的医院id | |
| 2185 | + if (userId != null) { | |
| 2186 | + Users dbuser = usersService.getUsers(userId); | |
| 2187 | + if (dbuser != null) { | |
| 2188 | + hospitalId = String.valueOf(dbuser.getOrgId()); | |
| 2181 | 2189 | } |
| 2182 | - else | |
| 2183 | - { | |
| 2184 | - babyQuery.setBirthEnd(start); | |
| 2185 | - } | |
| 2190 | + } | |
| 2186 | 2191 | |
| 2187 | - babyQuery.setBirthStart(DateUtil.parseYMD(dates[0])); | |
| 2192 | + BabyCheckModelQuery babyQuery = new BabyCheckModelQuery(); | |
| 2193 | + babyQuery.setHospitalId(hospitalId); | |
| 2188 | 2194 | |
| 2189 | - } | |
| 2190 | - else if (StringUtils.isNotEmpty(request.getBirth())) | |
| 2195 | + babyQuery.setYn(YnEnums.YES.getId()); | |
| 2196 | + Date currentDate = DateUtil.formatDate(new Date()); | |
| 2197 | + | |
| 2198 | + if (StringUtils.isNotEmpty(request.getBirth())) | |
| 2191 | 2199 | { |
| 2192 | 2200 | String birthStr = request.getBirth(); |
| 2193 | 2201 | String[] dates = birthStr.split(" - "); |
| 2194 | 2202 | babyQuery.setBirthStart(DateUtil.parseYMD(dates[0])); |
| 2195 | 2203 | babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1])); |
| 2196 | 2204 | } |
| 2197 | - else if (request.getMonthAgeStart() != null && request.getMonthAgeEnd() != null) | |
| 2205 | + if (request.getMonthAgeStart() != null) | |
| 2198 | 2206 | { |
| 2199 | 2207 | Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart()); |
| 2200 | - babyQuery.setBirthEnd(start); | |
| 2201 | - | |
| 2202 | - Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1); | |
| 2203 | - babyQuery.setBirthStart(end); | |
| 2208 | + babyQuery.setCheckDateEnd(start); | |
| 2204 | 2209 | } |
| 2205 | - else if (request.getMonthAgeStart() != null) | |
| 2210 | + if (request.getMonthAgeEnd() != null) | |
| 2206 | 2211 | { |
| 2207 | - Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart()); | |
| 2208 | - babyQuery.setBirthEnd(start); | |
| 2209 | - } | |
| 2210 | - else if (request.getMonthAgeEnd() != null) | |
| 2211 | - { | |
| 2212 | 2212 | Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1); |
| 2213 | - babyQuery.setBirthStart(end); | |
| 2213 | + babyQuery.setCheckDateStart(end); | |
| 2214 | 2214 | } |
| 2215 | - Map<String,List<BabyGrowthCountResult>> result = new HashMap<>(); | |
| 2216 | 2215 | |
| 2217 | - Map<String,List<BabyGrowthCountResult>> mapItems = getCountGroupItemMaps(); | |
| 2218 | - for(String key : mapItems.keySet()) | |
| 2219 | - { | |
| 2220 | - List<BabyGrowthCountResult> groups = mapItems.get(key); | |
| 2221 | - GrowthCountTask task = new GrowthCountTask(groups,babyQuery,babyBookbuildingService,key); | |
| 2222 | - result.put(key,task.getResults()); | |
| 2216 | + List<Map<String,String>> results = new ArrayList<>(); | |
| 2217 | + | |
| 2218 | + List<BabyCheckModel> babyCheckModels = babyCheckService.queryBabyCheckRecord(babyQuery); | |
| 2219 | + if (CollectionUtils.isNotEmpty(babyCheckModels)) { | |
| 2220 | + int batchSize = 50; | |
| 2221 | + int end = 0; | |
| 2222 | + List<Future> futures = new ArrayList<>(); | |
| 2223 | + for (int i = 0; i < babyCheckModels.size(); i += batchSize) { | |
| 2224 | + end = (end + batchSize); | |
| 2225 | + if (end > babyCheckModels.size()) { | |
| 2226 | + end = babyCheckModels.size(); | |
| 2227 | + } | |
| 2228 | + final List<BabyCheckModel> checkModels = babyCheckModels.subList(i, end); | |
| 2229 | + Callable c = new Callable() | |
| 2230 | + { | |
| 2231 | + @Override | |
| 2232 | + public List<Map<String,String>> call() throws Exception { | |
| 2233 | + List<Map<String,String>> list = new ArrayList<>(); | |
| 2234 | + if (CollectionUtils.isNotEmpty(checkModels)) | |
| 2235 | + { | |
| 2236 | + for(BabyCheckModel checkModel : checkModels) | |
| 2237 | + { | |
| 2238 | + if (StringUtils.isNotEmpty(checkModel.getBuildId())) | |
| 2239 | + { | |
| 2240 | + BabyModel model = getBabyModelById(checkModel.getBuildId()); | |
| 2241 | + Map<String,String> map = new HashMap<>(); | |
| 2242 | + map.put("babyId",model.getId()); | |
| 2243 | + map.put("checkId",checkModel.getId()); | |
| 2244 | + map.put("sex", StringUtils.emptyDeal(SexEnum.getTextById(model.getSex()))); //性别 | |
| 2245 | + map.put("babyName", StringUtils.emptyDeal(model.getName())); //儿童名称 | |
| 2246 | + map.put("birthday", StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(model.getBirth()))); //生日 | |
| 2247 | + map.put("age",""); //当前月龄 | |
| 2248 | + map.put("height",checkModel.getHeight()); //身长 | |
| 2249 | + map.put("weight", checkModel.getWeight()); //体重 | |
| 2250 | + map.put("growthEvaluate",checkModel.getGrowthEvaluate()); //体格发育评价 | |
| 2251 | + map.put("checkDate",StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(checkModel.getCheckDate()))); | |
| 2252 | + String checkDoctorId = checkModel.getCheckDoctor() ; | |
| 2253 | + String checkDoctor = ""; | |
| 2254 | + if (StringUtils.isNotEmpty(checkDoctorId)) | |
| 2255 | + { | |
| 2256 | + Users user = usersService.getUsers(Integer.parseInt(checkDoctorId)); | |
| 2257 | + if (user != null) | |
| 2258 | + { | |
| 2259 | + checkDoctor = user.getName(); | |
| 2260 | + } | |
| 2261 | + } | |
| 2262 | + map.put("checkDoctor",checkDoctor); | |
| 2263 | + } | |
| 2264 | + | |
| 2265 | + } | |
| 2266 | + } | |
| 2267 | + return list; | |
| 2268 | + } | |
| 2269 | + }; | |
| 2270 | + | |
| 2271 | + Future f = pool.submit(c); | |
| 2272 | + futures.add(f); | |
| 2273 | + } | |
| 2274 | + for (Future f : futures) { | |
| 2275 | + try { | |
| 2276 | + results.addAll((List) f.get(30, TimeUnit.SECONDS)); | |
| 2277 | + } catch (Exception e) { | |
| 2278 | + ExceptionUtils.catchException(e, "baby check list"); | |
| 2279 | + } | |
| 2280 | + } | |
| 2223 | 2281 | } |
| 2224 | 2282 | |
| 2225 | 2283 | BaseObjectResponse objectResponse = new BaseObjectResponse(); |
| 2226 | - objectResponse.setData(result); | |
| 2284 | + objectResponse.setData(results); | |
| 2227 | 2285 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 2228 | 2286 | objectResponse.setErrormsg("成功"); |
| 2229 | 2287 | return objectResponse; |
| 2288 | + } | |
| 2289 | + | |
| 2290 | + private BabyModel getBabyModelById(String id) | |
| 2291 | + { | |
| 2292 | + BabyModelQuery query = new BabyModelQuery(); | |
| 2293 | + query.setId(id); | |
| 2294 | + query.setYn(YnEnums.YES.getId()); | |
| 2295 | + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(query); | |
| 2296 | + if (CollectionUtils.isNotEmpty(models)) | |
| 2297 | + { | |
| 2298 | + return models.get(0); | |
| 2299 | + } | |
| 2300 | + return null; | |
| 2230 | 2301 | } |
| 2231 | 2302 | |
| 2232 | 2303 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/GrowthCountTask.java
View file @
4accc45
| 1 | 1 | package com.lyms.platform.operate.web.utils; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.service.BabyBookbuildingService; |
| 4 | +import com.lyms.platform.biz.service.BabyCheckService; | |
| 4 | 5 | import com.lyms.platform.common.utils.ExceptionUtils; |
| 5 | 6 | import com.lyms.platform.operate.web.result.BabyGrowthCountResult; |
| 7 | +import com.lyms.platform.query.BabyCheckModelQuery; | |
| 6 | 8 | import com.lyms.platform.query.BabyModelQuery; |
| 7 | 9 | import org.apache.commons.collections.CollectionUtils; |
| 8 | 10 | |
| 9 | 11 | |
| 10 | 12 | |
| 11 | 13 | |
| ... | ... | @@ -16,16 +18,16 @@ |
| 16 | 18 | public class GrowthCountTask{ |
| 17 | 19 | |
| 18 | 20 | private static ExecutorService pool = Executors.newFixedThreadPool(6); |
| 19 | - private BabyModelQuery babyQuery; | |
| 21 | + private BabyCheckModelQuery babyQuery; | |
| 20 | 22 | private List<BabyGrowthCountResult> growth; |
| 21 | - private BabyBookbuildingService babyBookbuildingService; | |
| 23 | + private BabyCheckService babyCheckService; | |
| 22 | 24 | private String type; |
| 23 | - public GrowthCountTask(List<BabyGrowthCountResult> growth,BabyModelQuery babyQuery, | |
| 24 | - BabyBookbuildingService babyBookbuildingService,String type) | |
| 25 | + public GrowthCountTask(List<BabyGrowthCountResult> growth,BabyCheckModelQuery babyQuery, | |
| 26 | + BabyCheckService babyCheckService,String type) | |
| 25 | 27 | { |
| 26 | 28 | this.babyQuery=babyQuery; |
| 27 | 29 | this.growth = growth; |
| 28 | - this.babyBookbuildingService = babyBookbuildingService; | |
| 30 | + this.babyCheckService = babyCheckService; | |
| 29 | 31 | this.type = type; |
| 30 | 32 | } |
| 31 | 33 | public List<BabyGrowthCountResult> getResults() { |
| ... | ... | @@ -59,8 +61,8 @@ |
| 59 | 61 | { |
| 60 | 62 | babyQuery.setWeightEvaluate(grouwth.getEvaluate()); |
| 61 | 63 | } |
| 62 | - int count = babyBookbuildingService.queryBabyCount(babyQuery); | |
| 63 | - grouwth.setCount(String.valueOf(count)); | |
| 64 | + int count = babyCheckService.queryBabyCheckCount(babyQuery); | |
| 65 | + grouwth.setCount(String.valueOf(count)); | |
| 64 | 66 | } |
| 65 | 67 | } |
| 66 | 68 | |
| ... | ... | @@ -82,5 +84,62 @@ |
| 82 | 84 | |
| 83 | 85 | return results; |
| 84 | 86 | } |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | +// public List<BabyGrowthCountResult> getResults() { | |
| 91 | +// List<BabyGrowthCountResult> results = new ArrayList<>(); | |
| 92 | +// if (CollectionUtils.isNotEmpty(growth)) { | |
| 93 | +// | |
| 94 | +// int batchSize = 1; | |
| 95 | +// int end = 0; | |
| 96 | +// List<Future> futures = new ArrayList<>(); | |
| 97 | +// for (int i = 0; i < growth.size(); i += batchSize) { | |
| 98 | +// end = (end + batchSize); | |
| 99 | +// if (end > growth.size()) { | |
| 100 | +// end = growth.size(); | |
| 101 | +// } | |
| 102 | +// | |
| 103 | +// final List<BabyGrowthCountResult> growths = growth.subList(i, end); | |
| 104 | +// Callable c = new Callable() | |
| 105 | +// { | |
| 106 | +// @Override | |
| 107 | +// public List<BabyGrowthCountResult> call() throws Exception { | |
| 108 | +// | |
| 109 | +// if (CollectionUtils.isNotEmpty(growths)) | |
| 110 | +// { | |
| 111 | +// for(BabyGrowthCountResult grouwth : growths) | |
| 112 | +// { | |
| 113 | +// if ("身长".equals(type)) | |
| 114 | +// { | |
| 115 | +// babyQuery.setHeightEvaluate(grouwth.getEvaluate()); | |
| 116 | +// } | |
| 117 | +// else if ("体重".equals(type)) | |
| 118 | +// { | |
| 119 | +// babyQuery.setWeightEvaluate(grouwth.getEvaluate()); | |
| 120 | +// } | |
| 121 | +// int count = babyBookbuildingService.queryBabyCount(babyQuery); | |
| 122 | +// grouwth.setCount(String.valueOf(count)); | |
| 123 | +// } | |
| 124 | +// } | |
| 125 | +// | |
| 126 | +// return growths; | |
| 127 | +// } | |
| 128 | +// }; | |
| 129 | +// | |
| 130 | +// Future f = pool.submit(c); | |
| 131 | +// futures.add(f); | |
| 132 | +// } | |
| 133 | +// for (Future f : futures) { | |
| 134 | +// try { | |
| 135 | +// results.addAll((List) f.get(30, TimeUnit.SECONDS)); | |
| 136 | +// } catch (Exception e) { | |
| 137 | +// ExceptionUtils.catchException(e, "baby growth count"); | |
| 138 | +// } | |
| 139 | +// } | |
| 140 | +// } | |
| 141 | +// | |
| 142 | +// return results; | |
| 143 | +// } | |
| 85 | 144 | } |