Commit d302223f673c490ad065563ecc3f69da28c76066

Authored by litao@lymsh.com
1 parent fecfd91592

儿保健建档相关接口

Showing 4 changed files with 143 additions and 15 deletions

platform-dal/src/main/java/com/lyms/platform/pojo/BabyEyePatient.java View file @ d302223
... ... @@ -99,6 +99,16 @@
99 99 /**===================== 父亲基本信息 ========================*/
100 100 private String fName;
101 101  
  102 + /**
  103 + * 证件类型Id
  104 + */
  105 + private String fcCardTypeId;
  106 +
  107 + /**
  108 + * 证件号
  109 + */
  110 + private String fCardNo;
  111 +
102 112 private String fPhone;
103 113  
104 114 private Date fBirth;
... ... @@ -217,7 +227,7 @@
217 227 /**
218 228 * 新生儿出院诊断
219 229 */
220   - private String ddIds;
  230 + private List<String> ddIds;
221 231  
222 232 /**=========================== 院内信息 =======================*/
223 233 /**
224 234  
... ... @@ -255,7 +265,30 @@
255 265 */
256 266 private String serviceStatus;
257 267  
  268 + public String getFcCardTypeId() {
  269 + return fcCardTypeId;
  270 + }
258 271  
  272 + public void setFcCardTypeId(String fcCardTypeId) {
  273 + this.fcCardTypeId = fcCardTypeId;
  274 + }
  275 +
  276 + public String getfCardNo() {
  277 + return fCardNo;
  278 + }
  279 +
  280 + public void setfCardNo(String fCardNo) {
  281 + this.fCardNo = fCardNo;
  282 + }
  283 +
  284 + public String getDiagnosiId() {
  285 + return diagnosiId;
  286 + }
  287 +
  288 + public void setDiagnosiId(String diagnosiId) {
  289 + this.diagnosiId = diagnosiId;
  290 + }
  291 +
259 292 public String getmHighRiskFactorId() {
260 293 return mHighRiskFactorId;
261 294 }
262 295  
... ... @@ -664,11 +697,11 @@
664 697 this.hospitalizationNum = hospitalizationNum;
665 698 }
666 699  
667   - public String getDdIds() {
  700 + public List<String> getDdIds() {
668 701 return ddIds;
669 702 }
670 703  
671   - public void setDdIds(String ddIds) {
  704 + public void setDdIds(List<String> ddIds) {
672 705 this.ddIds = ddIds;
673 706 }
674 707  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEyePatientServiceImpl.java View file @ d302223
... ... @@ -13,8 +13,13 @@
13 13 import com.lyms.platform.operate.web.facade.BasicConfigFacade;
14 14 import com.lyms.platform.operate.web.result.BasicConfigResult;
15 15 import com.lyms.platform.operate.web.service.BabyEyePatientService;
  16 +import com.lyms.platform.operate.web.utils.CollectionUtils;
16 17 import com.lyms.platform.operate.web.utils.MongoUtil;
17 18 import com.lyms.platform.permission.dao.master.BabyEyePatientMapper;
  19 +import com.lyms.platform.permission.dao.master.CouponMapper;
  20 +import com.lyms.platform.permission.dao.slave.UsersMapper;
  21 +import com.lyms.platform.permission.model.Users;
  22 +import com.lyms.platform.permission.service.OrganizationService;
18 23 import com.lyms.platform.pojo.BabyEyePatient;
19 24 import com.lyms.platform.pojo.BabyModel;
20 25 import com.lyms.platform.pojo.NewbornVisit;
... ... @@ -54,6 +59,12 @@
54 59 @Autowired
55 60 private MongoUtil mongoUtil;
56 61  
  62 + @Autowired
  63 + UsersMapper usersMapper;
  64 +
  65 + @Autowired
  66 + private CouponMapper couponMapper;
  67 +
57 68 @Override
58 69 public BaseObjectResponse init() {
59 70 List<Map<String, Object>> sex = EnumUtil.toJson(SexEnum.class, "id", "text");
... ... @@ -68,12 +79,6 @@
68 79 "serviceStatus", serviceStatus, "nation", nation, "fmType", fmType);
69 80 }
70 81  
71   - public static void main(String[] args) {
72   -
73   - List<Map<String, Object>> sex = EnumUtil.toJson(SexEnum.class, "id", "text");
74   - System.out.println(sex);
75   - }
76   -
77 82 @Override
78 83 public BaseResponse addOrUpdate(Integer userId, BabyEyePatient babyEyePatient) {
79 84 if(StringUtils.isEmpty(babyEyePatient.getId())) {
80 85  
... ... @@ -99,16 +104,64 @@
99 104 BabyEyePatient babyEyePatient = mongoTemplate.findById(id, BabyEyePatient.class);
100 105 Map<String, Object> restMap = new HashedMap();
101 106 if(babyEyePatient != null) {
  107 + /** 儿童基本信息 */
102 108 restMap.put("name", babyEyePatient.getName());
103 109 restMap.put("sex", StringUtils.isEmpty(babyEyePatient.getSex()) ? "" : SexEnum.getTextById(Integer.parseInt(babyEyePatient.getSex())));
104 110 restMap.put("cardNo", babyEyePatient.getCardNo());
105 111 restMap.put("nationId", mongoUtil.findName(babyEyePatient.getNationId()));
106   - restMap.put("", babyEyePatient.getBirth());
107   -// restMap.put("", babyEyePatient.);
108   -// restMap.put("", babyEyePatient.);
109   -// restMap.put("", babyEyePatient.);
110   -// restMap.put("", babyEyePatient.);
111   -// restMap.put("", babyEyePatient.);
  112 + restMap.put("birth", DateUtil.getYyyyMmDd(babyEyePatient.getBirth()));
  113 + restMap.put("birthDesc", babyEyePatient.getBirthDesc());
  114 + restMap.put("address", mongoUtil.getAddress(babyEyePatient.getProvinceId(), babyEyePatient.getCityId(), babyEyePatient.getAreaId(), babyEyePatient.getStreetId(), babyEyePatient.getAddress()));
  115 + restMap.put("zipCode", babyEyePatient.getZipCode());
  116 + /** 母亲基本信息 */
  117 + restMap.put("mName", babyEyePatient.getmName());
  118 + restMap.put("mcCardTypeId", mongoUtil.findName(babyEyePatient.getMcCardTypeId())); /**证件类型*/
  119 + restMap.put("mCardNo", babyEyePatient.getmCardNo());
  120 + restMap.put("mBirth", DateUtil.getYyyyMmDd(babyEyePatient.getmBirth()));
  121 + restMap.put("mAge", babyEyePatient.getmAge());
  122 + restMap.put("mPlevelTypeId", mongoUtil.findName(babyEyePatient.getmPlevelTypeId())); /** 文化程度 */
  123 + restMap.put("mProfessionTypeId", mongoUtil.findName(babyEyePatient.getmProfessionTypeId())); /** 职业类别 */
  124 + restMap.put("mPhone", babyEyePatient.getmPhone());
  125 + /** 父亲基本信息 */
  126 + restMap.put("fName", babyEyePatient.getfName());
  127 + restMap.put("fcCardTypeId", mongoUtil.findName(babyEyePatient.getFcCardTypeId())); /**证件类型*/
  128 + restMap.put("fCardNo", babyEyePatient.getfCardNo());
  129 + restMap.put("fBirth", DateUtil.getYyyyMmDd(babyEyePatient.getfBirth()));
  130 + restMap.put("fAge", babyEyePatient.getfAge());
  131 + restMap.put("fPlevelTypeId", mongoUtil.findName(babyEyePatient.getfPlevelTypeId())); /** 文化程度 */
  132 + restMap.put("fProfessionTypeId", mongoUtil.findName(babyEyePatient.getfProfessionTypeId())); /** 职业类别 */
  133 + restMap.put("fPhone", babyEyePatient.getfPhone());
  134 + /** 分娩信息 */
  135 + restMap.put("dueDateDesc", babyEyePatient.getDueDateDesc());
  136 + restMap.put("deliveryType", babyEyePatient.getDeliveryType());
  137 + restMap.put("deliveryType2", babyEyePatient.getDeliveryType2());
  138 + if(babyEyePatient.getParityNum() != null && babyEyePatient.getProductNum() != null) {
  139 + restMap.put("number", "第" + babyEyePatient.getParityNum() + "胎/第" + babyEyePatient.getProductNum() + "产"); /** 胎产次 */
  140 +
  141 + }
  142 + restMap.put("weight", babyEyePatient.getWeight());
  143 + restMap.put("length", babyEyePatient.getLength());
  144 + restMap.put("head", babyEyePatient.getHead());
  145 + if(StringUtils.isNotEmpty(babyEyePatient.getApgarOneMin()) && StringUtils.isNotEmpty(babyEyePatient.getApgaFiveMin()) && StringUtils.isNotEmpty(babyEyePatient.getApgaTenMin())) {
  146 + restMap.put("apgar", babyEyePatient.getApgarOneMin() + "分-" + babyEyePatient.getApgaFiveMin() + "分-" + babyEyePatient.getApgaTenMin() + "分" );
  147 + }
  148 + restMap.put("malformation", babyEyePatient.isMalformation() ? "是" : "否");
  149 + restMap.put("fmHospitalId", couponMapper.getHospitalName(babyEyePatient.getFmHospitalId()));
  150 + restMap.put("mHighRiskFactorIds", mongoUtil.findNameList(babyEyePatient.getmHighRiskFactorIds()));
  151 + restMap.put("gesell", babyEyePatient.isGesell() ? "是" : "否");
  152 + restMap.put("diagnosiIds", mongoUtil.findNames(babyEyePatient.getDiagnosiIds())); /** 诊断结果 */
  153 + restMap.put("ddIds", mongoUtil.findNameList(babyEyePatient.getDdIds()));
  154 + if(StringUtils.isNotEmpty(babyEyePatient.getDoctor())) {
  155 + Users users = usersMapper.getUsers(Integer.parseInt(babyEyePatient.getDoctor()));
  156 + restMap.put("doctor", users == null ? null : users.getName());
  157 + }
  158 + restMap.put("bookBuildingDate", DateUtil.getYyyyMmDd(babyEyePatient.getBookBuildingDate()));
  159 + restMap.put("vcCardNo", babyEyePatient.getVcCardNo());
  160 + restMap.put("barCode", babyEyePatient.getBarCode());
  161 + restMap.put("serviceType", mongoUtil.findName(babyEyePatient.getServiceType()));
  162 + restMap.put("serviceStatus", mongoUtil.findName(babyEyePatient.getServiceStatus()));
  163 + restMap.put("remark", babyEyePatient.getRemark());
  164 + CollectionUtils.removeNullValue(restMap);
112 165 }
113 166 return RespBuilder.buildSuccess(restMap);
114 167 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CollectionUtils.java View file @ d302223
1 1 package com.lyms.platform.operate.web.utils;
2 2  
  3 +import org.apache.commons.collections.MapUtils;
3 4 import org.apache.commons.lang3.StringUtils;
4 5 import org.springframework.util.Assert;
5 6  
... ... @@ -26,6 +27,19 @@
26 27 }
27 28 }
28 29 return map;
  30 + }
  31 +
  32 + public static void removeNullValue(Map<String, Object> map) {
  33 + if(MapUtils.isNotEmpty(map)) {
  34 + Set<Map.Entry<String, Object>> entries = map.entrySet();
  35 + Iterator<Map.Entry<String, Object>> iterator = entries.iterator();
  36 + while (iterator.hasNext()) {
  37 + Map.Entry<String, Object> set = iterator.next();
  38 + if(set.getValue() == null) {
  39 + iterator.remove();
  40 + }
  41 + }
  42 + }
29 43 }
30 44  
31 45 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java View file @ d302223
... ... @@ -6,6 +6,7 @@
6 6 import com.lyms.platform.pojo.Patients;
7 7 import com.mongodb.BasicDBObject;
8 8 import com.mongodb.DBObject;
  9 +import org.apache.commons.collections.map.HashedMap;
9 10 import org.springframework.beans.factory.annotation.Autowired;
10 11 import org.springframework.data.mongodb.core.MongoTemplate;
11 12 import org.springframework.data.mongodb.core.query.BasicQuery;
... ... @@ -45,6 +46,16 @@
45 46 return list;
46 47 }
47 48  
  49 + public String getAddress(String provinceId, String cityId, String areaId, String streetId, String address) {
  50 + StringBuilder sb = new StringBuilder();
  51 + sb.append(findName(provinceId))
  52 + .append(findName(cityId))
  53 + .append(findName(areaId))
  54 + .append(findName(streetId))
  55 + .append(address);
  56 + return sb.toString().replaceAll("null", "");
  57 + }
  58 +
48 59 /**
49 60 * 按照月份、省市区统计总数
50 61 * 详见原型图建册人数统计
... ... @@ -214,6 +225,23 @@
214 225 }
215 226 }
216 227 return names;
  228 + }
  229 +
  230 + public List<Map<String, Object>> findNameList(List<String> ids) {
  231 + if(CollectionUtils.isNotEmpty(ids)) {
  232 + return null;
  233 + }
  234 + List<Map<String, Object>> rest = new ArrayList<>();
  235 + for (String id : ids) {
  236 + BasicConfig basicConfig = findBasicConfigById(id);
  237 + if(basicConfig != null) {
  238 + Map<String, Object> tempMap = new HashedMap();
  239 + tempMap.put("id", basicConfig.getId());
  240 + tempMap.put("name", basicConfig.getName());
  241 + rest.add(tempMap);
  242 + }
  243 + }
  244 + return rest;
217 245 }
218 246 }