VistA alert display

This commit is contained in:
Jiang Yio 2023-05-08 22:52:55 -04:00
parent 98cd861b5b
commit 38b13f9ad6
3 changed files with 90 additions and 1 deletions

View File

@ -23,6 +23,7 @@
import RoutePatientOrders from './RoutePatientOrders.vue'; import RoutePatientOrders from './RoutePatientOrders.vue';
import RoutePlanner from './RoutePlanner.vue'; import RoutePlanner from './RoutePlanner.vue';
import RouteRecall from './RouteRecall.vue'; import RouteRecall from './RouteRecall.vue';
import RouteInbox from './RouteInbox.vue';
export default { export default {
components: { components: {
@ -45,7 +46,8 @@
{ name: 'Schedule', href: '/' }, { name: 'Schedule', href: '/' },
{ name: 'Lookup', href: '/lookup' }, { name: 'Lookup', href: '/lookup' },
{ name: 'Planner', href: '/planner' }, { name: 'Planner', href: '/planner' },
{ name: 'Recall', href: '/recall' } { name: 'Recall', href: '/recall' },
{ name: 'Inbox', href: '/inbox' },
] ]
} }
}; };
@ -64,6 +66,7 @@
] }, ] },
{ path: '/planner', component: RoutePlanner }, { path: '/planner', component: RoutePlanner },
{ path: '/recall', component: RouteRecall }, { path: '/recall', component: RouteRecall },
{ path: '/inbox', component: RouteInbox },
].forEach(route => this.$root.$router.addRoute(route)); ].forEach(route => this.$root.$router.addRoute(route));
await this.$root.$router.replace(this.$route); await this.$root.$router.replace(this.$route);
} }

67
htdocs/RouteInbox.vue Normal file
View File

@ -0,0 +1,67 @@
<template>
<Subtitle value="Inbox" />
<div>
<div class="card mb-3 shadow">
<div class="card-header d-flex justify-content-between align-items-center">
<span>Alerts</span>
</div>
<div class="card-body">
<table class="table" style="font-family: monospace;" v-if="(resultset) && (resultset.length > 0)">
<thead>
<tr><th>I</th><th>Patient</th><th>Loc</th><th>Urg</th><th>Time</th><th>Message</th><th>XQAID</th><th>DUZ</th></tr>
</thead>
<tbody>
<tr v-for="row in resultset" :style="{ backgroundColor: strHashHSL(row.patient, '90%') }">
<td>{{row.info}}</td>
<td>{{row.patient}}</td>
<td>{{row.location}}</td>
<td>{{urgency[row.urgency]}}</td>
<td>{{datefmt(strptime_vista(row.meta_time))}}</td>
<td>{{row.message}}</td>
<td>{{row.meta_xqaid}}</td>
<td>{{row.meta_duz}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</template>
<script>
import { strHashHSL, strptime_vista } from './util.mjs';
import Subtitle from './Subtitle.vue';
export default {
components: {
Subtitle
},
props: {
client: Object
},
data() {
return {
resultset: [],
urgency: { 'n/a': 'n/a', 'low': 'L', 'Moderate': 'M', 'HIGH': 'H' }
};
},
methods: {
strHashHSL,
strptime_vista,
datefmt(date) {
return date ? date.toLocaleDateString('sv-SE') + ' ' + date.toLocaleTimeString('en-GB') : '';
}
},
created() {
this.$watch(
() => this.client,
async () => {
if(this.client) this.resultset = await this.client.ORWORB_FASTUSER();
else this.resultset = [];
},
{ immediate: true }
);
}
};
</script>

View File

@ -153,6 +153,23 @@ export const d_parse_orderoptions_meddose = data => {
return res; return res;
}; };
export const d_parse_notifications_fastuser = data => d_split(data, '^', 'info', 'patient', 'location', 'urgency', 'time', 'message', 'unk_6', 'meta', 'unk_7', 'unk_8').map(row => {
var meta = row.meta.split(';');
var xqaid = row.meta_xqaid = meta[0];
row.meta_duz = meta[1];
row.meta_time = +meta[2];
if(xqaid.startsWith('OR,')) {
xqaid = xqaid.split(',');
row.meta_source = xqaid[0];
row.meta_dfn = xqaid[1];
row.meta_ien = xqaid[2]; // file 100.9 IEN
} else if(xqaid.startsWith('TIU')) {
row.meta_source = 'TIU';
row.meta_ien = xqaid.substring(3); // document IEN (DA)
}
return row;
});
export function memoized(fn) { export function memoized(fn) {
var cache = {}; var cache = {};
return async function(...args) { return async function(...args) {
@ -297,6 +314,8 @@ export function Client(cid, secret) {
this.ORWDPS2_DAY2QTY = memoized(aflow((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWDPS2_DAY2QTY', ...args), d_log, d_unwrap)); this.ORWDPS2_DAY2QTY = memoized(aflow((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWDPS2_DAY2QTY', ...args), d_log, d_unwrap));
this.ORWDPS2_QTY2DAY = memoized(aflow((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWDPS2_QTY2DAY', ...args), d_log, d_unwrap)); this.ORWDPS2_QTY2DAY = memoized(aflow((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWDPS2_QTY2DAY', ...args), d_log, d_unwrap));
this.ORWORB_FASTUSER = aflow(() => this.call({ method: 'ORWORB_FASTUSER', context: ['OR CPRS GUI CHART'], ttl: 60, stale: false }), d_log, d_unwrap, d_parse_notifications_fastuser);
return this; return this;
} }
Client._registry = {}; Client._registry = {};