Files
streamline-emr/docker/_streamline-src/public/js/observations/6_12_years.js
T

268 lines
7.2 KiB
JavaScript
Executable File

// (the beginning number in the identifier is the corresponding id in the triage_observations table)
// Validating the temperature values
$('#temperature').change(function () {
let tempValue = $('#temperature').val();
if (between(tempValue, 36.5, 37.4)) {
$('#temperatureKews').css({
"color": "green",
"font-size": "bold"
}).text('0');
} else if (between(tempValue, 35, 36.4) || between(tempValue, 37.5, 38.9)) {
$('#temperatureKews').css({
'color': 'red'
}).text('1');
} else if (between(tempValue, 39, 100)) {
$('#temperatureKews').css({
'color': 'red'
}).text('2');
} else if (between(tempValue, 0, 35)) {
$('#temperatureKews').css({
'color': 'red'
}).text('3');
} else {
$('#temperatureKews').text('Not in range');
}
});
// Validating the pulse value
$('#pulse').change(function () {
let pulseValue = $('#pulse').val();
if (between(pulseValue, 76, 100)) {
$('#pulseKews').css({
"color": "green",
"font-weight": "thick"
}).text('0');
} else if (between(pulseValue, 66, 75) || between(pulseValue, 101, 120)) {
$('#pulseKews').css({
"color": "red",
"font-size": "thick"
}).text('1');
} else if (between(pulseValue, 56, 65) || between(pulseValue, 121, 140)) {
$('#pulseKews').css({
"color": "red",
"font-size": "thick"
}).text('2');
} else if (between(pulseValue, 0, 55) || between(pulseValue, 141, 500)) {
$('#pulseKews').css({
"color": "red",
"font-size": "thick"
}).text('3');
} else {
$('#pulseKews').css({
"color": "red",
"font-size": "thick"
}).text('Not in Range');
}
});
// Validating the respirations
$('#respirations').change(function () {
let respValue = $('#respirations').val();
if (between(respValue, 18, 30)) {
$('#respirationsKews').css({
"color": "green"
}).text("0");
} else if (between(respValue, 14, 17) || between(respValue, 31, 40)) {
$('#respirationsKews').css({
"color": "red"
}).text("1");
} else if (between(respValue, 10, 13) || between(respValue, 41, 50)) {
$('#respirationsKews').css({
"color": "red"
}).text("2");
} else if (between(respValue, 0, 10) || between(respValue, 51, 500)) {
$('#respirationsKews').css({
"color": "red"
}).text("3");
} else {
$('#respirationsKews').css({
"color": "red"
}).text("Not in range");
}
});
// Validating repspiratory distress
$('#respiratory_distress').change(function () {
let disValue = $('#respiratory_distress').val();
if (disValue === 'None') {
$('#respiratory_distressKews').css({
"color": "green"
}).text('0');
} else if (disValue === 'Mild') {
$('#respiratory_distressKews').css({
"color": "red"
}).text('1');
} else if (disValue === 'Severe') {
$('#respiratory_distressKews').css({
"color": "red"
}).text('2');
} else {
$('#respiratory_distressKews').text('');
}
});
// Validating the concious level
$('#conscious_level').change(function () {
let conValue = $('#conscious_levelValue').val();
if (conValue === "alert") {
$('#conscious_levelKews').css({
"color": "green"
}).text('0');
} else if (conValue === "responds to voice/irritable") {
$('#conscious_levelKews').css({
"color": "red",
"font-color": "red"
}).text('1');
} else if (conValue === "responds to pain") {
$('#conscious_levelKews').css({
"color": "red",
"font-color": "red"
}).text('2');
} else if (conValue === "unresponsive") {
$('#conscious_levelKews').css({
"color": "red"
}).text('3');
} else {
$('#conscious_levelKews').text('');
}
});
// Validating Feeding
$('#feeding').change(function () {
let feedValue = $('#feeding').val();
if (feedValue === "Normal") {
$('#feedingKews').css({
"color": "green"
}).text('0');
} else if (feedValue === "Drinks poorly") {
$('#feedingKews').css({
"color": "red"
}).text('1');
} else if (feedValue === "Unable to drink") {
$('#feedingKews').css({
"color": "red"
}).text('2');
} else {
$('#feedingKews').text('');
}
});
// Validating Vomiting/Puking
$('#vomiting').change(function () {
let vomValue = $('#vomiting').val();
if (vomValue === "none") {
$('#vomitingKews').css({
"color": "green"
}).text('0');
} else if (vomValue === "occasional") {
$('#vomitingKews').css({
"color": "red"
}).text('1');
} else if (vomValue === "vomits everything") {
$('#vomitingKews').css({
"color": "red"
}).text('2');
} else {
$('#vomitingKews').text('');
}
});
// Validating convulsions
$('#convulsions').change(function () {
let convValue = $('#convulsions').val();
if (convValue === "None") {
$('#convulsionsKews').css({
"color": "green"
}).text('0');
} else if (convValue === "Occasional Reported") {
$('#convulsionsKews').css({
"color": "red"
}).text('1');
} else if (convValue === "Frequent Reported") {
$('#convulsionsKews').css({
"color": "red"
}).text('2');
} else if (convValue === "Convulsing") {
$('#convulsionsKews').css({
"color": "red"
}).text('3');
} else {
$('#convulsionsKews').text('');
}
});
// validating the MUAC values
$('#muac').change(function () {
let muacValue = $('#muac').val();
if (between(muacValue, 12.5, 50)) {
$('#muacKews').css({
"color": "green",
"font-weight": "bolder"
}).text('GREEN');
} else if (between(muacValue, 11.5, 12.4)) {
$('#muacKews').css({
"color": "#FFC40C",
"font-weight": "bolder"
}).text('YELLOW');
} else if (between(muacValue, 1, 11.4)) {
$('#muacKews').css({
"color": "RED",
"font-weight": "bolder"
}).text('RED');
} else {
$('#muacKews').css({
"color": "RED",
"font-weight": "normal"
}).text('Not in range');
}
});
// calculating the BMI
$("#height,#weight").change(function () {
let weight = $("#weight").val();
let height = $("#height").val();
if (weight > 0 && height > 0) {
let bmi = (parseFloat(weight) / (parseFloat(height) * parseFloat(height)));
bmi = +bmi.toFixed(1);
$("#bmi").val(bmi);
get_nutritional_status();
} else {
$("#bmi").val(0);
$('#nutritional_status_div').hide();
}
});
function between(currentValue, low, high) {
if (currentValue < low) {
return false;
} else if (currentValue > high) {
return false;
} else {
return true;
}
}