Class: Record

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document
Defined in:
lib/health-data-standards/models/record.rb

Constant Summary collapse

Sections =
[:allergies, :care_goals, :conditions, :encounters, :immunizations, :medical_equipment,
:medications, :procedures, :results, :social_history, :vital_signs, :support, :advance_directives,
:insurance_providers, :functional_statuses]

Instance Method Summary collapse

Instance Method Details

#entries_for_oid(oid) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/health-data-standards/models/record.rb', line 56

def entries_for_oid(oid)
  matching_entries_by_section = Sections.map do |section|
    section_entries = self.send(section)
    if section_entries.present?
      section_entries.find_all { |entry| entry.oid == oid }
    else
      []
    end
  end
  matching_entries_by_section.flatten
end

#over_18?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/health-data-standards/models/record.rb', line 52

def over_18?
  Time.at(birthdate) < Time.now.years_ago(18)
end

#providersObject



48
49
50
# File 'lib/health-data-standards/models/record.rb', line 48

def providers
  provider_performances.map {|pp| pp.provider }
end