From c1ca4ea4146a861f5babba52e67f7e8927f1ae02 Mon Sep 17 00:00:00 2001 From: inportb Date: Sat, 1 Oct 2022 00:38:59 -0400 Subject: [PATCH] Order viewer --- htdocs/OrderFilterPicker.vue | 28 +++++++++ htdocs/RoutePatientDetail.vue | 17 +++++- htdocs/ViewOrders.vue | 104 ++++++++++++++++++++++++++++++++++ htdocs/reportparser.mjs | 33 +++++++++++ htdocs/vistax.mjs | 19 ++++++- main.py | 2 +- 6 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 htdocs/OrderFilterPicker.vue create mode 100644 htdocs/ViewOrders.vue diff --git a/htdocs/OrderFilterPicker.vue b/htdocs/OrderFilterPicker.vue new file mode 100644 index 0000000..f7b10a0 --- /dev/null +++ b/htdocs/OrderFilterPicker.vue @@ -0,0 +1,28 @@ + + + diff --git a/htdocs/RoutePatientDetail.vue b/htdocs/RoutePatientDetail.vue index 857f53b..8b228eb 100644 --- a/htdocs/RoutePatientDetail.vue +++ b/htdocs/RoutePatientDetail.vue @@ -21,6 +21,14 @@ +
+
+ Orders + + +
+
+
@@ -29,12 +37,14 @@ import DateRangePicker from './DateRangePicker.vue'; import ViewVitalsLabs from './ViewVitalsLabs.vue'; + import OrderFilterPicker from './OrderFilterPicker.vue'; + import ViewOrders from './ViewOrders.vue'; var now = new Date(); export default { components: { - DateRangePicker, ViewVitalsLabs + DateRangePicker, ViewVitalsLabs, OrderFilterPicker, ViewOrders }, props: { client: Object @@ -44,7 +54,10 @@ dfn: null, info: null, report_date: now, - report_date_begin: now + report_date_begin: now, + orders_filter: 2, + orders_date: now, + orders_date_begin: now }; }, watch: { diff --git a/htdocs/ViewOrders.vue b/htdocs/ViewOrders.vue new file mode 100644 index 0000000..1880e2e --- /dev/null +++ b/htdocs/ViewOrders.vue @@ -0,0 +1,104 @@ + + + + + diff --git a/htdocs/reportparser.mjs b/htdocs/reportparser.mjs index 1932106..b52d016 100644 --- a/htdocs/reportparser.mjs +++ b/htdocs/reportparser.mjs @@ -179,3 +179,36 @@ export function measurement_parse(data) { res.push(...extras); return res; } + +export function order_parse(data) { + var res = [], item, line; + for(var i = 0; i < data.length; ++i) { + if((line = data[i]).startsWith('~')) { + res.push(item = line.slice(1).split('^')); + item.IFN = item[0]; + item.Grp = item[1]; + item.OrdTm = item[2]; + item.StrtTm = item[3]; + item.StopTm = item[4]; + item.Sts = item[5]; + item.Sig = item[6]; + item.Nrs = item[7]; + item.Clk = item[8]; + item.PrvID = item[9]; + item.PrvNam = item[10]; + item.Act = item[11]; + item.Flagged = item[12]; + item.DCType = item[13]; + item.ChartRev = item[14]; + item.DEA = item[15]; + item.DigSig = item[17]; + item.LOC = item[18]; + item.DCORIGINAL = item[19]; + item.IsPendingDCorder = item[20]; + item.IsDelayOrder = item[21]; + item.text = []; + } else if((item) && (line.startsWith('t'))) item.text.push(line.slice(1)); + else console.log('INVALID:', line); + } + return res; +} diff --git a/htdocs/vistax.mjs b/htdocs/vistax.mjs index e8e0649..d49e4fc 100644 --- a/htdocs/vistax.mjs +++ b/htdocs/vistax.mjs @@ -2,7 +2,7 @@ import { reactive, watch } from 'vue'; import vista from './vista.mjs'; import cookie from './cookie.mjs'; -import { lab_parse, lab_reparse_results, measurement_parse } from './reportparser.mjs'; +import { lab_parse, lab_reparse_results, measurement_parse, order_parse } from './reportparser.mjs'; export const state = reactive(cookie.get('state') ? JSON.parse(cookie.get('state')) : {}); if((!state.secret) && (cookie.get('secret'))) state.resources = cookie.get('secret'); @@ -67,12 +67,24 @@ export function caretseparated1(fn, columns=null) { } } +export function sliced(fn, start, end) { + return async function(...args) { + return (await fn(...args)).slice(start, end); + } +} + export function labreportparsed(fn) { return async function(...args) { return lab_parse(await fn(...args)); } } +export function orderparsed(fn) { + return async function(...args) { + return order_parse(await fn(...args)); + } +} + export function tabulated(fn, mapping) { return async function(...args) { var res = (await fn(...args)).map(function(row) { return row.slice(); }), nrow = res.length; @@ -141,6 +153,11 @@ export function Client(cid, secret) { this.ORWLRR_INTERIM = memoized(labreportparsed(unwrapped(logged((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWLRR_INTERIM', ...args), 'ORWLRR_INTERIM')))); this.ORWLRR_INTERIM_RESULTS = memoized(async (...args) => lab_reparse_results(await this.ORWLRR_INTERIM(...args))); + this.ORWORDG_ALLTREE = memoized(caretseparated(unwrapped(logged(() => this.callctx(['OR CPRS GUI CHART'], 'ORWORDG_ALLTREE'), 'ORWORDG_ALLTREE')), ['ien', 'name', 'parent', 'has_children'])); + this.ORWORDG_REVSTS = memoized(caretseparated(unwrapped(logged(() => this.callctx(['OR CPRS GUI CHART'], 'ORWORDG_REVSTS'), 'ORWORDG_REVSTS')), ['ien', 'name', 'parent', 'has_children'])); + this.ORWORR_AGET = memoized(caretseparated(sliced(unwrapped(logged((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWORR_AGET', ...args), 'ORWORR_AGET')), 1), ['ifn', 'dgrp', 'time'])); + this.ORWORR_GET4LST = memoized(orderparsed(unwrapped(logged((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWORR_GET4LST', ...args), 'ORWORR_GET4LST')))); + return this; } Client._registry = {}; diff --git a/main.py b/main.py index d910f22..25053e9 100644 --- a/main.py +++ b/main.py @@ -31,7 +31,7 @@ class CacheProxyRPC(util.CacheProxy): if volatile is None: volatile = util.Store().memo self._cache(('__call__', 'close', 'authenticate', 'keepalive', 'XWB_CREATE_CONTEXT', 'XWB_IM_HERE'), None) - self._cache(('SDEC_RESOURCE', 'ORWLRR_ALLTESTS_ALL'), persistent, prefix=prefix, ttl=float('inf')) + self._cache(('SDEC_RESOURCE', 'ORWLRR_ALLTESTS_ALL', 'ORWORDG_ALLTREE', 'ORWORDG_REVSTS'), persistent, prefix=prefix, ttl=float('inf')) self._cache(('XWB_GET_BROKER_INFO', 'XUS_INTRO_MSG'), volatile, prefix=prefix, ttl=float('inf')) self._cache(None, volatile, prefix=prefix, ttl=float('-inf')) def _cache_persistent(self, persistent=None, prefix=''):