Created
March 26, 2020 13:48
-
-
Save iordic/409c174a7428e65d802c1302d70ed8e8 to your computer and use it in GitHub Desktop.
Aplicación para el cálculo del test de coronavirus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
font-family: sans-serif; | |
padding: 1em; | |
} | |
#result { | |
display: none; | |
padding: 5px; | |
font-weight: bold; | |
color: darkblue; | |
} | |
legend { | |
font-size: 1.5em; | |
text-decoration: underline overline; | |
} | |
form { | |
text-align: center; | |
} | |
form > input { | |
margin-top: 1em; | |
margin-bottom: 1em; | |
} | |
</style> | |
<script> | |
function getScore() { | |
var scores = { | |
'falta_aire':60, | |
'fiebre':15, | |
'tos':15, | |
'contacto_positivo':29, | |
'mucosidad':0, | |
'dolor_muscular':0, | |
'gastrointestinal':0, | |
'mas_20_dias':-15 | |
}; | |
var total = 0; | |
var radios; | |
// Recorremos cada punto y para cada punto todos sus radiobuttons | |
for (var i in scores) { | |
radios = document.getElementsByName(i); | |
for (var j = 0; j < radios.length; j++) { | |
if (radios[j].checked) { | |
total += scores[i] * radios[j].value; | |
//console.log(i + ": " + scores[i] * radios[j].value); | |
break; | |
} | |
} | |
} | |
var result_field = document.getElementById("result"); | |
result_field.style.display = "block"; | |
if (total >= 30) { | |
result_field.innerHTML = "Tus respuestas sugieren la posibilidad de tener sintomatología compatible con COVID-19"; // 'con-sintomas' | |
} else { | |
result_field.innerHTML = "Tus respuestas sugieren que no tienes síntomas o no son suficientes para determinar un contagio de COVID-19"; // 'sin-sintomas'; | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<form> | |
<legend>Test de autodiagnóstico</legend> | |
<br> | |
<label id="result">Null</label> | |
<br> | |
<br> | |
<label>¿Tienes sensación de falta de aire de inicio brusco (en ausencia de cualquier otra patología que justifique este síntoma)?</label> | |
<br> | |
<input type="radio" name="falta_aire" value="1"> | |
<label>Sí</label> | |
<input type="radio" name="falta_aire" value="0" checked> | |
<label>No</label> | |
<br> | |
<label>¿Tienes fiebre? (+37.7ºC)</label> | |
<br> | |
<input type="radio" name="fiebre" value="1"> | |
<label>Sí</label> | |
<input type="radio" name="fiebre" value="0" checked> | |
<label>No</label> | |
<br> | |
<label>¿Tienes tos seca y persistente?</label> | |
<br> | |
<input type="radio" name="tos" value="1"> | |
<label>Sí</label> | |
<input type="radio" name="tos" value="0" checked> | |
<label>No</label> | |
<br> | |
<label>¿Has tenido contacto estrecho con algún paciente positivo confirmado?</label> | |
<br> | |
<input type="radio" name="contacto_positivo" value="1"> | |
<label>Sí</label> | |
<input type="radio" name="contacto_positivo" value="0" checked> | |
<label>No</label> | |
<br> | |
<label>¿Tienes mucosidad en la nariz?</label> | |
<br> | |
<input type="radio" name="mucosidad" value="1"> | |
<label>Sí</label> | |
<input type="radio" name="mucosidad" value="0" checked> | |
<label>No</label> | |
<br> | |
<label>¿Tienes dolor muscular?</label> | |
<br> | |
<input type="radio" name="dolor_muscular" value="1"> | |
<label>Sí</label> | |
<input type="radio" name="dolor_muscular" value="0" checked> | |
<label>No</label> | |
<br> | |
<label>¿Tienes sintomatología gastrointestinal?</label> | |
<br> | |
<input type="radio" name="gastrointestinal" value="1"> | |
<label>Sí</label> | |
<input type="radio" name="gastrointestinal" value="0" checked> | |
<label>No</label> | |
<br> | |
<label>¿Llevas más de 20 días con estos síntomas?</label> | |
<br> | |
<input type="radio" name="mas_20_dias" value="1"> | |
<label>Sí</label> | |
<input type="radio" name="mas_20_dias" value="0" checked> | |
<label>No</label> | |
<br><br> | |
<input type="button" value="Obtener resultados" onclick="getScore()"> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment