瀏覽代碼

解决手机端建档出现地址是null的数据

hurugang 2 年之前
父節點
當前提交
79fa5dde30

+ 6 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/ZyReqController.java

@@ -1,10 +1,12 @@
 package cn.hnthyy.thmz.controller.mz;
 
 import cn.hnthyy.thmz.comment.UserLoginToken;
+import cn.hnthyy.thmz.entity.his.mz.CodeNameEntity;
 import cn.hnthyy.thmz.entity.his.mz.Employee;
 import cn.hnthyy.thmz.entity.his.mz.MzPatientMi;
 import cn.hnthyy.thmz.entity.his.mz.MzZyReq;
 import cn.hnthyy.thmz.enums.GenderEnum;
+import cn.hnthyy.thmz.service.his.RegionService;
 import cn.hnthyy.thmz.service.his.ResponceTypeService;
 import cn.hnthyy.thmz.service.his.mz.EmployeeService;
 import cn.hnthyy.thmz.service.his.mz.MzPatientMiService;
@@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 @Slf4j
 @RestController
@@ -32,6 +35,8 @@ public class ZyReqController {
     private MzPatientMiService mzPatientMiService;
     @Autowired
     private ResponceTypeService responceTypeService;
+    @Autowired
+    private RegionService regionService;
     /**
      * 查询病人的住院证
      *
@@ -115,6 +120,7 @@ public class ZyReqController {
             MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(patientId);
             mzPatientMi.setGender(GenderEnum.getGenderByCode(mzPatientMi.getSex()).name);
             mzPatientMi.setResponseTypeName(responceTypeService.queryMzNameByCode(mzPatientMi.getResponseType()));
+            mzPatientMi.setFullAddress(regionService.queryAll().stream().collect(Collectors.toMap(CodeNameEntity::getCode, CodeNameEntity::getName)),new StringBuffer());
             resultMap.put("mzPatientMi", mzPatientMi);
             return resultMap;
         } catch (Exception e) {

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzPatientMi.java

@@ -201,6 +201,8 @@ public class MzPatientMi {
             }
             address=sbf.toString();
             sbf.setLength(0);
+        }else {
+            address=address.replaceAll("null","");
         }
     }
 }

+ 3 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzPatientMiServiceImpl.java

@@ -112,6 +112,9 @@ public class MzPatientMiServiceImpl implements MzPatientMiService {
         if (StringUtils.isBlank(mzPatientMi.getIcCardNo())) {
             mzPatientMi.setIcCardNo(patientNo);
         }
+        if (StringUtils.isBlank(mzPatientMi.getAddress())) {
+            mzPatientMi.setAddress(mzPatientMi.getAddress().replaceAll("null",""));
+        }
         return mzPatientMiMapper.insertMzPatientMi(mzPatientMi);
     }