Commit b89302906661dfac66ed4d93fd2d849f16fca711
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 2 changed files
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/FolicAcidController.java
View file @
b893029
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 | //获取单个发放记录 |
43 | 43 | @RequestMapping(value = "/getFolicAcid", method = RequestMethod.GET) |
44 | 44 | @ResponseBody |
45 | - @TokenRequired | |
45 | +// @TokenRequired | |
46 | 46 | public BaseObjectResponse getFolicAcid(@Valid FolicAcidQueryRequest folicAcidQueryRequest, |
47 | 47 | HttpServletRequest request) { |
48 | 48 | return folicAcidFacade.getFolicAcid(folicAcidQueryRequest); |
... | ... | @@ -54,7 +54,8 @@ |
54 | 54 | @TokenRequired |
55 | 55 | public BaseListResponse queryFolicAcid(@Valid FolicAcidQueryRequest folicAcidQueryRequest, |
56 | 56 | HttpServletRequest request) { |
57 | - return folicAcidFacade.queryFolicAcid(folicAcidQueryRequest); | |
57 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
58 | + return folicAcidFacade.queryFolicAcid(folicAcidQueryRequest,loginState.getId()); | |
58 | 59 | } |
59 | 60 | |
60 | 61 | //删除叶酸发放记录 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/FolicAcidFacade.java
View file @
b893029
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 | |
56 | 61 | |
... | ... | @@ -96,7 +101,11 @@ |
96 | 101 | model.setPhone(addRequest.getPhone()); |
97 | 102 | |
98 | 103 | model.setSex(SystemConfig.WOMAN_ID); |
104 | + //建档日期 | |
105 | + model.setBuildDay(DateUtil.getYmd(new Date())); | |
99 | 106 | |
107 | + model.setVcCardNo(addRequest.getVcCardNo()); | |
108 | + | |
100 | 109 | ResidentsArchiveModel residentsArchiveModel = residentsArchiveService.addResident(model); |
101 | 110 | |
102 | 111 | id = addOrUpdate(addRequest,userId,residentsArchiveModel.getId()); |
103 | 112 | |
... | ... | @@ -179,10 +188,10 @@ |
179 | 188 | archiveMap.put("certificateTypeId", archiveModel.getCertificateTypeId()); |
180 | 189 | archiveMap.put("username", archiveModel.getUsername()); |
181 | 190 | archiveMap.put("birthday",archiveModel.getBirthday()); |
182 | - archiveMap.put("age", archiveModel.getAge()); | |
191 | + archiveMap.put("age", StringUtils.isEmpty(archiveModel.getBirthday()) ? "" : DateUtil.getAge(DateUtil.parseYMD(archiveModel.getBirthday()))); | |
183 | 192 | archiveMap.put("phone", archiveModel.getPhone()); |
184 | 193 | archiveMap.put("id", archiveModel.getId()); |
185 | - if (archiveModel.getSex()== SystemConfig.WOMAN_ID){ | |
194 | + if (StringUtils.isEmpty(archiveModel.getSex()) || archiveModel.getSex().equals(SystemConfig.WOMAN_ID )){ | |
186 | 195 | archiveMap.put("sex", "女"); |
187 | 196 | }else { |
188 | 197 | archiveMap.put("sex", "男"); |
... | ... | @@ -203,7 +212,7 @@ |
203 | 212 | return response; |
204 | 213 | } |
205 | 214 | |
206 | - public BaseListResponse queryFolicAcid(FolicAcidQueryRequest queryRequest){ | |
215 | + public BaseListResponse queryFolicAcid(FolicAcidQueryRequest queryRequest,Integer userId){ | |
207 | 216 | |
208 | 217 | List<Map<String,Object>> list = new ArrayList<>(); |
209 | 218 | |
... | ... | @@ -215,8 +224,6 @@ |
215 | 224 | folicAcidQuery.setLimit(queryRequest.getLimit()); |
216 | 225 | folicAcidQuery.setNeed("y"); |
217 | 226 | |
218 | - folicAcidQuery.setHospitalId(queryRequest.getHospitalId()); | |
219 | - | |
220 | 227 | if(StringUtils.isNotEmpty(queryRequest.getDrawTime())){ |
221 | 228 | String[] dates = queryRequest.getDrawTime().split(" - "); |
222 | 229 | folicAcidQuery.setDrawTimeStart(DateUtil.parseYMD(dates[0])); |
... | ... | @@ -229,7 +236,6 @@ |
229 | 236 | folicAcidQuery.setDrawTimeEnd(date); |
230 | 237 | } |
231 | 238 | } |
232 | - | |
233 | 239 | folicAcidQuery.setHighRisk(queryRequest.getHighRisk()); |
234 | 240 | |
235 | 241 | //省市区筛选机构 |
236 | 242 | |
237 | 243 | |
... | ... | @@ -240,13 +246,54 @@ |
240 | 246 | organizationQuery.setProvinceId(queryRequest.getProvinceId()); |
241 | 247 | organizationQuery.setCityId(queryRequest.getCityId()); |
242 | 248 | organizationQuery.setAreaId(queryRequest.getAreaId()); |
243 | - | |
244 | 249 | organizationList = new ArrayList<>(); |
245 | 250 | organizationList = organizationService.queryHospitals(organizationQuery); |
246 | 251 | } |
247 | 252 | |
248 | - List<String> hospitalIds = null; | |
249 | 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; | |
250 | 297 | if (CollectionUtils.isNotEmpty(organizationList)){ |
251 | 298 | hospitalIds = new ArrayList<>(); |
252 | 299 | for (Organization hospital : organizationList){ |
... | ... | @@ -260,8 +307,7 @@ |
260 | 307 | }else { |
261 | 308 | folicAcidQuery.setHospitalId("-1"); |
262 | 309 | } |
263 | - } | |
264 | - | |
310 | + }*/ | |
265 | 311 | List<FolicAcid> folicAcidList = folicAcidService.queryFolicAcid(folicAcidQuery); |
266 | 312 | if (CollectionUtils.isNotEmpty(folicAcidList)){ |
267 | 313 | for (FolicAcid data : folicAcidList){ |