// (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.0, 37.7)) { $('#temperatureKews').css({ "color": "green", "font-size": "bold" }).text('0'); } else if (between(tempValue, 35, 35.9) || between(tempValue, 37.8, 38.5)) { $('#temperatureKews').css({ 'color': 'red' }).text('1'); } else if (between(tempValue, 34, 34.9) || between(tempValue, 38.6, 100)) { $('#temperatureKews').css({ 'color': 'red' }).text('2'); } else if (between(tempValue, 0, 33)) { $('#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, 51, 100)) { $('#pulseKews').css({ "color": "green", "font-weight": "thick" }).text('0'); } else if (between(pulseValue, 40, 50) || between(pulseValue, 101, 110)) { $('#pulseKews').css({ "color": "red", "font-size": "thick" }).text('1'); } else if (between(pulseValue, 0, 39) || between(pulseValue, 111, 129)) { $('#pulseKews').css({ "color": "red", "font-size": "thick" }).text('2'); } else if (between(pulseValue, 130, 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, 9, 18)) { $('#respirationsKews').css({ "color": "green" }).text("0"); } else if (between(respValue, 19, 25)) { $('#respirationsKews').css({ "color": "red" }).text("1"); } else if (between(respValue, 0, 8) || between(respValue, 26, 30)) { $('#respirationsKews').css({ "color": "red" }).text("2"); } else if (between(respValue, 31, 500)) { $('#respirationsKews').css({ "color": "red" }).text("3"); } else { $('#respirationsKews').css({ "color": "red" }).text("Not in range"); } }); // Validating Systolic bp $('#systolic_bp').change(function () { let sysValue = $('#systolic_bp').val(); if (between(sysValue, 101, 159)) { $('#systolic_bpKews').css({ "color": "green" }).text('0'); } else if (between(sysValue, 81, 100) || between(sysValue, 160, 200)) { $('#systolic_bpKews').css({ "color": "red" }).text('1'); } else if (between(sysValue, 71, 80) || between(sysValue, 201, 1000)) { $('#systolic_bpKews').css({ "color": "red" }).text('2'); } else if (between(sysValue, 0, 70)) { $('#systolic_bpKews').css({ "color": "red" }).text('3'); } else { $('#systolic_bpValue').css({ "color": "red" }); $('#systolic_bpKews').text('Not in range'); } }); // Validating diastolic bp $('#diastolic_bp').change(function () { let diaValue = $('#diastolic_bp').val(); if (between(diaValue, 0, 94)) { $('#diastolic_bpKews').css({ "color": "green" }).text('0'); } else if (between(diaValue, 95, 104)) { $('#diastolic_bpKews').css({ "color": "red" }).text('1'); } else if (between(diaValue, 105, 500)) { $('#diastolic_bpKews').css({ "color": "red" }).text('2'); } else { $('#diastolic_bpKews').css({ "color": "red" }).text('Not in range'); } }); // 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/irritated") { $('#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 Urine output $('#urine_output').change(function () { let urValue = $('#urine_output').val(); if (urValue === "normal") { $('#urine_outputKews').css({ "color": "green" }).text('0'); } else if (urValue === "reduced") { $('#urine_outputKews').css({ "color": "red" }).text('1'); } else if (urValue === "none for 24 hours") { $('#urine_outputKews').css({ "color": "red" }).text('3'); } else { $('#urine_outputKews').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 $("#weight,#height").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; } }