Is there a way in SQL to run a query on certain user names and how many appointments they have made monthly in Centricity?
Here is a starting point, just modify the dates-
SELECT createdby, count(CreatedBy) as Num FROM appointments
WHERE created > '2015-01-01' and Created < '2015-02-01'
GROUP BY CreatedBy ORDER BY Num desc
This is one that I use to get appointments created for the last 30 days. Just replace the XX with loginname of the employee you want to see what they did.
If you want to see everyone, just remove that portion of the script. This will also pull the doctor scheduled with, the facility and the created date and time. I have this automated via SSRS to send out at the first of the month to my office managers. It gives it a total count of appointments and then breaks it down by appointment type.
DECLARE @Now DATETIME = GETDATE();
DECLARE @1DaysAgo DATETIME = DATEADD(day,-30,@Now);Select a.created, at.Name as AppointmentType, a.Status, pp.searchname,pp.PatientId, df.ListName, a.ApptStart, a.createdby, df1.ListName, df2.listname
from Appointments a
left outer join ApptType at on a.ApptTypeId = at.ApptTypeId
left outer join DoctorFacility df on a.DoctorId = df.DoctorFacilityId
left outer join DoctorFacility df1 on a.FacilityId = df1.DoctorFacilityId
left outer join doctorfacility df2 on a.CreatedBy = df2.LoginUser
left outer join PatientProfile pp on a.OwnerId = pp.PatientProfileId
where a.created BETWEEN '01/01/2015 12:00 AM' AND getdate()
and (a.createdby like '%xx%' OR a.createdby like '%xx%')order by a.CreatedBy
Thank You! That worked.
Thank You!