Revision [187]

Last edited on 2008-12-16 15:20:31 by SethKrieger
Additions:
======Intakes for Period with Primary Dx, Primary Provider, and Office Location======
I need a query that can be done by date range for charge with a CPT code of 90801 and will print out the ID, Name, Primary Dx, Primary Provider, and Office location (which is taken from Box 32 in the CSU that is attached to the charge).
SELECT
a.id AS "ID",
(a.lastname+', '+a.firstname) AS "Name",
e.dxcode AS "Primary Dx",
f.provcode AS "Primary Provider",
g.shorthand AS "Office Location"

FROM
patients a
JOIN journal b ON a.ptnum = b.ptnum
JOIN jcharges c ON b.jnum = c.jnum
JOIN ptcsu d ON c.ptcsunum = d.ptcsunum
LEFT OUTER JOIN dx e ON d.dx1 = e.dxnum
LEFT OUTER JOIN providers f ON a.providernum = f.providernum
LEFT OUTER JOIN facilities g ON d.facilitynum = g.facilitynum
JOIN services h ON c.servicenum = h.servicenum
WHERE
h.cptcode = '90801'
AND b.trandate BETWEEN '2008-01-01' AND '2008-12-31'
Order BY "Name"
Deletions:
======Query Title ======
comments here appear in italics
paste your tested query here


Revision [186]

The oldest known version of this page was created on 2008-12-16 15:19:17 by SethKrieger [Cloned from NewQuery]
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki