lighter 3 年之前
父节点
当前提交
ff19a63f80

+ 1 - 1
src/main/java/thyyxxk/simzfeeoprnsystm/controller/SiMzFeeController.java

@@ -52,7 +52,7 @@ public class SiMzFeeController {
     }
 
     @PostMapping("/revokeOutpatientSettlement")
-    public ResultVo<String> revokeOutpatientSettlement(@RequestBody MzPatientInfo p) {
+    public ResultVo<FundDetail> revokeOutpatientSettlement(@RequestBody MzPatientInfo p) {
         return service.revokeOutpatientSettlement(p);
     }
 

+ 2 - 2
src/main/java/thyyxxk/simzfeeoprnsystm/dao/SiMzDao.java

@@ -101,8 +101,8 @@ public interface SiMzDao {
             "preselfpay_amt=#{preselfpayAmt}, inscp_scp_amt=#{inscpScpAmt} where pat_no=#{patNo} and times=#{times}")
     void updateSortOfAmt(SiPatInfo patInfo);
 
-    @Select("select * from t_si_setlinfo where pat_no=#{patNo} and times=#{times} and revoked=0")
-    SiSetlinfo selectSettledInfo(@Param("patNo") String patNo, @Param("times") int times);
+    @Select("select top 1 * from t_si_setlinfo where pat_no=#{patNo} and times=#{times} and revoked=#{revoked} order by setl_time desc")
+    SiSetlinfo selectSettledInfo(@Param("patNo") String patNo, @Param("times") int times, @Param("revoked") int revoked);
 
     @Select("select psn_no,certno as mdtrtCertNo,mdtrtCertType='02', " +
             "psn_cert_type,certno,med_type,insuplc_admdvs, " +

+ 5 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/dicts/SiFunction.java

@@ -53,6 +53,11 @@ public enum SiFunction {
      */
     UPLOAD_SELF_FUNDED_PATIENT_FEE_DETAIL("4201"),
 
+    /**
+     * 通过此交易上传门急诊诊疗记录(门急诊诊疗记录)
+     */
+    UPLOAD_CLINIC_RECORDS("4301"),
+
     /* =========================================== 电子凭证缴费业务 ========================================== */
     /**
      * 定点医药机构向地方移动支付中心发起上传费用明细交易,

+ 8 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/pojo/FundDetail.java

@@ -14,4 +14,12 @@ public class FundDetail {
     private String acctPay;
     private String cashPay;
     private String selfPay;
+
+    public void reverseAll() {
+        totalCost = "-" + totalCost;
+        fundPay = "-" + fundPay;
+        acctPay = "-" + acctPay;
+        cashPay = "-" + cashPay;
+        selfPay = "-" + selfPay;
+    }
 }

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

@@ -343,7 +343,7 @@ public class SiMzFeeService {
     }
 
     private ResultVo<FundDetail> getFundDetailResultVo(MzPatientInfo p) {
-        SiSetlinfo sisetl = mzDao.selectSettledInfo(p.getPatNo(), p.getTimes());
+        SiSetlinfo sisetl = mzDao.selectSettledInfo(p.getPatNo(), p.getTimes(), 0);
         if (null != sisetl && null != sisetl.getSetlId()) {
             return getFundDetailResultVo(sisetl);
         }
@@ -357,6 +357,9 @@ public class SiMzFeeService {
         fundDetail.setCashPay(String.valueOf(sisetl.getPsnCashPay()));
         fundDetail.setAcctPay(String.valueOf(sisetl.getAcctPay()));
         fundDetail.setSelfPay(String.valueOf(sisetl.getPsnPartAmt()));
+        if (sisetl.getRevoked() == 1) {
+            fundDetail.reverseAll();
+        }
         return ResultVoUtil.success(fundDetail);
     }
 
@@ -435,17 +438,14 @@ public class SiMzFeeService {
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
     }
 
-    public ResultVo<String> revokeOutpatientSettlement(MzPatientInfo p) {
+    public ResultVo<FundDetail> revokeOutpatientSettlement(MzPatientInfo p) {
         if (null == p.getTimes()) {
             p.setTimes(mzDao.selectMaxTimes(p.getPatNo()));
         }
-        QueryWrapper<SiSetlinfo> wrapper = new QueryWrapper<>();
-        wrapper.eq("pat_no", p.getPatNo());
-        wrapper.eq("times", p.getTimes());
-        wrapper.eq("revoked", 0);
-        SiSetlinfo setlinfo = setlinfoDao.selectOne(wrapper);
+        SiSetlinfo setlinfo = mzDao.selectSettledInfo(p.getPatNo(), p.getTimes(), 0);
         if (null == setlinfo) {
-            return ResultVoUtil.success("门诊结算撤销成功。");
+            setlinfo = mzDao.selectSettledInfo(p.getPatNo(), p.getTimes(), 1);
+            return getFundDetailResultVo(setlinfo);
         }
         JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_OUTPATIENT_SETTLEMENT,
                 mzDao.selectAdmdvs(setlinfo.getPatNo(), setlinfo.getTimes(), setlinfo.getLedgerSn()), p.getStaffId());
@@ -468,7 +468,7 @@ public class SiMzFeeService {
             mzDao.deleteSetlInfo(p.getPatNo(), p.getTimes());
             mzDao.deleteSetlDetail(p.getPatNo(), p.getTimes());
             mzDao.updateRvkSetlMsgid(p.getPatNo(), p.getTimes(), input.getString("msgid"));
-            return ResultVoUtil.success("门诊结算撤销成功。");
+            return getFundDetailResultVo(setlinfo);
         }
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
     }
@@ -496,4 +496,9 @@ public class SiMzFeeService {
             revokeOutpatientRegistration(mzPatientInfo);
         }
     }
+
+//    public ResultVo<String> uploadClinicRecords() {
+//        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.UPLOAD_CLINIC_RECORDS, "", "99999");
+//
+//    }
 }