Hello,
I need a sql script that will show
- Referral orders placed after 7/1/2018
-Ordering Provider
-Order Date
-Order Description
-NPI
-Patient Name
-DOB
-SSN
-MRN
-Insurance
-DX
-Referred To Provider
Any Help on this would be appreciated!
This should get you started, Note this will give you every order since 07/01/2018 depending on your clinic size this query might take a while.
SELECT (USR.FIRSTNAME+' '+USR.LASTNAME) AS "PROVIDER", ORD.ORDERDATE AS "ORDER DATE", ORD.DESCRIPTION, USR.NPI, (PAT.First+' '+PAT.Last) AS "PATIENT NAME", PAT.Birthdate AS "DOB", PAT.SSN, PAT.MedicalRecordNumber AS "MRN", ORD.DXGROUPID AS "DX"
FROM ORDERS ORD, USR, PatientProfile PAT
WHERE ORD.PUBUSER = USR.PVID AND ORD.PID = PAT.PID AND ORD.ORDERTYPE = 'R' AND ORD.ORDERDATE > '07/01/2018'