Browse Source

解决病人姓名太长无法保存,解决简易门诊没有医生信息无法保存

hurugang 3 years ago
parent
commit
c4287114ea

+ 6 - 0
src/main/java/cn/hnthyy/thmz/common/Constants.java

@@ -381,4 +381,10 @@ public class Constants {
      * 重新匹配合同
      */
     public static final String CONTRACT_RE_MATCH="contract_re_match";
+
+
+    /**
+     * 简易门诊编码
+     */
+    public static final String SIMPLE_OUTPATIENT_CODE="10";
 }

+ 16 - 2
src/main/java/cn/hnthyy/thmz/controller/mz/MzChargeDetailController.java

@@ -31,6 +31,7 @@ import com.auth0.jwt.interfaces.DecodedJWT;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DataIntegrityViolationException;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
@@ -410,6 +411,14 @@ public class MzChargeDetailController {
             resultMap.put("message", "病人姓名更新成功");
             return resultMap;
         } catch (Exception e) {
+            if (e instanceof DataIntegrityViolationException){
+                if(e.getMessage().contains("将截断字符串或二进制数据")){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "病人姓名超长");
+                    log.error("系统异常,错误信息{病人姓名超长}");
+                    return resultMap;
+                }
+            }
             resultMap.put("code", -1);
             resultMap.put("message", "病人姓名更新失败,系统出错,请联系管理员");
             log.error("病人姓名更新失败,系统异常,错误信息{}", e);
@@ -1473,7 +1482,7 @@ public class MzChargeDetailController {
      */
     @UserLoginToken
     @RequestMapping(value = "/savePrescription", method = {RequestMethod.POST})
-    public Map<String, Object> savePrescription(@RequestBody MzPrescriptionVo mzPrescriptionVo) {
+    public Map<String, Object> savePrescription(@RequestBody MzPrescriptionVo mzPrescriptionVo,HttpServletRequest httpServletRequest) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
             if (StringUtils.isBlank(mzPrescriptionVo.getSerialNo())) {
@@ -1495,7 +1504,12 @@ public class MzChargeDetailController {
                     resultMap.put("message", "当前接诊患者的分诊记录不存在");
                     return resultMap;
                 }
-                mzPrescriptionVo.setDoctorCode(mzfzPatientOrder.getDoctorCode());
+                if(Constants.SIMPLE_OUTPATIENT_CODE.equals(mzfzPatientOrder.getReqType())){
+                    User tokenUser = TokenUtil.getUser(httpServletRequest);
+                    mzPrescriptionVo.setDoctorCode(tokenUser.getUserIdCode());
+                }else {
+                    mzPrescriptionVo.setDoctorCode(mzfzPatientOrder.getDoctorCode());
+                }
                 mzPrescriptionVo.setVisitDeptCode(mzfzPatientOrder.getDeptCode());
             }
             mzPrescriptionVo.setJzFlag(YesNoEnum.NO.code);