nutricion 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +12 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Guardfile +82 -0
- data/README.md +35 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/doc/Individuo.html +604 -0
- data/doc/Lista.html +852 -0
- data/doc/Node.html +409 -0
- data/doc/Nutricion.html +145 -0
- data/doc/Nutricional.html +1999 -0
- data/doc/Paciente.html +3151 -0
- data/doc/_index.html +156 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +496 -0
- data/doc/file.README.html +119 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +119 -0
- data/doc/js/app.js +292 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +675 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/nutricion/array.rb +48 -0
- data/lib/nutricion/dsl.rb +133 -0
- data/lib/nutricion/icc.rb +354 -0
- data/lib/nutricion/lista_code.rb +175 -0
- data/lib/nutricion/nutricion_code.rb +157 -0
- data/lib/nutricion/version.rb +4 -0
- data/lib/nutricion.rb +11 -0
- data/nutricion.gemspec +40 -0
- metadata +179 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>
|
|
7
|
+
Top Level Namespace
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.9.16
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
pathId = "";
|
|
19
|
+
relpath = '';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
|
24
|
+
|
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<div class="nav_wrap">
|
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
|
32
|
+
<div id="resizer"></div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div id="main" tabindex="-1">
|
|
36
|
+
<div id="header">
|
|
37
|
+
<div id="menu">
|
|
38
|
+
|
|
39
|
+
<a href="_index.html">Index</a> »
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<span class="title">Top Level Namespace</span>
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div id="search">
|
|
47
|
+
|
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
|
49
|
+
href="class_list.html">
|
|
50
|
+
|
|
51
|
+
<svg width="24" height="24">
|
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
|
55
|
+
</svg>
|
|
56
|
+
</a>
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
<div class="clear"></div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div id="content"><h1>Top Level Namespace
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<h2>Defined Under Namespace</h2>
|
|
82
|
+
<p class="children">
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Nutricion.html" title="Nutricion (module)">Nutricion</a></span>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Individuo.html" title="Individuo (class)">Individuo</a></span>, <span class='object_link'><a href="Lista.html" title="Lista (class)">Lista</a></span>, <span class='object_link'><a href="Node.html" title="Node (class)">Node</a></span>, <span class='object_link'><a href="Nutricional.html" title="Nutricional (class)">Nutricional</a></span>, <span class='object_link'><a href="Paciente.html" title="Paciente (class)">Paciente</a></span>
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
</p>
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<div id="footer">
|
|
105
|
+
Generated on Wed Dec 12 18:55:16 2018 by
|
|
106
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
107
|
+
0.9.16 (ruby-2.3.4).
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
</div>
|
|
111
|
+
</body>
|
|
112
|
+
</html>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
class Array
|
|
3
|
+
|
|
4
|
+
#Método para ordenar una Lista usando For.
|
|
5
|
+
def ordenacion_For ()
|
|
6
|
+
|
|
7
|
+
array_f = Array.new()
|
|
8
|
+
array_f = self
|
|
9
|
+
|
|
10
|
+
for i in 0..(array_f.length) do
|
|
11
|
+
for j in 0..(array_f.length-2) do
|
|
12
|
+
if(array_f[j] > array_f[j+1])
|
|
13
|
+
temporal = array_f[j]
|
|
14
|
+
array_f[j] = array_f[j+1]
|
|
15
|
+
array_f[j+1] = temporal
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
array_f
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
#Método para ordenar una Lista usando Each.
|
|
25
|
+
def ordenacion_Each()
|
|
26
|
+
|
|
27
|
+
array_f = Array.new()
|
|
28
|
+
array_f = self
|
|
29
|
+
|
|
30
|
+
indice = 0
|
|
31
|
+
array_f.each do |x|
|
|
32
|
+
array_f.each do |y|
|
|
33
|
+
if (indice < array_f.length-1)
|
|
34
|
+
if (array_f[indice] > array_f[indice+1])
|
|
35
|
+
temporal = array_f[indice]
|
|
36
|
+
array_f[indice] = array_f[indice+1]
|
|
37
|
+
array_f[indice+1] = temporal
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
indice = indice+1
|
|
41
|
+
end
|
|
42
|
+
indice = 0
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
array_f
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
class Dsl
|
|
2
|
+
|
|
3
|
+
attr_reader :ingesta, :desayunos, :almuerzos, :cenas
|
|
4
|
+
|
|
5
|
+
#@note La equivalencia de las diferentes palabras en gramos
|
|
6
|
+
@@equivalenciasGram = {"pieza"=>200, "taza"=>250, "cucharón"=>80, "rodaja"=>50, "vaso"=>200, "porción"=>100 }
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def initialize (dia, &bloque)
|
|
10
|
+
|
|
11
|
+
@desayunos = ["Desayuno"]
|
|
12
|
+
@almuerzos = ["Almuerzo"]
|
|
13
|
+
@cenas = ["Cena"]
|
|
14
|
+
|
|
15
|
+
@dia = dia
|
|
16
|
+
|
|
17
|
+
@v_energetico_total = 0.0
|
|
18
|
+
|
|
19
|
+
instance_eval(&bloque)
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def titulo(titu)
|
|
25
|
+
@titulo = titu
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def ingesta ( opciones = {} )
|
|
30
|
+
if (opciones[:min])
|
|
31
|
+
@min = opciones[:min]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
if ( opciones[:max] )
|
|
35
|
+
@max = opciones[:max]
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def cambiar_cantidad( porcion )
|
|
40
|
+
|
|
41
|
+
numero_array = porcion.split(" ")[0]
|
|
42
|
+
palabra_array = porcion.split(" ")[1]
|
|
43
|
+
|
|
44
|
+
gramos = numero_array.to_f * @@equivalenciasGram[palabra_array.chomp ' ']
|
|
45
|
+
|
|
46
|
+
gramos
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def desayuno( opciones={} )
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
if opciones[:gramos]
|
|
53
|
+
cant = opciones[:gramos]
|
|
54
|
+
elsif opciones[:porcion]
|
|
55
|
+
cant = cambiar_cantidad(opciones[:porcion])
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
@desayuno_class = Nutricional.new(opciones[:descripcion], opciones[:grasas].to_f, 0.0, 0.0, opciones[:carbohidratos].to_f, 0.0, 0.0, 0.0, opciones[:proteinas].to_f, 0.0, 0.0, opciones[:sal].to_f )
|
|
59
|
+
|
|
60
|
+
# @desayuno_class.suma_kcal * cant
|
|
61
|
+
@v_energetico_total += @desayuno_class.suma_kcal
|
|
62
|
+
@desayunos << @desayuno_class
|
|
63
|
+
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def almuerzo( opciones={} )
|
|
69
|
+
|
|
70
|
+
if opciones[:gramos]
|
|
71
|
+
cant = opciones[:gramos]
|
|
72
|
+
elsif opciones[:porcion]
|
|
73
|
+
cant = cambiar_cantidad(opciones[:porcion])
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
@almuerzo_class = Nutricional.new( opciones[:descripcion], opciones[:grasas].to_f, 0.0, 0.0, opciones[:carbohidratos].to_f , 0.0, 0.0, opciones[:fibra].to_f, opciones[:proteinas].to_f, 0.0, 0.0, opciones[:sal].to_f )
|
|
77
|
+
|
|
78
|
+
# @almuerzo_class.suma_kcal * cant
|
|
79
|
+
@v_energetico_total += @desayuno_class.suma_kcal
|
|
80
|
+
@almuerzos << @almuerzo_class
|
|
81
|
+
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def cena( opciones={} )
|
|
86
|
+
|
|
87
|
+
if opciones[:gramos]
|
|
88
|
+
cant = opciones[:gramos]
|
|
89
|
+
elsif opciones[:porcion]
|
|
90
|
+
cant = cambiar_cantidad(opciones[:porcion])
|
|
91
|
+
end
|
|
92
|
+
@cena_class = Nutricional.new( opciones[:descripcion], opciones[:grasas], 0, 0, opciones[:carbohidratos], 0, 0, 0, opciones[:proteinas], 0, 0, opciones[:sal] )
|
|
93
|
+
|
|
94
|
+
# @cena_class.suma_kcal * cant
|
|
95
|
+
@v_energetico_total += @desayuno_class.suma_kcal
|
|
96
|
+
@cenas << @cena_class
|
|
97
|
+
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def to_s
|
|
102
|
+
salida = @dia + "\t"
|
|
103
|
+
salida += "\nMenu " + @titulo
|
|
104
|
+
salida += "\n\n\t \tComposición nutricional: \n"
|
|
105
|
+
salida += "=============================================================================\n"
|
|
106
|
+
# salida += "\t \t \t grasas carbohidratos proteinas fibra sal \t valor energético\n"
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@desayunos.each_with_index do |desayuno, index|
|
|
110
|
+
salida += "#{desayuno.to_s}\n\n"
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
salida += "\n"
|
|
114
|
+
|
|
115
|
+
@almuerzos.each_with_index do |almuerzo, index|
|
|
116
|
+
salida += "#{almuerzo.to_s}\n\n"
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
salida += "\n"
|
|
121
|
+
|
|
122
|
+
@cenas.each_with_index do |cena, index|
|
|
123
|
+
salida += "#{cena.to_s}\n\n"
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
salida += "Valor energetico total = " + (@v_energetico_total).round(2).to_s
|
|
127
|
+
salida += "\n=============================================================================\n"
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
salida
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
end
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
#Clase Individuo (Individuo que tiene un nombre, edad y sexo)
|
|
2
|
+
class Individuo
|
|
3
|
+
|
|
4
|
+
# Se ha incluido el mixin Comparable.
|
|
5
|
+
include Comparable
|
|
6
|
+
|
|
7
|
+
#Getters
|
|
8
|
+
attr_reader :nombre, :edad, :sexo
|
|
9
|
+
|
|
10
|
+
#Inicializar los valores
|
|
11
|
+
def initialize(nombre, edad, sexo)
|
|
12
|
+
|
|
13
|
+
@nombre = nombre
|
|
14
|
+
@edad = edad
|
|
15
|
+
@sexo = sexo
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
#Metodo para que la clase sea Comparable
|
|
20
|
+
def <=>(other)
|
|
21
|
+
|
|
22
|
+
return nil unless other.instance_of?Individuo
|
|
23
|
+
@nombre <=> other.nombre
|
|
24
|
+
@edad <=> other.edad
|
|
25
|
+
@sexo <=> other.sexo
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
#Mostrar los resultados
|
|
30
|
+
def to_s()
|
|
31
|
+
"Sujeto: #{@nombre}. Edad: #{@edad}. Sexo: #{@sexo}. "
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
#Clase Paciente (Individuo que ademas tiene un peso, altura y medias de tricipital, bicipital, subescapular, suprailiaco, brazo, cintura y cadera)
|
|
40
|
+
class Paciente < Individuo
|
|
41
|
+
|
|
42
|
+
#Getters
|
|
43
|
+
attr_reader :peso, :altura, :imc, :oms, :descripcion, :grasa, :tricipital, :bicipital, :subescapular, :suprailiaco, :brazo, :cintura, :cadera, :rcc_total, :actividad, :peso_t_i, :gasto_energetico_basal, :gasto_energetico_total, :efecto_termogeno, :gasto_act
|
|
44
|
+
|
|
45
|
+
#Inicializar los valores
|
|
46
|
+
def initialize(nombre, peso, altura, edad, sexo, tricipital, bicipital, subescapular, suprailiaco, brazo, cintura, cadera, actividad)
|
|
47
|
+
|
|
48
|
+
super(nombre, edad, sexo)
|
|
49
|
+
|
|
50
|
+
@peso = peso
|
|
51
|
+
@altura = altura
|
|
52
|
+
@tricipital = tricipital
|
|
53
|
+
@bicipital = bicipital
|
|
54
|
+
@subescapular = subescapular
|
|
55
|
+
@suprailiaco = suprailiaco
|
|
56
|
+
@brazo = brazo
|
|
57
|
+
@cintura = cintura
|
|
58
|
+
@cadera = cadera
|
|
59
|
+
@actividad = actividad
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
calcular_imc(peso,altura)
|
|
63
|
+
clasificacion_imc(imc)
|
|
64
|
+
descripcion_popular(imc)
|
|
65
|
+
calculo_grasa(imc,edad,sexo)
|
|
66
|
+
calculo_pliegues_cutaneos(tricipital, bicipital, subescapular, suprailiaco)
|
|
67
|
+
calcular_circunferencias(brazo,cintura,cadera)
|
|
68
|
+
calcular_rcc(cintura, cadera, sexo)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
obtener_peso_ideal()
|
|
72
|
+
obtener_gasto_ener_basal_paciente()
|
|
73
|
+
obtener_efec_termogeno()
|
|
74
|
+
obtener_gasto_fisico()
|
|
75
|
+
obtener_gasto_total()
|
|
76
|
+
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
#Método para realizar el calculo del IMC (Índice de Masa Corporal)
|
|
81
|
+
def calcular_imc(peso, altura)
|
|
82
|
+
|
|
83
|
+
imc = peso / (altura * altura)
|
|
84
|
+
@imc = imc.round(2)
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
#Método para clasificar el individuo según el imc que obtengamos
|
|
90
|
+
def clasificacion_imc(imc)
|
|
91
|
+
|
|
92
|
+
case @imc
|
|
93
|
+
|
|
94
|
+
when 0 .. 18.49
|
|
95
|
+
@oms = ", se clasifica como Bajo peso"
|
|
96
|
+
|
|
97
|
+
when 18.5 .. 24.9
|
|
98
|
+
@oms = ", se clasifica como Adecuado"
|
|
99
|
+
|
|
100
|
+
when 25.0 .. 29.9
|
|
101
|
+
@oms = ", se clasifica como Sobrepeso"
|
|
102
|
+
|
|
103
|
+
when 30.0 .. 34.9
|
|
104
|
+
@oms = ", se clasifica como Obesidad grado 1"
|
|
105
|
+
|
|
106
|
+
when 35.0 .. 39.9
|
|
107
|
+
@oms = ", se clasifica como Obesidad grado 2"
|
|
108
|
+
|
|
109
|
+
else
|
|
110
|
+
@oms = ", se clasifica como Obesidad grado 3"
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
#Método para clasificar el individuo según el IMC que obtengamos
|
|
117
|
+
def descripcion_popular(imc)
|
|
118
|
+
|
|
119
|
+
case @imc
|
|
120
|
+
|
|
121
|
+
when (0 .. 18.49)
|
|
122
|
+
@descripcion = " y segun la descripcion popular se considera Delgado."
|
|
123
|
+
|
|
124
|
+
when (18.5 .. 24.9)
|
|
125
|
+
@descripcion = " y segun la descripcion popular se considera Aceptable."
|
|
126
|
+
|
|
127
|
+
when (25.0 .. 29.9)
|
|
128
|
+
@descripcion = " y segun la descripcion popular se considera Sobrepeso."
|
|
129
|
+
|
|
130
|
+
when (30.0 .. 34.9)
|
|
131
|
+
@descripcion = " y segun la descripcion popular se considera Obesidad."
|
|
132
|
+
|
|
133
|
+
when (35.0 .. 39.9)
|
|
134
|
+
@descripcion = " y segun la descripcion popular se considera Obesidad."
|
|
135
|
+
|
|
136
|
+
else
|
|
137
|
+
@descripcion = " y segun la descripcion popular se considera Obesidad."
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
#Método para calcular la cantidad de grasa
|
|
144
|
+
def calculo_grasa(imc, edad, sexo)
|
|
145
|
+
|
|
146
|
+
constante = 1.2
|
|
147
|
+
constante2 = 0.23
|
|
148
|
+
constante3 = 10.8
|
|
149
|
+
constante4 = 5.4
|
|
150
|
+
|
|
151
|
+
grasa = (constante*imc)+(constante2*edad)-(constante3*sexo)-constante4
|
|
152
|
+
@grasa = "\nEl porcentaje de grasa es: #{grasa.round(2)}"
|
|
153
|
+
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
#Método para calcular el conjunto de pliegues
|
|
158
|
+
def calculo_pliegues_cutaneos(tricipital, bicipital, subescapular, suprailiaco)
|
|
159
|
+
|
|
160
|
+
@tricipital = media_vector(tricipital)
|
|
161
|
+
|
|
162
|
+
@bicipital = media_vector(bicipital)
|
|
163
|
+
|
|
164
|
+
@subescapular = media_vector(subescapular)
|
|
165
|
+
|
|
166
|
+
@suprailiaco = media_vector(suprailiaco)
|
|
167
|
+
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
#Método para calcular las medias de los vectores
|
|
172
|
+
def media_vector(vector)
|
|
173
|
+
|
|
174
|
+
suma = 0
|
|
175
|
+
vector.each { |num| suma += num }
|
|
176
|
+
resultado = (suma/vector.length).round(2)
|
|
177
|
+
resultado
|
|
178
|
+
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
#Método para calcular las medias
|
|
182
|
+
def calcular_circunferencias(brazo, cintura, cadera)
|
|
183
|
+
|
|
184
|
+
@brazo = media_vector(brazo)
|
|
185
|
+
|
|
186
|
+
@cintura = media_vector(cintura)
|
|
187
|
+
|
|
188
|
+
@cadera = media_vector(cadera)
|
|
189
|
+
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
#Metodo para el calculo del imc
|
|
194
|
+
def calculo_imc(peso, talla)
|
|
195
|
+
|
|
196
|
+
imc = peso/(talla*talla)
|
|
197
|
+
@imc = imc.round(2)
|
|
198
|
+
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
#Método para calcular el RCC
|
|
203
|
+
def calcular_rcc(cintura,cadera,sexo)
|
|
204
|
+
|
|
205
|
+
@cintura = media_vector(cintura)
|
|
206
|
+
|
|
207
|
+
@cadera = media_vector(cadera)
|
|
208
|
+
|
|
209
|
+
rcc = (@cintura/@cadera).round(2)
|
|
210
|
+
|
|
211
|
+
@rcc = " \nRelación cintura/cadera: #{rcc}"
|
|
212
|
+
|
|
213
|
+
@rcc_total = rcc
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
#Caso de clasificacion de los hombre
|
|
217
|
+
if (sexo == 1)
|
|
218
|
+
|
|
219
|
+
case rcc
|
|
220
|
+
|
|
221
|
+
when (0 .. 0.82)
|
|
222
|
+
@descripcion_rcc = " parece que los datos obtenidos son demasiado bajos."
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
when (0.83 .. 0.88)
|
|
226
|
+
@descripcion_rcc = " y se considera Bajo."
|
|
227
|
+
|
|
228
|
+
when (0.89 .. 0.95)
|
|
229
|
+
@descripcion_rcc = " y se considera Moderado."
|
|
230
|
+
|
|
231
|
+
when (0.96 .. 1.01)
|
|
232
|
+
@descripcion_rcc = " y se considera Alto."
|
|
233
|
+
|
|
234
|
+
else
|
|
235
|
+
@descripcion_rcc = " y se considera Muy alto."
|
|
236
|
+
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
#Caso de clasificacion de las mujeres
|
|
245
|
+
if (sexo == 0)
|
|
246
|
+
|
|
247
|
+
case rcc
|
|
248
|
+
|
|
249
|
+
when 0 .. 0.71
|
|
250
|
+
@descripcion_rcc = " parece que los datos obtenidos son demasiado bajos."
|
|
251
|
+
|
|
252
|
+
when 0.72 .. 0.75
|
|
253
|
+
@descripcion_rcc = " y se considera Bajo."
|
|
254
|
+
|
|
255
|
+
when 0.76 .. 0.78
|
|
256
|
+
@descripcion_rcc = " y se considera Bajo-Moderado."
|
|
257
|
+
|
|
258
|
+
when 0.78 .. 0.82
|
|
259
|
+
@descripcionn_rcc = " y se considera Moderado."
|
|
260
|
+
|
|
261
|
+
else
|
|
262
|
+
@descripcion_rcc = " y se considera Alto."
|
|
263
|
+
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
#Método para que la clase sea Comparable
|
|
271
|
+
def <=>(other)
|
|
272
|
+
|
|
273
|
+
return nil unless other.instance_of?Paciente
|
|
274
|
+
# @peso <=> other.peso
|
|
275
|
+
# @altura <=> other.altura
|
|
276
|
+
# @tricipital <=> other.tricipital
|
|
277
|
+
# @bicipital <=> other.bicipital
|
|
278
|
+
# @subescapular <=> other.subescapular
|
|
279
|
+
# @suprailiaco <=> other.suprailiaco
|
|
280
|
+
# @brazo <=> other.brazo
|
|
281
|
+
# @cintura <=> other.cintura
|
|
282
|
+
# @cadera <=> other.cadera
|
|
283
|
+
|
|
284
|
+
@gasto_energetico_total <=> other.gasto_energetico_total
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
#Método para obtener el peso ideal que debería tener el paciente
|
|
289
|
+
def obtener_peso_ideal()
|
|
290
|
+
@peso_t_i = (@altura - 1.50) * 0.75 + 50
|
|
291
|
+
@peso_t_i
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
#Método para obtener el gasto de energía (Kcal) basal del paciente (energía que usa el cuerpo de forma natural, por estar vivo)
|
|
296
|
+
def obtener_gasto_ener_basal_paciente()
|
|
297
|
+
if (@sexo == 0)
|
|
298
|
+
@gasto_energetico_basal = (10.0*@peso) + (6.25 * @altura) - (5.0*@edad) - 161.0
|
|
299
|
+
else
|
|
300
|
+
@gasto_energetico_basal = (10.0*@peso) + (6.25 * @altura) - (5.0*@edad) + 5.0
|
|
301
|
+
end
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
#Método para obtener el cálculo del efecto termógeno (gasto energético que necesita el paciente para procesar los alimentos)
|
|
306
|
+
def obtener_efec_termogeno()
|
|
307
|
+
if (@sexo == 0)
|
|
308
|
+
@efecto_termogeno = @gasto_energetico_basal * 0.10
|
|
309
|
+
else
|
|
310
|
+
@efecto_termogeno = @gasto_energetico_basal * 0.10
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
#Método para obtener el cálculo del gasto que tiene la persona según la actividad física que realice
|
|
316
|
+
def obtener_gasto_fisico()
|
|
317
|
+
|
|
318
|
+
case @actividad
|
|
319
|
+
when "reposo"
|
|
320
|
+
@factor = 0.0
|
|
321
|
+
when "ligera"
|
|
322
|
+
@factor = 0.12
|
|
323
|
+
when "moderada"
|
|
324
|
+
@factor = 0.27
|
|
325
|
+
else
|
|
326
|
+
@factor = 0.54
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
@gasto_act = @gasto_energetico_basal * @factor
|
|
330
|
+
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
#Método para obtener el gasto total del individuo (basal + ejercicio + termógeno)
|
|
335
|
+
def obtener_gasto_total()
|
|
336
|
+
@gasto_energetico_total = @gasto_energetico_basal + @efecto_termogeno + @gasto_act
|
|
337
|
+
@gasto_energetico_total.round(2)
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
#Método para mostrar los resultados
|
|
342
|
+
def to_s()
|
|
343
|
+
|
|
344
|
+
@resumen = super
|
|
345
|
+
@resumen << "El IMC del individuo #{@nombre} es #{@imc}#{@oms}#{@descripcion}#{@grasa} " +
|
|
346
|
+
"\nPliegues cutáneos(mm) \nMedia tricipital: #{@tricipital} \nMedia bicipital: #{@bicipital} \nMedia subescapular: #{@subescapular} \nMedia suprailiaco: #{@suprailiaco} " +
|
|
347
|
+
"\nCircunferencias(mm): \nMedia cintura: #{@cintura} \nMedia cadera: #{@cadera} \nMedia brazo: #{@brazo}" +
|
|
348
|
+
"#{@rcc}#{@descripcion_rcc}"
|
|
349
|
+
|
|
350
|
+
@resumen
|
|
351
|
+
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
end
|