---
title: "medication_order"
description: "An order for a medication, vaccine, nutritional product or other therapeutic item for an identified individual."
---

An order for a medication, vaccine, nutritional product or other therapeutic item for an identified individual.

**Purpose.** To record all aspects of an order of a medication, vaccine, nutritional product or other therapeutic item for an identified individual.

## Source

| Model | Leg | Role |
|---|---|---|
| `openEHR-EHR-INSTRUCTION.medication_order.v3` | openEHR | defines this table |

## Columns

| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `form_id` | `uuid` → [`form`](/docs/tables/form) | no | The form this entry was recorded on. | — |
| `form_block_id` | `uuid` | yes | The block within the form, when the entry is bound to one. | — |
| `medication_item`<br />`medication_item_code`<br />`medication_item_system`<br />`medication_item_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Medication item | `/activities[at0001]/description[at0002]/items[at0070]` |
| `route`<br />`route_code`<br />`route_system`<br />`route_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Route | `/activities[at0001]/description[at0002]/items[at0091]` |
| `body_site`<br />`body_site_code`<br />`body_site_system`<br />`body_site_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Body site | `/activities[at0001]/description[at0002]/items[at0092]` |
| `structured_body_site_anatomical_location` | `uuid` | yes | — | — |
| `structured_body_site_anatomical_location_circle` | `uuid` | yes | — | — |
| `structured_body_site_anatomical_location_relative` | `uuid` | yes | — | — |
| `administration_method`<br />`administration_method_code`<br />`administration_method_system`<br />`administration_method_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Administration method | `/activities[at0001]/description[at0002]/items[at0094]` |
| `overall_directions_description` | `text` | yes | Overall directions description | `/activities[at0001]/description[at0002]/items[at0009]` |
| `parsable_directions_value`<br />`parsable_directions_formalism` | text, text<br />`text`, `text` | yes | Parsable directions | `/activities[at0001]/description[at0002]/items[at0047]` |
| `specific_directions_description` | `text` | yes | Specific directions description | `/activities[at0001]/description[at0002]/items[at0173]` |
| `dosage_justification` | `text` | yes | Dosage justification | `/activities[at0001]/description[at0002]/items[at0174]` |
| `medication_safety_exceptional_safety_override` | `boolean` | yes | Exceptional safety override? | `/activities[at0001]/description[at0002]/items[at0062]/items[at0064]` |
| `medication_safety_total_daily_effective_dose_purpose` | `text` | yes | Purpose | `/activities[at0001]/description[at0002]/items[at0062]/items[at0150]/items[at0165]` |
| `medication_safety_total_daily_effective_dose_t_9a749e_magnitude`<br />`medication_safety_total_daily_effective_dose_t_9a749e_units` | quantity<br />`numeric`, `text` | yes | Total daily amount | `/activities[at0001]/description[at0002]/items[at0062]/items[at0150]/items[at0151]` |
| `additional_instruction`<br />`additional_instruction_code`<br />`additional_instruction_system`<br />`additional_instruction_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Additional instruction | `/activities[at0001]/description[at0002]/items[at0044]` |
| `patient_information`<br />`patient_information_code`<br />`patient_information_system`<br />`patient_information_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Patient information | `/activities[at0001]/description[at0002]/items[at0105]` |
| `monitoring_instruction` | `text` | yes | Monitoring instruction | `/activities[at0001]/description[at0002]/items[at0107]` |
| `clinical_indication`<br />`clinical_indication_code`<br />`clinical_indication_system`<br />`clinical_indication_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Clinical indication | `/activities[at0001]/description[at0002]/items[at0018]` |
| `therapeutic_intent` | `text` | yes | Therapeutic intent | `/activities[at0001]/description[at0002]/items[at0148]` |
| `clinician_guidance` | `text` | yes | Clinician guidance | `/activities[at0001]/description[at0002]/items[at0179]` |
| `order_details_order_start_date_time` | `timestamptz` | yes | Order start date/time | `/activities[at0001]/description[at0002]/items[at0113]/items[at0012]` |
| `order_details_order_stop_date_time` | `timestamptz` | yes | Order stop date/time | `/activities[at0001]/description[at0002]/items[at0113]/items[at0013]` |
| `order_details_order_start_criterion` | `text` | yes | Order start criterion | `/activities[at0001]/description[at0002]/items[at0113]/items[at0011]` |
| `order_details_order_stop_criterion` | `text` | yes | Order stop criterion | `/activities[at0001]/description[at0002]/items[at0113]/items[at0016]` |
| `order_details_administrations_completed` | `integer` | yes | Administrations completed | `/activities[at0001]/description[at0002]/items[at0113]/items[at0060]` |
| `order_details_duration_of_order_completed` | `interval` | yes | Duration of order completed | `/activities[at0001]/description[at0002]/items[at0113]/items[at0050]` |
| `dispense_directions_dispense_instruction` | `text` | yes | Dispense instruction | `/activities[at0001]/description[at0002]/items[at0129]/items[at0106]` |
| `dispense_directions_substitution_direction`<br />`dispense_directions_substitution_direction_code`<br />`dispense_directions_substitution_direction_system`<br />`dispense_directions_substitution_direction_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Substitution direction | `/activities[at0001]/description[at0002]/items[at0129]/items[at0132]` |
| `dispense_directions_non_substitution_reason` | `text` | yes | Non-substitution reason | `/activities[at0001]/description[at0002]/items[at0129]/items[at0154]` |
| `dispense_directions_priority`<br />`dispense_directions_priority_code`<br />`dispense_directions_priority_system`<br />`dispense_directions_priority_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Priority | `/activities[at0001]/description[at0002]/items[at0129]/items[at0139]` |
| `dispense_directions_dispensing_start_date` | `timestamptz` | yes | Dispensing start date | `/activities[at0001]/description[at0002]/items[at0129]/items[at0155]` |
| `dispense_directions_dispensing_expiry_date` | `timestamptz` | yes | Dispensing expiry date | `/activities[at0001]/description[at0002]/items[at0129]/items[at0161]` |
| `comment` | `text` | yes | Comment | `/activities[at0001]/description[at0002]/items[at0167]` |
| `order_identifier_value`<br />`order_identifier_system` | text, text<br />`text`, `text` | yes | Order identifier | `/protocol[at0005]/items[at0004]` |

## Constraints

```sql
check ((medication_item_code is null and medication_item_system is null and medication_item_valueset_id is null) or (medication_item is not null and medication_item_code is not null and medication_item_system is not null and medication_item_valueset_id is not null))
check ((route_code is null and route_system is null and route_valueset_id is null) or (route is not null and route_code is not null and route_system is not null and route_valueset_id is not null))
check ((body_site_code is null and body_site_system is null and body_site_valueset_id is null) or (body_site is not null and body_site_code is not null and body_site_system is not null and body_site_valueset_id is not null))
check (num_nonnulls(structured_body_site_anatomical_location, structured_body_site_anatomical_location_circle, structured_body_site_anatomical_location_relative) <= 1)
check ((administration_method_code is null and administration_method_system is null and administration_method_valueset_id is null) or (administration_method is not null and administration_method_code is not null and administration_method_system is not null and administration_method_valueset_id is not null))
check ((parsable_directions_value is null and parsable_directions_formalism is null) or (parsable_directions_value is not null and parsable_directions_formalism is not null))
check ((medication_safety_total_daily_effective_dose_t_9a749e_magnitude is null and medication_safety_total_daily_effective_dose_t_9a749e_units is null) or (medication_safety_total_daily_effective_dose_t_9a749e_magnitude is not null and medication_safety_total_daily_effective_dose_t_9a749e_units is not null))
check ((additional_instruction_code is null and additional_instruction_system is null and additional_instruction_valueset_id is null) or (additional_instruction is not null and additional_instruction_code is not null and additional_instruction_system is not null and additional_instruction_valueset_id is not null))
check ((patient_information_code is null and patient_information_system is null and patient_information_valueset_id is null) or (patient_information is not null and patient_information_code is not null and patient_information_system is not null and patient_information_valueset_id is not null))
check ((clinical_indication_code is null and clinical_indication_system is null and clinical_indication_valueset_id is null) or (clinical_indication is not null and clinical_indication_code is not null and clinical_indication_system is not null and clinical_indication_valueset_id is not null))
check (order_details_administrations_completed is null or order_details_administrations_completed >= 0)
check ((dispense_directions_substitution_direction_code is null and dispense_directions_substitution_direction_system is null and dispense_directions_substitution_direction_valueset_id is null and dispense_directions_substitution_direction is null) or (dispense_directions_substitution_direction is not null and dispense_directions_substitution_direction_code is not null and dispense_directions_substitution_direction_system is not null and dispense_directions_substitution_direction_valueset_id is not null))
check ((dispense_directions_priority_code is null and dispense_directions_priority_system is null and dispense_directions_priority_valueset_id is null) or (dispense_directions_priority is not null and dispense_directions_priority_code is not null and dispense_directions_priority_system is not null and dispense_directions_priority_valueset_id is not null))
check (order_identifier_system is null or order_identifier_value is not null)
```

## Unique

- `form_block_id`

## References

| Columns | Target | On delete |
|---|---|---|
| `form_id` | [`form`](/docs/tables/form) | cascade |
| `form_id, form_block_id` | [`form_block`](/docs/tables/form_block) | cascade |
| `medication_item_valueset_id, medication_item_code, medication_item_system, medication_item` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `route_valueset_id, route_code, route_system, route` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `body_site_valueset_id, body_site_code, body_site_system, body_site` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `administration_method_valueset_id, administration_method_code, administration_method_system, administration_method` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `additional_instruction_valueset_id, additional_instruction_code, additional_instruction_system, additional_instruction` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `patient_information_valueset_id, patient_information_code, patient_information_system, patient_information` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `clinical_indication_valueset_id, clinical_indication_code, clinical_indication_system, clinical_indication` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `dispense_directions_substitution_direction_valueset_id, dispense_directions_substitution_direction_code, dispense_directions_substitution_direction_system, dispense_directions_substitution_direction` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `dispense_directions_priority_valueset_id, dispense_directions_priority_code, dispense_directions_priority_system, dispense_directions_priority` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `structured_body_site_anatomical_location` | [`anatomical_location`](/docs/tables/anatomical_location) | no action |
| `structured_body_site_anatomical_location_circle` | [`anatomical_location_circle`](/docs/tables/anatomical_location_circle) | no action |
| `structured_body_site_anatomical_location_relative` | [`anatomical_location_relative`](/docs/tables/anatomical_location_relative) | no action |

## Referenced by

- [`medication_order_medication_details`](/docs/tables/medication_order_medication_details) via `medication_order_id`
- [`medication_order_administration_device`](/docs/tables/medication_order_administration_device) via `medication_order_id`
- [`medication_order_structured_dose_and_timing_directions`](/docs/tables/medication_order_structured_dose_and_timing_directions) via `medication_order_id`
- [`medication_order_medication_safety_safety_override`](/docs/tables/medication_order_medication_safety_safety_override) via `medication_order_id`
- [`medication_order_medication_safety_maximum_dose`](/docs/tables/medication_order_medication_safety_maximum_dose) via `medication_order_id`

## Indexes

- `medication_order_form_id_idx` on `form_id`
- `medication_order_structured_body_site_anatomical_location_idx` on `structured_body_site_anatomical_location`
- `medication_order_structured_body_site_anatomical_locatio_9a7a76` on `structured_body_site_anatomical_location_circle`
- `medication_order_structured_body_site_anatomical_locatio_f2eb61` on `structured_body_site_anatomical_location_relative`

## Child tables

5 tables hang off `medication_order`, one row per repetition.

### `medication_order_medication_details`

Child table — one row per repetition, deleted with its parent.

| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `medication_order_id` | `uuid` → [`medication_order`](/docs/tables/medication_order) | no | — | — |
| `position` | `integer` | no | Order of this row within its parent, from zero. | — |
| `medication_detail_id` | `uuid` | no | Medication details | `/activities[at0001]/description[at0002]/items[at0143]` |

#### Unique

- `medication_order_id, position`
- `medication_order_id, medication_detail_id`

#### References

| Columns | Target | On delete |
|---|---|---|
| `medication_order_id` | [`medication_order`](/docs/tables/medication_order) | cascade |
| `medication_detail_id` | [`medication_detail`](/docs/tables/medication_detail) | no action |

#### Indexes

- `medication_order_medication_details_medication_detail_id_idx` on `medication_detail_id`

### `medication_order_administration_device`

Child table — one row per repetition, deleted with its parent.

| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `medication_order_id` | `uuid` → [`medication_order`](/docs/tables/medication_order) | no | — | — |
| `position` | `integer` | no | Order of this row within its parent, from zero. | — |
| `device_id` | `uuid` | no | Administration device | `/activities[at0001]/description[at0002]/items[at0095]` |

#### Unique

- `medication_order_id, position`
- `medication_order_id, device_id`

#### References

| Columns | Target | On delete |
|---|---|---|
| `medication_order_id` | [`medication_order`](/docs/tables/medication_order) | cascade |
| `device_id` | [`device`](/docs/tables/device) | no action |

#### Indexes

- `medication_order_administration_device_device_id_idx` on `device_id`

### `medication_order_structured_dose_and_timing_directions`

Child table — one row per repetition, deleted with its parent.

| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `medication_order_id` | `uuid` → [`medication_order`](/docs/tables/medication_order) | no | — | — |
| `position` | `integer` | no | Order of this row within its parent, from zero. | — |
| `therapeutic_direction_id` | `uuid` | no | Structured dose and timing directions | `/activities[at0001]/description[at0002]/items[at0177]` |

#### Unique

- `medication_order_id, position`
- `medication_order_id, therapeutic_direction_id`

#### References

| Columns | Target | On delete |
|---|---|---|
| `medication_order_id` | [`medication_order`](/docs/tables/medication_order) | cascade |
| `therapeutic_direction_id` | [`therapeutic_direction`](/docs/tables/therapeutic_direction) | no action |

#### Indexes

- `medication_order_structured_dose_and_timing_directions_t_81b978` on `therapeutic_direction_id`

### `medication_order_medication_safety_safety_override`

Child table — one row per repetition, deleted with its parent.

| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `medication_order_id` | `uuid` → [`medication_order`](/docs/tables/medication_order) | no | — | — |
| `position` | `integer` | no | Order of this row within its parent, from zero. | — |
| `overriden_safety_advice` | `text` | yes | Overriden safety advice | `/activities[at0001]/description[at0002]/items[at0062]/items[at0178]/items[at0171]` |
| `override_reason` | `text` | yes | Override reason | `/activities[at0001]/description[at0002]/items[at0062]/items[at0178]/items[at0162]` |

#### Unique

- `medication_order_id, position`

#### References

| Columns | Target | On delete |
|---|---|---|
| `medication_order_id` | [`medication_order`](/docs/tables/medication_order) | cascade |

### `medication_order_medication_safety_maximum_dose`

Child table — one row per repetition, deleted with its parent.

| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `medication_order_id` | `uuid` → [`medication_order`](/docs/tables/medication_order) | no | — | — |
| `position` | `integer` | no | Order of this row within its parent, from zero. | — |
| `maximum_amount_magnitude`<br />`maximum_amount_units` | quantity<br />`numeric`, `text` | yes | Maximum amount | `/activities[at0001]/description[at0002]/items[at0062]/items[at0051]/items[at0130]` |
| `allowed_period` | `interval` | yes | Allowed period | `/activities[at0001]/description[at0002]/items[at0062]/items[at0051]/items[at0053]` |

#### Constraints

```sql
check ((maximum_amount_magnitude is null and maximum_amount_units is null) or (maximum_amount_magnitude is not null and maximum_amount_units is not null))
```

#### Unique

- `medication_order_id, position`

#### References

| Columns | Target | On delete |
|---|---|---|
| `medication_order_id` | [`medication_order`](/docs/tables/medication_order) | cascade |

## Value sets

| Value set | Codes |
|---|---|
| `org.openehr::openEHR-EHR-INSTRUCTION.medication_order.v3/substitution_direction` | 2 |

