Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

— REPORT SELISIH CLAIM OUTPATIENT—

select
sum(inv.sub_total) "Tarif RS",
sum((cas.claim_data -> 'grouper' -> 'response' -> 'cbg' ->> 'tariff')::int) "Tarif Claim",
sum((cas.claim_data -> 'grouper' -> 'response' -> 'cbg' ->> 'tariff')::int) - sum(inv.sub_total) "Selisih"
from
emr_episodes emrACTION & ITEM DETAIL REVENUE REPORT

join
outpatients out
on out.emr_episode_id = emr.id and out.deleted_at is null
join
invoices inv
on inv.emr_episode_id = emr.id and inv.deleted_at is null and inv.status != 'CANCELED'
join
vw_bpjs_casemixes cas
on cas.sep_no = out.sep_no
where
emr.deleted_at is null
and date(out.treatment_date) between {{Start_date}} and {{End_date}}

—Total Claim IGD—

select
-- date(out.treatment_date) "Tanggal Rawat",
-- cas.sep_no "SEP",
-- cas.claim_data ->> 'nomor_kartu' "No Kartu",
-- cas.claim_data ->> 'nama_pasien' "Nama Pasien",
-- cas.mr_no "NRM",
-- unit.name "Unit",
-- replace(cas.claim_data ->> 'diagnosa', '#',', ') "ICD10",
-- replace(cas.claim_data ->> 'procedure', '#',', ') "ICD9",
sum((cas.grouping -> 'response' -> 'cbg' ->> 'tariff')::int)
-- inv.sub_total "Tarif RS",
-- cas.claim_data -> 'grouper' -> 'response' -> 'cbg' ->> 'tariff' "Tarif Claim",
-- ((cas.claim_data -> 'grouper' -> 'response' -> 'cbg' ->> 'tariff')::int - (inv.sub_total)) "Selisih",
-- case
-- when ((cas.claim_data -> 'grouper' -> 'response' -> 'cbg' ->> 'tariff')::int - (inv.sub_total)) < 0
then concat('Loss')
-- else concat('Profit')
-- end "Profit/Loss",
-- cas.claim_data ->> 'klaim_status_cd' "Status",
-- cas.claim_data ->> 'coder_nm' "Petugas Casemix"
from
emr_episodes emr
join
ers
on ers.emr_episode_id = emr.id and ers.deleted_at is null
join
vw_bpjs_casemixes cas
on cas.sep_no = ers.sep_no
where
emr.deleted_at is null
and date(ers.check_in_date) between {{Start_date}} and {{End_date}}
-- group by
-- "Tanggal Rawat",
-- "SEP",
-- "No Kartu",
-- "Nama Pasien",
-- "NRM",
-- "Unit",
-- "ICD10",
-- "ICD9",
-- "INACBG",
-- "Tarif RS",
-- "Tarif Claim",
-- "Selisih",
-- "Profit/Loss",
-- "Status",
-- "Petugas Casemix"
-- order by
-- "Tanggal Rawat" asc

—TOTAL CLAIM RAWAT INAP—

select
-- date(out.treatment_date) "Tanggal Rawat",
-- cas.sep_no "SEP",
-- cas.claim_data ->> 'nomor_kartu' "No Kartu",
-- cas.claim_data ->> 'nama_pasien' "Nama Pasien",
-- cas.mr_no "NRM",
-- unit.name "Unit",
-- replace(cas.claim_data ->> 'diagnosa', '#',', ') "ICD10",
-- replace(cas.claim_data ->> 'procedure', '#',', ') "ICD9",
sum((cas.grouping -> 'response' -> 'cbg' ->> 'tariff')::int)
-- inv.sub_total "Tarif RS",
-- cas.claim_data -> 'grouper' -> 'response' -> 'cbg' ->> 'tariff' "Tarif Claim",
-- ((cas.claim_data -> 'grouper' -> 'response' -> 'cbg' ->> 'tariff')::int - (inv.sub_total)) "Selisih",
-- case
-- when ((cas.claim_data -> 'grouper' -> 'response' -> 'cbg' ->> 'tariff')::int - (inv.sub_total)) < 0
then concat('Loss')
-- else concat('Profit')
-- end "Profit/Loss",
-- cas.claim_data ->> 'klaim_status_cd' "Status",
-- cas.claim_data ->> 'coder_nm' "Petugas Casemix"
from
emr_episodes emr
join
inpatients inp
on inp.emr_episode_id = emr.id and inp.deleted_at is null
join
vw_bpjs_casemixes cas
on cas.sep_no = inp.sep_no
where
emr.deleted_at is null
and date(inp.check_in_date) between {{Start_date}} and {{End_date}}
-- group by
-- "Tanggal Rawat",
-- "SEP",
-- "No Kartu",
-- "Nama Pasien",
-- "NRM",
-- "Unit",
-- "ICD10",
-- "ICD9",
-- "INACBG",
-- "Tarif RS",
-- "Tarif Claim",
-- "Selisih",
-- "Profit/Loss",
-- "Status",
-- "Petugas Casemix"
-- order by
-- "Tanggal Rawat" asc

—TOTAL CLAIM RAWAT JALAN—

select
-- date(out.treatment_date) "Tanggal Rawat",
-- cas.sep_no "SEP",
-- cas.claim_data ->> 'nomor_kartu' "No Kartu",
-- cas.claim_data ->> 'nama_pasien' "Nama Pasien",
-- cas.mr_no "NRM",
-- unit.name "Unit",
-- replace(cas.claim_data ->> 'diagnosa', '#',', ') "ICD10",
-- replace(cas.claim_data ->> 'procedure', '#',', ') "ICD9",
sum((cas.grouping -> 'response' -> 'cbg' ->> 'tariff')::int)
-- inv.sub_total "Tarif RS",
-- cas.claim_data -> 'grouper' -> 'response' -> 'cbg' ->> 'tariff' "Tarif Claim",
-- ((cas.claim_data -> 'grouper' -> 'response' -> 'cbg' ->> 'tariff')::int - (inv.sub_total)) "Selisih",
-- case
-- when ((cas.claim_data -> 'grouper' -> 'response' -> 'cbg' ->> 'tariff')::int - (inv.sub_total)) < 0
then concat('Loss')
-- else concat('Profit')
-- end "Profit/Loss",
-- cas.claim_data ->> 'klaim_status_cd' "Status",
-- cas.claim_data ->> 'coder_nm' "Petugas Casemix"
from
emr_episodes emr
join
outpatients out
on out.emr_episode_id = emr.id and out.deleted_at is null
join
vw_bpjs_casemixes cas
on cas.sep_no = out.sep_no
where
emr.deleted_at is null
and date(out.treatment_date) between {{Start_date}} and {{End_date}}
-- group by
-- "Tanggal Rawat",
-- "SEP",
-- "No Kartu",
-- "Nama Pasien",
-- "NRM",
-- "Unit",
-- "ICD10",
-- "ICD9",
-- "INACBG",
-- "Tarif RS",
-- "Tarif Claim",
-- "Selisih",
-- "Profit/Loss",
-- "Status",
-- "Petugas Casemix"
-- order by
-- "Tanggal Rawat" asc

You might also like