Bläddra i källkod

预结算时一分钱都不能差。

lighter 4 år sedan
förälder
incheckning
2d1ea8f16a

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>hnthyyxxk</groupId>
     <artifactId>cssyb-uploadfees</artifactId>
-    <version>0.8</version>
+    <version>1.0</version>
     <name>cssyb-uploadfees</name>
     <description>cssyb upload fees.</description>
 

+ 10 - 11
src/main/java/hnthyyxxk/cssybuploadfees/service/UploadFeeService.java

@@ -7,7 +7,7 @@ import hnthyyxxk.cssybuploadfees.pojo.Fee;
 import hnthyyxxk.cssybuploadfees.pojo.DJRet;
 import hnthyyxxk.cssybuploadfees.pojo.SimpleResponse;
 import hnthyyxxk.cssybuploadfees.pojo.UploadFeeParam;
-import hnthyyxxk.cssybuploadfees.utils.DTool;
+import hnthyyxxk.cssybuploadfees.utils.DecimalUtil;
 import hnthyyxxk.cssybuploadfees.utils.ExceptionEnum;
 import hnthyyxxk.cssybuploadfees.utils.MsgProducer;
 import hnthyyxxk.cssybuploadfees.utils.SnowFlakeId;
@@ -19,7 +19,7 @@ import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
-import static hnthyyxxk.cssybuploadfees.utils.DTool.betweenAutoUpload;
+import static hnthyyxxk.cssybuploadfees.utils.DecimalUtil.betweenAutoUpload;
 
 /**
  * @author dj
@@ -68,7 +68,7 @@ public class UploadFeeService {
         if (null == param.getSid()) {
             return DJRet.fail(ExceptionEnum.LOGICAL_ERROR, "未检测到连接id,请刷新页面。");
         }
-        if (!"autoUpload".equals(param.getSid()) && DTool.betweenAutoUpload()) {
+        if (!"autoUpload".equals(param.getSid()) && DecimalUtil.betweenAutoUpload()) {
             return DJRet.fail(ExceptionEnum.LOGICAL_ERROR, "01:55:00 至 08:00:00 为自动上传时间,请勿在此时间段内做上传操作!");
         }
         param.setFeeSize(dao.queryFeeSize(param.getInpatientNo(), param.getAdmissTimes()));
@@ -120,20 +120,19 @@ public class UploadFeeService {
                 log.info("退费项目,安排到末尾 >>> {}", fee);
                 continue;
             }
-            fee.setPrice(DTool.mathDivide(fee.getChargeFee(), amount));
-            log.info("[ 操作员:{} ] - [ 患者{} ] - 费用上传>>> {}", param.getStaffId(),
-                    param.getMainInfo(), JSON.toJSONString(fee));
+            fee.setPrice(DecimalUtil.mathDivide(fee.getChargeFee(), amount));
             String stmt = getUploadFuncId(param.getYbType().trim()) + "^43010150145^" + param.getStaffId() + "^^" +
                     SnowFlakeId.getInstance().nextId() + "^0000^" + param.getYbJlh() + "|" + fee.getYbClass() + "|" +
                     fee.getYbBillCode() + "|" + fee.getDetailSn() + "|" + formatChargeDate(fee.getChargeDate()) + "|"
                     + fee.getChargeCode() + "|" + fee.getYbCode() + "|" + fee.getName() + "|" +
                     fee.getPrice() + "|" + amount + "|||||||||||||" + fee.getStatusFlag() + "|^";
             response = executeSybTrade(param.getStaffId(), stmt);
-            log.info("[ 操作员:{} ] - [ 患者{} ] - 费用上传回执>>> {}", param.getStaffId(), param.getMainInfo(), response);
+            log.info("[ 操作员:{} ] - [ 患者{} ] - 费用上传:{},回执:{}", param.getStaffId(), param.getMainInfo(),
+                    stmt, response);
             if ((response.getCode() == 0) || (response.getMessage().contains("主键重复"))) {
                 if (response.getCode() == 0) {
                     String retPrice = response.getMessage().split("\\|")[1].trim();
-                    int offset = DTool.mathCompare(retPrice.trim(), fee.getChargeFee().trim());
+                    int offset = DecimalUtil.mathCompare(retPrice.trim(), fee.getChargeFee().trim());
                     if (offset != 0) {
                         log.warn("[ 操作员:{} ] - [ 患者{} ] - 本条上传HIS费用和医保接收到的不一致。医保返回为 {}," +
                                 "本条费用HIS详细为 {} ", param.getStaffId(), param.getMainInfo(), response, fee);
@@ -189,12 +188,12 @@ public class UploadFeeService {
         if (response.getCode() == 0) {
             Map<String, String> feeMap = makeFeeMap(response.getMessage());
             final String hisCharge = getHisChargeFee(param.getInpatientNo(), param.getAdmissTimes());
-            if (DTool.mathCompare(feeMap.get("fundPay"), hisCharge) == 1) {
+            if (DecimalUtil.mathCompare(feeMap.get("fundPay"), hisCharge) == 1) {
                 feeMap.replace("fundPay", hisCharge);
             }
             dao.preCalculateCost(feeMap.get("fundPay"), feeMap.get("fullSelfPay"), feeMap.get("partSelfPay"),
                     param.getInpatientNo(), param.getAdmissTimes());
-            if (DTool.feeDiffsOverOneRmb(hisCharge, feeMap.get("totalCost"))) {
+            if (DecimalUtil.mathCompare(hisCharge, feeMap.get("totalCost")) != 0) {
                 String message = "患者:" + param.getName() + ",住院号:" +
                         param.getInpatientNo() + " HIS总费用:" + hisCharge + "与医保上传总费用:" +
                         feeMap.get("totalCost") + "不一致!";
@@ -239,7 +238,7 @@ public class UploadFeeService {
         String[] arr = feeMsg.split("\\|");
         Map<String, String> map = new HashMap<>();
         map.put("totalCost", arr[10]);
-        map.put("fundPay", DTool.mathMinus(arr[10], arr[14]));
+        map.put("fundPay", DecimalUtil.mathMinus(arr[10], arr[14]));
         map.put("cashPay", arr[14]);
         try {
             map.put("fullSelfPay", arr[46]);

+ 1 - 6
src/main/java/hnthyyxxk/cssybuploadfees/utils/DTool.java → src/main/java/hnthyyxxk/cssybuploadfees/utils/DecimalUtil.java

@@ -5,7 +5,7 @@ import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 
-public class DTool {
+public class DecimalUtil {
     public static boolean betweenAutoUpload() {
         SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
         try {
@@ -36,11 +36,6 @@ public class DTool {
         return d1.subtract(d2).toString();
     }
 
-    public static boolean feeDiffsOverOneRmb(String hisFee, String ybFee) {
-        double offset = Double.parseDouble(mathMinus(hisFee, ybFee));
-        return Math.abs(offset) > 1;
-    }
-
     public static String mathDivide(String a, String b) {
         BigDecimal b1 = new BigDecimal(a);
         BigDecimal b2 = new BigDecimal(b);