Commit 761a43830b94e0030dd67c5a321cb1befb50a86a

Authored by landong2015
1 parent 399e9757ae

update bug

Showing 1 changed file with 57 additions and 1 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/FolicAcidFacade.java View file @ 761a438
... ... @@ -33,6 +33,7 @@
33 33 import org.springframework.beans.factory.annotation.Autowired;
34 34 import org.springframework.stereotype.Component;
35 35  
  36 +import javax.jws.Oneway;
36 37 import javax.servlet.http.HttpServletResponse;
37 38 import java.io.OutputStream;
38 39 import java.util.*;
... ... @@ -198,6 +199,7 @@
198 199 }
199 200 }
200 201 }
  202 + List<Map> list = new ArrayList<>();
201 203  
202 204 if (archiveModel!=null){
203 205 //妇女信息
... ... @@ -206,7 +208,7 @@
206 208 archiveMap.put("certificateTypeId", archiveModel.getCertificateTypeId());
207 209 archiveMap.put("username", archiveModel.getUsername());
208 210 archiveMap.put("birthday",archiveModel.getBirthday() != null ? DateUtil.getyyyy_MM_dd(archiveModel.getBirthday()) : null);
209   - archiveMap.put("age", archiveModel.getBirthday() != null ? "" : DateUtil.getAge(archiveModel.getBirthday()));
  211 + archiveMap.put("age", archiveModel.getBirthday() == null ? "" : DateUtil.getAge(archiveModel.getBirthday()));
210 212 archiveMap.put("phone", archiveModel.getPhone());
211 213 archiveMap.put("id", archiveModel.getId());
212 214 if (StringUtils.isEmpty(archiveModel.getSex()) || archiveModel.getSex().equals(SystemConfig.WOMAN_ID )){
213 215  
... ... @@ -220,9 +222,63 @@
220 222 archiveMap.put("workUnit",archiveModel.getWorkUnit());
221 223 archiveMap.put("buildDay",archiveModel.getBuildDay());
222 224  
  225 + //获取历史发放记录
  226 + FolicAcidQuery folicAcidQuery = new FolicAcidQuery();
  227 + folicAcidQuery.setYn(YnEnums.YES.getId());
  228 + folicAcidQuery.setParentId(archiveModel.getId());
  229 +
  230 + List<String> hospitalList = null;
  231 + //判断当前用户是否有区域权限
  232 + if (userId!=null){
  233 + hospitalList = new ArrayList<>();
  234 + String hospital = autoMatchFacade.getHospitalId(userId);
  235 + if(null!=hospital){
  236 + //本院
  237 + hospitalList.add(hospital);
  238 + }
  239 + //查询用户是否有区域权限
  240 + DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery();
  241 + dataPermissionsModelQuery.setUserId(userId);
  242 + List<DataPermissionsModel> permissionsModels = dataPermissionService.queryPermission(dataPermissionsModelQuery);
  243 + if (CollectionUtils.isNotEmpty(permissionsModels)) {
  244 + Set<String> set = permissionsModels.get(0).getData().keySet();
  245 + Iterator<String> it = set.iterator();
  246 + while (it.hasNext()) {
  247 + String id = it.next();
  248 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(id) && !hospitalList.contains(id)) {
  249 + hospitalList.add(id);
  250 + }
  251 + }
  252 + }
  253 + folicAcidQuery.setHospitalList(hospitalList);
  254 + }
  255 + List<FolicAcid> folicAcidList = folicAcidService.queryFolicAcid(folicAcidQuery);
  256 + if (CollectionUtils.isNotEmpty(folicAcidList)){
  257 + for (FolicAcid data: folicAcidList){
  258 + Map<String,Object> acidMap = new HashMap<>();
  259 + if (data.getPregnancyType()!=null){
  260 + if (data.getPregnancyType()==1){
  261 + acidMap.put("pregnancyType","孕前");
  262 + }else if (data.getPregnancyType()==2){
  263 + acidMap.put("pregnancyType",data.getPregnancyWeeks());
  264 + }
  265 + }
  266 + acidMap.put("drawCount",data.getDrawCount());
  267 + acidMap.put("drawTime",DateUtil.getyyyy_MM_dd(data.getDrawTime()));
  268 + if (StringUtils.isNotEmpty(data.getHospitalId())){
  269 + if (data.getHospitalId().equals(hospitalId)){
  270 + acidMap.put("other",1);
  271 + }else {
  272 + acidMap.put("other",2);
  273 + }
  274 + }
  275 + list.add(acidMap);
  276 + }
  277 + }
223 278 }
224 279 resultMap.put("folicAcidResult",folicAcid);
225 280 resultMap.put("archiveResult",archiveMap);
  281 + resultMap.put("folicAcidHistory",list);
226 282 BaseObjectResponse response = new BaseObjectResponse();
227 283 response.setData(resultMap);
228 284 response.setErrorcode(ErrorCodeConstants.SUCCESS);