Просмотр исходного кода

费用上传前先校验正负相抵是否正确。

lighter 4 лет назад
Родитель
Сommit
8f51e45dbb

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>web-server</artifactId>
-    <version>7.9</version>
+    <version>8.2</version>
     <name>web-server</name>
     <description>server for yibao-web</description>
 

+ 14 - 0
src/main/java/thyyxxk/webserver/dao/his/yibao/AdvanceUploadDao.java

@@ -50,6 +50,20 @@ public interface AdvanceUploadDao {
                           @Param("admissTimes") Integer admissTimes,
                           @Param("ledgerSn") Integer ledgerSn);
 
+    @Select("select sum(charge_fee) from zy_detail_charge where " +
+            "inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} " +
+            "and ledger_sn=#{ledgerSn} and trans_flag_yb=2")
+    Integer selectOffsetFeeSum(@Param("inpatientNo") String inpatientNo,
+                               @Param("admissTimes") Integer admissTimes,
+                               @Param("ledgerSn") Integer ledgerSn);
+
+    @Update("update zy_detail_charge set trans_flag_yb=0 where " +
+            "inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} " +
+            "and ledger_sn=#{ledgerSn} and trans_flag_yb=2")
+    void rollbackOffsetFees(@Param("inpatientNo") String inpatientNo,
+                            @Param("admissTimes") Integer admissTimes,
+                            @Param("ledgerSn") Integer ledgerSn);
+
     @Select("select detail_sn,rtrim(charge_code_mx) as chargeCodeMx,charge_fee from zy_detail_charge " +
             "where inpatient_no=#{zyh} and admiss_times=#{zycs} and ledger_sn=#{sn} " +
             "and isnull(infant_flag,0)!=1 and isnull(trans_flag_yb,0) not in (1,2)")

+ 8 - 1
src/main/java/thyyxxk/webserver/service/yibao/SettleService.java

@@ -36,7 +36,14 @@ public class SettleService {
     }
 
     public void posNegOffset(Overview overview) {
-        Queue<FeeCounteract> fees = dao.selectAllNotUploadedFees(overview.getInpatientNo(), overview.getAdmissTimes(), overview.getLedgerSn());
+        Integer offsetFeeSum = dao.selectOffsetFeeSum(overview.getInpatientNo(),
+                overview.getAdmissTimes(), overview.getLedgerSn());
+        if (null != offsetFeeSum && offsetFeeSum != 0) {
+            dao.rollbackOffsetFees(overview.getInpatientNo(),
+                    overview.getAdmissTimes(), overview.getLedgerSn());
+        }
+        Queue<FeeCounteract> fees = dao.selectAllNotUploadedFees(overview.getInpatientNo(),
+                overview.getAdmissTimes(), overview.getLedgerSn());
         if (null == fees || fees.isEmpty()) {
             return;
         }

+ 14 - 0
src/main/java/thyyxxk/webserver/utils/DateUtil.java

@@ -3,6 +3,8 @@ package thyyxxk.webserver.utils;
 import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.Calendar;
 import java.util.Date;
 
@@ -91,4 +93,16 @@ public class DateUtil {
         }
         return age;
     }
+
+    public static final String DEFAULT_PATTERN = "yyyy-MM-dd HH:mm:ss";
+
+    public static String now() {
+        LocalDateTime time = LocalDateTime.now();
+        return time.format(DateTimeFormatter.ofPattern(DEFAULT_PATTERN));
+    }
+
+    public static String plusSeconds(int seconds) {
+        LocalDateTime time = LocalDateTime.now().plusSeconds(seconds);
+        return time.format(DateTimeFormatter.ofPattern(DEFAULT_PATTERN));
+    }
 }