First
This commit is contained in:
92
htdocs/ViewVitalsLabs.vue
Normal file
92
htdocs/ViewVitalsLabs.vue
Normal file
@@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<div>
|
||||
<label class="form-check form-check-inline form-switch form-check-label" v-for="report in reports">
|
||||
<input class="form-check-input" type="checkbox" v-model="report.selected" /> {{report.name}}
|
||||
</label>
|
||||
</div>
|
||||
<ViewData :resultset="resultset" :daily="true" :reports="reports_selected" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { strftime_vista, strptime_vista } from './util.mjs';
|
||||
|
||||
import ViewData from './ViewData.vue';
|
||||
|
||||
const reports = [
|
||||
{ name: 'Vitals', value: ['T', 'P', 'R', 'SBP', 'DBP', 'Pulse Oximetry', 'Wt', 'Ht', 'Pain'], selected: true },
|
||||
{ name: 'CBC', value: ['HGB', 'MCV', 'PLT', 'WBC', 'NEUTROPHIL#'], selected: false },
|
||||
{ name: 'Renal', value: ['CREATININE', 'UREA NITROGEN', 'EGFR CKD-EPI 2021', 'Estimated GFR dc\'d 3/30/2022'], selected: false },
|
||||
{ name: 'Hepatic', value: ['SGOT', 'SGPT', 'LDH', 'ALKALINE PHOSPHATASE', 'GAMMA-GTP', 'TOT. BILIRUBIN', 'DIR. BILIRUBIN', 'ALBUMIN'], selected: false },
|
||||
{ name: 'Electrolytes', value: ['SODIUM', 'CHLORIDE', 'CO2', 'CALCIUM', 'IONIZED CALCIUM (LABCORP)', 'POTASSIUM', 'MAGNESIUM', 'PO4', 'ANION GAP', 'OSMOBLD'], selected: false },
|
||||
{ name: 'Coagulation', value: ['PT', 'INR', 'PTT'], selected: false },
|
||||
{ name: 'Vitamins', value: ['FERRITIN', 'IRON', 'TIBC', 'B 12', 'FOLATE', 'VITAMIN D TOTAL 25-OH'], selected: false },
|
||||
{ name: 'Thyroid', value: ['TSH', 'T4 (THYROXINE)'], selected: false }
|
||||
];
|
||||
reports.reduce((acc, x) => acc[x] = x, reports);
|
||||
|
||||
const vitals_mapping = {
|
||||
'T': { range: '35 - 38' },
|
||||
'P': { range: '60 - 100', unit: 'bpm' },
|
||||
'R': { range: '12 - 19', unit: 'bpm' },
|
||||
'Pulse Oximetry': { range: '95 - 100' }
|
||||
};
|
||||
|
||||
function vitals_normalize(rs) {
|
||||
return rs.map(function(x) {
|
||||
var res = {
|
||||
time: x.datetime,
|
||||
name: x.name,
|
||||
unit: x.unit,
|
||||
value: x.value,
|
||||
flag: x.flag,
|
||||
comment: x.user
|
||||
};
|
||||
return vitals_mapping[x.name] ? Object.assign(res, vitals_mapping[x.name]) : res;
|
||||
});
|
||||
}
|
||||
|
||||
function labs_normalize(rs) {
|
||||
return rs.map(function(x) {
|
||||
return {
|
||||
time: x.time_collected,
|
||||
name: x.name,
|
||||
unit: x.unit,
|
||||
range: x.range,
|
||||
value: x.value,
|
||||
flag: x.flag,
|
||||
comment: x.comment
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ViewData
|
||||
},
|
||||
props: {
|
||||
client: Object,
|
||||
dfn: String,
|
||||
date_begin: Date,
|
||||
date_end: Date
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
resultset: null,
|
||||
reports
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
params() {
|
||||
return { dfn: this.dfn, date_begin: strftime_vista(this.date_begin), date_end: strftime_vista(this.date_end) };
|
||||
},
|
||||
reports_selected() {
|
||||
return this.reports.filter(x => x.selected).map(x => x.value);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
async params(value, oldvalue) {
|
||||
this.resultset = vitals_normalize(await this.client.GMV_EXTRACT_REC(value.dfn, value.date_end, value.date_begin)).concat(labs_normalize(await this.client.ORWLRR_INTERIM_RESULTS(value.dfn, value.date_end, value.date_begin)));
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Reference in New Issue
Block a user