There are two versions of this SQL: Firebird and MySQL. The MySQL version only applies to clients who are have migrated to MySQL.. All other Practices should continue to use the Firebird version of this code. Click to expand and copy the code you need. If you are unsure which code to use, please check with your Practice Administrator. |
About
This report shows the following information:
- Patient chart number
- First name
- Last name
- Location
- Referral date
- Provider to whom patient was referred
- Referral category/type
- Dx code(s)
- Referring provider
- Status of referral
A sample image of this SQL report run in the Database Viewer is shown below:
Caveats
None.
SQL Code: Firebird
To highlight and copy the code below to your clipboard, simply click the Copy button.
select patno, fname, lname, loc_name, date1 as referral_date, refmd, refmdspecialty as category, dx, dx2, p_md as referring_provider, status from referalletter rl inner join register r on r.patno = rl.patno inner join location on location.id = r.loc_id where date1 between :Start_Date and :end_Date and custom1 = 'REFERRAL'
SQL Code: MySQL
To highlight and copy the code below to your clipboard, simply click the Copy button.
select rl.patno, fname, lname, loc_name, date1 as referral_date, refmd, refmdspecialty as category, dx, dx2, p_md as referring_provider, status from referalletter rl inner join register r on r.patno = rl.patno inner join location on location.id = r.loc_id where date1 between :start_date and :end_date and custom1 = 'REFERRAL'