select *
from (select a.结算单据号,
a.医疗机构名称,
a.统筹区域名称,
a.科室名称,
a.患者身份证号,
a.结算日期,
a.就医类型,
a.诊断名称,
row_number() over(partition by a.诊断名称 order by 总费用 desc) rn1,
a.患者姓名,
a.总费用
from (select t.结算单据号,
t.医疗机构名称,
t.统筹区域名称,
t.科室名称,
t.患者身份证号,
t.结算日期,
t.就医类型,
replace(t.诊断名称, ' ', '') 诊断名称,
t.患者姓名,
t.医疗总发生费用 总费用
from 门诊结算主表 t
where t.就医类型 like '%特%'
--and t.诊断名称 like '%肝硬化%'
group by t.结算单据号,
t.医疗机构名称,
t.统筹区域名称,
t.科室名称,
t.患者身份证号,
t.结算日期,
t.就医类型,
replace(t.诊断名称, ' ', ''),
t.患者姓名,
t.医疗总发生费用) a)
where rn1 < 10;
门特按照诊断TOP10
于 2025-01-22 10:05:43 首次发布