Schedule a demo
Segment

Pharmacy/treatment order

Carries the prescriber's original pharmacy or treatment order as placed, including the requested drug or treatment code, requested give amount and units, dosage form, and provider instructions. It is sent by a CPOE or EHR system to the pharmacy system in OMP order messages and represents the order before the pharmacy encodes it. RXO may also carry non-medication treatment orders such as respiratory therapy.

34fields
0required
v2.9HL7 version
rxo.py
from zato.hl7v2 import RXO, CWE

rxo = RXO()
give_code = CWE(identifier='VIT01', text='Daily Vitamin D')
rxo.requested_give_code = give_code

Build RXO segments in Python

How to construct and work with real-world RXO segments.

1

Daily vitamin D softgels

Supplement code, amount, units, and dosage form for a wellness routine

from zato.hl7v2.v2_9 import RXO
from zato.hl7v2.v2_9 import CWE

rxo = RXO()
rxo.requested_give_code = CWE(
    identifier='VITD',
    text='Vitamin D3 1000 IU',
)
rxo.requested_give_amount_minimum = '1'
rxo.requested_give_units = CWE(identifier='IU', text='IU')
rxo.requested_dosage_form = CWE(
    identifier='CAP', text='Softgel')
2

Omega-3 with meal instructions

Repeatable instruction fields, substitution preference, and refill count

from zato.hl7v2.v2_9 import RXO
from zato.hl7v2.v2_9 import CWE

rxo = RXO()
rxo.requested_give_code = CWE(
    identifier='OM3', text='Omega-3 EPA-DHA')
rxo.requested_give_amount_minimum = '1'
rxo.requested_give_amount_maximum = '2'
rxo.requested_give_units = CWE(
    identifier='CAP', text='Capsule')
rxo.requested_dosage_form = CWE(
    identifier='SOFTG', text='Softgel')
rxo.providers_pharmacy_treatment_instructions = [
    CWE(identifier='MEAL', text='With lunch')]
rxo.providers_administration_instructions = [
    CWE(identifier='WATER', text='Take with water')]
rxo.allow_substitutions = 'N'
rxo.requested_dispense_code = CWE(
    identifier='BOT', text='Bottle')
rxo.requested_dispense_amount = '60'
rxo.requested_dispense_units = CWE(
    identifier='BOT', text='Bottle')
rxo.number_of_refills = '3'
3

Multivitamin with delivery context

Total daily dose, identifiers, dispensing pharmacy, and phone contact

from zato.hl7v2.v2_9 import RXO
from zato.hl7v2.v2_9 import (
    CQ, CWE, CNE, EI, PL, XAD, XCN, XTN,
)

rxo = RXO()
rxo.requested_give_code = CWE(
    identifier='MULTI', text='Daily Multivitamin')
rxo.requested_give_amount_minimum = '1'
rxo.requested_give_units = CWE(
    identifier='TAB', text='Tablet')
rxo.requested_dosage_form = CWE(
    identifier='TAB', text='Tablet')
rxo.number_of_refills = '2'
rxo.pharmacist_treatment_suppliers_verifier_id = XCN(
    person_identifier='1234567890',
    family_name='GREEN',
    given_name='SAM',
    suffix='MD'
)
rxo.needs_human_review = 'N'
rxo.requested_give_per_time_unit = 'QD'
rxo.requested_give_strength = '500'
rxo.requested_give_strength_units = CWE(
    identifier='MG', text='mg')
rxo.indication = [
    CWE(identifier='WELL', text='General wellness')]
rxo.requested_give_rate_amount = '1'
rxo.requested_give_rate_units = CWE(identifier='PERHOUR')
rxo.total_daily_dose = CQ(
    quantity='2',
    units=CWE(identifier='TAB'),
)
rxo.supplementary_code = [
    CWE(identifier='SUPP', text='Wellness plan')]
rxo.medication_instance_identifier = EI(
    entity_identifier='RXINST01',
    universal_id_type='WELL',
)
rxo.segment_instance_identifier = EI(
    entity_identifier='SEG01',
    universal_id_type='WELL',
)
rxo.mood_code = CNE(identifier='INT', text='Intent')
rxo.dispensing_pharmacy = CWE(
    identifier='PHARM',
    text='Green Valley Pharmacy',
)
rxo.dispensing_pharmacy_address = XAD(
    street_address='100 Wellness Way',
    city='Portland',
    state_or_province='OR',
    zip_or_postal_code='97201',
    country='USA',
)
rxo.deliver_to_patient_location = PL(
    point_of_care='HOME',
    room='101',
    bed='A',
)
rxo.deliver_to_address = XAD(
    street_address='200 Courier Rd',
    city='Portland',
    state_or_province='OR',
    zip_or_postal_code='97202',
    country='USA',
)
rxo.pharmacy_phone_number = XTN(
    telephone_number='5551002000',
    telecommunication_use_code='PRN',
    telecommunication_equipment_type='PH'
)

Learn by building

Step-by-step guides for working with HL7 v2 in Zato.

Frequently asked questions

RXO carries the requested product or treatment, amounts and units, dosage form, instructions for pharmacy and administration, substitution and dispensing preferences, refills, identifiers, and delivery details for nutrition and wellness-related orders. It works with ORC and often appears with RXE, RXR, RXD, or RXA in medication messaging.

Use CWE for field 1 and assign it to requested_give_code:

from zato.hl7v2.v2_9 import RXO, CWE

rxo = RXO()
rxo.requested_give_code = CWE(
    identifier='VIT01', text='Daily Vitamin D')

HL7 reserved positions 8 and 14 are withdrawn in many implementations; pipes still advance the field index, so interfaces may show empty components between active fields. Your integration guide should list which positions your trading partners populate.

Fields such as providers_pharmacy_treatment_instructions, providers_administration_instructions, indication, and supplementary_code may repeat in ER7 (separated by ~). In Python, assign a list of CWE instances.

from zato.hl7v2.v2_9 import RXO, CWE

rxo = RXO()
rxo.providers_administration_instructions = [
    CWE(identifier='MEAL', text='With breakfast'),
    CWE(identifier='HYDR', text='With water'),
]

Field 23 is a composite quantity with units. Use CQ with a numeric quantity and CWE units:

from zato.hl7v2.v2_9 import RXO, CQ, CWE

rxo = RXO()
rxo.total_daily_dose = CQ(
    quantity='2',
    units=CWE(identifier='TAB'))

Zato connects to any system that speaks HL7v2 over MLLP or FHIR over REST. This includes Epic, Cerner, Meditech, Allscripts, and other EHR platforms.

Yes, Zato has built-in MLLP support for sending and receiving HL7v2 messages. MLLP channels handle the framing protocol automatically.

Zato supports HL7 v2.9, which is backward compatible with earlier versions including v2.3, v2.5, and v2.7. Standard segments and datatypes are available as typed Python classes.

Yes. Zato handles both HL7v2 and FHIR natively, so you can parse v2 messages and build FHIR resources with IG-specific extensions in the same service. Typed Python classes are available for both protocols, including extensions from US Core, UK Core, Da Vinci, and other Implementation Guides.

RXO field reference

Complete list of fields in the RXO segment, HL7 v2.9.

#Python nameDatatypeUsageRepeatableTable
1requested_give_codeCWEOptionalNoHL70747
2requested_give_amount_minimumNMOptionalNo-
3requested_give_amount_maximumNMOptionalNo-
4requested_give_unitsCWEOptionalNoHL70748
5requested_dosage_formCWEOptionalNoHL70750
6providers_pharmacy_treatment_instructionsCWEOptionalYesHL70751
7providers_administration_instructionsCWEOptionalYesHL70718
9allow_substitutionsIDOptionalNoHL70161
10requested_dispense_codeCWEOptionalNoHL70753
11requested_dispense_amountNMOptionalNo-
12requested_dispense_unitsCWEOptionalNoHL70754
13number_of_refillsNMOptionalNo-
15pharmacist_treatment_suppliers_verifier_idXCNOptionalYes-
16needs_human_reviewIDOptionalNoHL70136
17requested_give_per_time_unitSTOptionalNo-
18requested_give_strengthNMOptionalNo-
19requested_give_strength_unitsCWEOptionalNoHL70756
20indicationCWEOptionalYesHL70694
21requested_give_rate_amountSTOptionalNo-
22requested_give_rate_unitsCWEOptionalNoHL70760
23total_daily_doseCQOptionalNo-
24supplementary_codeCWEOptionalYesHL70700
25requested_drug_strength_volumeNMOptionalNo-
26requested_drug_strength_volume_unitsCWEOptionalNoHL70764
27pharmacy_order_typeIDOptionalNoHL70480
28dispensing_intervalNMOptionalNo-
29medication_instance_identifierEIOptionalNo-
30segment_instance_identifierEIOptionalNo-
31mood_codeCNEOptionalNoHL70725
32dispensing_pharmacyCWEOptionalNoHL70733
33dispensing_pharmacy_addressXADOptionalNo-
34deliver_to_patient_locationPLOptionalNo-
35deliver_to_addressXADOptionalNo-
36pharmacy_phone_numberXTNOptionalYes-

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python