You are here: Home Information for OSCAR Users EMR Resources Report Templates Billing Report Templates Billing Dx code search - (Ontario Billing v1)
Personal tools
Document Actions

Billing Dx code search - (Ontario Billing v1)

by David Chan last modified 2007-08-16 10:07

Search for patient by dx codes based on billing data. After a user selected date.

<report  title="Billing Dx code search" description="Billing Dx code search - (Ontario Billing v1)" active="1">
<query>
select distinct b.demographic_name, (YEAR(CURRENT_DATE)-YEAR(DATE_FORMAT(CONCAT((d.year_of_birth), '-', (d.month_of_birth),'-',(d.date_of_birth)),'%Y-%m-%d')))-(RIGHT(CURRENT_DATE,5)<RIGHT(DATE_FORMAT(CONCAT((d.year_of_birth), '-', (d.month_of_birth),'-',(d.date_of_birth)),'%Y-%m-%d'),5)) as age,
d.chart_no,
d.sex,
p.last_name,
b.billing_date,
bd.diagnostic_code

from billingdetail bd, billing b , demographic d, provider p

where

b.billing_no = bd.billing_no
and
b.demographic_no = d.demographic_no
and
d.provider_no = p.provider_no
and

d.patient_status='AC'

and b.billing_date > '{billing_date}'

and bd.diagnostic_code in ({multi_field})

order by d.chart_no, p.last_name, d.last_name, d.sex, AGE, b.billing_date, bd.diagnostic_code;

</query>

<param id="multi_field" type="textlist" description="A comma-separated list of choices ">
</param>
<param id="billing_date" type="date" description="Billing Date (From date)">
</param>

</report>