// (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, 130)) { $('#pulseKews').css({ "color": "green", "font-weight": "thick" }).text('0'); } else if (between(pulseValue, 66, 75) || between(pulseValue, 131, 160)) { $('#pulseKews').css({ "color": "red", "font-size": "thick" }).text('1'); } else if (between(pulseValue, 56, 65) || between(pulseValue, 161, 180)) { $('#pulseKews').css({ "color": "red", "font-size": "thick" }).text('2'); } else if (between(pulseValue, 0, 55) || between(pulseValue, 181, 1000)) { $('#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, 21, 40)) { $('#respirationsKews').css({ "color": "green" }).text("0"); } else if (between(respValue, 16, 20) || between(respValue, 41, 50)) { $('#respirationsKews').css({ "color": "red" }).text("1"); } else if (between(respValue, 11, 15) || between(respValue, 51, 60)) { $('#respirationsKews').css({ "color": "red" }).text("2"); } else if (between(respValue, 0, 10) || between(respValue, 61, 500)) { $('#respirationsKews').css({ "color": "red" }).text("3"); } else { $('#respirationsKews').css({ "color": "red" }).text("Not in range"); } }); // Validating respiratory 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_level').val(); if (conValue === "alert") { $('#conscious_levelKews').css({ "color": "green" }).text('0'); } else if (conValue === "responds to voice") { $('#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); } }); function between(currentValue, low, high) { if (currentValue < low) { return false; } else if (currentValue > high) { return false; } else { return true; } }