Commit 307b002df69cad0ef7f5cf86d44c4cb6da9dacf8
1 parent
22ea269289
Exists in
master
and in
6 other branches
儿保总概率统计
Showing 4 changed files with 324 additions and 124 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/facade/PatientFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/babyStatisticalProbabilityWorker.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyStatisticsManagerController.java
View file @
307b002
... | ... | @@ -573,5 +573,18 @@ |
573 | 573 | return babyStatisticsManagerFacade.babyStatisticalProbability(babyMonthAge, getUserId(request)); |
574 | 574 | |
575 | 575 | } |
576 | + | |
577 | + /** | |
578 | + * 儿保统计概率导出 | |
579 | + **/ | |
580 | + @RequestMapping(value = "/babyStatisticalProbabilityExcel", method = RequestMethod.GET) | |
581 | + @TokenRequired | |
582 | + @ResponseBody | |
583 | + public void babyStatisticalProbabilityExcel(Integer babyMonthAge, HttpServletRequest request, HttpServletResponse response) { | |
584 | + | |
585 | + babyStatisticsManagerFacade.babyStatisticalProbabilityExcel(babyMonthAge, getUserId(request), response); | |
586 | + | |
587 | + } | |
588 | + | |
576 | 589 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java
View file @
307b002
... | ... | @@ -7,25 +7,31 @@ |
7 | 7 | import com.lyms.platform.common.enums.SexEnum; |
8 | 8 | import com.lyms.platform.common.enums.YnEnums; |
9 | 9 | import com.lyms.platform.common.result.BaseObjectResponse; |
10 | -import com.lyms.platform.common.utils.DateUtil; | |
11 | -import com.lyms.platform.common.utils.ExceptionUtils; | |
12 | -import com.lyms.platform.common.utils.JsonUtil; | |
13 | -import com.lyms.platform.common.utils.PropertiesUtils; | |
10 | +import com.lyms.platform.common.utils.*; | |
14 | 11 | import com.lyms.platform.operate.web.request.*; |
15 | 12 | import com.lyms.platform.operate.web.result.*; |
16 | 13 | import com.lyms.platform.operate.web.utils.JdbcUtil; |
14 | +import com.lyms.platform.operate.web.worker.MaterDeliverWorker; | |
15 | +import com.lyms.platform.operate.web.worker.babyStatisticalProbabilityWorker; | |
17 | 16 | import com.lyms.platform.permission.service.UsersService; |
18 | 17 | import com.lyms.platform.pojo.BabyCheckModel; |
19 | 18 | import com.lyms.platform.pojo.BabyModel; |
19 | +import com.lyms.platform.pojo.MaternalDeliverModel; | |
20 | 20 | import com.lyms.platform.query.BabyCheckModelQuery; |
21 | 21 | import com.lyms.platform.query.BabyModelQuery; |
22 | 22 | import org.apache.commons.collections.CollectionUtils; |
23 | 23 | import org.apache.commons.lang.StringUtils; |
24 | 24 | import org.springframework.beans.factory.annotation.Autowired; |
25 | +import org.springframework.beans.factory.annotation.Qualifier; | |
26 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
25 | 27 | import org.springframework.stereotype.Component; |
28 | +import scala.util.parsing.combinator.testing.Str; | |
26 | 29 | |
30 | +import javax.servlet.http.HttpServletResponse; | |
27 | 31 | import java.math.BigDecimal; |
28 | 32 | import java.util.*; |
33 | +import java.util.concurrent.Callable; | |
34 | +import java.util.concurrent.Future; | |
29 | 35 | |
30 | 36 | /** |
31 | 37 | * @auther HuJiaqi |
... | ... | @@ -52,6 +58,11 @@ |
52 | 58 | @Autowired |
53 | 59 | private AutoMatchFacade autoMatchFacade; |
54 | 60 | |
61 | + | |
62 | + @Autowired | |
63 | + @Qualifier("commonThreadPool") | |
64 | + private ThreadPoolTaskExecutor commonThreadPool; | |
65 | + | |
55 | 66 | public BabyStatisticsManagerBuildDoctorGroupResult babyStatisticsManagerBuildDoctorGroup(BabyStatisticsManagerBuildDoctorGroupRequest babyStatisticsManagerBuildDoctorGroupRequest) { |
56 | 67 | BabyStatisticsManagerBuildDoctorGroupResult babyStatisticsManagerBuildDoctorGroupResult = new BabyStatisticsManagerBuildDoctorGroupResult(); |
57 | 68 | |
58 | 69 | |
59 | 70 | |
60 | 71 | |
61 | 72 | |
62 | 73 | |
63 | 74 | |
64 | 75 | |
65 | 76 | |
66 | 77 | |
67 | 78 | |
68 | 79 | |
... | ... | @@ -924,138 +935,212 @@ |
924 | 935 | |
925 | 936 | public BaseObjectResponse babyStatisticalProbability(Integer babyMonthAge, Integer userId) { |
926 | 937 | String hospitaId = autoMatchFacade.getHospitalId(userId); |
927 | - Map<String, Object> data = new HashMap<>(); | |
938 | + List<Map<String, Integer>> dataRequest = new ArrayList<>(); | |
928 | 939 | BabyModelQuery babyQuery = new BabyModelQuery(); |
929 | 940 | babyQuery.setHospitalId(hospitaId); |
930 | 941 | babyQuery.setYn(YnEnums.YES.getId()); |
931 | - if (null != babyMonthAge) { | |
942 | + Date currentDate = DateUtil.formatDate(new Date()); | |
943 | + Date start = DateUtil.addMonth(currentDate, -babyMonthAge); | |
944 | + babyQuery.setBirthEnd(start); | |
945 | + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -babyMonthAge - 1), 1); | |
946 | + babyQuery.setBirthStart(end); | |
947 | + List<BabyModel> babyModels = babyService.queryBabyWithQuery(babyQuery); | |
948 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
949 | + | |
950 | + int batchSize = 5; | |
951 | + int ends = 0; | |
952 | + List<Future> futures = new ArrayList<>(); | |
953 | + for (int i = 0; i < babyModels.size(); i += batchSize) { | |
954 | + ends = (ends + batchSize); | |
955 | + if (ends > babyModels.size()) { | |
956 | + ends = babyModels.size(); | |
957 | + } | |
958 | + List<BabyModel> mlist = babyModels.subList(i, ends); | |
959 | + Callable c = new babyStatisticalProbabilityWorker(babyMonthAge, mlist, babyCheckService); | |
960 | + Future f = commonThreadPool.submit(c); | |
961 | + if (f != null) { | |
962 | + futures.add(f); | |
963 | + } | |
964 | + } | |
965 | + if (CollectionUtils.isNotEmpty(futures)) { | |
966 | + for (Future f : futures) { | |
967 | + try { | |
968 | + dataRequest.add((Map<String, Integer>) f.get()); | |
969 | + } catch (Exception e) { | |
970 | + ExceptionUtils.catchException(e, "fm list error."); | |
971 | + } | |
972 | + } | |
973 | + } | |
974 | + } | |
975 | + return new BaseObjectResponse().setData(sum(dataRequest)); | |
976 | + | |
977 | + } | |
978 | + | |
979 | + /** | |
980 | + * 儿保统计导出 | |
981 | + **/ | |
982 | + public void babyStatisticalProbabilityExcel(Integer babyMonthAge, Integer userId, HttpServletResponse response) { | |
983 | + try { | |
984 | + List<Map<String, Integer>> dataRequest = new ArrayList<>(); | |
985 | + String hospitaId = autoMatchFacade.getHospitalId(userId); | |
986 | + List<Map<String, Object>> excelList = new ArrayList<>(); | |
987 | + Map<String, Object> data = new HashMap<>(); | |
988 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
989 | + babyQuery.setHospitalId(hospitaId); | |
990 | + babyQuery.setYn(YnEnums.YES.getId()); | |
932 | 991 | Date currentDate = DateUtil.formatDate(new Date()); |
933 | 992 | Date start = DateUtil.addMonth(currentDate, -babyMonthAge); |
934 | 993 | babyQuery.setBirthEnd(start); |
935 | 994 | Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -babyMonthAge - 1), 1); |
936 | 995 | babyQuery.setBirthStart(end); |
937 | 996 | List<BabyModel> babyModels = babyService.queryBabyWithQuery(babyQuery); |
938 | - BabyCheckModelQuery babyCheckModelQuery = new BabyCheckModelQuery(); | |
939 | - BabyCheckModelQuery babyCheckQuery = new BabyCheckModelQuery(); | |
940 | - //只查询1月龄做过检查的人数 | |
941 | - babyCheckQuery.setCheckMonth(1); | |
942 | - babyCheckQuery.setYn(YnEnums.YES.getId()); | |
943 | - babyCheckModelQuery.setYn(YnEnums.YES.getId()); | |
944 | - int probabilityCount = 0; | |
945 | - int managementRateChechkCount = 0; | |
946 | 997 | if (CollectionUtils.isNotEmpty(babyModels)) { |
947 | - for (BabyModel baby : babyModels) { | |
948 | - babyCheckModelQuery.setBuildId(baby.getId()); | |
949 | - int checkCount = babyCheckService.queryBabyCheckCount(babyCheckModelQuery); | |
950 | - //正常 | |
951 | - if (null == baby.getHighRisk() || baby.getHighRisk() != 1) { | |
952 | - if (babyMonthAge >= 1 && babyMonthAge <= 2 && checkCount >= 1) { | |
953 | - probabilityCount++; | |
954 | - } else if (babyMonthAge >= 3 && babyMonthAge <= 5 && checkCount >= 2) { | |
955 | - probabilityCount++; | |
956 | - } else if (babyMonthAge >= 6 && babyMonthAge <= 7 && checkCount >= 3) { | |
957 | - probabilityCount++; | |
958 | - } else if (babyMonthAge >= 8 && babyMonthAge <= 11 && checkCount >= 4) { | |
959 | - probabilityCount++; | |
960 | - } else if (babyMonthAge >= 12 && checkCount >= 5) { | |
961 | - } | |
962 | - //高儿计算规则 | |
963 | - } else { | |
964 | - if (babyMonthAge == 1 && checkCount >= 1) { | |
965 | - probabilityCount++; | |
966 | - } else if (babyMonthAge == 2 && checkCount >= 2) { | |
967 | - probabilityCount++; | |
968 | - } else if (babyMonthAge == 3 && checkCount >= 3) { | |
969 | - probabilityCount++; | |
970 | - } else if (babyMonthAge == 4 && checkCount >= 4) { | |
971 | - probabilityCount++; | |
972 | - } else if (babyMonthAge == 5 && checkCount >= 5) { | |
973 | - probabilityCount++; | |
974 | - } else if (babyMonthAge >= 6 && babyMonthAge <= 7 && checkCount >= 6) { | |
975 | - probabilityCount++; | |
976 | - } else if (babyMonthAge >= 8 && babyMonthAge <= 9 && checkCount >= 7) { | |
977 | - probabilityCount++; | |
978 | - } else if (babyMonthAge >= 10 && babyMonthAge <= 11 && checkCount >= 8) { | |
979 | - probabilityCount++; | |
980 | - } else if (babyMonthAge >= 12 && babyMonthAge <= 14 && checkCount >= 9) { | |
981 | - probabilityCount++; | |
982 | - } else if (babyMonthAge >= 15 && babyMonthAge <= 17 && checkCount >= 10) { | |
983 | - probabilityCount++; | |
984 | - } else if (babyMonthAge >= 18 && babyMonthAge <= 20 && checkCount >= 11) { | |
985 | - probabilityCount++; | |
986 | - } else if (babyMonthAge >= 21 && babyMonthAge <= 23 && checkCount >= 12) { | |
987 | - probabilityCount++; | |
988 | - } else if (babyMonthAge >= 24 && checkCount >= 13) { | |
989 | - probabilityCount++; | |
990 | - } | |
998 | + int batchSize = 5; | |
999 | + int ends = 0; | |
1000 | + List<Future> futures = new ArrayList<>(); | |
1001 | + for (int i = 0; i < babyModels.size(); i += batchSize) { | |
1002 | + ends = (ends + batchSize); | |
1003 | + if (ends > babyModels.size()) { | |
1004 | + ends = babyModels.size(); | |
991 | 1005 | } |
992 | - /**总管理率统计**/ | |
993 | - babyCheckQuery.setBuildId(baby.getId()); | |
994 | - int RateChechkCount = babyCheckService.queryBabyCheckCount(babyCheckQuery); | |
995 | - if (RateChechkCount != 0) { | |
996 | - managementRateChechkCount++; | |
1006 | + List<BabyModel> mlist = babyModels.subList(i, ends); | |
1007 | + Callable c = new babyStatisticalProbabilityWorker(babyMonthAge, mlist, babyCheckService); | |
1008 | + Future f = commonThreadPool.submit(c); | |
1009 | + if (f != null) { | |
1010 | + futures.add(f); | |
997 | 1011 | } |
998 | 1012 | } |
1013 | + if (CollectionUtils.isNotEmpty(futures)) { | |
1014 | + for (Future f : futures) { | |
1015 | + try { | |
1016 | + dataRequest.add((Map<String, Integer>) f.get()); | |
1017 | + } catch (Exception e) { | |
1018 | + ExceptionUtils.catchException(e, "fm list error."); | |
1019 | + } | |
1020 | + } | |
1021 | + } | |
999 | 1022 | } |
1000 | - data.put("standardCheckCount", probabilityCount); | |
1001 | - data.put("standardTotalnumber", babyModels.size()); | |
1002 | - data.put("standardPercentage", percent(probabilityCount, babyModels.size())); | |
1003 | - data.put("managementRateChechkCount", managementRateChechkCount); | |
1004 | - data.put("managementRateCount", babyModels.size()); | |
1005 | - data.put("managementRatePercentage", percent(managementRateChechkCount, babyModels.size())); | |
1023 | + data = this.sum(dataRequest); | |
1024 | + Map<String, String> header = new LinkedHashMap<>(); | |
1025 | + header.put("type", "类型"); | |
1026 | + header.put("totalnumber", "总数"); | |
1027 | + header.put("checkCount", "检查人数"); | |
1028 | + header.put("percentage", "百分比"); | |
1029 | + Map<String, Object> managementRateMap = new LinkedHashMap<>(); | |
1030 | + managementRateMap.put("type", "总管理率"); | |
1031 | + managementRateMap.put("totalnumber", data.get("managementRateCount").toString()); | |
1032 | + managementRateMap.put("checkCount", data.get("managementRateChechkCount").toString()); | |
1033 | + managementRateMap.put("percentage", data.get("managementRatePercentage").toString()); | |
1034 | + Map<String, Object> standardMap = new LinkedHashMap<>(); | |
1035 | + standardMap.put("type", "规范管理率"); | |
1036 | + standardMap.put("totalnumber", data.get("standardTotalnumber").toString()); | |
1037 | + standardMap.put("checkCount", data.get("standardCheckCount").toString()); | |
1038 | + standardMap.put("percentage", data.get("standardPercentage").toString()); | |
1039 | + excelList.add(managementRateMap); | |
1040 | + excelList.add(standardMap); | |
1041 | + response.setContentType("application/force-download"); | |
1042 | + response.setHeader("Content-Disposition", "attachment;filename=" + new String(("儿保总概率统计.xls").getBytes("UTF-8"), "ISO-8859-1")); | |
1043 | + ExcelUtil.toExcel(response.getOutputStream(), excelList, header); | |
1044 | + } catch (Exception e) { | |
1045 | + ExceptionUtils.catchException(e, "babyStatisticsManagerSelfConversionListExcel异常"); | |
1006 | 1046 | } |
1007 | - return new BaseObjectResponse().setData(data); | |
1008 | - | |
1009 | 1047 | } |
1010 | 1048 | |
1011 | - /*** | |
1012 | - *type 0表示正常 1表示高危 | |
1013 | - */ | |
1014 | - public void calculationRules(int checkCount, Integer babyMonthAge, Integer type, int probabilityCount) { | |
1015 | - //正常儿童 | |
1016 | - if (type == 1) { | |
1017 | - if (babyMonthAge >= 1 && babyMonthAge <= 2 && checkCount >= 1) { | |
1018 | - probabilityCount++; | |
1019 | - } else if (babyMonthAge >= 3 && babyMonthAge <= 5 && checkCount >= 2) { | |
1020 | - probabilityCount++; | |
1021 | - } else if (babyMonthAge >= 6 && babyMonthAge <= 7 && checkCount >= 3) { | |
1022 | - probabilityCount++; | |
1023 | - } else if (babyMonthAge >= 8 && babyMonthAge <= 11 && checkCount >= 4) { | |
1024 | - probabilityCount++; | |
1025 | - } else if (babyMonthAge >= 12 && checkCount >= 5) { | |
1026 | - | |
1049 | + public Map<String, Object> probabilityData(Integer babyMonthAge, List<BabyModel> babyModels) { | |
1050 | + Map<String, Object> data = new HashMap<>(); | |
1051 | + int probabilityCount = 0; | |
1052 | + int managementRateChechkCount = 0; | |
1053 | + BabyCheckModelQuery babyCheckModelQuery = new BabyCheckModelQuery(); | |
1054 | + BabyCheckModelQuery babyCheckQuery = new BabyCheckModelQuery(); | |
1055 | + //只查询1月龄做过检查的人数 | |
1056 | + babyCheckQuery.setCheckMonth(1); | |
1057 | + babyCheckQuery.setYn(YnEnums.YES.getId()); | |
1058 | + babyCheckModelQuery.setYn(YnEnums.YES.getId()); | |
1059 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
1060 | + for (BabyModel baby : babyModels) { | |
1061 | + babyCheckModelQuery.setBuildId(baby.getId()); | |
1062 | + int checkCount = babyCheckService.queryBabyCheckCount(babyCheckModelQuery); | |
1063 | + //正常 | |
1064 | + if (null == baby.getHighRisk() || baby.getHighRisk() != 1) { | |
1065 | + if (babyMonthAge >= 1 && babyMonthAge <= 2 && checkCount >= 1) { | |
1066 | + probabilityCount++; | |
1067 | + } else if (babyMonthAge >= 3 && babyMonthAge <= 5 && checkCount >= 2) { | |
1068 | + probabilityCount++; | |
1069 | + } else if (babyMonthAge >= 6 && babyMonthAge <= 7 && checkCount >= 3) { | |
1070 | + probabilityCount++; | |
1071 | + } else if (babyMonthAge >= 8 && babyMonthAge <= 11 && checkCount >= 4) { | |
1072 | + probabilityCount++; | |
1073 | + } else if (babyMonthAge >= 12 && checkCount >= 5) { | |
1074 | + } | |
1075 | + //高儿计算规则 | |
1076 | + } else { | |
1077 | + if (babyMonthAge == 1 && checkCount >= 1) { | |
1078 | + probabilityCount++; | |
1079 | + } else if (babyMonthAge == 2 && checkCount >= 2) { | |
1080 | + probabilityCount++; | |
1081 | + } else if (babyMonthAge == 3 && checkCount >= 3) { | |
1082 | + probabilityCount++; | |
1083 | + } else if (babyMonthAge == 4 && checkCount >= 4) { | |
1084 | + probabilityCount++; | |
1085 | + } else if (babyMonthAge == 5 && checkCount >= 5) { | |
1086 | + probabilityCount++; | |
1087 | + } else if (babyMonthAge >= 6 && babyMonthAge <= 7 && checkCount >= 6) { | |
1088 | + probabilityCount++; | |
1089 | + } else if (babyMonthAge >= 8 && babyMonthAge <= 9 && checkCount >= 7) { | |
1090 | + probabilityCount++; | |
1091 | + } else if (babyMonthAge >= 10 && babyMonthAge <= 11 && checkCount >= 8) { | |
1092 | + probabilityCount++; | |
1093 | + } else if (babyMonthAge >= 12 && babyMonthAge <= 14 && checkCount >= 9) { | |
1094 | + probabilityCount++; | |
1095 | + } else if (babyMonthAge >= 15 && babyMonthAge <= 17 && checkCount >= 10) { | |
1096 | + probabilityCount++; | |
1097 | + } else if (babyMonthAge >= 18 && babyMonthAge <= 20 && checkCount >= 11) { | |
1098 | + probabilityCount++; | |
1099 | + } else if (babyMonthAge >= 21 && babyMonthAge <= 23 && checkCount >= 12) { | |
1100 | + probabilityCount++; | |
1101 | + } else if (babyMonthAge >= 24 && checkCount >= 13) { | |
1102 | + probabilityCount++; | |
1103 | + } | |
1104 | + } | |
1105 | + /**总管理率统计**/ | |
1106 | + babyCheckQuery.setBuildId(baby.getId()); | |
1107 | + int RateChechkCount = babyCheckService.queryBabyCheckCount(babyCheckQuery); | |
1108 | + if (RateChechkCount != 0) { | |
1109 | + managementRateChechkCount++; | |
1110 | + } | |
1027 | 1111 | } |
1028 | - //高危儿 | |
1029 | - } else if (type == 2) { | |
1030 | - if (babyMonthAge == 1 && checkCount >= 1) { | |
1031 | - probabilityCount++; | |
1032 | - } else if (babyMonthAge == 2 && checkCount >= 2) { | |
1033 | - probabilityCount++; | |
1034 | - } else if (babyMonthAge == 3 && checkCount >= 3) { | |
1035 | - probabilityCount++; | |
1036 | - } else if (babyMonthAge == 4 && checkCount >= 4) { | |
1037 | - probabilityCount++; | |
1038 | - } else if (babyMonthAge == 5 && checkCount >= 5) { | |
1039 | - probabilityCount++; | |
1040 | - } else if (babyMonthAge >= 6 && babyMonthAge <= 7 && checkCount >= 6) { | |
1041 | - probabilityCount++; | |
1042 | - } else if (babyMonthAge >= 8 && babyMonthAge <= 9 && checkCount >= 7) { | |
1043 | - probabilityCount++; | |
1044 | - } else if (babyMonthAge >= 10 && babyMonthAge <= 11 && checkCount >= 8) { | |
1045 | - probabilityCount++; | |
1046 | - } else if (babyMonthAge >= 12 && babyMonthAge <= 14 && checkCount >= 9) { | |
1047 | - probabilityCount++; | |
1048 | - } else if (babyMonthAge >= 15 && babyMonthAge <= 17 && checkCount >= 10) { | |
1049 | - probabilityCount++; | |
1050 | - } else if (babyMonthAge >= 18 && babyMonthAge <= 20 && checkCount >= 11) { | |
1051 | - probabilityCount++; | |
1052 | - } else if (babyMonthAge >= 21 && babyMonthAge <= 23 && checkCount >= 12) { | |
1053 | - probabilityCount++; | |
1054 | - } else if (babyMonthAge >= 24 && checkCount >= 13) { | |
1055 | - probabilityCount++; | |
1056 | - } | |
1057 | 1112 | } |
1113 | + data.put("standardCheckCount", probabilityCount); | |
1114 | + data.put("standardTotalnumber", babyModels.size()); | |
1115 | + data.put("standardPercentage", percent(probabilityCount, babyModels.size())); | |
1116 | + data.put("managementRateChechkCount", managementRateChechkCount); | |
1117 | + data.put("managementRateCount", babyModels.size()); | |
1118 | + data.put("managementRatePercentage", percent(managementRateChechkCount, babyModels.size())); | |
1119 | + return data; | |
1058 | 1120 | } |
1059 | 1121 | |
1122 | + | |
1123 | + public Map<String, Object> sum(List<Map<String, Integer>> request) { | |
1124 | + Map<String, Object> data = new HashMap<>(); | |
1125 | + | |
1126 | + Integer managementRateChechkCount = 0; | |
1127 | + Integer standardCheckCount = 0; | |
1128 | + Integer managementRateCount = 0; | |
1129 | + Integer standardTotalnumber = 0; | |
1130 | + | |
1131 | + for (Map<String, Integer> map : request) { | |
1132 | + managementRateChechkCount += map.get("managementRateChechkCount"); | |
1133 | + standardCheckCount += map.get("standardCheckCount"); | |
1134 | + managementRateCount += map.get("managementRateCount"); | |
1135 | + standardTotalnumber += map.get("standardTotalnumber"); | |
1136 | + } | |
1137 | + data.put("standardCheckCount", standardCheckCount); | |
1138 | + data.put("standardTotalnumber", standardTotalnumber); | |
1139 | + data.put("standardPercentage", percent(standardCheckCount, standardTotalnumber)); | |
1140 | + data.put("managementRateChechkCount", managementRateChechkCount); | |
1141 | + data.put("managementRateCount", managementRateCount); | |
1142 | + data.put("managementRatePercentage", percent(managementRateChechkCount, managementRateCount)); | |
1143 | + return data; | |
1144 | + } | |
1060 | 1145 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
307b002
... | ... | @@ -1737,17 +1737,19 @@ |
1737 | 1737 | patientBaseResult.setFlag(true); |
1738 | 1738 | } |
1739 | 1739 | } |
1740 | - | |
1741 | - if (null != pw.getPrintingTime()) { | |
1742 | - int hasPrint = DateUtil.getDays(pw.getPrintingTime(), new Date()); | |
1743 | - if (hasPrint > 21) { | |
1744 | - patientBaseResult.setHasPrintInWeek(false); | |
1740 | + if (null != pw) { | |
1741 | + if (null != pw.getPrintingTime()) { | |
1742 | + int hasPrint = DateUtil.getDays(pw.getPrintingTime(), new Date()); | |
1743 | + if (hasPrint > 21) { | |
1744 | + patientBaseResult.setHasPrintInWeek(false); | |
1745 | + } else { | |
1746 | + patientBaseResult.setHasPrintInWeek(true); | |
1747 | + } | |
1745 | 1748 | } else { |
1746 | - patientBaseResult.setHasPrintInWeek(true); | |
1749 | + patientBaseResult.setHasPrintInWeek(false); | |
1747 | 1750 | } |
1748 | - } else { | |
1749 | - patientBaseResult.setHasPrintInWeek(false); | |
1750 | 1751 | } |
1752 | + | |
1751 | 1753 | return new BaseObjectResponse().setData(patientBaseResult).setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS); |
1752 | 1754 | } |
1753 | 1755 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/babyStatisticalProbabilityWorker.java
View file @
307b002
1 | +package com.lyms.platform.operate.web.worker; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.BabyCheckService; | |
4 | +import com.lyms.platform.common.enums.YnEnums; | |
5 | +import com.lyms.platform.pojo.BabyModel; | |
6 | +import com.lyms.platform.query.BabyCheckModelQuery; | |
7 | +import org.apache.commons.collections.CollectionUtils; | |
8 | + | |
9 | +import java.math.BigDecimal; | |
10 | +import java.util.HashMap; | |
11 | +import java.util.List; | |
12 | +import java.util.Map; | |
13 | +import java.util.concurrent.Callable; | |
14 | + | |
15 | +public class babyStatisticalProbabilityWorker implements Callable<Map<String, Integer>> { | |
16 | + | |
17 | + private Integer babyMonthAge; | |
18 | + private List<BabyModel> babyModels; | |
19 | + private BabyCheckService babyCheckService; | |
20 | + | |
21 | + public babyStatisticalProbabilityWorker(Integer babyMonthAge, List<BabyModel> babyModels, BabyCheckService babyCheckService) { | |
22 | + this.babyMonthAge = babyMonthAge; | |
23 | + this.babyModels = babyModels; | |
24 | + this.babyCheckService = babyCheckService; | |
25 | + } | |
26 | + | |
27 | + @Override | |
28 | + public Map<String, Integer> call() throws Exception { | |
29 | + Map<String, Integer> data = new HashMap<>(); | |
30 | + int probabilityCount = 0; | |
31 | + int managementRateChechkCount = 0; | |
32 | + BabyCheckModelQuery babyCheckModelQuery = new BabyCheckModelQuery(); | |
33 | + BabyCheckModelQuery babyCheckQuery = new BabyCheckModelQuery(); | |
34 | + //只查询1月龄做过检查的人数 | |
35 | + babyCheckQuery.setCheckMonth(1); | |
36 | + babyCheckQuery.setYn(YnEnums.YES.getId()); | |
37 | + babyCheckModelQuery.setYn(YnEnums.YES.getId()); | |
38 | + if (CollectionUtils.isNotEmpty(babyModels)) { | |
39 | + for (BabyModel baby : babyModels) { | |
40 | + babyCheckModelQuery.setBuildId(baby.getId()); | |
41 | + int checkCount = babyCheckService.queryBabyCheckCount(babyCheckModelQuery); | |
42 | + //正常 | |
43 | + if (null == baby.getHighRisk() || baby.getHighRisk() != 1) { | |
44 | + if (babyMonthAge >= 1 && babyMonthAge <= 2 && checkCount >= 1) { | |
45 | + probabilityCount++; | |
46 | + } else if (babyMonthAge >= 3 && babyMonthAge <= 5 && checkCount >= 2) { | |
47 | + probabilityCount++; | |
48 | + } else if (babyMonthAge >= 6 && babyMonthAge <= 7 && checkCount >= 3) { | |
49 | + probabilityCount++; | |
50 | + } else if (babyMonthAge >= 8 && babyMonthAge <= 11 && checkCount >= 4) { | |
51 | + probabilityCount++; | |
52 | + } else if (babyMonthAge >= 12 && checkCount >= 5) { | |
53 | + } | |
54 | + //高儿计算规则 | |
55 | + } else { | |
56 | + if (babyMonthAge == 1 && checkCount >= 1) { | |
57 | + probabilityCount++; | |
58 | + } else if (babyMonthAge == 2 && checkCount >= 2) { | |
59 | + probabilityCount++; | |
60 | + } else if (babyMonthAge == 3 && checkCount >= 3) { | |
61 | + probabilityCount++; | |
62 | + } else if (babyMonthAge == 4 && checkCount >= 4) { | |
63 | + probabilityCount++; | |
64 | + } else if (babyMonthAge == 5 && checkCount >= 5) { | |
65 | + probabilityCount++; | |
66 | + } else if (babyMonthAge >= 6 && babyMonthAge <= 7 && checkCount >= 6) { | |
67 | + probabilityCount++; | |
68 | + } else if (babyMonthAge >= 8 && babyMonthAge <= 9 && checkCount >= 7) { | |
69 | + probabilityCount++; | |
70 | + } else if (babyMonthAge >= 10 && babyMonthAge <= 11 && checkCount >= 8) { | |
71 | + probabilityCount++; | |
72 | + } else if (babyMonthAge >= 12 && babyMonthAge <= 14 && checkCount >= 9) { | |
73 | + probabilityCount++; | |
74 | + } else if (babyMonthAge >= 15 && babyMonthAge <= 17 && checkCount >= 10) { | |
75 | + probabilityCount++; | |
76 | + } else if (babyMonthAge >= 18 && babyMonthAge <= 20 && checkCount >= 11) { | |
77 | + probabilityCount++; | |
78 | + } else if (babyMonthAge >= 21 && babyMonthAge <= 23 && checkCount >= 12) { | |
79 | + probabilityCount++; | |
80 | + } else if (babyMonthAge >= 24 && checkCount >= 13) { | |
81 | + probabilityCount++; | |
82 | + } | |
83 | + } | |
84 | + /**总管理率统计**/ | |
85 | + babyCheckQuery.setBuildId(baby.getId()); | |
86 | + int RateChechkCount = babyCheckService.queryBabyCheckCount(babyCheckQuery); | |
87 | + if (RateChechkCount != 0) { | |
88 | + managementRateChechkCount++; | |
89 | + } | |
90 | + } | |
91 | + } | |
92 | + data.put("standardCheckCount", probabilityCount); | |
93 | + data.put("standardTotalnumber", babyModels.size()); | |
94 | + //data.put("standardPercentage", percent(probabilityCount, babyModels.size())); | |
95 | + data.put("managementRateChechkCount", managementRateChechkCount); | |
96 | + data.put("managementRateCount", babyModels.size()); | |
97 | + //data.put("managementRatePercentage", percent(managementRateChechkCount, babyModels.size())); | |
98 | + return data; | |
99 | + } | |
100 | +} |