Composite Quantity with Units (CQ) -- HL7v2 composite data type.
Used for quantities with associated units.
2 components:
- Quantity (NM)
- Units (CE) -- sub-components delimited by
&
Summary
Types
@type t() :: %HL7v2.Type.CQ{quantity: binary() | nil, units: HL7v2.Type.CE.t() | nil}
Functions
Encodes a CQ to a list of component strings.
Examples
iex> HL7v2.Type.CQ.encode(%HL7v2.Type.CQ{quantity: "10", units: %HL7v2.Type.CE{identifier: "mL"}})
["10", "mL"]
iex> HL7v2.Type.CQ.encode(%HL7v2.Type.CQ{quantity: "5"})
["5"]
iex> HL7v2.Type.CQ.encode(nil)
[]
Parses a CQ from a list of components.
Examples
iex> HL7v2.Type.CQ.parse(["10", "mL&milliliter&UCUM"])
%HL7v2.Type.CQ{quantity: "10", units: %HL7v2.Type.CE{identifier: "mL", text: "milliliter", name_of_coding_system: "UCUM"}}
iex> HL7v2.Type.CQ.parse(["5"])
%HL7v2.Type.CQ{quantity: "5"}
iex> HL7v2.Type.CQ.parse([])
%HL7v2.Type.CQ{}