select sum(西药费) 西药费, sum(中成药费) 中成药费, sum(中草药费) 中草药费, sum(挂号费) 挂号费, sum(床位费) 床位费, sum(诊疗费) 诊疗费, sum(检查费) 检查费, sum(治疗费) 治疗费, sum(护理费) 护理费, sum(手术费) 手术费, sum(化验费) 化验费, sum(放射费) 放射费, sum(其他费) 其他费, DECODE(a.hospital_didt,'YLV21051','昆明医科大学第一附属医院','43120189-1-2','昆明医科大学第一附属医院呈贡医院') 院区 from (select nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '01', t.tot_cost, 0)), 0) 西药费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '02', t.tot_cost, 0)), 0) 中成药费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '03', t.tot_cost, 0)), 0) 中草药费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '04', t.tot_cost, 0)), 0) 挂号费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '05', t.tot_cost, 0)), 0) 床位费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '06', t.tot_cost, 0)), 0) 诊疗费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '07', t.tot_cost, 0)), 0) 检查费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '08', t.tot_cost, 0)), 0) 治疗费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '09', t.tot_cost, 0)), 0) 护理费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '10', t.tot_cost, 0)), 0) 手术费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '11', t.tot_cost, 0)), 0) 化验费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '12', t.tot_cost, 0)), 0) 放射费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '14', t.tot_cost, 0)), 0) 其他费, DECODE(a.hospital_didt,'YLV21051','昆明医科大学第一附属医院','43120189-1-2','昆明医科大学第一附属医院呈贡医院') 院区 from fin_ipb_feeinfo t,fin_ipr_inmaininfo a where t.balance_state = '0' AND t.inpatient_no=a.inpatient_no and t.fee_date >= to_date('2023-04-18 00:00:00','yyyy-mm-dd hh24:mi:ss') and t.fee_date <= to_date('2023-04-18 10:00:00','yyyy-mm-dd hh24:mi:ss') GROUP BY DECODE(a.hospital_didt,'YLV21051','昆明医科大学第一附属医院','43120189-1-2','昆明医科大学第一附属医院呈贡医院') union select nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '01', t.tot_cost, 0)), 0) 西药费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '02', t.tot_cost, 0)), 0) 中成药费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '03', t.tot_cost, 0)), 0) 中草药费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '04', t.tot_cost, 0)), 0) 挂号费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '05', t.tot_cost, 0)), 0) 床位费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '06', t.tot_cost, 0)), 0) 诊疗费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '07', t.tot_cost, 0)), 0) 检查费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '08', t.tot_cost, 0)), 0) 治疗费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '09', t.tot_cost, 0)), 0) 护理费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '10', t.tot_cost, 0)), 0) 手术费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '11', t.tot_cost, 0)), 0) 化验费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '12', t.tot_cost, 0)), 0) 放射费, nvl(sum(decode(fun_get_fee_stat_cate('ZY01', t.fee_code), '14', t.tot_cost, 0)), 0) 其他费, DECODE(a.hospital_didt,'YLV21051','昆明医科大学第一附属医院','43120189-1-2','昆明医科大学第一附属医院呈贡医院') 院区 from fin_ipb_feeinfo t,fin_ipr_inmaininfo a where t.balance_state = '1' AND t.inpatient_no=a.inpatient_no and t.fee_date >= to_date('2023-04-18 00:00:00','yyyy-mm-dd hh24:mi:ss') and t.fee_date <= to_date('2023-04-18 10:00:00','yyyy-mm-dd hh24:mi:ss') and t.balance_date > to_date('2023-04-18 10:00:00','yyyy-mm-dd hh24:mi:ss') GROUP BY DECODE(a.hospital_didt,'YLV21051','昆明医科大学第一附属医院','43120189-1-2','昆明医科大学第一附属医院呈贡医院')


原文地址: https://www.cveoy.top/t/topic/nu6U 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录