Macro - Future date & Patient Weight in drug label
Submitted by gretalloyd on Wed, 18/08/2021 - 20:39
Hi,
Is it possible to insert a macro into a medication label set up within products?
I would like to insert tomorrow's date and the patient weight.
Our current label is:
Using syringe provided, measure to the XX dose. Give orally once daily with food for 6 days.
Start
Stop if vomiting or not eating. Do not overdose.
I'd like it to be have the patient weight (rounded to whole number) where the XX is, and after Start to have tomorrows date.
So it would read:
Using syringe provided, measure to the 25kg dose. Give orally once daily with food for 6 days.
Start Thursday 19/08/21
Stop if vomiting or not eating. Do not overdose.
Is this possible?
Re: Macro - Future date & Patient Weight in drug label
Not officially, but it can be done by exploiting a feature of macros where if they fail to expand, the macro text is retained.
In Administration - Lookups, create a new macro, with:
concat('Using syringe provided, measure to the ', math:round(patient:weight(openvpms:get(., 'patient.entity')), 0), 'kg dose. Give orally once daily with food for 6 days.', $nl,
'Start ', date:format(date:add(openvpms:get(.,'startTime'), '1d'), 'EEEE dd/MM/yy'), $nl,
'Stop if vomiting or not eating. Do not overdose.')
In your medication, in the Dispensing Label field, enter @testdruglabel
This will fail to expand when editing the product as it cannot access a patient, but will expand when the product is dispensed.
Re: Macro - Future date & Patient Weight in drug label
Thanks Tim, that works perfectly!