Class: Renalware::Transplants::RecipientOperation

Inherits:
ApplicationRecord
  • Object
show all
Extended by:
Enumerize
Includes:
Document::Base, PatientScope
Defined in:
app/models/renalware/transplants/recipient_operation.rb

Instance Method Summary collapse

Instance Method Details

#cold_ischaemic_time_formattedObject



47
48
49
50
# File 'app/models/renalware/transplants/recipient_operation.rb', line 47

def cold_ischaemic_time_formatted
  # For presentation purposes
  Duration.new(self[:cold_ischaemic_time]).to_s
end

#cold_ischaemic_time_formatted=(value) ⇒ Object



52
53
54
# File 'app/models/renalware/transplants/recipient_operation.rb', line 52

def cold_ischaemic_time_formatted=(value)
  self.cold_ischaemic_time = Duration.from_string(value).seconds
end

#recipient_age_at_operationObject



65
66
67
68
69
70
71
# File 'app/models/renalware/transplants/recipient_operation.rb', line 65

def recipient_age_at_operation
  @recipient_age_at_operation ||=
    AutomaticAgeCalculator.new(
      Age.new,
      born_on: patient.born_on, age_on_date: performed_on
    ).compute
end

#theatre_case_start_timeObject



43
44
45
# File 'app/models/renalware/transplants/recipient_operation.rb', line 43

def theatre_case_start_time
  TimeOfDay.new(self[:theatre_case_start_time])
end

#warm_ischaemic_time_formattedObject



56
57
58
59
# File 'app/models/renalware/transplants/recipient_operation.rb', line 56

def warm_ischaemic_time_formatted
  # For presentation purposes
  Duration.new(self[:warm_ischaemic_time]).to_s
end

#warm_ischaemic_time_formatted=(value) ⇒ Object



61
62
63
# File 'app/models/renalware/transplants/recipient_operation.rb', line 61

def warm_ischaemic_time_formatted=(value)
  self.warm_ischaemic_time = Duration.from_string(value).seconds
end