Class: Renalware::Patients::PrimaryCarePhysician

Inherits:
ApplicationRecord
  • Object
show all
Includes:
ActiveModel::Validations, Renalware::Personable
Defined in:
app/models/renalware/patients/primary_care_physician.rb

Overview

Represents a Primary Care Physician (PCP). The PCP could either be:

  • a UK-based General Practitioner (GP)

  • a foreign PCP or other referring physician

Defined Under Namespace

Classes: PrimaryCarePhysicianAddressAccessError

Instance Method Summary collapse

Instance Method Details

#current_addressObject



60
61
62
63
64
65
66
67
# File 'app/models/renalware/patients/primary_care_physician.rb', line 60

def current_address
  raise PrimaryCarePhysicianAddressAccessError,
        "primary_care_physician#current_address should not be called: "\
        "we always use the patient.practice.address when contacting the GP. "\
        "In a sense the practice is more important that the GP, as the GP may have "\
        "moved on"
  # address || practice_address
end

#full_nameObject



29
30
31
# File 'app/models/renalware/patients/primary_care_physician.rb', line 29

def full_name
  :name
end

#given_nameObject



33
34
35
# File 'app/models/renalware/patients/primary_care_physician.rb', line 33

def given_name
  ""
end

#practice_addressObject



69
70
71
72
73
# File 'app/models/renalware/patients/primary_care_physician.rb', line 69

def practice_address
  address = practices.first.try(:address)
  address.name = "#{title} #{name}".strip if address.present?
  address
end

#salutationObject



51
52
53
54
55
56
57
# File 'app/models/renalware/patients/primary_care_physician.rb', line 51

def salutation
  [
    Renalware.config.salutation_prefix,
    title,
    name
  ].compact.join(" ")
end

#skip_given_name_validation?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/renalware/patients/primary_care_physician.rb', line 41

def skip_given_name_validation?
  true
end

#titleObject



47
48
49
# File 'app/models/renalware/patients/primary_care_physician.rb', line 47

def title
  "Dr"
end

#to_sObject



37
38
39
# File 'app/models/renalware/patients/primary_care_physician.rb', line 37

def to_s
  [title, name].compact.join(" ")
end