Class: Paciente
- Includes:
- Comparable
- Defined in:
- lib/prct08/paciente.rb
Overview
Clase Paciente, hereda características de Individuo para proveer datos médicos adicionales y facilitar la evaluación de la salud del mismo.
Contiene utilidades del módulo Comparable
Instance Attribute Summary collapse
- #c_cad ⇒ Object readonly
- #c_cint ⇒ Object readonly
- #size ⇒ Object readonly
-
#w ⇒ Float
readonly
Peso size [Float] Altura en metros c_cint [Float] Circunferencia de la cintura en cm c_cad [Float] Circunferencia de cadera en cm.
Attributes inherited from Individuo
Instance Method Summary collapse
-
#<=>(anOther) ⇒ Object
Definición del método abstracto en Comparable.
- #calorias_suficientes(f_act_f, calorias) ⇒ Object
-
#efecto_term ⇒ Object
Gasto energético requerido para procesar los alimentos.
-
#fat_p ⇒ Object
Cálculo del porcentaje de grasa.
-
#gasto_act_fis(f_act_f) ⇒ Object
A partir del factor de actividad física.
-
#gasto_ene_basal ⇒ Object
Requerimiento energético de individuo en estado sedentario o de reposo.
-
#gasto_ene_total(f_act_f) ⇒ Object
A partir de los valores en gasto energético basal, efecto termógeno y gasto actividad física.
-
#imc ⇒ Object
Cálculo del índice de masa corporal del individuo.
-
#initialize(name, surn, gen, age, w, size, c_cint, c_cad) ⇒ Paciente
constructor
Inicializa atributos clase padre y propios de la clase Paciente.
-
#pl_bicip(x, y, z) ⇒ Object
Media entre mediciones de los pliegues bicipitales.
-
#pl_subesc(x, y, z) ⇒ Object
Media entre mediciones de los pliegues subescapulares.
-
#pl_supral(x, y, z) ⇒ Object
Media entre mediciones de los pliegues supralumbares.
-
#pl_tricip(x, y, z) ⇒ Object
Media entre mediciones de los pliegues tricipitales.
-
#rcc ⇒ Object
Cálculo del ratio cintura-cadera.
-
#to_s ⇒ String
Salida formateada, separada por comas, de los datos registrados para el paciente.
Constructor Details
#initialize(name, surn, gen, age, w, size, c_cint, c_cad) ⇒ Paciente
Inicializa atributos clase padre y propios de la clase Paciente
26 27 28 29 |
# File 'lib/prct08/paciente.rb', line 26 def initialize(name, surn, gen, age, w, size, c_cint, c_cad) super(name,surn,gen,age) @w, @size, @c_cint, @c_cad = w, size, c_cint, c_cad end |
Instance Attribute Details
#c_cad ⇒ Object (readonly)
18 19 20 |
# File 'lib/prct08/paciente.rb', line 18 def c_cad @c_cad end |
#c_cint ⇒ Object (readonly)
18 19 20 |
# File 'lib/prct08/paciente.rb', line 18 def c_cint @c_cint end |
#size ⇒ Object (readonly)
18 19 20 |
# File 'lib/prct08/paciente.rb', line 18 def size @size end |
#w ⇒ Float (readonly)
Peso size [Float] Altura en metros c_cint [Float] Circunferencia de la cintura en cm c_cad [Float] Circunferencia de cadera en cm
14 15 16 |
# File 'lib/prct08/paciente.rb', line 14 def w @w end |
Instance Method Details
#<=>(anOther) ⇒ Object
Definición del método abstracto en Comparable
21 22 23 |
# File 'lib/prct08/paciente.rb', line 21 def <=>(anOther) imc <=> anOther.imc end |
#calorias_suficientes(f_act_f, calorias) ⇒ Object
114 115 116 117 118 119 120 121 122 |
# File 'lib/prct08/paciente.rb', line 114 def calorias_suficientes(f_act_f, calorias) porc_l = gasto_ene_total(f_act_f) - (gasto_ene_total(f_act_f) * 0.10) porc_u = gasto_ene_total(f_act_f) + (gasto_ene_total(f_act_f) * 0.10) if(calorias.between?(porc_l, porc_u)) return true else return false end end |
#efecto_term ⇒ Object
Gasto energético requerido para procesar los alimentos
99 100 101 |
# File 'lib/prct08/paciente.rb', line 99 def efecto_term @ef_ter = (gasto_ene_basal * 0.10).truncate(2) end |
#fat_p ⇒ Object
Cálculo del porcentaje de grasa
47 48 49 50 |
# File 'lib/prct08/paciente.rb', line 47 def fat_p @fatp = 1.2*imc + 0.23*age - 10.8*gen - 5.4 @fatp.truncate(2).to_f end |
#gasto_act_fis(f_act_f) ⇒ Object
A partir del factor de actividad física
104 105 106 |
# File 'lib/prct08/paciente.rb', line 104 def gasto_act_fis(f_act_f) @g_act_f = (gasto_ene_basal * f_act_f).truncate(2) end |
#gasto_ene_basal ⇒ Object
Requerimiento energético de individuo en estado sedentario o de reposo
89 90 91 92 93 94 95 96 |
# File 'lib/prct08/paciente.rb', line 89 def gasto_ene_basal if(@gen == 0) @g_ene_b = (10 * @w) + (6.25 * @size) - (5 * @age) - 161 else @g_ene_b = (10 * @w) + (6.25 * @size) - (5 * @age) - 5 end @g_ene_b.truncate(2) end |
#gasto_ene_total(f_act_f) ⇒ Object
A partir de los valores en gasto energético basal, efecto termógeno y gasto actividad física
110 111 112 |
# File 'lib/prct08/paciente.rb', line 110 def gasto_ene_total(f_act_f) (gasto_ene_basal + efecto_term + gasto_act_fis(f_act_f)).round(2) end |
#imc ⇒ Object
Cálculo del índice de masa corporal del individuo
40 41 42 43 44 |
# File 'lib/prct08/paciente.rb', line 40 def imc size2 = @size*@size @imc = @w/size2 @imc.truncate(2).to_f end |
#pl_bicip(x, y, z) ⇒ Object
Media entre mediciones de los pliegues bicipitales
67 68 69 70 71 |
# File 'lib/prct08/paciente.rb', line 67 def pl_bicip(x, y, z) @pl_bic = x + y + z @pl_bic /= 3 @pl_bic.truncate(2) end |
#pl_subesc(x, y, z) ⇒ Object
Media entre mediciones de los pliegues subescapulares
74 75 76 77 78 79 |
# File 'lib/prct08/paciente.rb', line 74 def pl_subesc(x, y, z) @pl_sub = x + y + z @pl_sub /= 3 @pl_sub.truncate(2) end |
#pl_supral(x, y, z) ⇒ Object
Media entre mediciones de los pliegues supralumbares
82 83 84 85 86 |
# File 'lib/prct08/paciente.rb', line 82 def pl_supral(x, y, z) @pl_sup = x + y + z @pl_sup /= 3 @pl_sup.truncate(2) end |
#pl_tricip(x, y, z) ⇒ Object
Media entre mediciones de los pliegues tricipitales
59 60 61 62 63 |
# File 'lib/prct08/paciente.rb', line 59 def pl_tricip(x, y, z) @pl_tr = x + y + z @pl_tr /= 3 @pl_tr.truncate(2) end |
#rcc ⇒ Object
Cálculo del ratio cintura-cadera
53 54 55 56 |
# File 'lib/prct08/paciente.rb', line 53 def rcc @rcc = @c_cint.to_f / @c_cad.to_f @rcc.truncate(2) end |
#to_s ⇒ String
Salida formateada, separada por comas, de los datos registrados para el paciente
34 35 36 37 |
# File 'lib/prct08/paciente.rb', line 34 def to_s a = super.to_s return a + "(#{@w},#{@size},#{@c_cint},#{@c_cad})" end |