I am looking for a report that will give me the most frequently placed orders by location. Anyone have anything that they are willing to share?
Since we're on CPS I'm not sure I could create a report for you that would work. But I could probably get you going in the right direction. My first question would be how many orders you want to see per location, e.g. top 10? My second question is do you need to exclude any order types such as E&M charges?
Thank you so much! I am looking for the top 50 orders placed. Just Tests and Procedures.
Again, I'm on CPS and I don't know if the table structure for EMR will match, so I'm going to start with a rough sketch of the query and hope that gets us pointed in the right direction.
You want the top 50 test and service orders for each location. I'm going to assume the following:
1. You want completed orders only.
2. You're looking at orders by description
3. You're not looking for any specific time frame.
The query would look something like this:
;WITH cte_Orders AS ( SELECT l.ABBREVNAME AS Location, o.DESCRIPTION AS OrderDesc, COUNT(o.ORDERID) AS OrderCount, ROW_NUMBER() OVER (PARTITION BY l.ABBREVNAME ORDER BY COUNT(o.ORDERID) DESC) AS OrderRank FROM ORDERS o INNER JOIN DOCUMENT d ON o.SDID = d.SDID INNER JOIN LOCREG l ON d.LOCOFCARE = l.LOCID WHERE o.CHANGE IN (0,2) AND o.ORDERTYPE IN ('S','T') AND o.STATUS = 'C' GROUP BY l.ABBREVNAME, o.DESCRIPTION ) SELECT Location, OrderDesc, OrderCount FROM cte_Orders WHERE OrderRank <= 50 ORDER BY Location, OrderRank
Let's see how far we get with that.