Class: IHub::Models::Appointment

Inherits:
Base
  • Object
show all
Defined in:
lib/ihub/models/appointment.rb

Constant Summary collapse

CHECKED_IN =

Potential status_name’s

'CHECKED IN'
CHECKED_OUT =
'CHECKED OUT'
NO_ACTION =
'NO ACTION TAKEN'
NO_SHOW =
'NO-SHOW'
NO_SHOW_RE_BOOK =
'NO-SHOW & AUTO RE-BOOK'
INPATIENT =
'INPATIENT APPOINTMENT'
FUTURE =
'FUTURE'
NON_COUNT =
'NON-COUNT'
DELETED =
'DELETED'
ACTION_REQUIRED =
'ACTION REQUIRED'
CLINIC_CANCELLED =
'CANCELLED BY CLINIC'
PATIENT_CANCELLED =
'CANCELLED BY PATIENT'
CLINIC_CANCELLED_RE_BOOK =
'CANCELLED BY CLINIC & AUTO RE-BOOK'
PATIENT_CANCELLED_RE_BOOK =
'CANCELLED BY PATIENT & AUTO-REBOOK'
STATUS_NAMES =
[CHECKED_IN, CHECKED_OUT, NO_ACTION, NO_SHOW, NO_SHOW_RE_BOOK, INPATIENT,
FUTURE, NON_COUNT, DELETED, ACTION_REQUIRED, CLINIC_CANCELLED, PATIENT_CANCELLED,
CLINIC_CANCELLED_RE_BOOK, PATIENT_CANCELLED_RE_BOOK].freeze
COMPENSATION =

Potential type_name’s

'COMPENSATION & PENSION'
CLASS_II =
'CLASS II DENTAL'
ORGAN =
'ORGAN DONORS'
EMPLOYEE =
'EMPLOYEE'
PRIMA =
'PRIMA FACIA'
RESEARCH =
'RESEARCH'
COLLATERAL =
'COLLATERAL OF VET.'
SHARING =
'SHARING AGREEMENT'
REGULAR =
'REGULAR'
COMPUTER =
'COMPUTER GENERATED'
SERVICE =
'SERVICE CONNECTED'
TYPE_NAMES =
[COMPENSATION, CLASS_II, ORGAN, EMPLOYEE, PRIMA, RESEARCH, COLLATERAL,
SHARING, REGULAR, COMPUTER, SERVICE].freeze

Class Method Summary collapse

Class Method Details

.build(appointment) ⇒ IHub::Models:Appointment

Converts an appointment hash from iHub into an instance of the Appointment model class.

Important to note that iHub’s ‘date_time_date’ attribute is being remapped to start_time.

Parameters:

  • appointment (Hash)

    A hash of data for one appointment

Returns:

  • (IHub::Models:Appointment)

    An instance of this class



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/ihub/models/appointment.rb', line 70

def self.build(appointment)
  IHub::Models::Appointment.new(
    appointment_status_code: appointment['appointment_status_code'],
    appointment_status_name: appointment['appointment_status_name'],
    assigning_facility: appointment['assigning_facility'],
    clinic_code: appointment['clinic_code'],
    clinic_name: appointment['clinic_name'],
    facility_code: appointment['facility_code'],
    facility_name: appointment['facility_name'],
    local_id: appointment['local_id'],
    other_information: appointment['other_information'],
    start_time: appointment['date_time_date'],
    status_code: appointment['status_code'],
    status_name: appointment['status_name'],
    type_code: appointment['type_code'],
    type_name: appointment['type_name']
  )
end

.build_all(appointments) ⇒ Object



89
90
91
# File 'lib/ihub/models/appointment.rb', line 89

def self.build_all(appointments)
  appointments.map { |appointment| build(appointment) }
end