Commit 37ca254348e69165fc044758ea4e955377987ed8
1 parent
b052331b9f
Exists in
master
and in
6 other branches
隆化-儿童统计管理-儿童健康体检统计表
Showing 6 changed files with 355 additions and 5 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyStatisticsManagerController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyManageRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyManageListResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/BabyList2Task.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/BabyList3Task.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyStatisticsManagerController.java
View file @
37ca254
| ... | ... | @@ -16,10 +16,7 @@ |
| 16 | 16 | import org.apache.commons.lang.StringUtils; |
| 17 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | 18 | import org.springframework.stereotype.Controller; |
| 19 | -import org.springframework.web.bind.annotation.RequestBody; | |
| 20 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 21 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 22 | -import org.springframework.web.bind.annotation.ResponseBody; | |
| 19 | +import org.springframework.web.bind.annotation.*; | |
| 23 | 20 | |
| 24 | 21 | import javax.servlet.http.HttpServletRequest; |
| 25 | 22 | import javax.servlet.http.HttpServletResponse; |
| ... | ... | @@ -591,6 +588,21 @@ |
| 591 | 588 | |
| 592 | 589 | babyStatisticsManagerFacade.babyStatisticalProbabilityExcel(babyMonthAge, getUserId(request), response); |
| 593 | 590 | |
| 591 | + } | |
| 592 | + | |
| 593 | + /** | |
| 594 | + * 隆化-儿童健康体检统计表 | |
| 595 | + * @param request | |
| 596 | + * @param babyManageRequest | |
| 597 | + * @return | |
| 598 | + */ | |
| 599 | + @RequestMapping(value = "/babyHealthCheckUpStatistics", method = RequestMethod.GET) | |
| 600 | + @TokenRequired | |
| 601 | + @ResponseBody | |
| 602 | + public BaseListResponse babyHealthCheckUpStatistics(HttpServletRequest request, | |
| 603 | + BabyManageRequest babyManageRequest) { | |
| 604 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 605 | + return babyStatisticsManagerFacade.babyHealthCheckUpStatistics(babyManageRequest,loginState.getId()); | |
| 594 | 606 | } |
| 595 | 607 | |
| 596 | 608 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java
View file @
37ca254
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.service.BabyBookbuildingService; | |
| 3 | 4 | import com.lyms.platform.biz.service.BabyCheckService; |
| 4 | 5 | import com.lyms.platform.biz.service.BabyService; |
| 5 | 6 | import com.lyms.platform.biz.service.BasicConfigService; |
| 6 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 7 | 8 | import com.lyms.platform.common.enums.SexEnum; |
| 8 | 9 | import com.lyms.platform.common.enums.YnEnums; |
| 10 | +import com.lyms.platform.common.result.BaseListResponse; | |
| 9 | 11 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 10 | 12 | import com.lyms.platform.common.utils.*; |
| 11 | 13 | import com.lyms.platform.operate.web.request.*; |
| 12 | 14 | import com.lyms.platform.operate.web.result.*; |
| 15 | +import com.lyms.platform.operate.web.utils.BabyList2Task; | |
| 16 | +import com.lyms.platform.operate.web.utils.BabyList3Task; | |
| 17 | +import com.lyms.platform.operate.web.utils.BabyListTask; | |
| 13 | 18 | import com.lyms.platform.operate.web.utils.JdbcUtil; |
| 14 | 19 | import com.lyms.platform.operate.web.worker.MaterDeliverWorker; |
| 15 | 20 | import com.lyms.platform.operate.web.worker.babyStatisticalProbabilityWorker; |
| 21 | +import com.lyms.platform.permission.service.OrganizationService; | |
| 16 | 22 | import com.lyms.platform.permission.service.UsersService; |
| 17 | 23 | import com.lyms.platform.pojo.BabyCheckModel; |
| 18 | 24 | import com.lyms.platform.pojo.BabyModel; |
| 19 | 25 | |
| ... | ... | @@ -57,8 +63,11 @@ |
| 57 | 63 | |
| 58 | 64 | @Autowired |
| 59 | 65 | private AutoMatchFacade autoMatchFacade; |
| 66 | + @Autowired | |
| 67 | + private BabyBookbuildingService babyBookbuildingService; | |
| 68 | + @Autowired | |
| 69 | + private OrganizationService organizationService; | |
| 60 | 70 | |
| 61 | - | |
| 62 | 71 | @Autowired |
| 63 | 72 | @Qualifier("commonThreadPool") |
| 64 | 73 | private ThreadPoolTaskExecutor commonThreadPool; |
| ... | ... | @@ -1312,6 +1321,95 @@ |
| 1312 | 1321 | data.put("managementRateCount", managementRateCount); |
| 1313 | 1322 | data.put("managementRatePercentage", percent(managementRateChechkCount, managementRateCount)); |
| 1314 | 1323 | return data; |
| 1324 | + } | |
| 1325 | + | |
| 1326 | + public BaseListResponse babyHealthCheckUpStatistics(BabyManageRequest request,Integer userId) { | |
| 1327 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 1328 | + | |
| 1329 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 1330 | + babyQuery.setHospitalId(hospitalId); | |
| 1331 | + babyQuery.setYn(YnEnums.YES.getId()); | |
| 1332 | + // 省 | |
| 1333 | + babyQuery.setProvinceId(StringUtils.isEmpty(request.getProvinceId()) ? null : request.getProvinceId()); | |
| 1334 | + // 市 | |
| 1335 | + babyQuery.setCityId(StringUtils.isEmpty(request.getCityId()) ? null : request.getCityId()); | |
| 1336 | + // 区/县 | |
| 1337 | + babyQuery.setAreaId(StringUtils.isEmpty(request.getAreaId()) ? null : request.getAreaId()); | |
| 1338 | + //街道 | |
| 1339 | + babyQuery.setStreetId(StringUtils.isEmpty(request.getStreetId()) ? null : request.getStreetId()); | |
| 1340 | + | |
| 1341 | + //筛选检查时间 | |
| 1342 | + List<BabyModel> babyModels=babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
| 1343 | + List<String> ids=new ArrayList<>(); | |
| 1344 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
| 1345 | + int batchSize = 5; | |
| 1346 | + int end = 0; | |
| 1347 | + List <Future> futures = new ArrayList <>(); | |
| 1348 | + for (int i = 0; i < babyModels.size(); i += batchSize) { | |
| 1349 | + end = (end + batchSize); | |
| 1350 | + if (end > babyModels.size()) { | |
| 1351 | + end = babyModels.size(); | |
| 1352 | + } | |
| 1353 | + List <BabyModel> ms = babyModels.subList(i, end); | |
| 1354 | + Callable c = new BabyList2Task( | |
| 1355 | + ms,babyCheckService, | |
| 1356 | + request.getCheckTime()); | |
| 1357 | + Future f = commonThreadPool.submit(c); | |
| 1358 | + futures.add(f); | |
| 1359 | + } | |
| 1360 | + if (CollectionUtils.isNotEmpty(futures)) { | |
| 1361 | + for (Future f : futures) { | |
| 1362 | + try { | |
| 1363 | + ids.addAll((List <String>) f.get()); | |
| 1364 | + } catch (Exception e) { | |
| 1365 | + ExceptionUtils.catchException(e, "BabyList2Task list error."); | |
| 1366 | + } | |
| 1367 | + } | |
| 1368 | + } | |
| 1369 | + } | |
| 1370 | + //结果ids分页组装数据 | |
| 1371 | + List <BabyManageListResult> list = new ArrayList <>(); | |
| 1372 | + BabyModelQuery babyQuery2 = new BabyModelQuery(); | |
| 1373 | + if (CollectionUtils.isNotEmpty(ids)) { | |
| 1374 | + | |
| 1375 | + babyQuery2.setNeed("true");//分页 | |
| 1376 | + babyQuery2.setPage(request.getPage()); | |
| 1377 | + babyQuery2.setLimit(request.getLimit()); | |
| 1378 | + babyQuery2.setIds(ids); | |
| 1379 | + List<BabyModel> babyModels2=babyBookbuildingService.queryBabyBuildByCond(babyQuery2); | |
| 1380 | + int batchSize = 5; | |
| 1381 | + int end = 0; | |
| 1382 | + List <Future> futures = new ArrayList <>(); | |
| 1383 | + for (int i = 0; i < babyModels2.size(); i += batchSize) { | |
| 1384 | + end = (end + batchSize); | |
| 1385 | + if (end > babyModels2.size()) { | |
| 1386 | + end = babyModels2.size(); | |
| 1387 | + } | |
| 1388 | + List <BabyModel> ms = babyModels2.subList(i, end); | |
| 1389 | + Callable c = new BabyList3Task( | |
| 1390 | + basicConfigService, | |
| 1391 | + organizationService, | |
| 1392 | + ms, hospitalId,babyCheckService); | |
| 1393 | + Future f = commonThreadPool.submit(c); | |
| 1394 | + futures.add(f); | |
| 1395 | + } | |
| 1396 | + if (CollectionUtils.isNotEmpty(futures)) { | |
| 1397 | + for (Future f : futures) { | |
| 1398 | + try { | |
| 1399 | + list.addAll((List <BabyManageListResult>) f.get()); | |
| 1400 | + } catch (Exception e) { | |
| 1401 | + ExceptionUtils.catchException(e, "BabyList3Task list error."); | |
| 1402 | + } | |
| 1403 | + } | |
| 1404 | + } | |
| 1405 | + } | |
| 1406 | + | |
| 1407 | + BaseListResponse objectResponse = new BaseListResponse(); | |
| 1408 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 1409 | + objectResponse.setData(list); | |
| 1410 | + objectResponse.setPageInfo(babyQuery2.getPageInfo()); | |
| 1411 | + objectResponse.setErrormsg("成功"); | |
| 1412 | + return objectResponse; | |
| 1315 | 1413 | } |
| 1316 | 1414 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyManageRequest.java
View file @
37ca254
| ... | ... | @@ -133,6 +133,16 @@ |
| 133 | 133 | private Integer settleType; |
| 134 | 134 | //高危结案时间 |
| 135 | 135 | private String settleTime; |
| 136 | + //儿保检查时间 | |
| 137 | + private String checkTime; | |
| 138 | + | |
| 139 | + public String getCheckTime() { | |
| 140 | + return checkTime; | |
| 141 | + } | |
| 142 | + | |
| 143 | + public void setCheckTime(String checkTime) { | |
| 144 | + this.checkTime = checkTime; | |
| 145 | + } | |
| 136 | 146 | |
| 137 | 147 | public Integer getSettleType() { |
| 138 | 148 | return settleType; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyManageListResult.java
View file @
37ca254
| ... | ... | @@ -120,6 +120,28 @@ |
| 120 | 120 | //隆化-儿童建档-自动结案时间 |
| 121 | 121 | private String settleTime; |
| 122 | 122 | |
| 123 | + //隆化-儿童健康体检统计表 (只有居住地) | |
| 124 | + private String habitat; | |
| 125 | + | |
| 126 | + //隆化-儿童健康体检统计表 -体检套餐对应检查时间 | |
| 127 | + private List<Map> dataResult; | |
| 128 | + | |
| 129 | + public List<Map> getDataResult() { | |
| 130 | + return dataResult; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public void setDataResult(List<Map> dataResult) { | |
| 134 | + this.dataResult = dataResult; | |
| 135 | + } | |
| 136 | + | |
| 137 | + public String getHabitat() { | |
| 138 | + return habitat; | |
| 139 | + } | |
| 140 | + | |
| 141 | + public void setHabitat(String habitat) { | |
| 142 | + this.habitat = habitat; | |
| 143 | + } | |
| 144 | + | |
| 123 | 145 | public Integer getSettleType() { |
| 124 | 146 | return settleType; |
| 125 | 147 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/BabyList2Task.java
View file @
37ca254
| 1 | +package com.lyms.platform.operate.web.utils; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.BabyCheckService; | |
| 4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
| 5 | +import com.lyms.platform.common.enums.ServiceStatusEnums; | |
| 6 | +import com.lyms.platform.common.enums.ServiceTypeEnums; | |
| 7 | +import com.lyms.platform.common.enums.SexEnum; | |
| 8 | +import com.lyms.platform.common.enums.YnEnums; | |
| 9 | +import com.lyms.platform.common.utils.DateUtil; | |
| 10 | +import com.lyms.platform.common.utils.StringUtils; | |
| 11 | +import com.lyms.platform.operate.web.facade.BabyCheckFacade; | |
| 12 | +import com.lyms.platform.operate.web.facade.BasicConfigFacade; | |
| 13 | +import com.lyms.platform.operate.web.result.BabyManageListResult; | |
| 14 | +import com.lyms.platform.permission.service.OrganizationService; | |
| 15 | +import com.lyms.platform.permission.service.UsersService; | |
| 16 | +import com.lyms.platform.pojo.BabyCheckModel; | |
| 17 | +import com.lyms.platform.pojo.BabyModel; | |
| 18 | +import com.lyms.platform.pojo.BasicConfig; | |
| 19 | +import com.lyms.platform.query.BabyCheckModelQuery; | |
| 20 | +import org.apache.commons.collections.CollectionUtils; | |
| 21 | + | |
| 22 | +import java.util.ArrayList; | |
| 23 | +import java.util.Date; | |
| 24 | +import java.util.List; | |
| 25 | +import java.util.concurrent.Callable; | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * Created by shy on 2022/3/17. | |
| 29 | + */ | |
| 30 | +public class BabyList2Task implements Callable { | |
| 31 | + | |
| 32 | + private List<BabyModel> models; | |
| 33 | + | |
| 34 | + private BabyCheckService babyCheckService; | |
| 35 | + | |
| 36 | + private String checkTime; | |
| 37 | + | |
| 38 | + public BabyList2Task( | |
| 39 | + List<BabyModel> models, | |
| 40 | + BabyCheckService babyCheckService, | |
| 41 | + String checkTime) { | |
| 42 | + this.models = models; | |
| 43 | + this.babyCheckService = babyCheckService; | |
| 44 | + this.checkTime = checkTime; | |
| 45 | + | |
| 46 | + } | |
| 47 | + | |
| 48 | + @Override | |
| 49 | + public List<String> call() throws Exception { | |
| 50 | + List<String> list = new ArrayList<>(); | |
| 51 | + if (CollectionUtils.isNotEmpty(models)) { | |
| 52 | + for (BabyModel model : models) { | |
| 53 | + BabyCheckModelQuery query = new BabyCheckModelQuery(); | |
| 54 | + query.setBuildId(model.getId()); | |
| 55 | + query.setYn(YnEnums.YES.getId()); | |
| 56 | + //儿保检查时间 | |
| 57 | + if(StringUtils.isNotEmpty(checkTime)){ | |
| 58 | + | |
| 59 | + String[] dates = checkTime.split(" - "); | |
| 60 | + | |
| 61 | + query.setCheckDateStart(DateUtil.parseYMD(dates[0])); | |
| 62 | + if (dates.length == 2) { | |
| 63 | + Date date = DateUtil.parseYMD(dates[1]); | |
| 64 | + if (null != date) { | |
| 65 | + long d = date.getTime() + 86398000; | |
| 66 | + date = new Date(d); | |
| 67 | + } | |
| 68 | + query.setCheckDateEnd(date); | |
| 69 | + } | |
| 70 | + } | |
| 71 | + List <BabyCheckModel> models = babyCheckService.queryBabyCheckRecord(query); | |
| 72 | + if (CollectionUtils.isNotEmpty(models)) { | |
| 73 | + list.add(model.getId()); | |
| 74 | + } | |
| 75 | + } | |
| 76 | + } | |
| 77 | + return list; | |
| 78 | + } | |
| 79 | + | |
| 80 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/BabyList3Task.java
View file @
37ca254
| 1 | +package com.lyms.platform.operate.web.utils; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.BabyCheckService; | |
| 4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
| 5 | +import com.lyms.platform.common.enums.SexEnum; | |
| 6 | +import com.lyms.platform.common.enums.YnEnums; | |
| 7 | +import com.lyms.platform.common.utils.DateUtil; | |
| 8 | +import com.lyms.platform.common.utils.StringUtils; | |
| 9 | +import com.lyms.platform.operate.web.result.BabyManageListResult; | |
| 10 | +import com.lyms.platform.permission.service.OrganizationService; | |
| 11 | +import com.lyms.platform.pojo.BabyCheckModel; | |
| 12 | +import com.lyms.platform.pojo.BabyModel; | |
| 13 | +import com.lyms.platform.pojo.BasicConfig; | |
| 14 | +import com.lyms.platform.query.BabyCheckModelQuery; | |
| 15 | +import org.apache.commons.collections.CollectionUtils; | |
| 16 | + | |
| 17 | +import java.util.*; | |
| 18 | +import java.util.concurrent.Callable; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * Created by shy on 2022/3/17. | |
| 22 | + */ | |
| 23 | +public class BabyList3Task implements Callable { | |
| 24 | + | |
| 25 | + private BasicConfigService basicConfigService; | |
| 26 | + | |
| 27 | + private OrganizationService organizationService; | |
| 28 | + | |
| 29 | + private List<BabyModel> models; | |
| 30 | + | |
| 31 | + private String hospitalId; | |
| 32 | + | |
| 33 | + private BabyCheckService babyCheckService; | |
| 34 | + | |
| 35 | + public BabyList3Task( | |
| 36 | + BasicConfigService basicConfigService, | |
| 37 | + OrganizationService organizationService, | |
| 38 | + List<BabyModel> models, | |
| 39 | + String hospitalId, | |
| 40 | + BabyCheckService babyCheckService) { | |
| 41 | + this.basicConfigService = basicConfigService; | |
| 42 | + this.organizationService = organizationService; | |
| 43 | + this.models = models; | |
| 44 | + this.hospitalId = hospitalId; | |
| 45 | + this.babyCheckService = babyCheckService; | |
| 46 | + | |
| 47 | + } | |
| 48 | + | |
| 49 | + @Override | |
| 50 | + public List<BabyManageListResult> call() throws Exception { | |
| 51 | + List<BabyManageListResult> list = new ArrayList<>(); | |
| 52 | + if (CollectionUtils.isNotEmpty(models)) { | |
| 53 | + for (BabyModel model : models) { | |
| 54 | + BabyManageListResult result = new BabyManageListResult(); | |
| 55 | + result.setId(model.getId()); | |
| 56 | + | |
| 57 | + | |
| 58 | + result.setSex(model.getSex() == null ? "" : StringUtils.emptyDeal(SexEnum.getTextById(model.getSex()))); | |
| 59 | + result.setBabyName(StringUtils.emptyDeal(model.getName())); | |
| 60 | + result.setBirthday(StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(model.getBirth()))); | |
| 61 | + result.setMommyName(StringUtils.emptyDeal(model.getMname())); | |
| 62 | + result.setMommnyPhone(StringUtils.emptyDeal(model.getMphone())); | |
| 63 | + result.setMommnyEncryptPhone(StringUtils.encryPhone(model.getMphone())); | |
| 64 | + result.setMonthAge(StringUtils.emptyDeal(DateUtil.getBabyMonthAge(model.getBirth(), new Date()))); | |
| 65 | + result.setPatientId(model.getParentId()); | |
| 66 | + result.setBuildTime(DateUtil.getyyyy_MM_dd(model.getBuildDate())); | |
| 67 | + String hospitalName = organizationService.getOrganization(Integer.valueOf(hospitalId)).getName(); | |
| 68 | + result.setHospitalName(hospitalName); | |
| 69 | + | |
| 70 | + result.setHospitalName(organizationService.getOrganization(Integer.valueOf(model.getHospitalId())).getName()); | |
| 71 | + // 开始查询省市区街道 | |
| 72 | + // 省 | |
| 73 | + BasicConfig provinceName = basicConfigService.getOneBasicConfigById(model.getProvinceId()); | |
| 74 | + // 市 | |
| 75 | + BasicConfig cityName = basicConfigService.getOneBasicConfigById(model.getCityId()); | |
| 76 | + // 区 | |
| 77 | + BasicConfig areaName = basicConfigService.getOneBasicConfigById(model.getAreaId()); | |
| 78 | + // 街道 | |
| 79 | + BasicConfig streetName = basicConfigService.getOneBasicConfigById(model.getStreetId()); | |
| 80 | + // 具体 | |
| 81 | + String address = model.getAddress(); | |
| 82 | + String habitat = ""; | |
| 83 | + if (provinceName != null) { | |
| 84 | + habitat += provinceName.getName(); | |
| 85 | + } | |
| 86 | + if (cityName != null) { | |
| 87 | + habitat += cityName.getName(); | |
| 88 | + } | |
| 89 | + if (areaName != null) { | |
| 90 | + habitat += areaName.getName(); | |
| 91 | + } | |
| 92 | + if (streetName != null) { | |
| 93 | + habitat += streetName.getName(); | |
| 94 | + } | |
| 95 | + if (!StringUtils.isEmpty(address)) { | |
| 96 | + habitat += address; | |
| 97 | + } | |
| 98 | + if (habitat.length() == 0) { | |
| 99 | + habitat = "-"; | |
| 100 | + } | |
| 101 | + result.setHabitat(habitat); | |
| 102 | + | |
| 103 | + BabyCheckModelQuery query = new BabyCheckModelQuery(); | |
| 104 | + query.setBuildId(model.getId()); | |
| 105 | + query.setYn(YnEnums.YES.getId()); | |
| 106 | + | |
| 107 | + List <BabyCheckModel> models = babyCheckService.queryBabyCheckRecord(query); | |
| 108 | + if (CollectionUtils.isNotEmpty(models)) { | |
| 109 | + List<Map> listdata=new ArrayList<>(); | |
| 110 | + for (BabyCheckModel babyCheckModel : models) { | |
| 111 | + Map<Integer,Object> map=new HashMap<>(); | |
| 112 | + map.put(babyCheckModel.getTcType(), DateUtil.getyyyy_MM_dd(babyCheckModel.getCheckDate())); | |
| 113 | + listdata.add(map); | |
| 114 | + } | |
| 115 | + result.setDataResult(listdata); | |
| 116 | + } | |
| 117 | + | |
| 118 | + list.add(result); | |
| 119 | + } | |
| 120 | + } | |
| 121 | + return list; | |
| 122 | + } | |
| 123 | + | |
| 124 | +} |