瀏覽代碼

保存处方就诊记录丢失问题

lihong 1 年之前
父節點
當前提交
0556e1be43

+ 11 - 6
src/main/java/cn/hnthyy/thmz/controller/mz/MzChargeDetailController.java

@@ -1871,6 +1871,7 @@ public class MzChargeDetailController {
             resultMap.put("code", -1);
             resultMap.put("message", e.getMessage());
             log.error("系统异常,错误信息{}", e.getMessage());
+            rollBackSaveClinc(clinic);
             return resultMap;
         } catch (Exception e) {
             resultMap.put("code", -1);
@@ -1878,16 +1879,20 @@ public class MzChargeDetailController {
             log.error("系统异常,保存处方失败,错误信息{}", e);
             log.error(JsonUtil.object2Json(mzPrescriptionVo));
             //保存就诊记录带id 因为跨数据库回滚失败零时方案,不做正常保存
-            if (clinic != null) {
-                Clinic dbClinic = clinicService.queryById(clinic.getId());
-                if (dbClinic == null) {
-                    clinicService.saveClinicWithId(clinic);
-                }
-            }
+            rollBackSaveClinc(clinic);
             return resultMap;
         }
     }
 
+    void rollBackSaveClinc(Clinic clinic) {
+        if (clinic != null) {
+            Clinic dbClinic = clinicService.queryById(clinic.getId());
+            if (dbClinic == null) {
+                clinicService.saveClinicWithId(clinic);
+            }
+        }
+    }
+
 
     /**
      * 计算临时处方的中药,西药,诊疗以及总金额

+ 2 - 2
src/main/java/cn/hnthyy/thmz/service/impl/his/zd/JcJyItemChargeServiceImpl.java

@@ -526,10 +526,10 @@ public class JcJyItemChargeServiceImpl implements JcJyItemChargeService {
             }
             Integer age = mzPatientMi.getAgeForYear();
             if(age != null){
-                if(zdItem.getMinAgeRestriction() != null && age < zdItem.getMinAgeRestriction() ){
+                if(zdItem.getMinAgeRestriction() != null && age >= zdItem.getMinAgeRestriction() ){
                     errMsg.add(StrUtil.format("此项目编码{}({})开具的最小年龄为{}岁",zdItem.getCode(),zdItem.getName(),zdItem.getMinAgeRestriction()));
                 }
-                if(zdItem.getMaxAgeRestriction() != null && age > zdItem.getMaxAgeRestriction() ){
+                if(zdItem.getMaxAgeRestriction() != null && age <= zdItem.getMaxAgeRestriction() ){
                     errMsg.add(StrUtil.format("此项目编码{}({})开具的最大年龄为{}岁",zdItem.getCode(),zdItem.getName(),zdItem.getMaxAgeRestriction()));
                 }
             }