فهرست منبع

处理数据异常导致的类型转换bug

zhanghang 4 سال پیش
والد
کامیت
c0577454ee
1فایلهای تغییر یافته به همراه23 افزوده شده و 3 حذف شده
  1. 23 3
      src/main/java/com/diagbot/facade/ConsoleFacade.java

+ 23 - 3
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -635,19 +635,39 @@ public class ConsoleFacade {
                 String pathologyFee = stringStringMap.get("pathologyFee");
                 String antibiosisFee = stringStringMap.get("antibiosisFee");
                 if(StringUtil.isNotEmpty(operationFee)) {
-                    if (Double.parseDouble(operationFee) > 0) {
+                    double of = 0.0;
+                    try {
+                        of = Double.parseDouble(operationFee);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    if (of > 0) {
                         //手术code
                         operationCode.add(behospitalCode);
                     }
                 }
                 if(StringUtil.isNotEmpty(operationFee)&&StringUtil.isNotEmpty(pathologyFee)) {
-                    if (Double.parseDouble(operationFee) > 0 && Double.parseDouble(pathologyFee) > QualityContent.pathologyFee) {
+                    double of = 0.0;
+                    double pf = 0.0;
+                    try {
+                        of = Double.parseDouble(operationFee);
+                        pf = Double.parseDouble(pathologyFee);
+                    } catch (NumberFormatException e) {
+                        e.printStackTrace();
+                    }
+                    if (of > 0 && pf > QualityContent.pathologyFee) {
                         //病理code
                         operationPathologyCode.add(behospitalCode);
                     }
                 }
                     if(StringUtil.isNotEmpty(antibiosisFee)) {
-                    if (Double.parseDouble(antibiosisFee) > 0) {
+                        double af = 0.0;
+                        try {
+                            af = Double.parseDouble(antibiosisFee);
+                        } catch (NumberFormatException e) {
+                            e.printStackTrace();
+                        }
+                        if (af > 0) {
                         //抗菌code
                         antibiosisCode.add(behospitalCode);
                     }