Commit 7681838010ed06b7c70773e021643a22f762b02e
1 parent
18f2478e6b
Exists in
master
and in
6 other branches
产筛统计报表
Showing 1 changed file with 104 additions and 10 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SieveFacade.java
View file @
7681838
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | import com.lyms.platform.operate.web.utils.CommonsHelper; |
20 | 20 | import com.lyms.platform.operate.web.worker.SieveWorker; |
21 | 21 | import com.lyms.platform.permission.model.Organization; |
22 | +import com.lyms.platform.permission.model.OrganizationQuery; | |
22 | 23 | import com.lyms.platform.permission.service.CouponService; |
23 | 24 | import com.lyms.platform.permission.service.OrganizationService; |
24 | 25 | import com.lyms.platform.permission.service.UsersService; |
25 | 26 | |
26 | 27 | |
27 | 28 | |
28 | 29 | |
... | ... | @@ -1114,19 +1115,27 @@ |
1114 | 1115 | List<String> currentUserHospPermissions = areaCountFacade.getCurrentUserHospPermissions(userId, cqSieveQueryRequest.getProvinceId(), |
1115 | 1116 | cqSieveQueryRequest.getCityId(), cqSieveQueryRequest.getAreaId()); |
1116 | 1117 | |
1118 | + String[] dates = null; | |
1119 | + if (StringUtils.isNotEmpty(cqSieveQueryRequest.getTime())) { | |
1120 | + dates = cqSieveQueryRequest.getTime().split(" - "); | |
1121 | + } | |
1117 | 1122 | |
1118 | 1123 | BasicConfigQuery basicQuery = new BasicConfigQuery(); |
1119 | 1124 | basicQuery.setYn(YnEnums.YES.getId()); |
1120 | 1125 | basicQuery.setTypeId("b7ea005c-dfac-4c2a-bdae-25239b3f44fd"); |
1121 | 1126 | |
1127 | + int addrType = 0; | |
1122 | 1128 | if (StringUtils.isNotEmpty(cqSieveQueryRequest.getProvinceId())) { |
1123 | 1129 | basicQuery.setParentId(cqSieveQueryRequest.getProvinceId()); |
1130 | + addrType = 1; | |
1124 | 1131 | } |
1125 | 1132 | if (StringUtils.isNotEmpty(cqSieveQueryRequest.getCityId())) { |
1126 | 1133 | basicQuery.setParentId(cqSieveQueryRequest.getCityId()); |
1134 | + addrType = 2; | |
1127 | 1135 | } |
1128 | 1136 | if (StringUtils.isNotEmpty(cqSieveQueryRequest.getAreaId())) { |
1129 | 1137 | basicQuery.setParentId(cqSieveQueryRequest.getAreaId()); |
1138 | + addrType = 3; | |
1130 | 1139 | } |
1131 | 1140 | |
1132 | 1141 | //x轴标题数据 |
... | ... | @@ -1153,8 +1162,7 @@ |
1153 | 1162 | sieveQuery.setHospitalIds(currentUserHospPermissions); |
1154 | 1163 | sieveQuery.setYn(YnEnums.YES.getId()); |
1155 | 1164 | sieveQuery.setStatus(3); |
1156 | - if (StringUtils.isNotEmpty(cqSieveQueryRequest.getTime())) { | |
1157 | - String[] dates = cqSieveQueryRequest.getTime().split(" - "); | |
1165 | + if (dates != null) { | |
1158 | 1166 | sieveQuery.setResultTimeStart(DateUtil.parseYMD(dates[0])); |
1159 | 1167 | if (dates.length == 2) { |
1160 | 1168 | sieveQuery.setResultTimeEnd(DateUtil.parseYMDHMS(dates[1] + " 23:59:59")); |
1161 | 1169 | |
1162 | 1170 | |
1163 | 1171 | |
... | ... | @@ -1168,16 +1176,15 @@ |
1168 | 1176 | map.put("name", "产筛人数"); |
1169 | 1177 | map.put("type", "bar"); |
1170 | 1178 | map.put("data", csItems); |
1179 | + series.add(map); | |
1171 | 1180 | |
1172 | - | |
1173 | 1181 | DiagnosisQuery diagnosisQuery = new DiagnosisQuery(); |
1174 | 1182 | diagnosisQuery.setHospitalIds(currentUserHospPermissions); |
1175 | 1183 | |
1176 | - if (StringUtils.isNotEmpty(cqSieveQueryRequest.getTime())) { | |
1177 | - String[] dates = cqSieveQueryRequest.getTime().split(" - "); | |
1178 | - sieveQuery.setResultTimeStart(DateUtil.parseYMD(dates[0])); | |
1184 | + if (dates != null) { | |
1185 | + diagnosisQuery.setResultDateStart(DateUtil.parseYMD(dates[0])); | |
1179 | 1186 | if (dates.length == 2) { |
1180 | - sieveQuery.setResultTimeEnd(DateUtil.parseYMDHMS(dates[1] + " 23:59:59")); | |
1187 | + diagnosisQuery.setResultDateEnd(DateUtil.parseYMDHMS(dates[1] + " 23:59:59")); | |
1181 | 1188 | } |
1182 | 1189 | } |
1183 | 1190 | |
1184 | 1191 | |
1185 | 1192 | |
... | ... | @@ -1185,17 +1192,104 @@ |
1185 | 1192 | List<String> dItems = new ArrayList<>(); |
1186 | 1193 | csItems.add(String.valueOf(diagnosisCount)); |
1187 | 1194 | Map<String, Object> dMap = new HashMap(); |
1188 | - map.put("name", "产筛人数"); | |
1189 | - map.put("type", "bar"); | |
1190 | - map.put("data", dItems); | |
1195 | + dMap.put("name", "诊断人数"); | |
1196 | + dMap.put("type", "bar"); | |
1197 | + dMap.put("data", dItems); | |
1191 | 1198 | series.add(dMap); |
1192 | 1199 | |
1200 | + List<List<String>> result = new ArrayList<>(); | |
1201 | + | |
1202 | +// List<String> titles = new ArrayList<>(); | |
1203 | +// titles.add("序号"); | |
1204 | +// titles.add("地市名称"); | |
1205 | +// titles.add("机构数"); | |
1206 | +// titles.add("应筛查人数"); | |
1207 | +// titles.add("产筛总数"); | |
1208 | +// titles.add("诊断总人数"); | |
1209 | +// result.add(titles); | |
1210 | + | |
1211 | + int num = 1; | |
1212 | + if (CollectionUtils.isNotEmpty(configList)) | |
1213 | + { | |
1214 | + | |
1215 | + for (BasicConfig c : configList) { | |
1216 | + List<String> items = new ArrayList<>(); | |
1217 | + items.add(String.valueOf(num)); | |
1218 | + items.add(c.getName()); | |
1219 | + | |
1220 | + OrganizationQuery query = new OrganizationQuery(); | |
1221 | + query.setYn(YnEnums.YES.getId()); | |
1222 | + if (addrType == 1) { | |
1223 | + query.setCityId(c.getId()); | |
1224 | + } else if (addrType == 2) { | |
1225 | + query.setAreaId(c.getId()); | |
1226 | + } | |
1227 | + //查询机构数 | |
1228 | + List<Organization> orgs = organizationService.queryOrganization(query); | |
1229 | + int orgSize = CollectionUtils.isNotEmpty(orgs) ? orgs.size() : 0; | |
1230 | + items.add(String.valueOf(orgSize)); | |
1231 | + | |
1232 | + | |
1233 | + List<String> hids = getConditionHospitalIds(currentUserHospPermissions, orgs); | |
1234 | + | |
1235 | + | |
1236 | + //应筛查人数 | |
1237 | + SieveQuery ySieveQuery = new SieveQuery(); | |
1238 | + ySieveQuery.setHospitalIds(hids); | |
1239 | + if (dates != null) { | |
1240 | + ySieveQuery.setResultTimeStart(DateUtil.parseYMD(dates[0])); | |
1241 | + if (dates.length == 2) { | |
1242 | + ySieveQuery.setResultTimeEnd(DateUtil.parseYMDHMS(dates[1] + " 23:59:59")); | |
1243 | + } | |
1244 | + } | |
1245 | + int ycount = sieveService.queryListCount(ySieveQuery); | |
1246 | + items.add(String.valueOf(ycount)); | |
1247 | + | |
1248 | + //产筛总数 | |
1249 | + SieveQuery sieveQuery1 = new SieveQuery(); | |
1250 | + sieveQuery1.setHospitalIds(hids); | |
1251 | + sieveQuery1.setYn(YnEnums.YES.getId()); | |
1252 | + sieveQuery1.setStatus(3); | |
1253 | + if (dates != null) { | |
1254 | + sieveQuery1.setResultTimeStart(DateUtil.parseYMD(dates[0])); | |
1255 | + if (dates.length == 2) { | |
1256 | + sieveQuery1.setResultTimeEnd(DateUtil.parseYMDHMS(dates[1] + " 23:59:59")); | |
1257 | + } | |
1258 | + } | |
1259 | + int sieveFinishCountAll = sieveService.queryListCount(sieveQuery1); | |
1260 | + items.add(String.valueOf(sieveFinishCountAll)); | |
1261 | + | |
1262 | + //诊断总人数 | |
1263 | + DiagnosisQuery diagnosisQuery1 = new DiagnosisQuery(); | |
1264 | + diagnosisQuery1.setHospitalIds(currentUserHospPermissions); | |
1265 | + if (dates != null) { | |
1266 | + diagnosisQuery1.setResultDateStart(DateUtil.parseYMD(dates[0])); | |
1267 | + if (dates.length == 2) { | |
1268 | + diagnosisQuery1.setResultDateEnd(DateUtil.parseYMDHMS(dates[1] + " 23:59:59")); | |
1269 | + } | |
1270 | + } | |
1271 | + int diagnosisCountAll = diagnosisService.queryDiagnosisCount(diagnosisQuery1); | |
1272 | + items.add(String.valueOf(diagnosisCountAll)); | |
1273 | + num++; | |
1274 | + } | |
1275 | + } | |
1276 | + | |
1193 | 1277 | Map<String, Object> datas = new HashMap<>(); |
1194 | 1278 | datas.put("series", series); |
1195 | 1279 | datas.put("xAxis", xAxis); |
1196 | 1280 | datas.put("legend", titleItems); |
1197 | 1281 | return new BaseObjectResponse() |
1198 | 1282 | .setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(datas); |
1283 | + } | |
1284 | + | |
1285 | + private List<String> getConditionHospitalIds(List<String> currentUserHospPermissions, List<Organization> conditionHospitals) { | |
1286 | + List<String> hids = new ArrayList<>(); | |
1287 | + for (Organization org : conditionHospitals) { | |
1288 | + hids.add(String.valueOf(org.getId())); | |
1289 | + } | |
1290 | + hids.retainAll(currentUserHospPermissions); | |
1291 | + | |
1292 | + return hids; | |
1199 | 1293 | } |
1200 | 1294 | |
1201 | 1295 | @Autowired |