Current Referring Vet within Email Templates

Hi,

As Tim G is on holidays, I'm wondering if someone can help with an strange behaviour we've noticed within email templates.

If a patient has been to our clinic before, but on this new visit has a different referring vet to previous visit, we add a new referring vet to the patient. This automatically ends the previous vet to todays date and puts the new referring vet starting todays date.

We then create a new referral letter for this patient at the end of consult and for some reason the referring vet in the Subject Line of the email is correct (the new referring vet), but the referring vet within the Email Body is incorrect (the previous referring vet)

In the screenshot attached, the previous referring vet was - No Referral Vet and the new referring vet is Sam Snelling.

I presume it is something to do with the macros we are using.

In the email template, the Subject Line is a Macro and it includes: ',openvpms:get(party:getPatientReferralVet($patient),'firstName'),' ',openvpms:get(party:getPatientReferralVet($patient),'lastName'),'

whereas the Jasper report document for the Email body uses:

($F{[openvpms:get(party:getPatientReferralVet(.),'lastName')]}!=null)?
($F{[openvpms:get(party:getPatientReferralVet(.),'firstName')]}+" "
+$F{[openvpms:get(party:getPatientReferralVet(.),'lastName')]}+", "
+$F{[openvpms:get(party:getPatientReferralVetPractice(.),'name')]}):" ??? NO REFERRAL VET ???"

 

Also, if I change the date of end for the previous referring vet, it doesn't fix it, but would it make more sense to have the date of ending for previous referring vet be -1 day?

Hope that all makes sense. If no one knows, then I will just email Tim G when he gets back from holidays as he knows my email templates better than we do :)

Greta

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Current Referring Vet within Email Templates

When you say the "previous referring vet" was NO referring Vet do you mean you actually have a Vet or a vet supplier called No Referring Vet? because if this is the case its not actually finding that suppplier its finding NO supplier.

In the Jasper Template its simply checking for a referring vet and it the LAST NAME value of that referring vet is NULL then it will show "??? NO REFERRAL VET ???"

So the simplet answer is that for some reason.  The jasperreport value

$F{[openvpms:get(party:getPatientReferralVet(.),'lastName')]}

is returning NULL

 

Also regarding dates - pretty much everything works that way..try changing a patient owner - you will see the new owner starts today and the old one finishes today ...what you cant see is the times which will ensure no overlap

It shouldnt matter anyway as the jxpath above knows to find the active relationship - if it isnt there might be a bug.

 

 

 

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Current Referring Vet within Email Templates

Hi Ben,

Thanks for the reply. Sorry for the confusion, No Referring Vet is a Veterinarian in our system, not that ZZ Dog didn't have a referring vet.

I have done another practice one. The previous referring vet was Diana and the new vet is David. Screenshot attached. David is correct in the Subject Line, but Diana is populated incorrectly through the Email Body.

So, maybe that does mean there is a bug is the jxpath is looking for active relationship?

AttachmentSize
Screenshot 2.odt 291.75 KB

Re: Current Referring Vet within Email Templates

Certainly Odd.

 

Sorry dont have a answer for this...it seems like a bug to me...

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Current Referring Vet within Email Templates

The email subject uses the current patient, and the most recent referral.

The email body expecting to be launched from an act, and will use the associated patient and date/time of the act to determine which referral to use.

If the referral was created after the act, then the previous referral will be selected. As a workaround, you can edit the referrals, back dating them so the correct one is selected.

Re: Current Referring Vet within Email Templates

Is another option to use the patient rather than the act..

ie ues

$F{[openvpms:get(party:getPatientReferralVet(openvpms:get(.,patient.entity)),'lastName')]}
Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Current Referring Vet within Email Templates

Is another option to use the patient rather than the act..

ie ues

$F{[openvpms:get(party:getPatientReferralVet(openvpms:get(.,patient.entity)),'lastName')]}
Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Current Referring Vet within Email Templates

Greta - I don't have easy access to your system from the laptop I have with me, so I can't login and have a look.  However, one v.useful piece of information with be a screeshot of the Patients|Info screen showing the Referrals tab so that we can see who the referring vets were when. [I assume that you have things set up so that Sam S is in the system both as one of your clinicians and as a Supplier/Vet - it might be better for testing if you renamed the Supplier|Vet as Sam SupplierVet or something else.]  We want things so that the visit clinician is different from the referring vet so that we can easily understand where the names are coming from.

Also - since the screen shows only the dates (and not the times), do you know the time relationship between the visit start time and the setting of the (new) referring vet.  If you created the visit and then thought 'oh new referring vet - better set it' then at the visit start time the 'current' referring vet would have been the previous one - and the "real" referring vet would have become active a couple of minutes later.

Regards, Tim G

Re: Current Referring Vet within Email Templates

Hi Tim,

Thanks for replying. We can manage by manually changing the vet until you get back, I didn't mean to bother you while you are on holidays.

I have done the screenshots. It is pretty self explanatory, but yes.. if you change the referring vet after you have started the visit, then it will use the referring vet from then.

I really like Ben's suggestion of using $F{[openvpms:get(party:getPatientReferralVet(openvpms:get(.,patient.entity)),'lastName')]} but I tried to change it in Jasper Reports and made an absolute mess of it. It just kept giving me different errors.

Greta

AttachmentSize
Screenshots.odt 643.81 KB

Re: Current Referring Vet within Email Templates

Hi,

Our email template when emailing histories contains the following expression.

"Dear "+$F{[openvpms:get(party:getPatientReferralVetPractice(.),'name')]}+","

However sometimes, as below, the referring vet name appears as null.

Are we using the wrong expression?

Cheers,

Adrian

 

Re: Current Referring Vet within Email Templates

Adrian - you have blanked out so much, that I cannot figure out where you invoked the email write screen from. I can see that you are in the Workflow workspace and you have something open for Edit, and then the email write screen got invoked.

The expression looks good, and is close to the one below so my guess is the problem is associated with the dates. As per http://www.openvpms.org/documentation/csh/1.9/reference/jxpath

Seeing that (.) [meaning the current act or patient] is being used, if the code is using act rather than patient, the system will look for the referring practice active at the start of the act's start time - and if the referring practice (Bateau Bay Vet Clinic in the above case) was set AFTER the start of the visit, then it will not get picked up.

Tim A may wish to comment on whether the date comparison is a date/time or just date compare. If the visit started on last Tuesday at 1536, but the referring practive was not set until 1600 on the same day, then a date/time compare will not find the referring practice.

You could force the system to use the patient, thus picking up the current referring practice, by using:

$F{[openvpms:get(party:getPatientReferralVetPractice(openvpms:get(.,"patient.objectReference")),'name')]

Regards, Tim G

Re: Current Referring Vet within Email Templates

That should probably be:

F{[openvpms:get(party:getPatientReferralVetPractice(openvpms:get(.,'patient.entity')),'name')]

IIRC, the patient.objectReference only applies to expressions used to display appointments in Workflow - Scheduling and tasks in Workflow - Work Lists.

The party:getPatientReferralVet(act) function does perform a date/time comparison.

Re: Current Referring Vet within Email Templates

Hi,

Umm.. I have tried all combinations of the above and no dice....

I have also tried altering the content source for the System Email Template this is attached to. I have tried $visit $patient and . 

Sorry - too many variables and too deep a knowledge of computer stuff for my brain to process.

I have attached the file I am trying to modify along with a screenshot of the template used.

Thank you,

Adrian

AttachmentSize
MedicalHistoryEmailTemplate20160703v1.jrxml 8.5 KB
MedicalHistoryEmailTemplate20160703v6.jrxml 8.94 KB

Re: Current Referring Vet within Email Templates

Try the attached. The Content Source needs to be $patient.

AttachmentSize
MedicalHistoryEmailTemplate.jrxml 8.19 KB

Re: Current Referring Vet within Email Templates

thank you - this works! much appreciated.

Syndicate content