Sha256: f2e56ebc61ba1885d59ead21eaece2b5059f0e9e46202b70de0592026ef8d3a9

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

require 'ruby-hl7'

class HL7::Message::Segment::ZDRF < HL7::Message::Segment
  add_field :custom_field_1
  add_field :custom_field_2
  add_field :custom_field_3
  add_field :custom_field_4
  add_field :custom_field_5
  add_field :custom_field_6
  add_field :custom_field_7
  add_field :custom_field_8
  add_field :custom_field_9
  add_field :custom_field_10
  add_field :custom_field_11
  add_field :custom_field_12
  add_field :custom_field_13
  add_field :custom_field_14
  add_field :custom_field_15
  add_field :custom_field_16
  add_field :custom_field_17
  add_field :custom_field_18
  add_field :custom_field_19
  add_field :custom_field_20
  
  def to_hash
    return @hash if @hash
    
    hash = super.to_hash
    hash["id"] = hash["customField1"]
    hash["npi"] = find_value(hash["customField2"])
    hash["phone"] = find_value(hash["customField3"])
    hash["email"] = find_value(hash["customField4"])
    hash["fname"] = find_value(hash["customField5"])
    hash["lname"] = find_value(hash["customField6"])
    hash
  end
  
  def provider_hash(key,code)
    to_hash.merge({"providerType"=>code})
  end
  
  private
  
  def find_value(string="")
    string.split("^").last
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby-hl7-extensions-0.4.7 lib/segments/zdrf.rb
ruby-hl7-extensions-0.4.6 lib/segments/zdrf.rb
ruby-hl7-extensions-0.4.5 lib/segments/zdrf.rb
ruby-hl7-extensions-0.4.4 lib/segments/zdrf.rb
ruby-hl7-extensions-0.4.3 lib/segments/zdrf.rb