Composite Price (CP) -- HL7v2 composite data type.
Used for price information with optional range and type qualifiers.
6 components:
- Price (MO) -- sub-components delimited by
&(quantity & denomination) - Price Type (ID) -- Table 0205
- From Value (NM)
- To Value (NM)
- Range Units (CE) -- sub-components delimited by
& - Range Type (ID) -- Table 0298
Summary
Types
@type t() :: %HL7v2.Type.CP{ from_value: binary() | nil, price: HL7v2.Type.MO.t() | nil, price_type: binary() | nil, range_type: binary() | nil, range_units: HL7v2.Type.CE.t() | nil, to_value: binary() | nil }
Functions
Encodes a CP to a list of component strings.
Examples
iex> HL7v2.Type.CP.encode(%HL7v2.Type.CP{price: %HL7v2.Type.MO{quantity: "100.00", denomination: "USD"}, price_type: "UP"})
["100.00&USD", "UP"]
iex> HL7v2.Type.CP.encode(%HL7v2.Type.CP{price: %HL7v2.Type.MO{quantity: "50"}})
["50"]
iex> HL7v2.Type.CP.encode(nil)
[]
Parses a CP from a list of components.
Examples
iex> HL7v2.Type.CP.parse(["100.00&USD", "UP"])
%HL7v2.Type.CP{price: %HL7v2.Type.MO{quantity: "100.00", denomination: "USD"}, price_type: "UP"}
iex> HL7v2.Type.CP.parse(["50"])
%HL7v2.Type.CP{price: %HL7v2.Type.MO{quantity: "50"}}
iex> HL7v2.Type.CP.parse([])
%HL7v2.Type.CP{}