class Trizetto::Api::Eligibility::WebService::Patient

A Patient is either a Subscriber or Depedent. This is the common attributes between the two

Constants

KEY_CLEANUP

Attributes

benefits[RW]

The benefits this patient has.

name[RW]
traces[RW]

The traces, by source (uppercased), in the response

Example

patient.traces  # => {"99TRIZETTO" => "812341292"}

Example

patient.trace_number("99TRIZETTO")  # => "812341292"
patient.trace_number("99Trizeeto")  # => "812341292"

Public Class Methods

new(raw_hash = {}) click to toggle source
# File lib/trizetto/api/eligibility/web_service/patient.rb, line 33
def initialize(raw_hash = {})
  trace_ids, trace_numbers = Array(raw_hash.delete(:trace_id)), Array(raw_hash.delete(:trace_number))

  super(raw_hash)

  self.name = PatientName.new(raw_hash[:patientname]) if raw_hash.has_key?(:patientname)

  benefits_xml = raw_hash[:benefit] || []
  benefits_xml = [benefits_xml] if benefits_xml.is_a?(Hash)

  self.benefits = benefits_xml.map do |benefit_xml|
    Benefit.new(benefit_xml)
  end

  self.traces = {}
  if trace_ids.length == trace_numbers.length
    trace_ids.each.with_index do |id, index|
      traces[id.upcase] = trace_numbers[index]
    end
  end

  if self.subscriberaddinfo.is_a?(Hash)
    self.subscriberaddinfo = [self.subscriberaddinfo]
  end

  self.additional_info = self.subscriberaddinfo&.map do |additional_info_hash|
    AdditionalInfo.new(additional_info_hash)
  end || []
end

Public Instance Methods

group_number() click to toggle source

Looks in the additional info returned with the patient for a group number

The group number is the additinal infomation node with a id of 6P or Group Number.

@see www.eedi.net/4010/278004010X094A1%5C29_278004010X094A1.htm

@return [String]

# File lib/trizetto/api/eligibility/web_service/patient.rb, line 71
def group_number
  # it seems 6P is group number
  self.additional_info.detect do |additional_info|
    ["6P", "Group Number"].include?(additional_info.id)
  end&.group_policy_number
end
plan_number() click to toggle source

Looks in the additional info returned with the patient for a group number @return [String]

# File lib/trizetto/api/eligibility/web_service/patient.rb, line 80
def plan_number
  self.additional_info.detect do |additional_info|
    additional_info.id == "Plan Number"
  end&.group_policy_number
end
trace_number(trace_id="99Trizetto") click to toggle source

Looks for a trace number by trace_id (who added the trace).

@return [String]

# File lib/trizetto/api/eligibility/web_service/patient.rb, line 89
def trace_number(trace_id="99Trizetto")
  self.traces[trace_id&.upcase]
end