<?xml version="1.0" encoding="UTF-8"?>

<MedicationDispense xmlns="http://hl7.org/fhir">
  <id value="meddisp0303"/>
  <contained>
    <Medication>
      <id value="med0310"/>
      <code>
        <coding>
          <system value="http://www.nlm.nih.gov/research/umls/rxnorm"/>
          <code value="1049623"/>
          <display value="oxycodone hydrochloride 5 MG Oral Tablet [Roxicodone]"/>
        </coding>
      </code>
    </Medication>
  </contained>
  <partOf>
    <reference value="Procedure/biopsy"/>
  </partOf>
  <status value="on-hold"/>
  <notPerformedReason>
    <reference>
      <reference value="DetectedIssue/allergy"/>
    </reference>
  </notPerformedReason>
  <category>
    <coding>
      <system value="http://terminology.hl7.org/fhir/CodeSystem/medicationdispense-category"/>
      <code value="outpatient"/>
      <display value="Outpatient"/>
    </coding>
  </category>
  <medication>
    <!--  Linked to a RESOURCE Medication  -->
    <reference>
      <reference value="#med0310"/>
    </reference>
  </medication>
  <subject>
    <reference value="Patient/pat1"/>
    <display value="Donald Duck"/>
  </subject>
  <encounter>
    <reference value="Encounter/f001"/>
  </encounter>
  <performer>
    <actor>
      <reference value="Practitioner/f006"/>
    </actor>
  </performer>
  <authorizingPrescription>
    <reference value="MedicationRequest/medrx0310"/>
  </authorizingPrescription>
  <type>
    <coding>
      <system value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
      <code value="EM"/>
      <display value="Emergency Supply"/>
    </coding>
  </type>
  <quantity>
    <value value="30"/>
    <system value="http://terminology.hl7.org/CodeSystem/v3-orderableDrugForm"/>
    <code value="TAB"/>
  </quantity>
  <daysSupply>
    <value value="10"/>
    <unit value="Day"/>
    <system value="http://unitsofmeasure.org"/>
    <code value="d"/>
  </daysSupply>
  <whenPrepared value="2016-04-15T07:14:00+05:00"/>
  <dosageInstruction>
    <simple>
      <text value="one to two tablets every 4-6 hours as needed for rib pain"/>
      <additionalInstruction>
        <coding>
          <system value="http://snomed.info/sct"/>
          <code value="418914006"/>
          <display value="Warning. May cause drowsiness. If affected do not drive or operate machinery. Avoid alcoholic drink (qualifier value)"/>
        </coding>
      </additionalInstruction>
      <timing>
        <repeat>
          <frequency value="1"/>
          <period value="4"/>
          <periodMax value="6"/>
          <periodUnit value="h"/>
        </repeat>
      </timing>
      <asNeededFor>
        <coding>
          <system value="http://snomed.info/sct"/>
          <code value="297217002"/>
          <display value="Rib Pain (finding)"/>
        </coding>
      </asNeededFor>
      <route>
        <coding>
          <system value="http://snomed.info/sct"/>
          <code value="26643006"/>
          <display value="Oral Route"/>
        </coding>
      </route>
      <method>
        <coding>
          <system value="http://snomed.info/sct"/>
          <code value="421521009"/>
          <display value="Swallow - dosing instruction imperative (qualifier value)"/>
        </coding>
      </method>
    </simple>
  </dosageInstruction>
</MedicationDispense>