Hello,
I was wondering if there is a way write a code that will check when the last time an order was made within 24 months. And display information depending on if it is true or not.
Can this be done?
Thanks!
The short answer is yes, but it would require some coding. You will probably want to use the ORDERS_ALL() function and then parse through the orders and store the appropriate parameters into variables (e.g. order status and start date of order) so you can identify the order you are looking for in particular and record when it was completed. Use DURATIONDAYS() function to determine if order was completed within past 24 months (i.e. 730 days). If order was performed multiple times, you could use an array or sorting algorithm to pick the most recent one. Your output to the user could be a popup box or a data display. I have used these functions extensively to create a summary of clinical recommendations for our providers.
Be glad to furnish you a code example, follows suggestions above.
Thank you so much, I know where to start now.
I appreciate your help!
Tosh
One other thing to note. You might want to pull ORDERS_ALL() into a variable and then use that in your visibility regions, particularly if you are stacking several on top of each other to show one versus another. I have had some performance issues when using ORDERS_ALL(), PROB_AFTER(), etc in visibility regions that way.
Be certain to use break in your loop after finding the order. ORDERS_ALL returns every order on the patient, meaning if a patient has been established for a period of time, the loop iteration count can be high. Clock cycles are precious in the EMR and we rarely are afforded an opportunity to manage them, so 'carpe break' when you can! 🙂
I'd like to say, VirtualHITman (Greg) was able to assist with this issue and even offered(performed) offline assistance to help with changing colors of a data display based off an order array. He worked on it over a weekend and sent me the fix. Definitely a lifesaver!!! Thank you!
Thanks Cliff. Glad everything worked out for you!