Class: Paciente

Inherits:
Individuo show all
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

Author:

  • Fernando González Petit

Since:

  • 0.1.0

Instance Attribute Summary collapse

Attributes inherited from Individuo

#age, #gen, #name, #surn

Instance Method Summary collapse

Constructor Details

#initialize(name, surn, gen, age, w, size, c_cint, c_cad) ⇒ Paciente

Inicializa atributos clase padre y propios de la clase Paciente

Since:

  • 0.1.0



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_cadObject (readonly)

Since:

  • 0.1.0



18
19
20
# File 'lib/prct08/paciente.rb', line 18

def c_cad
  @c_cad
end

#c_cintObject (readonly)

Since:

  • 0.1.0



18
19
20
# File 'lib/prct08/paciente.rb', line 18

def c_cint
  @c_cint
end

#sizeObject (readonly)

Since:

  • 0.1.0



18
19
20
# File 'lib/prct08/paciente.rb', line 18

def size
  @size
end

#wFloat (readonly)

Peso size [Float] Altura en metros c_cint [Float] Circunferencia de la cintura en cm c_cad [Float] Circunferencia de cadera en cm

Returns:

  • (Float)

    the current value of w

Since:

  • 0.1.0



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

Since:

  • 0.1.0



21
22
23
# File 'lib/prct08/paciente.rb', line 21

def <=>(anOther)
	imc <=> anOther.imc
end

#calorias_suficientes(f_act_f, calorias) ⇒ Object

Since:

  • 0.1.0



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_termObject

Gasto energético requerido para procesar los alimentos

Since:

  • 0.1.0



99
100
101
# File 'lib/prct08/paciente.rb', line 99

def efecto_term
	@ef_ter = (gasto_ene_basal * 0.10).truncate(2)
end

#fat_pObject

Cálculo del porcentaje de grasa

Since:

  • 0.1.0



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

Since:

  • 0.1.0



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_basalObject

Requerimiento energético de individuo en estado sedentario o de reposo

Since:

  • 0.1.0



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

Since:

  • 0.1.0



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

#imcObject

Cálculo del índice de masa corporal del individuo

Since:

  • 0.1.0



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

Since:

  • 0.1.0



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

Since:

  • 0.1.0



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

Since:

  • 0.1.0



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

Since:

  • 0.1.0



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

#rccObject

Cálculo del ratio cintura-cadera

Since:

  • 0.1.0



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_sString

Salida formateada, separada por comas, de los datos registrados para el paciente

Returns:

  • (String)

    Cadena con datos de paciente

Since:

  • 0.1.0



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