Files
streamline-emr/docker/streamline-src/public/js/observations/over_12_years_news.js
T

178 lines
5.4 KiB
JavaScript
Executable File

//Validating the temperature values
$('#temperature').change(function () {
let tempValue = $('#temperature').val();
if (between(tempValue, 36.1, 38.0)) {
$('#temperatureNewsText').css({
"color": "green",
"font-size": "bold"
}).text('0');
$('#temperatureNews').val('0');
} else if (between(tempValue, 35.1, 36.0) || between(tempValue, 38.1, 39.0)) {
$('#temperatureNewsText').css({
'color': 'red'
}).text('1');
$('#temperatureNews').val('1');
} else if (tempValue >= 39.1) {
$('#temperatureNewsText').css({
'color': 'red'
}).text('2');
$('#temperatureNews').val('2');
} else if (tempValue <= 35.0) {
$('#temperatureNewsText').css({
'color': 'red'
}).text('3');
$('#temperatureNews').text('3');
}
});
//Validating the pulse value / heart rate
$('#pulse').change(function () {
let pulseValue = $('#4Value').val();
if (between(pulseValue, 51, 90)) {
$('#pulseNewsText').css({
"color": "green",
"font-weight": "thick"
}).text('0');
$('#pulseNews').val('0');
} else if (between(pulseValue, 41, 50) || between(pulseValue, 91, 110)) {
$('#pulseNewsText').css({
"color": "red",
"font-size": "thick"
}).text('1');
$('#pulseNews').val('1');
} else if (between(pulseValue, 111, 130)) {
$('#pulseNewsText').css({
"color": "red",
"font-size": "thick"
}).text('2');
$('#pulseNews').val('2');
} else if (pulseValue >= 131 || pulseValue <= 40) {
$('#pulseNewsText').css({
"color": "red",
"font-size": "thick"
}).text('3');
$('#pulseNews').val('3');
}
});
//Validating the respirations
$('#respirations').change(function () {
let respValue = $('#respirations').val();
if (between(respValue, 12, 20)) {
$('#respirationsNewsText').css({
"color": "green"
}).text("0");
$('#respirationsNews').val("0");
} else if (between(respValue, 9, 11)) {
$('#respirationsNewsText').css({
"color": "red"
}).text("1");
$('#respirationsNews').val("1");
} else if (between(respValue, 21, 24)) {
$('#respirationsNewsText').css({
"color": "red"
}).text("2");
$('#respirationsNews').val("2");
} else if (respValue >= 25 || respValue <= 8) {
$('#respirationsNewsText').css({
"color": "red"
}).text("3");
$('#respirationsNews').val("3");
}
});
//Validating the oxygen saturations (SaO2(%))
$('#sao2').change(function () {
let saValue = $('#sao2').val();
if (saValue >= 96) {
$('#sao2NewsText').css({
"color": "green"
}).text("0");
$('#sao2News').val("0");
} else if (between(saValue, 94, 95)) {
$('#sao2NewsText').css({
"color": "red"
}).text("1");
$('#sao2News').val("1");
} else if (between(saValue, 92, 93)) {
$('#sao2NewsText').css({
"color": "red"
}).text("2");
$('#sao2News').val("2");
} else if (saValue <= 91) {
$('#sao2NewsText').css({
"color": "red"
}).text("3");
$('#sao2News').val("3");
}
});
//Validating Systolic bp
$('#systolic_bp').change(function () {
let sysValue = $('#systolic_bp').val();
if (between(sysValue, 111, 219)) {
$('#systolic_bpNewsText').css({
"color": "green"
}).text('0');
$('#systolic_bpNews').val('0');
} else if (between(sysValue, 101, 110)) {
$('#systolic_bpNewsText').css({
"color": "red"
}).text('1');
$('#systolic_bpNews').val('1');
} else if (between(sysValue, 91, 100)) {
$('#systolic_bpNewsText').css({
"color": "red"
}).text('2');
$('#systolic_bpNews').val('2');
} else if (sysValue >= 220 || sysValue <= 90) {
$('#systolic_bpNewsText').css({
"color": "red"
}).text('3');
$('#systolic_bpNews').val('3');
}
});
//Validating the concious level
$('#conscious_level').change(function () {
let conValue = $('#conscious_level').val();
if (conValue === "alert") {
$('#conscious_levelNewsText').css({
"color": "green"
}).text('0');
$('#conscious_levelNews').val('0');
} else if (conValue === "responds to voice/irritated" || conValue === "responds to pain" || conValue === "unresponsive") {
$('#conscious_levelNewsText').css({
"color": "red",
"font-color": "red"
}).text('3');
$('#conscious_levelNews').val('3');
}
});
//Validating the supplementary oxygen
$('#supplementary_oxygen').change(function () {
let suOxValue = $('#supplementary_oxygen').val();
if (suOxValue === "No") {
$('#supplementary_oxygenNewsText').css({
"color": "green"
}).text('0');
$('#supplementary_oxygenNews').val('0');
} else if (suOxValue === "Yes") {
$('#supplementary_oxygenNewsText').css({
"color": "red",
"font-color": "red"
}).text('2');
$('#supplementary_oxygenNews').val('2');
}
});
function between(currentValue, low, high) {
if (currentValue < low) {
return false;
} else if (currentValue > high) {
return false;
} else {
return true;
}
}