update:医保对账医疗总金额统计逻辑更新

This commit is contained in:
Elliott
2025-12-29 09:39:27 +08:00
parent 6fd57d6177
commit 4c416ed691
3 changed files with 24 additions and 1916 deletions

View File

@@ -286,11 +286,7 @@
t.insutype as INSUTYPE,
t.clr_type as CLR_TYPE,
count(distinct t.HisTransId) as FIXMEDINS_SETL_CNT,
cast(
IFNULL(sum(t.ybtc),0)
+ IFNULL(sum(case when t.is_inpatient = 1 then 0 else t.ybzh_non_refund end),0)
+ IFNULL(sum(t.zf),0)
as decimal(19,2)) as MEDFEE_SUMAMT,
cast(IFNULL(sum(t.total_amt),0) as decimal(19,2)) as MEDFEE_SUMAMT,
cast(IFNULL(sum(t.ybtc),0) as decimal(19,2)) as FUND_PAY_SUMAMT,
cast(IFNULL(sum(t.ybzh),0) as decimal(19,2)) as ACCT_PAY
from (
@@ -298,6 +294,7 @@
insutype,
clr_type,
HisTransId,
sum(cast(IFNULL(Amount,0) as decimal(19,2))) as total_amt,
max(cast(IFNULL(ybtcAmount,0) as decimal(19,2))) as ybtc,
max(cast(IFNULL(ybzhAmount,0) as decimal(19,2))) as ybzh,
max(case when TradingStatus != '2' then cast(IFNULL(ybzhAmount,0) as decimal(19,2)) else 0 end) as ybzh_non_refund,