Hello all;
I am relatively new to the forum and am not certain I am posting in the right place. I am attempting to build a quick text or something comparable that we can attach to our patient instructions document listing the name, address and phone number for any referrals to outside providers added during update. I have used the below but it will only return the order information for the most recent order entered and if the referral order is entered prior to any other orders, it will not return the appropriate addresss for the "referral" order.
{ORDERS_NEW("LIST","R")}
{ORD_SERV_PROV_NAME()}
{ORD_SERV_PROV_BUS_NAME()}
{ORD_SERV_PROV_ADDR()}
Any ideas would be greatly appreciated.
I just worked on something similar- however we are using it to pull in the address only for specific referrals.
This is still in pilot so not guarantying anything.
But below is the function- there are two options- if you send the 'check' argument it just returns a value if there is a service provider and the ordercode was added during the update. It could be edited to return the name of the referral and the service provider address for all referrals entered that day.
One other thing to note- it does look a little funny in the patient instructions because every line is numbered so the address is a numbered list.
I hope this makes sense.
----------
{fn fngetserprov(ordercode,type){
//type check- checks if order exists for today
// srvprovider - returns the srvprovider name, address and phone
type=tolower(type)
//get visit date to confirm order date is same
local strvstdate=sub(str(document.clinicaldate),1,10)
// return FALSE if unable to check code or nothing if no service provider
local results=if type=='check' then 'FALSE' else '' endif
aryorderlist=getfield(ORDERS_NEW('delim'),"|^","")
strnumelements=size(aryorderlist)
For strcounter=1, strcounter0 and aryorderlist[ordermatch+1] = strvstdate
then
if type=='check' then results= 'TRUE'
else
results= aryorderlist[ordermatch+ 10] + HRET + aryorderlist[ordermatch+ 12] + HRET + aryorderlist[ordermatch+ 13]
endif
return results
else "" endif
endfor
return results}}
--- example of how we are using it-----
{fn fnPIhosp(){
cond
case fngetserprov('ERDIRECT-MR','check')=="TRUE"
"Your provider is sending you to the Emergency Room to be admitted to the hospital. We are seriously concerned about your health. Please go directly to the Emergency Room, the staff there is expecting you. Do not stop anywhere along the way. It is very important you go straight to the Emergency Room located at:" + HRET + fngetserprov('ERDIRECT-MR','srvprovider') + HRET
else "" endcond}}
Wow, thank you so much. I appreciate you getting back with me about this.