> ## Documentation Index
> Fetch the complete documentation index at: https://help.elationhealth.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MedicationDispense

## Overview

Indicates that a medication product is to be or has been dispensed for a named person/patient. This includes a description of the medication product (supply) provided and the instructions for administering the medication. The medication dispense is the result of a pharmacy system responding to a medication order.

**Each MedicationDispense has next elements:**

* a status
* a medication
* a patient

**Each MedicationDispense supports next elements:**

* who dispensed the medication
* the authorizing prescription
* type of dispense (e.g., partially dispensed)
* the quantity dispensed
* a date for when dispensed to the patient
* free text dosage instructions (the SIG)
* the dose and rate

**Profile specific implementation guidance:**

* The MedicationDispense resource is used to represent the USCDI v3 medication fill status.
* This Profile can represent a medication using a code or reference a Medication resource
  * When using a code, RXNorm concepts are used. They are defined as an extensible binding to .medicationCodeableConcept. USCDI V3+ recommends the National Drug Codes (NDC) as an optional terminology. They can be supplied as an additional coding element.
  * When referencing a Medication resource in .medicationReference, the resource may be contained or an external resource.
  * The server systems are not required to support both a code and a reference, but SHALL support at least one of these methods.
  * If an external reference to a Medication resource is used, the server SHALL support the \_include parameter for searching this element.
  * The client application SHALL support all methods.

This resource conforms to [USCDI V3 profile](https://www.healthit.gov/isa/uscdi-data-class/medications#uscdi-v3) for MedicationDispense \* refer to [StructureDefinition US Core MedicationDispense](http://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-medicationdispense.html). MedicationDispense response will be provided in JSON (refers to Capability Statement) format as per [FHIR](https://hl7.org/fhir) standard R4 version.

### Must support elements, mandatory and optional search parameters

*MedicationDispense **must support** these elements:*

* `status`
* `medication[x]`
* `subject`
* `performer`
  * `actor`
* `authorizingPrescription`
* `type`
* `quantity`
* `whenHandedOver`
* `dosageInstruction`
  * `text`
  * `timing`
* `doseAndRate`
  * `dose[x]`

*The following search parameters and search parameter combinations SHALL be supported:*

**SHALL** support searching using the `patient` search parameter:

* including optional support for these `_include` parameters: MedicationDispense:medication

`GET [base]/MedicationDispense?patient=14676`

*The following search parameter combinations **SHOULD** be supported (**optional**):*

**SHOULD** support searching using the combination of the `patient` and `status` search parameters:

* including support for OR search on status (e.g.status=\{system|}\[code],\{system|}\[code],...)

`GET [base url]/MedicationDispense?patient={Type/}[id]&status={system|}[code]`

**SHOULD** support searching using the combination of the `patient` and `status` and `type` search parameters:

* including support for OR search on status (e.g.status=\{system|}\[code],\{system|}\[code],...)

`GET [base url]/MedicationDispense?patient={Type/}[id]&status={system|}[code]&type={system|}[code]`

The response to any search operation is always a list of resources in a Bundle or an Operation Outcome.

## MedicationDispense By Patient Id

Search for MedicationDispense by patient.

**METHOD** *GET*

```
[base url]/MedicationDispense?patient={Type/}[id]
```

**PARAMS**

\[base url] - [FHIR base url](/articles/fhir/service-base-urls)

\[id] - Id for the Patient

**HEADERS**

The Authorization token SHALL be obtained during the Authentication and Authorization process. Go to [Authentication and Authorization](/articles/fhir/authentication-authorization) for further details.

| Header        | Type       | Required/Optional | Value            |
| ------------- | ---------- | ----------------- | ---------------- |
| Authorization | **string** | required          | `Bearer <token>` |

**RESPONSES**

| Code | Description                        | Comment                                                                                                                                         |
| ---- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| 200  | OK                                 | The request was processed successfully                                                                                                          |
| 400  | Bad request                        | Invalid request parameters or FHIR operation outcome resource returned                                                                          |
| 401  | Unauthorized                       | This code indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource |
| 404  | No route matched with those values | The request was able to communicate with a given server, but the server could not find what was requested                                       |
| 500  | Internal Server Error              | The server has encountered a situation it doesn't know how to handle                                                                            |

**EXAMPLE:**

```
curl --location --request GET 'https://sandbox.fhir.elationemr.com/fhir/MedicationDispense?patient=Patient/c5137fa5-3216-b12a-cbbc-a0c6bef361g7' \
--header 'Authorization: Bearer fe1cd986-1ac7-4c26-b8b3-d632a48408fd'
```

## MedicationDispense by patient and status search parameters

Get MedicationDispenses using the combination of the patient and status search parameters

**METHOD** *GET*

```
GET [base url]/MedicationDispense?patient={Type/}[id]&status={system|}[code]
```

**PARAMS**

\[base url] - [FHIR base url](/articles/fhir/service-base-urls)

\{Type/} - Type for the Reference. *Example:* `Patient`
\[id] - patient id
\{system|} - terminology system used to identify medication dispense status
\[code] - status of the medication dispense

**HEADERS**

The Authorization token SHALL be obtained during the Authentication and Authorization process. Go to [Authentication and Authorization](/articles/fhir/authentication-authorization) for further details.

| Header        | Type       | Required/Optional | Value            |
| ------------- | ---------- | ----------------- | ---------------- |
| Authorization | **string** | required          | `Bearer <token>` |

**RESPONSES**

| Code | Description                        | Comment                                                                                                                                         |
| ---- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| 200  | OK                                 | The request was processed successfully                                                                                                          |
| 400  | Bad request                        | Invalid request parameters or FHIR operation outcome resource returned                                                                          |
| 401  | Unauthorized                       | This code indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource |
| 404  | No route matched with those values | The request was able to communicate with a given server, but the server could not find what was requested                                       |
| 500  | Internal Server Error              | The server has encountered a situation it doesn't know how to handle                                                                            |

**EXAMPLE:**

```
curl --location --request GET 'https://sandbox.fhir.elationemr.com/fhir/MedicationDispense?patient=Patient/fe1cd986-1ac7-4c26-b8b3-d632a48408fd&status=completed' \
--header 'Authorization: Bearer 1239b275-909e-4754-8f73-1e411fd6769e'
```

## MedicationDispense by patient and status and type search parameters

Get MedicationDispenses using the combination of the patient and status and type search parameters

**METHOD** *GET*

```
GET [base url]/MedicationDispense?patient={Type/}[id]&status={system|}[code]&type={system|}[code]
```

**PARAMS**

\[base url] - [FHIR base url](/articles/fhir/service-base-urls)

\{Type/} - Type for the Reference. *Example:* `Patient`
\[id] - patient id
\{system|} - terminology system used to identify medication dispense status or type
\[code] - status or type of the medication dispense

**HEADERS**

The Authorization token SHALL be obtained during the Authentication and Authorization process. Go to [Authentication and Authorization](/articles/fhir/authentication-authorization) for further details.

| Header        | Type       | Required/Optional | Value            |
| ------------- | ---------- | ----------------- | ---------------- |
| Authorization | **string** | required          | `Bearer <token>` |

**RESPONSES**

| Code | Description                        | Comment                                                                                                                                         |
| ---- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| 200  | OK                                 | The request was processed successfully                                                                                                          |
| 400  | Bad request                        | Invalid request parameters or FHIR operation outcome resource returned                                                                          |
| 401  | Unauthorized                       | This code indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource |
| 404  | No route matched with those values | The request was able to communicate with a given server, but the server could not find what was requested                                       |
| 500  | Internal Server Error              | The server has encountered a situation it doesn't know how to handle                                                                            |

**EXAMPLE:**

```
curl --location --request GET 'https://sandbox.fhir.elationemr.com/fhir/MedicationDispense?patient=Patient/fe1cd986-1ac7-4c26-b8b3-d632a48408fd&status=completed&type=http://terminology.hl7.org/CodeSystem/v3-ActCode|EM' \
--header 'Authorization: Bearer 1239b275-909e-4754-8f73-1e411fd6769e'
```
