class Redox::Models::Transaction

Public Instance Methods

add_medication(ndc_code: nil, quantity: nil, magnitude: nil, unit: nil, description: nil) click to toggle source
# File lib/redox/models/transaction.rb, line 32
def add_medication(ndc_code: nil, quantity: nil, magnitude: nil, unit: nil, description: nil)
  self[:NDC] = { Code: ndc_code, Description: description }
  self[:Extensions] = {
    'ndc-quantity' => {
      integer: quantity&.to_s
    },
    'ndc-units-measure' => {
      coding: {
        code: magnitude&.to_s,
        display: unit
      }
    }
  }
  self
end
add_ordering_provider(**kwargs) click to toggle source
# File lib/redox/models/transaction.rb, line 48
def add_ordering_provider(**kwargs)
  self[:OrderingProviders] ||= []
  self[:OrderingProviders] << OrderingProvider.new(kwargs)
  self
end
add_performer(**kwargs) click to toggle source
# File lib/redox/models/transaction.rb, line 54
def add_performer(**kwargs)
  self[:Performers] ||= []
  self[:Performers] << OrderingProvider.new(kwargs)
  self
end
as_json(args) click to toggle source
# File lib/redox/models/transaction.rb, line 70
def as_json(args)
  self.to_h
end
to_h() click to toggle source
Calls superclass method
# File lib/redox/models/transaction.rb, line 60
def to_h
  result = super.to_h

  %w[EndDateTime DateTimeOfService].each do |k|
    result[k] = Redox::Models.format_datetime(result[k])
  end

  result
end