// (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').css({ 'color': 'red' }).text('Not in range'); } }); // Validating the pulse value $('#pulse').change(function () { let pulseValue = $('#pulse').val(); if (between(pulseValue, 121, 160)) { $('#pulseKews').css({ "color": "green", "font-weight": "thick" }).text('0'); } else if (between(pulseValue, 101, 120) || between(pulseValue, 161, 180)) { $('#pulseKews').css({ "color": "red", "font-size": "thick" }).text('1'); } else if (between(pulseValue, 81, 100) || between(pulseValue, 181, 200)) { $('#pulseKews').css({ "color": "red", "font-size": "thick" }).text('2'); } else if (between(pulseValue, 0, 80) || between(pulseValue, 201, 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, 31, 55)) { $('#respirationsKews').css({ "color": "green" }).text("0"); } else if (between(respValue, 26, 30) || between(respValue, 56, 70)) { $('#respirationsKews').css({ "color": "red" }).text("1"); } else if (between(respValue, 20, 25) || between(respValue, 71, 80)) { $('#respirationsKews').css({ "color": "red" }).text("2"); } else if (between(respValue, 0, 19) || between(respValue, 81, 200)) { $('#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_level').val(); if (conValue === "alert") { $('#conscious_levelKews').css({ "color": "green", "font-color": "red" }).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", "font-color": "red" }).text('3'); } else { $('#conscious_levelKews').css({ "color": "red", "font-color": "red" }).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'); } }); function between(currentValue, low, high) { if (currentValue < low) { return false; } else if (currentValue > high) { return false; } else { return true; } }