Notifications
Clear all
Topic starter
I was wondering if anyone on here has already written a script to pull a list of all office visits that have been opened for more than 3 days and have not been signed off on as of yet?
Posted : May 19, 2015 4:40 am
Here you go
SELECT (SELECT SEARCHNAME FROM PatientProfile WHERE PID = DOCUMENT.PID) AS PATIENT,
(SELECT REPLACE(LTRIM(RTRIM(ISNULL(FIRSTNAME,'')) + ' ' + RTRIM(ISNULL(MIDDLENAME,'')) + ' ' + RTRIM(ISNULL(LASTNAME,''))), ' ', ' ') AS PVNAME FROM USR WHERE PVID = DOCUMENT.USRID) AS PROVIDER,
DATEDIFF(DAY,dbo.Convert_ID_to_date(CLINICALDATE), GETDATE()) AS DAYS_OPENED,
*
FROM DOCUMENT
WHERE DATEDIFF(DAY,dbo.Convert_ID_to_date(CLINICALDATE), GETDATE()) > 3
AND STATUS <> 'S'
Posted : May 19, 2015 4:46 am