bugfix:对账对平
This commit is contained in:
@@ -247,22 +247,37 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 医保对账:按险种和清算类别分组统计(不限制PayType) -->
|
||||
<!-- 医保对账:按险种和清算类别分组统计(按ReceiptNO去重,即HisTransId)
|
||||
1. 医疗总金额(MEDFEE_SUMAMT):统计同一收据号(HisTransId)下的自费总额,取该收据号的ZFAmount并按组求和
|
||||
2. 统筹金额(FUND_PAY_SUMAMT)和账户金额(ACCT_PAY):只统计PayType为9和10的记录,按收据号合并
|
||||
3. 按HisTransId去重合并统计金额 -->
|
||||
<select id="findMedicalInsuranceGroupData" parameterType="HashMap" resultType="HashMap">
|
||||
select
|
||||
insutype as INSUTYPE,
|
||||
clr_type as CLR_TYPE,
|
||||
count(1) as FIXMEDINS_SETL_CNT,
|
||||
cast(IFNULL(sum(Amount),0) as decimal(19,2)) as MEDFEE_SUMAMT,
|
||||
cast(IFNULL(sum(ybtcAmount),0) as decimal(19,2)) as FUND_PAY_SUMAMT,
|
||||
cast(IFNULL(sum(ybzhAmount),0) as decimal(19,2)) as ACCT_PAY
|
||||
from hisbill_history
|
||||
where trade_date = #{trade_date}
|
||||
and insutype is not null
|
||||
and insutype != ''
|
||||
and clr_type is not null
|
||||
and clr_type != ''
|
||||
group by insutype, clr_type
|
||||
order by insutype, clr_type
|
||||
select
|
||||
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(t.ybzh),0) + IFNULL(sum(t.zf),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 (
|
||||
select
|
||||
insutype,
|
||||
clr_type,
|
||||
HisTransId,
|
||||
max(cast(IFNULL(ybtcAmount,0) as decimal(19,2))) as ybtc,
|
||||
max(cast(IFNULL(ybzhAmount,0) as decimal(19,2))) as ybzh,
|
||||
max(cast(IFNULL(zfAmount,0) as decimal(19,2))) as zf
|
||||
from hisbill_history
|
||||
where trade_date = #{trade_date}
|
||||
and insutype is not null
|
||||
and insutype != ''
|
||||
and clr_type is not null
|
||||
and clr_type != ''
|
||||
and HisTransId is not null
|
||||
and HisTransId != ''
|
||||
group by insutype, clr_type, HisTransId
|
||||
) as t
|
||||
group by t.insutype, t.clr_type
|
||||
order by t.insutype, t.clr_type
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user