Commit 89035385221deb09fe2c315dc49797f319b1a152
1 parent
41d1632b10
Exists in
master
and in
6 other branches
筛查统计
Showing 5 changed files with 258 additions and 10 deletions
- 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/SieveController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AreaCountFacade.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/facade/SieveFacade.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBuildController.java
View file @
8903538
... | ... | @@ -83,7 +83,7 @@ |
83 | 83 | @ResponseBody |
84 | 84 | public BaseResponse deleteBabyBuildById(@PathVariable("id") String id, HttpServletRequest request) { |
85 | 85 | |
86 | - return babyBookbuildingFacade.deleteBabyBuildById(id,getUserId(request)); | |
86 | + return babyBookbuildingFacade.deleteBabyBuildById(id, getUserId(request)); | |
87 | 87 | |
88 | 88 | } |
89 | 89 | |
... | ... | @@ -337,7 +337,7 @@ |
337 | 337 | // 是否区域 |
338 | 338 | request.setIsArea(isArea); |
339 | 339 | |
340 | - babyBookbuildingFacade.exportChilds(request,loginState.getId(),httpServletResponse); | |
340 | + babyBookbuildingFacade.exportChilds(request, loginState.getId(), httpServletResponse); | |
341 | 341 | } |
342 | 342 | |
343 | 343 | |
... | ... | @@ -483,6 +483,32 @@ |
483 | 483 | babyBookbuildingFacade.exportBabyGrowthRightList(babyManageRequest, loginState.getId(), httpServletResponse); |
484 | 484 | } |
485 | 485 | |
486 | + | |
487 | + | |
488 | + | |
489 | + | |
490 | + /** | |
491 | + * 围产儿统计报表 | |
492 | + * @param request | |
493 | + * @param response | |
494 | + * @param time | |
495 | + * @param ageType 1, <= 20 2, 20-=25 3,25-=30, 4,30-=35 5, >35 | |
496 | + * @param lievType 1 城镇 2 农业 | |
497 | + * @return | |
498 | + */ | |
499 | + @ResponseBody | |
500 | + @RequestMapping(value = "/queryWcBabyReport",method = RequestMethod.GET) | |
501 | + @TokenRequired | |
502 | + public BaseResponse queryWcBabyReport(HttpServletRequest request,HttpServletResponse response, | |
503 | + @RequestParam(required = false)String time, | |
504 | + @RequestParam(required = false)Integer ageType, | |
505 | + @RequestParam(required = false)Integer lievType, | |
506 | + @RequestParam(required = false)String provinceId, | |
507 | + @RequestParam(required = false)String cityId | |
508 | + ){ | |
509 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
510 | + return babyBookbuildingFacade.queryWcBabyReport(loginState.getId(), time, ageType,lievType ,provinceId,cityId); | |
511 | + } | |
486 | 512 | |
487 | 513 | |
488 | 514 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SieveController.java
View file @
8903538
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AreaCountFacade.java
View file @
8903538
1 | 1 | package com.lyms.platform.operate.web.facade; |
2 | 2 | |
3 | 3 | |
4 | +import com.lyms.platform.beans.AddressBean; | |
4 | 5 | import com.lyms.platform.biz.service.*; |
5 | 6 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
6 | 7 | import com.lyms.platform.common.enums.YnEnums; |
... | ... | @@ -160,6 +161,43 @@ |
160 | 161 | return hospitalList; |
161 | 162 | } |
162 | 163 | |
164 | + | |
165 | + public boolean hasPermissions(String id,Integer addType,List<DataPermissionsModel> permissionsModels) | |
166 | + { | |
167 | + | |
168 | + if (CollectionUtils.isNotEmpty(permissionsModels) && StringUtils.isNotEmpty(permissionsModels.get(0).getAreaPermission())) | |
169 | + { | |
170 | + List<AddressBean> addressBeanList = JsonUtil.toList(permissionsModels.get(0).getAreaPermission(), AddressBean.class); | |
171 | + if (CollectionUtils.isEmpty(addressBeanList)) | |
172 | + { | |
173 | + return false; | |
174 | + } | |
175 | + | |
176 | + for (AddressBean bean : addressBeanList) | |
177 | + { | |
178 | + if (addType == 1) { | |
179 | + if (id != null && id.equals(bean.getC())) { | |
180 | + return true; | |
181 | + } | |
182 | + } | |
183 | + else if (addType == 2) | |
184 | + { | |
185 | + if (id != null && id.equals(bean.getA())) | |
186 | + { | |
187 | + return true; | |
188 | + } | |
189 | + } | |
190 | + else if (addType == 3) | |
191 | + { | |
192 | + if (id != null && id.equals(bean.getS())) | |
193 | + { | |
194 | + return true; | |
195 | + } | |
196 | + } | |
197 | + } | |
198 | + } | |
199 | + return false; | |
200 | + } | |
163 | 201 | |
164 | 202 | /** |
165 | 203 | * 产检节点统计 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
8903538
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | import com.lyms.hospitalapi.qhdfy.QhdfyHisService; |
7 | 7 | import com.lyms.hospitalapi.qinglongxian.QingLongXianHisService; |
8 | 8 | import com.lyms.hospitalapi.v2.HisService; |
9 | +import com.lyms.platform.beans.AddressBean; | |
9 | 10 | import com.lyms.platform.beans.MsgRequest; |
10 | 11 | import com.lyms.platform.biz.service.*; |
11 | 12 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
... | ... | @@ -15,6 +16,7 @@ |
15 | 16 | import com.lyms.platform.common.result.BaseObjectResponse; |
16 | 17 | import com.lyms.platform.common.result.BaseResponse; |
17 | 18 | import com.lyms.platform.common.utils.*; |
19 | +import com.lyms.platform.common.utils.StringUtils; | |
18 | 20 | import com.lyms.platform.operate.web.request.*; |
19 | 21 | import com.lyms.platform.operate.web.result.*; |
20 | 22 | import com.lyms.platform.operate.web.service.ITrackDownService; |
... | ... | @@ -31,6 +33,7 @@ |
31 | 33 | import com.lyms.platform.pojo.*; |
32 | 34 | import com.lyms.platform.query.*; |
33 | 35 | import org.apache.commons.collections.CollectionUtils; |
36 | +import org.apache.commons.lang.*; | |
34 | 37 | import org.apache.commons.lang.math.NumberUtils; |
35 | 38 | import org.springframework.beans.factory.annotation.Autowired; |
36 | 39 | import org.springframework.beans.factory.annotation.Qualifier; |
37 | 40 | |
... | ... | @@ -119,7 +122,11 @@ |
119 | 122 | @Autowired |
120 | 123 | private SyncDataService syncDataService; |
121 | 124 | |
125 | + | |
122 | 126 | @Autowired |
127 | + private AreaCountFacade areaCountFacade; | |
128 | + | |
129 | + @Autowired | |
123 | 130 | private SmsConfigFacade smsConfigFacade; |
124 | 131 | |
125 | 132 | @Autowired |
... | ... | @@ -3214,5 +3221,172 @@ |
3214 | 3221 | public void deleteFmHistoryRecord(MongoQuery mongoQuery) { |
3215 | 3222 | babyBookbuildingService.deleteFmHistoryRecord(mongoQuery); |
3216 | 3223 | } |
3224 | + | |
3225 | + public BaseResponse queryWcBabyReport(Integer userId, String time, Integer ageType, Integer lievType, String provinceId, String cityId) { | |
3226 | + | |
3227 | + //获取用户权限医院和筛选条件的交集 | |
3228 | + List<String> currentUserHospPermissions = areaCountFacade.getCurrentUserHospPermissions(userId, provinceId, | |
3229 | + cityId, null); | |
3230 | + | |
3231 | + String[] dates = null; | |
3232 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(time)) { | |
3233 | + dates = time.split(" - "); | |
3234 | + } | |
3235 | + | |
3236 | + BasicConfigQuery basicQuery = new BasicConfigQuery(); | |
3237 | + basicQuery.setYn(YnEnums.YES.getId()); | |
3238 | + basicQuery.setTypeId("b7ea005c-dfac-4c2a-bdae-25239b3f44fd"); | |
3239 | + | |
3240 | + int addrType = 0; | |
3241 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(provinceId)) { | |
3242 | + basicQuery.setParentId(provinceId); | |
3243 | + addrType = 1; | |
3244 | + } | |
3245 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(cityId)) { | |
3246 | + basicQuery.setParentId(cityId); | |
3247 | + addrType = 2; | |
3248 | + } | |
3249 | + | |
3250 | + | |
3251 | + //x轴标题数据 | |
3252 | + List<String> xAxis = new ArrayList<>(); | |
3253 | + | |
3254 | + | |
3255 | +// DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
3256 | +// dataPermissionsModelQuery.setUserId(userId); | |
3257 | +// List<DataPermissionsModel> permissionsModels = dataPermissionService.queryPermission(dataPermissionsModelQuery); | |
3258 | + | |
3259 | + | |
3260 | + //获取地址列表 | |
3261 | + List<BasicConfig> configList = basicConfigService.queryBasicConfig(basicQuery); | |
3262 | + | |
3263 | + if (CollectionUtils.isNotEmpty(configList)) { | |
3264 | + for (BasicConfig addr : configList) { | |
3265 | + xAxis.add(addr.getName()); | |
3266 | + } | |
3267 | + } | |
3268 | + | |
3269 | + //分类标题 | |
3270 | + List<String> titleItems = new LinkedList<>(); | |
3271 | + titleItems.add("总数"); | |
3272 | + titleItems.add("男"); | |
3273 | + titleItems.add("女"); | |
3274 | + | |
3275 | + //图标数据 | |
3276 | + List<Map<String, Object>> series = new LinkedList<>(); | |
3277 | + | |
3278 | + if (CollectionUtils.isNotEmpty(configList)) { | |
3279 | + Map<String, Object> map = new HashMap(); | |
3280 | + map.put("name", "总数"); | |
3281 | + map.put("type", "bar"); | |
3282 | + | |
3283 | + Map<String, Object> manMap = new HashMap(); | |
3284 | + manMap.put("name", "男"); | |
3285 | + manMap.put("type", "bar"); | |
3286 | + | |
3287 | + Map<String, Object> womanMap = new HashMap(); | |
3288 | + womanMap.put("name", "女"); | |
3289 | + womanMap.put("type", "bar"); | |
3290 | + | |
3291 | + List<String> zsItems = new ArrayList<>(); | |
3292 | + List<String> manItems = new ArrayList<>(); | |
3293 | + List<String> womanItems = new ArrayList<>(); | |
3294 | + for (BasicConfig c : configList) { | |
3295 | + | |
3296 | + OrganizationQuery idQuery = new OrganizationQuery(); | |
3297 | + idQuery.setYn(YnEnums.YES.getId()); | |
3298 | + | |
3299 | + //查询机构数 | |
3300 | + if (addrType == 1) { | |
3301 | + idQuery.setCityId(c.getId()); | |
3302 | + } else if (addrType == 2) { | |
3303 | + idQuery.setAreaId(c.getId()); | |
3304 | + } | |
3305 | + List<Organization> orgs = organizationService.queryOrganization(idQuery); | |
3306 | + List<String> hids = getConditionHospitalIds(currentUserHospPermissions, orgs); | |
3307 | + | |
3308 | + if (CollectionUtils.isNotEmpty(hids)) | |
3309 | + { | |
3310 | + zsItems.add("0"); | |
3311 | + manItems.add("0"); | |
3312 | + womanItems.add("0"); | |
3313 | + } | |
3314 | + else | |
3315 | + { | |
3316 | + zsItems.add("0"); | |
3317 | + manItems.add("0"); | |
3318 | + womanItems.add("0"); | |
3319 | + } | |
3320 | + } | |
3321 | + map.put("data", zsItems); | |
3322 | + series.add(map); | |
3323 | + | |
3324 | + manMap.put("data", manItems); | |
3325 | + series.add(manMap); | |
3326 | + | |
3327 | + womanMap.put("data", womanItems); | |
3328 | + series.add(womanMap); | |
3329 | + } | |
3330 | + | |
3331 | + | |
3332 | + List<List<String>> result = new ArrayList<>(); | |
3333 | + | |
3334 | + int num = 1; | |
3335 | + if (CollectionUtils.isNotEmpty(configList)) | |
3336 | + { | |
3337 | + for (BasicConfig c : configList) { | |
3338 | + | |
3339 | + List<String> items = new ArrayList<>(); | |
3340 | + items.add(String.valueOf(num)); | |
3341 | + items.add(c.getName()); | |
3342 | + | |
3343 | + OrganizationQuery query = new OrganizationQuery(); | |
3344 | + query.setYn(YnEnums.YES.getId()); | |
3345 | + if (addrType == 1) { | |
3346 | + query.setCityId(c.getId()); | |
3347 | + } else if (addrType == 2) { | |
3348 | + query.setAreaId(c.getId()); | |
3349 | + } | |
3350 | + //查询机构数 | |
3351 | + List<Organization> orgs = organizationService.queryOrganization(query); | |
3352 | + int orgSize = CollectionUtils.isNotEmpty(orgs) ? orgs.size() : 0; | |
3353 | + items.add(String.valueOf(orgSize)); | |
3354 | + | |
3355 | + | |
3356 | + List<String> hids = getConditionHospitalIds(currentUserHospPermissions, orgs); | |
3357 | + if (CollectionUtils.isNotEmpty(hids)) { | |
3358 | + } | |
3359 | + else | |
3360 | + { | |
3361 | + items.add("0"); | |
3362 | + items.add("0"); | |
3363 | + items.add("0"); | |
3364 | + } | |
3365 | + num++; | |
3366 | + result.add(items); | |
3367 | + } | |
3368 | + } | |
3369 | + | |
3370 | + Map<String, Object> datas = new HashMap<>(); | |
3371 | + datas.put("series", series); | |
3372 | + datas.put("xAxis", xAxis); | |
3373 | + datas.put("legend", titleItems); | |
3374 | + datas.put("tableDatas", result); | |
3375 | + return new BaseObjectResponse() | |
3376 | + .setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(datas); | |
3377 | + } | |
3378 | + | |
3379 | + | |
3380 | + | |
3381 | + private List<String> getConditionHospitalIds(List<String> currentUserHospPermissions, List<Organization> conditionHospitals) { | |
3382 | + List<String> hids = new ArrayList<>(); | |
3383 | + for (Organization org : conditionHospitals) { | |
3384 | + hids.add(String.valueOf(org.getId())); | |
3385 | + } | |
3386 | + hids.retainAll(currentUserHospPermissions); | |
3387 | + | |
3388 | + return hids; | |
3389 | + } | |
3390 | + | |
3217 | 3391 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SieveFacade.java
View file @
8903538
... | ... | @@ -1143,12 +1143,20 @@ |
1143 | 1143 | //x轴标题数据 |
1144 | 1144 | List<String> xAxis = new ArrayList<>(); |
1145 | 1145 | |
1146 | - //获取地址列表 | |
1147 | - List<BasicConfig> configList = basicConfigService.queryBasicConfig(basicQuery); | |
1146 | + List<BasicConfig> configList = new ArrayList<>(); | |
1148 | 1147 | |
1148 | + DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
1149 | + dataPermissionsModelQuery.setUserId(userId); | |
1150 | + List<DataPermissionsModel> permissionsModels = dataPermissionService.queryPermission(dataPermissionsModelQuery); | |
1151 | + //获取地址列表 | |
1152 | + List<BasicConfig> dataConfigs = basicConfigService.queryBasicConfig(basicQuery); | |
1149 | 1153 | if (CollectionUtils.isNotEmpty(configList)) { |
1150 | - for (BasicConfig addr : configList) { | |
1151 | - xAxis.add(addr.getName()); | |
1154 | + for (BasicConfig addr : dataConfigs) { | |
1155 | + if (areaCountFacade.hasPermissions(addr.getId(),addrType,permissionsModels)) | |
1156 | + { | |
1157 | + configList.add(addr); | |
1158 | + xAxis.add(addr.getName()); | |
1159 | + } | |
1152 | 1160 | } |
1153 | 1161 | } |
1154 | 1162 | |
... | ... | @@ -1290,7 +1298,6 @@ |
1290 | 1298 | diagnosisQuery1.setResultDateEnd(DateUtil.parseYMDHMS(dates[1])); |
1291 | 1299 | } |
1292 | 1300 | } |
1293 | - System.out.println("diagnosisQuery1==="+diagnosisQuery1.convertToQuery().convertToMongoQuery()); | |
1294 | 1301 | int diagnosisCountAll = diagnosisService.queryDiagnosisCount(diagnosisQuery1); |
1295 | 1302 | items.add(String.valueOf(diagnosisCountAll)); |
1296 | 1303 | } |
1297 | 1304 | |
... | ... | @@ -1326,8 +1333,9 @@ |
1326 | 1333 | |
1327 | 1334 | @Autowired |
1328 | 1335 | private BasicConfigService basicConfigService; |
1329 | - | |
1330 | 1336 | @Autowired |
1337 | + private DataPermissionService dataPermissionService; | |
1338 | + @Autowired | |
1331 | 1339 | private AreaCountFacade areaCountFacade; |
1332 | 1340 | |
1333 | 1341 | |
1334 | 1342 | |
... | ... | @@ -1599,11 +1607,11 @@ |
1599 | 1607 | dates = cqSieveQueryRequest.getTime().split(" - "); |
1600 | 1608 | titleName+=cqSieveQueryRequest.getTime(); |
1601 | 1609 | } |
1602 | - List<Map<String,String>> list = getSieveDatas(currentUserHospPermissions,dates,cqSieveQueryRequest.getCityId()); | |
1610 | + List<Map<String,String>> list = getSieveDatas(currentUserHospPermissions, dates, cqSieveQueryRequest.getCityId()); | |
1603 | 1611 | response.setContentType("application/force-download"); |
1604 | 1612 | response.setHeader("Content-Disposition", "attachment;filename=" + new String(("孕妇产前筛查和诊断情况月报表.xls").getBytes("UTF-8"), "ISO-8859-1")); |
1605 | 1613 | String path = this.getClass().getResource("/").getPath()+ "whfy_sieve.xls"; |
1606 | - ExcelUtil.writeWhSieveExclFile(path, response.getOutputStream(), list,titleName); | |
1614 | + ExcelUtil.writeWhSieveExclFile(path, response.getOutputStream(), list, titleName); | |
1607 | 1615 | |
1608 | 1616 | } catch (Exception e) { |
1609 | 1617 | ExceptionUtils.catchException(e, "exportSieveReportExcl error"); |
... | ... | @@ -2024,5 +2032,6 @@ |
2024 | 2032 | |
2025 | 2033 | list.add(dataMap); |
2026 | 2034 | } |
2035 | + | |
2027 | 2036 | } |