lighter 2 лет назад
Родитель
Сommit
7ffbc62b1d

+ 1 - 2
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiZyDao.java

@@ -131,8 +131,7 @@ public interface SiZyDao {
      * @param admissTimes 住院次数
      * @param ledgerSn    账页号
      */
-    @Update("update zy_ledger_file set charge_yb=#{fundPay},fund_pay_sumamt=#{fundPay}, " +
-            "balance=(deposit+#{fundPay}-total_charge) " +
+    @Update("update zy_ledger_file set charge_yb=#{fundPay},fund_pay_sumamt=#{fundPay} " +
             "where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} and ledger_sn=#{ledgerSn}")
     void updateFundPay(@Param("fundPay") String fundPay,
                        @Param("inpatientNo") String inpatientNo,

+ 3 - 0
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiManageService.java

@@ -268,6 +268,9 @@ public class SiManageService {
 //                            ";医保基金支付总额:" + instStlLdgChk.getFundPaySumamt() + ";HIS基金支付总额:" + hisLdgChk.getFundPaySumamt());
         }
 
+        if (null != instStlLdgChk.getAcctPayFlag() && instStlLdgChk.getAcctPayFlag() == 2) {
+            instStlLdgChk.setAcctPay(BigDecimal.ZERO);
+        }
         JSONObject input = exec.makeTradeHeader(SiFunction.INSTITUTION_SETTLEMENT_LEDGER_CHECK);
         String ref = JSONObject.toJSONStringWithDateFormat(instStlLdgChk, "yyyy-MM-dd");
         input.getJSONObject("input").put("data", JSONObject.parseObject(ref));

+ 11 - 1
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiZyService.java

@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.sidicts.*;
 import thyyxxk.webserver.constants.YesOrNo;
+import thyyxxk.webserver.dao.his.inpatient.PatientDao;
 import thyyxxk.webserver.dao.his.medicalinsurance.*;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.inpatient.patient.NotUploadedFee;
@@ -41,6 +42,7 @@ public class SiZyService {
     private static final String ERROR_MESSAGE = "err_msg";
     private static final String OUTPUT = "output";
     private final SiZyDao dao;
+    private final PatientDao patientDao;
     private final SiQueryService queryService;
     private final SiQueryDao queryDao;
     private final SiSetlinfoDao setlinfodao;
@@ -55,10 +57,11 @@ public class SiZyService {
     private String siZyFeeUrl;
 
     @Autowired
-    public SiZyService(SiZyDao dao, SiQueryService queryService, SiQueryDao queryDao, SiSetlinfoDao setlinfoDao,
+    public SiZyService(SiZyDao dao, PatientDao patientDao, SiQueryService queryService, SiQueryDao queryDao, SiSetlinfoDao setlinfoDao,
                        SiSetldetailDao setldetldao, SiChargeTempDao chrgtmpdao, SiLogDao logDao, ExecService exec,
                        DismissService dismissService, SiZySrvc zySrvc, SiManageService manageService) {
         this.dao = dao;
+        this.patientDao = patientDao;
         this.queryService = queryService;
         this.queryDao = queryDao;
         this.setlinfodao = setlinfoDao;
@@ -277,6 +280,13 @@ public class SiZyService {
             JSONObject setlinfo = result.getJSONObject(OUTPUT).getJSONObject("setlinfo");
             String fundPay = setlinfo.getString("fund_pay_sumamt");
             dao.updateFundPay(fundPay, p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
+            patientDao.recountDeposit(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
+            patientDao.updateBalance(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
+            String balance = patientDao.selectLedgerBalance(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
+            if (StringUtil.isBlank(balance)) {
+                balance = "0";
+            }
+            patientDao.updateZyActPatientBalance(p.getInpatientNo(), balance);
             String message = "患者【" + p.getName() + "】院内总费用与医保中心总费用一致,医保报销金额为:¥ " + fundPay + "。";
             return ResultVoUtil.success(message);
         }