Sha256: 8f9cf62b224e3523097f506898ade53cdb12de27a13bc7bc309258735b49f3b9

Contents?: true

Size: 1.12 KB

Versions: 23

Compression:

Stored size: 1.12 KB

Contents

module Extensions
  module HL7
    module Segments
      module IN1

        def self.included base
          base.send :include, InstanceMethods
          base.extend ClassMethods
        end
        
        module InstanceMethods
          def insurance_co
            self.value_for_field("4")
          end
          
          def insurance_plan
            self.value_for_field("2.2")
          end
          
          def insured_name
            lname = self.value_for_field("16.1")
            fname = self.value_for_field("16.2")
            middle = self.value_for_field("16.3")
            if !lname.blank? and !fname.blank?
              "#{lname}, #{fname} #{middle}"
            elsif !lname.blank?
              lname
            end
          end
          
          def insured_address
            if self.value_for_field("19")
              address1, address2, city, state, zip = self.value_for_field("19").split(@item_delim) 
              "#{address1}#{address2.blank? ? "," : ", #{address2},"} #{city}, #{state}, #{zip}"
            else
              ""
            end
          end
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
ruby-hl7-extensions-0.4.8 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.4.7 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.4.6 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.4.5 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.4.4 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.4.3 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.4.2 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.4.1 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.4.0 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.3.6 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.3.4 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.3.3 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.3.2 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.3.1 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.2.2 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.2.1 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.2.0 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.1.9 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.1.8 lib/core_ext/segments/in1.rb
ruby-hl7-extensions-0.1.7 lib/core_ext/segments/in1.rb