Commit 731b3596b6e897a3796d93eac88ead4c572773a3
1 parent
e4d3cd6a4a
Exists in
master
and in
1 other branch
update
Showing 1 changed file with 52 additions and 8 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/FolicAcidFacade.java
View file @
731b359
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.service.BasicConfigService; |
| 4 | +import com.lyms.platform.biz.service.DataPermissionService; | |
| 4 | 5 | import com.lyms.platform.biz.service.FolicAcidService; |
| 5 | 6 | import com.lyms.platform.biz.service.ResidentsArchiveService; |
| 6 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 7 | 8 | |
| ... | ... | @@ -19,8 +20,10 @@ |
| 19 | 20 | import com.lyms.platform.permission.model.Users; |
| 20 | 21 | import com.lyms.platform.permission.service.OrganizationService; |
| 21 | 22 | import com.lyms.platform.permission.service.UsersService; |
| 23 | +import com.lyms.platform.pojo.DataPermissionsModel; | |
| 22 | 24 | import com.lyms.platform.pojo.FolicAcid; |
| 23 | 25 | import com.lyms.platform.pojo.ResidentsArchiveModel; |
| 26 | +import com.lyms.platform.query.DataPermissionsModelQuery; | |
| 24 | 27 | import com.lyms.platform.query.FolicAcidQuery; |
| 25 | 28 | import com.lyms.platform.query.ResidentsArchiveQuery; |
| 26 | 29 | import org.apache.commons.collections.CollectionUtils; |
| ... | ... | @@ -50,6 +53,8 @@ |
| 50 | 53 | private UsersService usersService; |
| 51 | 54 | @Autowired |
| 52 | 55 | private BasicConfigService basicConfigService; |
| 56 | + @Autowired | |
| 57 | + private DataPermissionService dataPermissionService; | |
| 53 | 58 | |
| 54 | 59 | public BaseResponse addOrUpdateFolicAcid(FolicAcidAddRequest addRequest,Integer userId){ |
| 55 | 60 | |
| ... | ... | @@ -99,6 +104,8 @@ |
| 99 | 104 | //建档日期 |
| 100 | 105 | model.setBuildDay(DateUtil.getYmd(new Date())); |
| 101 | 106 | |
| 107 | + model.setVcCardNo(addRequest.getVcCardNo()); | |
| 108 | + | |
| 102 | 109 | ResidentsArchiveModel residentsArchiveModel = residentsArchiveService.addResident(model); |
| 103 | 110 | |
| 104 | 111 | id = addOrUpdate(addRequest,userId,residentsArchiveModel.getId()); |
| ... | ... | @@ -205,7 +212,7 @@ |
| 205 | 212 | return response; |
| 206 | 213 | } |
| 207 | 214 | |
| 208 | - public BaseListResponse queryFolicAcid(FolicAcidQueryRequest queryRequest){ | |
| 215 | + public BaseListResponse queryFolicAcid(FolicAcidQueryRequest queryRequest,Integer userId){ | |
| 209 | 216 | |
| 210 | 217 | List<Map<String,Object>> list = new ArrayList<>(); |
| 211 | 218 | |
| ... | ... | @@ -217,8 +224,6 @@ |
| 217 | 224 | folicAcidQuery.setLimit(queryRequest.getLimit()); |
| 218 | 225 | folicAcidQuery.setNeed("y"); |
| 219 | 226 | |
| 220 | - folicAcidQuery.setHospitalId(queryRequest.getHospitalId()); | |
| 221 | - | |
| 222 | 227 | if(StringUtils.isNotEmpty(queryRequest.getDrawTime())){ |
| 223 | 228 | String[] dates = queryRequest.getDrawTime().split(" - "); |
| 224 | 229 | folicAcidQuery.setDrawTimeStart(DateUtil.parseYMD(dates[0])); |
| ... | ... | @@ -231,7 +236,6 @@ |
| 231 | 236 | folicAcidQuery.setDrawTimeEnd(date); |
| 232 | 237 | } |
| 233 | 238 | } |
| 234 | - | |
| 235 | 239 | folicAcidQuery.setHighRisk(queryRequest.getHighRisk()); |
| 236 | 240 | |
| 237 | 241 | //省市区筛选机构 |
| 238 | 242 | |
| 239 | 243 | |
| ... | ... | @@ -242,13 +246,54 @@ |
| 242 | 246 | organizationQuery.setProvinceId(queryRequest.getProvinceId()); |
| 243 | 247 | organizationQuery.setCityId(queryRequest.getCityId()); |
| 244 | 248 | organizationQuery.setAreaId(queryRequest.getAreaId()); |
| 245 | - | |
| 246 | 249 | organizationList = new ArrayList<>(); |
| 247 | 250 | organizationList = organizationService.queryHospitals(organizationQuery); |
| 248 | 251 | } |
| 249 | 252 | |
| 250 | - List<String> hospitalIds = null; | |
| 251 | 253 | |
| 254 | + List<String> hospitalList = null; | |
| 255 | + //判断当前用户是否有区域权限 | |
| 256 | + if (userId!=null){ | |
| 257 | + hospitalList = new ArrayList<>(); | |
| 258 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
| 259 | + if(null!=hospital){ | |
| 260 | + //本院 | |
| 261 | + hospitalList.add(hospital); | |
| 262 | + } | |
| 263 | + //查询用户是否有区域权限 | |
| 264 | + DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
| 265 | + dataPermissionsModelQuery.setUserId(userId); | |
| 266 | + List<DataPermissionsModel> permissionsModels = dataPermissionService.queryPermission(dataPermissionsModelQuery); | |
| 267 | + if (CollectionUtils.isNotEmpty(permissionsModels)) { | |
| 268 | + Set<String> set = permissionsModels.get(0).getData().keySet(); | |
| 269 | + Iterator<String> it = set.iterator(); | |
| 270 | + while (it.hasNext()) { | |
| 271 | + String id = it.next(); | |
| 272 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(id) && !hospitalList.contains(id)) { | |
| 273 | + hospitalList.add(id); | |
| 274 | + } | |
| 275 | + } | |
| 276 | + } | |
| 277 | + if (StringUtils.isNotEmpty(queryRequest.getHospitalId())){ | |
| 278 | + List<String> orgId = new ArrayList<>(); | |
| 279 | + orgId.add(queryRequest.getHospitalId()); | |
| 280 | + hospitalList.retainAll(orgId); | |
| 281 | + } | |
| 282 | + | |
| 283 | + if (organizationList!=null){ | |
| 284 | + List<String> orgId = new ArrayList<>(); | |
| 285 | + if (CollectionUtils.isNotEmpty(organizationList)) { | |
| 286 | + for (Organization org : organizationList) { | |
| 287 | + if (null != org.getId()) { | |
| 288 | + orgId.add(org.getId() + ""); | |
| 289 | + } | |
| 290 | + } | |
| 291 | + } | |
| 292 | + hospitalList.retainAll(orgId); | |
| 293 | + } | |
| 294 | + folicAcidQuery.setHospitalList(hospitalList); | |
| 295 | + } | |
| 296 | + /*List<String> hospitalIds = null; | |
| 252 | 297 | if (CollectionUtils.isNotEmpty(organizationList)){ |
| 253 | 298 | hospitalIds = new ArrayList<>(); |
| 254 | 299 | for (Organization hospital : organizationList){ |
| ... | ... | @@ -262,8 +307,7 @@ |
| 262 | 307 | }else { |
| 263 | 308 | folicAcidQuery.setHospitalId("-1"); |
| 264 | 309 | } |
| 265 | - } | |
| 266 | - | |
| 310 | + }*/ | |
| 267 | 311 | List<FolicAcid> folicAcidList = folicAcidService.queryFolicAcid(folicAcidQuery); |
| 268 | 312 | if (CollectionUtils.isNotEmpty(folicAcidList)){ |
| 269 | 313 | for (FolicAcid data : folicAcidList){ |