FHIR Chat · Not able to add <Medicatition> under <MedicationOrder> · implementers

Stream: implementers

Topic: Not able to add <Medicatition> under <MedicationOrder>


view this post on Zulip Ranjith (Jun 14 2016 at 16:48):

Not able to add <Medication> inside <MedicationOrder> using addContained() in the output:resultset; Anything to do with constraints ? Any thoughts would be Helpful!! Thank you.

view this post on Zulip James Agnew (Jun 14 2016 at 18:54):

Assuming you're using HAPI, you ned to have a reference to the contained resource (medication) from the containing resource (medicationorder). If you do not have such a reference, the serializer ignores the contained resource because it isn't valid

This would look something like medicationOrder.setMedication(new Reference().setResource(medication))

Also FYI there is a stream for HAPI here: https://chat.fhir.org/#narrow/stream/hapi

view this post on Zulip Ranjith (Jun 14 2016 at 21:36):

Thanks a lot ..James.

Made the following changes:--------
medOrder.setMedication(new Reference().setReferenceElement(medId));
medOrder.addContained(med);

Output: Getting the following but missing <Contained> tag. in DSTU3
<medicationReference>
<reference value="urn:uuid:d316e516-fe16-4b31-a88d-2270afd0262b"></reference>
</medicationReference>

Thanks.

view this post on Zulip James Agnew (Jun 15 2016 at 16:51):

Sorry, does that mean it's now working for you? Or it still isn't?

If it's not working, can you start a new topic over in the HAPI stream and post a complete code snippet showing what's not working?

view this post on Zulip Ranjith (Jun 15 2016 at 20:20):

Still not working. I will create a new topic in HAPI stream. with code snippet. Thanks a lot James.


Last updated: Apr 12 2022 at 19:14 UTC