Sha256: 2cf7918e5f37fe0c3d136aef5d39b603243c5996bea32fc7c0531d3c3099a10e

Contents?: true

Size: 1.51 KB

Versions: 12

Compression:

Stored size: 1.51 KB

Contents

require 'ruby-hl7'
class HL7::Message::Segment::ROL < HL7::Message::Segment
  weight 4
  add_field :role_instance_id
  add_field :action_code
  add_field :role
  add_field :role_person
  add_field :role_begin_date do |value|
    convert_to_ts(value)
  end
  add_field :role_end_date do |value|
    convert_to_ts(value)
  end
  add_field :role_duration
  add_field :role_action_reason
  add_field :provider_type
  add_field :organization_unit_type
  add_field :provider_info
  add_field :phone
  
  def to_hash
    return @hash if @hash
    @hash = super.to_hash
    @hash
  end
  
  def person_hash
    person = self.role_person.split(self.item_delim) rescue Array.new(20) {|i|""}
    
    {"id" => person[0],
     "lastName" => person[1],
     "firstName" => person[2],
     "middleInitOrName" => person[3],
     "suffix" => person[4],
     "prefix" => person[5],
     "degree" => person[6],
     "sourceTable" => person[7],
     "assigningAuthority" => person[8],
     "nameTypeCode" => person[9],
     "identifierCheckDigit" => person[10],
     "codeIdCheck" => person[11],
     "identifierTypeCode" => person[12],
     "assigningFacility" => person[13],
     "providerType" => self.role}
  end
  
end

module Extensions
  module HL7
    module Segments
      module ROL
        
        def self.included base
          base.send :include, InstanceMethods
          base.extend ClassMethods
        end
        
        module InstanceMethods
        end
        
        module ClassMethods
        end
        
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ruby-hl7-extensions-0.1.4 lib/core_ext/segments/rol.rb
ruby-hl7-extensions-0.1.3 lib/core_ext/segments/rol.rb
ruby-hl7-extensions-0.1.2 lib/core_ext/segments/rol.rb
ruby-hl7-extensions-0.1.1 lib/core_ext/segments/rol.rb
ruby-hl7-extensions-0.1.0 lib/core_ext/segments/rol.rb
ruby-hl7-extensions-0.0.84 lib/core_ext/segments/rol.rb
ruby-hl7-extensions-0.0.83 lib/core_ext/segments/rol.rb
ruby-hl7-extensions-0.0.82 lib/core_ext/segments/rol.rb
ruby-hl7-extensions-0.0.81 lib/core_ext/segments/rol.rb
ruby-hl7-extensions-0.0.80 lib/core_ext/segments/rol.rb
ruby-hl7-extensions-0.0.79 lib/core_ext/segments/rol.rb
ruby-hl7-extensions-0.0.78 lib/core_ext/segments/rol.rb