Commit bac5881921360a7b0ed292542841d93e05b9f343

Authored by dongqin
1 parent 8a64fcf0fb

宫颈癌个案模块

Showing 5 changed files with 94 additions and 16 deletions

platform-common/src/main/java/com/lyms/platform/common/utils/MapUtil.java View file @ bac5881
  1 +package com.lyms.platform.common.utils;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import org.springframework.cglib.beans.BeanMap;
  6 +
  7 +import com.google.common.collect.Maps;
  8 +
  9 +/**
  10 + * @author dongqin
  11 + * @description map 工具类
  12 + * @date 11:30 2019/11/26
  13 + **/
  14 +public class MapUtil {
  15 +
  16 + public static <T> Map<String, Object> beanToMap(T bean) {
  17 + Map<String, Object> map = Maps.newHashMap();
  18 + if (bean != null) {
  19 + BeanMap beanMap = BeanMap.create(bean);
  20 + for (Object key : beanMap.keySet()) {
  21 + map.put(key + "", beanMap.get(key));
  22 + }
  23 + }
  24 + return map;
  25 + }
  26 +}
platform-dal/src/main/java/com/lyms/platform/pojo/CervicalCancerModel.java View file @ bac5881
... ... @@ -20,11 +20,6 @@
20 20 private String id;
21 21  
22 22 /**
23   - * 妇女id
24   - */
25   - private String pid;
26   -
27   - /**
28 23 * 建档id
29 24 */
30 25 private String parentId;
... ... @@ -88,14 +83,6 @@
88 83  
89 84 public void setId(String id) {
90 85 this.id = id;
91   - }
92   -
93   - public String getPid() {
94   - return pid;
95   - }
96   -
97   - public void setPid(String pid) {
98   - this.pid = pid;
99 86 }
100 87  
101 88 public String getParentId() {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CervicalCancerController.java View file @ bac5881
... ... @@ -5,6 +5,7 @@
5 5 import org.springframework.web.bind.annotation.RequestBody;
6 6 import org.springframework.web.bind.annotation.RequestMapping;
7 7 import org.springframework.web.bind.annotation.RequestMethod;
  8 +import org.springframework.web.bind.annotation.RequestParam;
8 9 import org.springframework.web.bind.annotation.ResponseBody;
9 10  
10 11 import com.fasterxml.jackson.annotation.JsonAlias;
... ... @@ -28,6 +29,20 @@
28 29  
29 30 @Autowired
30 31 private CervicalCancerService cervicalCancerService;
  32 +
  33 + /**
  34 + *
  35 + * 根据身份证号获取对应的建档信息
  36 + *
  37 + * @param idCard
  38 + * @return
  39 + */
  40 + @RequestMapping(method = RequestMethod.GET, value = "/getPatientInfoByIdCard")
  41 + @ResponseBody
  42 + @TokenRequired
  43 + public BaseResponse getPatientInfoByIdCard(@RequestParam String idCard) {
  44 + return cervicalCancerService.getPatientInfoByIdCard(idCard);
  45 + }
31 46  
32 47  
33 48 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/CervicalCancerService.java View file @ bac5881
... ... @@ -38,5 +38,13 @@
38 38 * @return
39 39 */
40 40 BaseResponse detail(CervicalCancerRequest param);
  41 +
  42 + /**
  43 + * 根据身份证号获取对应的建档信息
  44 + *
  45 + * @param idCard
  46 + * @return
  47 + */
  48 + BaseResponse getPatientInfoByIdCard(String idCard);
41 49 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/CervicalCancerServiceImpl.java View file @ bac5881
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import java.util.Date;
4 4 import java.util.List;
  5 +import java.util.Map;
5 6  
6 7 import org.springframework.beans.factory.annotation.Autowired;
7 8 import org.springframework.data.domain.Sort;
8 9  
9 10  
10 11  
... ... @@ -11,17 +12,21 @@
11 12 import org.springframework.data.mongodb.core.query.Update;
12 13 import org.springframework.stereotype.Service;
13 14  
  15 +import com.lyms.platform.biz.service.BasicConfigService;
  16 +import com.lyms.platform.common.constants.ErrorCodeConstants;
14 17 import com.lyms.platform.common.result.BaseListResponse;
15 18 import com.lyms.platform.common.result.BaseResponse;
  19 +import com.lyms.platform.common.utils.MapUtil;
16 20 import com.lyms.platform.common.utils.MongoConvertHelper;
17 21 import com.lyms.platform.common.utils.ReflectionUtils;
18 22 import com.lyms.platform.common.utils.StringUtils;
19 23 import com.lyms.platform.operate.web.request.CervicalCancerListRequest;
20 24 import com.lyms.platform.operate.web.request.CervicalCancerRequest;
21 25 import com.lyms.platform.operate.web.service.CervicalCancerService;
22   -import com.lyms.platform.permission.service.UsersService;
  26 +import com.lyms.platform.operate.web.utils.CollectionUtils;
  27 +import com.lyms.platform.operate.web.utils.CommonsHelper;
23 28 import com.lyms.platform.pojo.CervicalCancerModel;
24   -import com.lyms.platform.pojo.MatdeliverFollowPushModel;
  29 +import com.lyms.platform.pojo.ResidentsArchiveModel;
25 30  
26 31 @Service
27 32 public class CervicalCancerServiceImpl implements CervicalCancerService {
... ... @@ -30,7 +35,7 @@
30 35 private MongoTemplate mongoTemplate;
31 36  
32 37 @Autowired
33   - private UsersService usersService;
  38 + private BasicConfigService basicConfigService;
34 39  
35 40 /**
36 41 * 保存单个
... ... @@ -123,6 +128,43 @@
123 128 CervicalCancerModel model = mongoTemplate.findOne(Query.query(Criteria.where("id").is(id)), CervicalCancerModel.class);
124 129 BaseResponse baseResponse = new BaseResponse();
125 130 baseResponse.setObject(model);
  131 + return baseResponse;
  132 + }
  133 +
  134 + /**
  135 + * 根据身份证号获取对应的建档信息
  136 + *
  137 + * @param idCard
  138 + * @return
  139 + */
  140 + @Override
  141 + public BaseResponse getPatientInfoByIdCard(String idCard) {
  142 + List<ResidentsArchiveModel> models = mongoTemplate.find(Query.query(Criteria.where("certificateNum").is(idCard)).with(new Sort(Sort.Direction.DESC, "created")), ResidentsArchiveModel.class);
  143 + if (CollectionUtils.isEmpty(models)) {
  144 + return new BaseResponse("查无数据,请先到妇女建档进行建档操作", ErrorCodeConstants.NO_DATA);
  145 + }
  146 + ResidentsArchiveModel model = models.get(0);
  147 + Map<String, Object> map = MapUtil.beanToMap(model);
  148 + String provinceId = model.getProvinceId();
  149 + map.put("provinceId", provinceId);
  150 + map.put("provinceStr", CommonsHelper.getName1(provinceId,basicConfigService));
  151 + String cityId = model.getCityId();
  152 + map.put("cityId", cityId);
  153 + map.put("cityStr", CommonsHelper.getName1(cityId,basicConfigService));
  154 + String areaId = model.getAreaId();
  155 + map.put("areaId", areaId);
  156 + map.put("areaStr", CommonsHelper.getName1(areaId,basicConfigService));
  157 + String streetId = model.getStreetId();
  158 + map.put("streetId", streetId);
  159 + map.put("streetStr", CommonsHelper.getName1(streetId,basicConfigService));
  160 + map.put("lastMenstrual", model.getMcyj());
  161 + map.put("name", model.getUsername());
  162 + map.put("age", model.getAge());
  163 + map.put("phone", model.getPhone());
  164 + map.put("idCardNo", model.getCertificateNum());
  165 +
  166 + BaseResponse baseResponse = new BaseResponse();
  167 + baseResponse.setObject(map);
126 168 return baseResponse;
127 169 }
128 170 }