Personal tools
Document Actions

Drug Report by Age

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

Reports patients by prescribed drug name, age and rx_date

<report  title="Drug Report by Patient Age" description="Reports patients by prescribed drug name, age and rx_date" active="1">
<query>
select dr.demographic_no, dr.BN, dr.special, de.last_name, de.first_name, de.sex, concat(year_of_birth, '-', month_of_birth, '-', date_of_birth) as DOB,
datediff(now(), concat(year_of_birth, '-', month_of_birth, '-', date_of_birth))/365 as Age, de.provider_no, (select concat(pr.first_name, ' ', pr.last_name)
from provider pr where pr.provider_no = de.provider_no) as Provider, concat(pr.first_name, ' ', pr.last_name) as Prescriber
from drugs dr, demographic de, provider pr where dr.demographic_no = de.demographic_no and dr.provider_no = pr.provider_no
and ( BN like '%{drugname}%')
and datediff(now(), concat(year_of_birth, '-', month_of_birth, '-', date_of_birth))/365 >= {age}
and rx_date > '{rx_date}' order by last_name, provider_no;</query>
<param id="drugname" type="text" description="Drugname keyword">
</param>
<param id="rx_date" type="date" description="Rx Date (From date)">
</param>
<param id="age" type="text" description="Age of Population (From age)">
</param>
</report>