Letter Fields
Submitted by EastsideVetEmerg on Wed, 08/11/2017 - 21:23
Hi,
I am looking to put a few fields in letters and having some difficulties. I can usually work things out from archetypes but struggling this time. Could just be tired.
In particular I need to put in:
- Clinician email address
- Clinician quantification
I also want to add or subtract sections based on clinician used to generate the letter. Using open office. E.g. we do this with location now. But I want some sections to be hidden based on location and others to be hidden based on clinician.
Tips appreciated.
Thanks,
Adrian
Re: Letter Fields
Adrian - from https://openvpms.org/documentation/csh/2.0/reference/jxpath or https://openvpms.org/documentation/csh/1.9/reference/jxpath for the email address you need party:getEmailAddress(openvpms:get(., "xxxx"))
I cannot say what XXXX is (ie how to reference the clinician) without knowing more details of what the letter is working with. It is probably clinician.entity
Qualifications: if you have a look at the security.user archetype you will see that the qualifications are have the path /details/qualifications - and from https://openvpms.org/documentation/csh/2.0/reference/reportFields or https://openvpms.org/documentation/csh/1.9/reference/reportFields you will see there is a table as follows:
so we can access the qualifications via openvpms:get(., "xxxx.qualifications")
Finally - remember that you should be able to grab the clinician's title, name and qualifications using something like [user:format(openvpms:get(., 'clinician.entity'), 'long')]
Note that I grabbed the above from the sample patient document in <OPENVPMS-HOME>\reports\Sample\A4\Sample Patient Document.odt - this also contains examples of how to hide fields - but remember that this is best used to switch text - ie doing his/her based on sex.
If you are trying to do sexy things (and it sounds like you are) hiding & showing large chunks of text, it would be better to work with a jrxml document rather than an odt one. With jrxml you have much more power with the 'Print when' facility. You might want to look at <OPENVPMS-HOME>\reports\Sample\A4\Sample Rabies Certificate.jrxml
Regards, Tim G
Re: Letter Fields
Hi Tim,
Thanks for that. We are trying to draw the clinician qualifications from the clinician referenced in the New Letter box. We are creating a patient letter. I have tried a few permutations and combinations without success.
openvpms:get(., "clinician.entity.qualifications") does not work.
halp please!
NB. Sexy items. Ok - I will leave this for now. It was just an idea to have one document with signatures for multiple clinicians - rather than each clinician having their own customised discharge and referral letter.
Re: Letter Fields
Stupid me - should test before talk/write. The recipe is:
So two errors: 1) how to get the qualifications; 2) incorrect call to get long format name.
NOTE - I ran into another problem: we are running 2.0 with the "Practices with multiple locations can now limit clinician, work list and printer selection to those available at the current practice location." enhancement. I entered DG as the clinician for the patient letter and it complained "Failed to validate property Clinician: dg is not valid for this field". I could not understand what was going wromg until I realised that I had the practice location set to ZZ Test and the only clinician allowed for this location is Dr ZZ.
I have submitted a Jira fixing 'Sample Patient Document.odt' and adding the clinician qualifications example to it. See https://openvpms.atlassian.net/browse/OVPMS-1978
Apologies for my screw ups.
Regards, Tim G
Re: Letter Fields
haha. All good! I was so close! I originally tried clinician.entity.qualification!
Thank you!
Re: Letter Fields
G'day Adrian
On your last point, using LibreOffice (OpenOffice should be similar) hidden paragraphs and document sections can contain other fields, but I don't think you can nest them. So if all the paragraphs/sections are in parallel things should work nicely.
However depending on the choice of variable (location/clinician) and conditional expression (location = 'A' , clinician !='Z') the document itself may get complex and difficult to maintain over time. Personally I find the table for creating variables and entering expressions a bit awkward, but then again, I don't use it frequently. As TimG says, jrxml would give more flexibility.
Simon Slater
Registered Linux User #463789 @ http://linuxcounter.net