Patients With Specified Diagnosis, Intake Date, And Last Date of Service
Back to Query Directory
I want to see a list of clients bearing a certain diagnosis, along with their intake date, each of their four diagnoses, and last date of service.
SELECT
Providers. ProvCode, Providers.ProvLName, Providers.ProvFName,
Patients.LastName, Patients.FirstName, Patients.IntakeDate,
PtVars.LFeeDate AS "Last Service",
PtCSUDx.DxCode1, PtCSUDx.DxCode2, PTCSUDx.DxCode3, PtCSUDx.DxCode4
FROM
Patients
LEFT OUTER JOIN Providers ON Patients.ProviderNum = Providers.ProviderNum
LEFT OUTER JOIN PtCSU ON Patients.PtNum = PtCSU.PtNum
LEFT OUTER JOIN PtCSUDx ON PtCSU.PtCSUNum = PtCSUDx.PtCSUNum
LEFT OUTER JOIN PtVars ON Patients.PtNum = PtVars.PtNum
WHERE
Patients.LicNum = 101 AND
PtCSU.TypeFlag = 'D' AND
PtCSUDx.DxCode1 = '300.14' /*<-- desired Dx code goes here*/
ORDER BY
Providers.ProvCode, Patients.LastName
Providers. ProvCode, Providers.ProvLName, Providers.ProvFName,
Patients.LastName, Patients.FirstName, Patients.IntakeDate,
PtVars.LFeeDate AS "Last Service",
PtCSUDx.DxCode1, PtCSUDx.DxCode2, PTCSUDx.DxCode3, PtCSUDx.DxCode4
FROM
Patients
LEFT OUTER JOIN Providers ON Patients.ProviderNum = Providers.ProviderNum
LEFT OUTER JOIN PtCSU ON Patients.PtNum = PtCSU.PtNum
LEFT OUTER JOIN PtCSUDx ON PtCSU.PtCSUNum = PtCSUDx.PtCSUNum
LEFT OUTER JOIN PtVars ON Patients.PtNum = PtVars.PtNum
WHERE
Patients.LicNum = 101 AND
PtCSU.TypeFlag = 'D' AND
PtCSUDx.DxCode1 = '300.14' /*<-- desired Dx code goes here*/
ORDER BY
Providers.ProvCode, Patients.LastName
CategoryQueries