Selaa lähdekoodia

夜间门诊统筹不直接结算,只返回试算结果

lighter 1 vuosi sitten
vanhempi
commit
9801448024

+ 18 - 3
src/main/java/thyyxxk/simzfeeoprnsystm/dao/SiSetlinfoDao.java

@@ -1,10 +1,8 @@
 package thyyxxk.simzfeeoprnsystm.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.*;
 import thyyxxk.simzfeeoprnsystm.pojo.SiSetlinfo;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Update;
 
 /**
  * @description: 结算基本信息
@@ -31,4 +29,21 @@ public interface SiSetlinfoDao extends BaseMapper<SiSetlinfo> {
                               @Param("setlId") String setlId,
                               @Param("medinsSetlId") String medinsSetlId,
                               @Param("setlMsgid") String setlMsgid);
+
+    @Delete("delete from t_si_presetlinfo where pat_no=#{patNo} and times=#{times} and ledger_sn=0")
+    int deletePreSettleInfo(@Param("patNo") String patNo,
+                             @Param("times") int times);
+
+    @Insert("insert into t_si_presetlinfo (pat_no,times,ledger_sn,mdtrt_id,psn_no,psn_name,psn_cert_type," +
+            "certno,gend,naty,brdy,age,insutype,psn_type,cvlserv_flag,mdtrt_cert_type,med_type," +
+            "medfee_sumamt,fulamt_ownpay_amt,overlmt_selfpay,preselfpay_amt,inscp_scp_amt,act_pay_dedc,hifp_pay," +
+            "pool_prop_selfpay,cvlserv_pay,hifes_pay,hifmi_pay,hifob_pay,maf_pay,hosp_part_amt,oth_pay," +
+            "fund_pay_sumamt,psn_part_amt,acct_pay,psn_cash_pay,balc,acct_mulaid_pay,staff_id,setl_type) " +
+            "values (#{patNo},#{times},#{ledgerSn},#{mdtrtId},#{psnNo},#{psnName},#{psnCertType},#{certno}," +
+            "#{gend},#{naty},#{brdy},#{age},#{insutype},#{psnType},#{cvlservFlag},#{mdtrtCertType}," +
+            "#{medType},#{medfeeSumamt},#{fulamtOwnpayAmt},#{overlmtSelfpay},#{preselfpayAmt},#{inscpScpAmt}," +
+            "#{actPayDedc},#{hifpPay},#{poolPropSelfpay},#{cvlservPay},#{hifesPay},#{hifmiPay},#{hifobPay},#{mafPay}," +
+            "#{hospPartAmt},#{othPay},#{fundPaySumamt},#{psnPartAmt},#{acctPay},#{psnCashPay},#{balc},#{acctMulaidPay}," +
+            "#{staffId},#{setlType})")
+    void insertPreSettleInfo(SiSetlinfo setlinfo);
 }

+ 2 - 2
src/main/java/thyyxxk/simzfeeoprnsystm/external/WebHisService.java

@@ -23,6 +23,6 @@ public interface WebHisService {
     @Post("{url}/siQuery/saveCumInfo")
     void saveCumInfo(@Var ("url") String url, @JSONBody SiSetlinfo setlinfo);
 
-    @Post("http://172.16.32.160:81/thmz/api/v1/mzChargeFee")
-    JSONObject mzChargeFee(@JSONBody JSONObject params);
+    @Post("{url}/mzChargeFee")
+    JSONObject mzChargeFee(@Var ("url") String url, @JSONBody JSONObject params);
 }

+ 11 - 1
src/main/java/thyyxxk/simzfeeoprnsystm/pojo/MzPatientInfo.java

@@ -37,7 +37,7 @@ public class MzPatientInfo {
     private String icdText;
     private Integer needSaving;
     private Integer saved;
-    private Integer needRevokeRegistration;
+    private Boolean revokeRegistration;
 
     private String mdtrtCertType;
     private String mdtrtCertNo;
@@ -45,6 +45,16 @@ public class MzPatientInfo {
     private String readCardBizType;
     private String expContent;
 
+    private Boolean savePreSettleResult;
+
+    public Boolean needRevokeRegistration() {
+        return null != revokeRegistration && revokeRegistration;
+    }
+
+    public Boolean needSavePreSettleResult() {
+        return null != savePreSettleResult && savePreSettleResult;
+    }
+
     public String getAcctUsedFlag() {
         return StringUtil.isBlank(acctUsedFlag) ? "0" : acctUsedFlag;
     }

+ 38 - 14
src/main/java/thyyxxk/simzfeeoprnsystm/service/SiMzFeeService.java

@@ -40,10 +40,14 @@ public class SiMzFeeService {
     private final SiLogDao logDao;
     @Value("${web-his-url}")
     private String webHisUrl;
+    @Value("${thmz-url}")
+    private String thmzUrl;
 
     @Autowired
     public SiMzFeeService(SiMzDao mzDao, SiSetlinfoDao setlinfoDao,
-                          SiSetldetailDao setldetailDao, ExecService exec, WebHisService webHisService, MariadbService mariadbService, SiLogDao logDao) {
+                          SiSetldetailDao setldetailDao, ExecService exec,
+                          WebHisService webHisService, MariadbService mariadbService,
+                          SiLogDao logDao) {
         this.mzDao = mzDao;
         this.setlinfoDao = setlinfoDao;
         this.setldetailDao = setldetailDao;
@@ -390,6 +394,18 @@ public class SiMzFeeService {
             fundDetail.setAcctPay(setlinfo.getString("acct_pay"));
             fundDetail.setSelfPay(setlinfo.getString("psn_part_amt"));
             fundDetail.setCardType(getCardType(mzPreSetlmt.getInsuplcAdmdvs()));
+
+            if (p.needSavePreSettleResult()) {
+                setlinfoDao.deletePreSettleInfo(p.getPatNo(), p.getTimes());
+                SiSetlinfo setlEntity = JSONObject.parseObject(setlinfo.toJSONString(), SiSetlinfo.class);
+                setlEntity.setPatNo(p.getPatNo());
+                setlEntity.setTimes(p.getTimes());
+                setlEntity.setLedgerSn(0);
+                setlEntity.setStaffId(p.getStaffId());
+                setlEntity.setSetlType(ClrType.OUTPATIENT.getCode());
+                setlinfoDao.insertPreSettleInfo(setlEntity);
+            }
+
             return ResultVoUtil.success(fundDetail);
         }
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
@@ -521,6 +537,9 @@ public class SiMzFeeService {
         }
         SiSetlinfo setlinfo = mzDao.selectSettledInfo(p.getPatNo(), p.getTimes(), 0);
         if (null == setlinfo) {
+            if (p.needRevokeRegistration()) {
+                deletePresettleInfo(p);
+            }
             setlinfo = mzDao.selectSettledInfo(p.getPatNo(), p.getTimes(), 1);
             if (null == setlinfo) {
                 return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有此患者的已结算数据。");
@@ -546,22 +565,18 @@ public class SiMzFeeService {
         input.getJSONObject("input").put("data", data);
         JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_OUTPATIENT_SETTLEMENT);
         log.info("【操作员:{}】门诊结算撤销:\n参数:{},\n结果:{}", p.getStaffId(), input, result);
-        if (null == result) {
-            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
-        }
         Integer infcode = result.getInteger(RESULT_CODE);
         logDao.insert(new SiLog(input, result, p.getPatNo(), p.getTimes(), infcode, setlinfo.getPsnNo()));
-        if (null == infcode) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "医保中心报错:" + result.getString("message"));
-        }
         if (infcode == 0) {
             afterRevokeSetl(p.getPatNo(), p.getTimes(), input.getString("msgid"));
-            if (null != p.getNeedRevokeRegistration() && p.getNeedRevokeRegistration() == 1) {
-                revokeOutpatientFeeDetails(p);
-                revokeOutpatientRegistration(p);
+            if (p.needRevokeRegistration()) {
+                deletePresettleInfo(p);
             }
             return getFundDetailFromSetlinfo(setlinfo);
         }
+        if (p.needRevokeRegistration()) {
+            deletePresettleInfo(p);
+        }
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
     }
 
@@ -725,9 +740,10 @@ public class SiMzFeeService {
             revokeOutpatientRegistration(mzptnt);
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, upldFeeRes.getMessage());
         }
-        // 上传完成之后结算并返回结算结果
+        // 上传完成之后试算并返回试算结果
         mzptnt.setReadCardBizType(ReadCardBizType.SETTLEMENT.getCode());
-        return outpatientSettlement(mzptnt);
+        mzptnt.setSavePreSettleResult(true);
+        return outpatientPreSettlement(mzptnt);
     }
 
     private ResultVo<String> mzChargeFee(String patientId, int times, String totalFee) {
@@ -736,13 +752,13 @@ public class SiMzFeeService {
         params.put("times", times);
         params.put("totalFee", totalFee);
         int tryTimes = 1;
-        JSONObject response = webHisService.mzChargeFee(params);
+        JSONObject response = webHisService.mzChargeFee(thmzUrl, params);
         log.info("第{}次保存处方:\n参数:{}\n结果:{}", tryTimes, params, response);
         while (0 != response.getInteger("code") && tryTimes < 5
                 && !response.getString("message").contains("已经收费")) {
             try {
                 tryTimes += 1;
-                response = webHisService.mzChargeFee(params);
+                response = webHisService.mzChargeFee(thmzUrl, params);
                 log.info("第{}次保存处方:\n参数:{}\n结果:{}", tryTimes, params, response);
                 TimeUnit.SECONDS.sleep(Math.min(tryTimes, 3));
             } catch (Exception e) {
@@ -759,4 +775,12 @@ public class SiMzFeeService {
         int result = MzgjUtil.inProcessing(patientId) ? 1 : 0;
         return ResultVoUtil.success(result);
     }
+
+    public void deletePresettleInfo(MzPatientInfo p) {
+        int res = setlinfoDao.deletePreSettleInfo(p.getPatNo(), p.getTimes());
+        if (res == 1) {
+            revokeOutpatientFeeDetails(p);
+            revokeOutpatientRegistration(p);
+        }
+    }
 }

+ 1 - 1
src/main/resources/application-prod.yml

@@ -53,4 +53,4 @@ mybatis-plus:
 si-api-url: http://dms.hun.hsip.gov.cn/isp-api/powercsb/1101
 si-access-key: 04eMGRg7beAO6vqwrZiLacV8Uy3jNn7QGDUcBO
 si-secret-key: SK3Oip3a2R3NLz2xm58Mpmi69oFu96KrdKNRKglN
-web-his-url: http://172.16.32.160:8706
+web-his-url: http://172.16.32.160:8077

+ 5 - 3
src/main/resources/application.yml

@@ -13,7 +13,7 @@ spring:
     cache: false
   datasource:
     dynamic:
-      primary: his
+      primary: dev
       strict: false
       datasource:
         his:
@@ -59,10 +59,12 @@ mybatis-plus:
 si-api-url: http://dms.hun.hsip.gov.cn/isp-api/powercsb/1101
 si-access-key: 04eMGRg7beAO6vqwrZiLacV8Uy3jNn7QGDUcBO
 si-secret-key: SK3Oip3a2R3NLz2xm58Mpmi69oFu96KrdKNRKglN
-#web-his-url: http://172.16.32.160:8706
+#web-his-url: http://172.16.32.160:8077
+#thmz-url: http://172.16.32.160:81/thmz/api/v1
 
 #测试环境
 #si-api-url: http://10.93.30.130:20001/isp-api/powercsb/1101
 #si-access-key: Zgs5jfxaKb86XbCuUzLK9EhFjiQfHR1vydaPzp
 #si-secret-key: SKT2ETMT3XkAYApqh79DCnN9ZjfbQEBMPU0GyLz9
-web-his-url: http://172.16.30.26:8706
+web-his-url: http://172.16.30.26:8706
+thmz-url: http://172.16.30.22:8089/thmz/api/v1