bugfix:对账排除住院订单

This commit is contained in:
Yuan
2025-11-20 09:33:53 +08:00
parent 0a344423e5
commit 97aae27351
14 changed files with 124 additions and 21 deletions

View File

@@ -30,12 +30,12 @@
<!--批量插入银行交易记录-->
<insert id="insertAllBankHistory" parameterType="java.util.List">
insert into
bankbill_history(C_QSRQ,C_JYRQ,C_JYSJ,C_ZDH,C_CARD,C_JYLX,C_JYJE,C_QSJE,C_SXF,C_SJZFJE,C_CKH,C_LSH,C_KLX,C_FKH,C_ZFFS,C_YSDDH,C_SHDDH,C_BZZD,C_QBYHJE,C_SHYHJE,C_YJYLSH,C_FQQS,C_FQSXF,C_FQFWF,C_FQFXF,C_QTYHJE,C_THDDH,C_FKFY,C_FDJC,C_ZDDH,bill_table_name,FUND_PAY_SUMAMT,ACCT_PAY,MEDFEE_SUMAMT)
bankbill_history(C_QSRQ,C_JYRQ,C_JYSJ,C_ZDH,C_CARD,C_JYLX,C_JYJE,C_QSJE,C_SXF,C_SJZFJE,C_CKH,C_LSH,C_KLX,C_FKH,C_ZFFS,C_YSDDH,C_SHDDH,C_BZZD,C_QBYHJE,C_SHYHJE,C_YJYLSH,C_FQQS,C_FQSXF,C_FQFWF,C_FQFXF,C_QTYHJE,C_THDDH,C_FKFY,C_FDJC,C_ZDDH,bill_table_name,FUND_PAY_SUMAMT,ACCT_PAY,MEDFEE_SUMAMT,is_inpatient)
values
<foreach collection="list" index="index" item="itm" separator=",">
(
#{itm.cQsrq},#{itm.cJyrq},#{itm.cJysj},#{itm.cZdh},#{itm.cCard},#{itm.cJylx},#{itm.cJyje},#{itm.cQsje},#{itm.cSxf},#{itm.cSjzfje},#{itm.cCkh},#{itm.cLsh},#{itm.cKlx}
,#{itm.cFkh},#{itm.cZffs},#{itm.cYsddh},#{itm.cShddh},#{itm.cBzzd},#{itm.cQbyhje},#{itm.cShyhje},#{itm.cYjylsh},#{itm.cFqqs},#{itm.cFqsxf},#{itm.cFqfwf},#{itm.cFqfxf},#{itm.cQtyhje},#{itm.cThddh},#{itm.cFkfy},#{itm.cFdjc},#{itm.cZddh},#{itm.billTableName},#{itm.fundPaySumamt},#{itm.acctPay},#{itm.medfeeSumamt}
,#{itm.cFkh},#{itm.cZffs},#{itm.cYsddh},#{itm.cShddh},#{itm.cBzzd},#{itm.cQbyhje},#{itm.cShyhje},#{itm.cYjylsh},#{itm.cFqqs},#{itm.cFqsxf},#{itm.cFqfwf},#{itm.cFqfxf},#{itm.cQtyhje},#{itm.cThddh},#{itm.cFkfy},#{itm.cFdjc},#{itm.cZddh},#{itm.billTableName},#{itm.fundPaySumamt},#{itm.acctPay},#{itm.medfeeSumamt},#{itm.isInpatient}
)
</foreach>
</insert>
@@ -136,6 +136,7 @@
left join (select C_YSDDH from bankbill_history where C_JYLX = '2' and C_JYRQ = #{trade_date}) b
on a.C_YSDDH = b.C_YSDDH
where a.C_JYRQ = #{trade_date}
and (a.is_inpatient is null or a.is_inpatient = '0') -- 排除住院订单
and b.C_YSDDH is null
</insert>
@@ -231,12 +232,12 @@
<insert id="insertBankbillOriginal" parameterType="HashMap">
insert into
bankbill_original(C_QSRQ,C_JYRQ,C_JYSJ,C_ZDH,C_CARD,C_JYLX,C_JYJE,C_QSJE,C_SXF,C_SJZFJE,C_CKH,C_LSH,C_KLX,C_FKH,C_ZFFS,C_YSDDH,C_SHDDH,C_BZZD,C_QBYHJE,C_SHYHJE,C_YJYLSH,C_FQQS,C_FQSXF,C_FQFWF,C_FQFXF,C_QTYHJE,C_THDDH,C_FKFY,C_FDJC,C_ZDDH,bill_table_name,FUND_PAY_SUMAMT,ACCT_PAY,MEDFEE_SUMAMT)
bankbill_original(C_QSRQ,C_JYRQ,C_JYSJ,C_ZDH,C_CARD,C_JYLX,C_JYJE,C_QSJE,C_SXF,C_SJZFJE,C_CKH,C_LSH,C_KLX,C_FKH,C_ZFFS,C_YSDDH,C_SHDDH,C_BZZD,C_QBYHJE,C_SHYHJE,C_YJYLSH,C_FQQS,C_FQSXF,C_FQFWF,C_FQFXF,C_QTYHJE,C_THDDH,C_FKFY,C_FDJC,C_ZDDH,bill_table_name,FUND_PAY_SUMAMT,ACCT_PAY,MEDFEE_SUMAMT,is_inpatient)
values
<foreach collection="list" index="index" item="itm" separator=",">
(
#{itm.cQsrq},#{itm.cJyrq},#{itm.cJysj},#{itm.cZdh},#{itm.cCard},#{itm.cJylx},#{itm.cJyje},#{itm.cQsje},#{itm.cSxf},#{itm.cSjzfje},#{itm.cCkh},#{itm.cLsh},#{itm.cKlx}
,#{itm.cFkh},#{itm.cZffs},#{itm.cYsddh},#{itm.cShddh},#{itm.cBzzd},#{itm.cQbyhje},#{itm.cShyhje},#{itm.cYjylsh},#{itm.cFqqs},#{itm.cFqsxf},#{itm.cFqfwf},#{itm.cFqfxf},#{itm.cQtyhje},#{itm.cThddh},#{itm.cFkfy},#{itm.cFdjc},#{itm.cZddh},#{itm.billTableName},#{itm.fundPaySumamt},#{itm.acctPay},#{itm.medfeeSumamt}
,#{itm.cFkh},#{itm.cZffs},#{itm.cYsddh},#{itm.cShddh},#{itm.cBzzd},#{itm.cQbyhje},#{itm.cShyhje},#{itm.cYjylsh},#{itm.cFqqs},#{itm.cFqsxf},#{itm.cFqfwf},#{itm.cFqfxf},#{itm.cQtyhje},#{itm.cThddh},#{itm.cFkfy},#{itm.cFdjc},#{itm.cZddh},#{itm.billTableName},#{itm.fundPaySumamt},#{itm.acctPay},#{itm.medfeeSumamt},#{itm.isInpatient}
)
</foreach>
</insert>

View File

@@ -40,6 +40,7 @@
select *
from bankbill_history
where C_JYRQ = #{trade_date}
and (is_inpatient is null or is_inpatient = '0') <!-- 排除住院订单(终端号10091548和10091549) -->
</select>
<insert id="saveOriginalData" parameterType="java.util.List">
insert into bankbills_original (

View File

@@ -24,6 +24,7 @@
select *
from hisbill_history
where trade_date = #{trade_date}
and PayMethod != '2' <!-- 排除PayMethod=2的记录不参与对账 -->
<if test="military_code != null and military_code != ''">
and PayType != #{military_code}
</if>
@@ -56,6 +57,7 @@
from hisbills_history
where trade_date=#{trade_date}
and PayMethod != '2' <!-- 排除PayMethod=2的记录不参与对账 -->
<if test="military_code != null and military_code != ''">
and PayType != #{military_code}
</if>

View File

@@ -80,6 +80,8 @@
inner join bankbill_history b on a.PlatformTransId = b.C_YSDDH
where b.C_JYRQ &gt;= #{startTime}
and b.C_JYRQ &lt;= #{endTime}
and a.PayMethod != '2' -- 排除不参与对账的记录
and (b.is_inpatient is null or b.is_inpatient = '0') -- 排除住院订单
<if test="prepayment_code != null and prepayment_code != ''">
and a.PayType != #{prepayment_code}
</if>
@@ -120,6 +122,7 @@
, '0'
, '1'
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}
and PayMethod != '2' -- 排除不参与对账的记录
<if test="military_code != null and military_code != ''">
and payType!=#{military_code}
</if>
@@ -134,7 +137,7 @@
</if>
) a
inner join
(select * from bankbill_history where C_JYRQ = #{trade_date}) b
(select * from bankbill_history where C_JYRQ = #{trade_date} and (is_inpatient is null or is_inpatient = '0')) b -- 排除住院订单
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and ROUND(CAST(a.Amount AS DECIMAL(18,2)), 2) = ROUND(CAST(b.C_JYJE AS DECIMAL(18,2)), 2)
</insert>
@@ -163,6 +166,7 @@
, '1'
, '1'
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}
and PayMethod != '2' -- 排除不参与对账的记录
<if test="military_code != null and military_code != ''">
and payType!=#{military_code}
</if>
@@ -177,7 +181,7 @@
</if>
) a
left join
(select * from bankbill_history where C_JYRQ = #{trade_date}) b
(select * from bankbill_history where C_JYRQ = #{trade_date} and (is_inpatient is null or is_inpatient = '0')) b -- 排除住院订单
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and ROUND(CAST(a.Amount AS DECIMAL(18,2)), 2) = ROUND(CAST(b.C_JYJE AS DECIMAL(18,2)), 2)
where b.C_SHDDH is null
</insert>
@@ -207,6 +211,7 @@
, '1'
, '1'
from (select * from hisbill_history where trade_date = #{trade_date} and payType!=#{cash_code}
and PayMethod != '2' -- 排除不参与对账的记录
<if test="military_code != null and military_code != ''">
and payType!=#{military_code}
</if>
@@ -221,7 +226,7 @@
</if>
) a
right join
(select * from bankbill_history where C_JYRQ = #{trade_date}) b
(select * from bankbill_history where C_JYRQ = #{trade_date} and (is_inpatient is null or is_inpatient = '0')) b -- 排除住院订单
on a.PlatformTransId = b.C_SHDDH and a.TradingStatus = b.C_JYLX and ROUND(CAST(a.Amount AS DECIMAL(18,2)), 2) = ROUND(CAST(b.C_JYJE AS DECIMAL(18,2)), 2)
where a.PlatformTransId is null
</insert>
@@ -252,6 +257,7 @@
, '0'
, '1'
from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code}
and PayMethod != '2' -- 排除不参与对账的记录
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
and HisOperCode not in
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
@@ -290,6 +296,7 @@
, '1'
, '1'
from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code}
and PayMethod != '2' -- 排除不参与对账的记录
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
and HisOperCode not in
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
@@ -329,6 +336,7 @@
, '1'
, '1'
from (select * from hisbill_history where trade_date = #{trade_date} and payType = #{cash_code}
and PayMethod != '2' -- 排除不参与对账的记录
<if test="excludeMilitaryOperators != null and excludeMilitaryOperators.size() > 0">
and HisOperCode not in
<foreach collection="excludeMilitaryOperators" item="operator" open="(" separator="," close=")">
@@ -589,11 +597,11 @@
</select>-->
<select id="findHisAndThirdJoinDataByParamAndNotUnique" parameterType="HashMap" resultType="HashMap">
select TranID, H_JYLX,Amount
select TranID, H_JYLX
from third_join_his
where trade_date = #{trade_date}
and TranID != ''
group by TranID, H_JYLX,Amount
group by TranID, H_JYLX
having count(TranID) > 1
</select>
@@ -606,6 +614,14 @@
and H_JYLX = #{h_jylx}
</delete>
<delete id="deleteThirdUnilateralByIddh" parameterType="HashMap">
delete
from third_join_his
where trade_date = #{trade_date}
and I_DDH = #{i_ddh}
and err_type = '2'
</delete>
<!--添加修改后的重复记录回数据库-->
<insert id="addNotUniqueData" parameterType="java.util.List">
insert into third_join_his(JYSJ

View File

@@ -244,4 +244,12 @@
<delete id="deleteUnilateralById" parameterType="HashMap">
delete from unmanger_unilateral where id = #{id}
</delete>
<delete id="deleteBankUnilateralByI_DDH" parameterType="HashMap">
delete
from unmanger_unilateral
where trade_date = #{trade_date}
and I_DDH = #{i_ddh}
and err_type = '2'
</delete>
</mapper>