Compare commits

...

6 Commits

7 changed files with 105 additions and 39 deletions

View File

@ -88,6 +88,7 @@
else { else {
[ [
{ path: '/', component: RouteSchedule }, { path: '/', component: RouteSchedule },
{ path: '/schedule/:from?/:to?', component: RouteSchedule },
{ path: '/lookup', component: RouteLookup }, { path: '/lookup', component: RouteLookup },
{ path: '/patient/:id', component: RoutePatient, children: [ { path: '/patient/:id', component: RoutePatient, children: [
{ path: '', component: RoutePatientDetail }, { path: '', component: RoutePatientDetail },

View File

@ -156,7 +156,7 @@
timeshift, timeshift_month timeshift, timeshift_month
}, },
mounted() { mounted() {
this.$emit('update:date_end', this.x_date_end = datecalc(this.x_date, this.x_range, this.direction)); if(this.x_range != 'Range') this.$emit('update:date_end', this.x_date_end = datecalc(this.x_date, this.x_range, this.direction));
} }
}; };
</script> </script>

View File

@ -1,15 +1,19 @@
<template> <template>
<Subtitle value="Patient" /> <Subtitle value="Patient" />
<div v-if="(sensitive) && (!patient_info)" class="alert alert-danger text-center mb-3 shadow" role="alert"> <div v-if="(sensitive) && (!viewsensitive)" class="alert alert-danger text-center mb-3 shadow" role="alert">
<Subtitle value="Restricted Record" /> <Subtitle value="Restricted Record" />
<h1>Warning: Restricted Record</h1> <h1>Warning: Restricted Record</h1>
<p>This record is protected by the Privacy Act of 1974 and the Health Insurance Portability and Accountability Act of 1996. If you elect to proceed, you will be required to prove you have a need to know. Accessing this patient is tracked, and your station Security Officer will contact you for your justification.</p> <p>This record is protected by the Privacy Act of 1974 and the Health Insurance Portability and Accountability Act of 1996. If you elect to proceed, you will be required to prove you have a need to know. Accessing this patient is tracked, and your station Security Officer will contact you for your justification.</p>
<router-link class="btn btn-danger" :to="'/patient/' + patient_dfn + '?viewsensitive'">Proceed</router-link> <button class="btn btn-danger" @click="viewsensitive = true">Proceed</button>
</div> </div>
<template v-if="patient_info"> <template v-if="patient_info">
<Submenu :value="menu" /> <Submenu :value="menu" />
<div class="card mb-3 shadow"> <div class="card mb-3 shadow">
<div class="card-header">{{patient_info.name}} <span :title="patient_info.pid">{{patient_info.pid.slice(-4)}}</span> #{{patient_dfn}}</div> <div v-if="sensitive" class="card-header alert-danger d-flex justify-content-between align-items-center">
<span>{{patient_info.name}} <span :title="patient_info.pid">{{patient_info.pid.slice(-4)}}</span> #{{patient_dfn}}</span>
<button class="btn-close" @click="viewsensitive = false"></button>
</div>
<div v-else class="card-header">{{patient_info.name}} <span :title="patient_info.pid">{{patient_info.pid.slice(-4)}}</span> #{{patient_dfn}}</div>
<div class="card-body row" style="font-family: monospace;"> <div class="card-body row" style="font-family: monospace;">
<div class="col" v-if="patient_info.dob"><strong>DOB:</strong> {{strptime_vista(patient_info.dob).toLocaleDateString('sv-SE')}}</div> <div class="col" v-if="patient_info.dob"><strong>DOB:</strong> {{strptime_vista(patient_info.dob).toLocaleDateString('sv-SE')}}</div>
<div class="col" v-if="patient_info.age"><strong>Age:</strong> {{patient_info.age}}</div> <div class="col" v-if="patient_info.age"><strong>Age:</strong> {{patient_info.age}}</div>
@ -25,6 +29,7 @@
</template> </template>
<script> <script>
import cookie from './cookie.mjs';
import { strptime_vista } from './util.mjs'; import { strptime_vista } from './util.mjs';
import Subtitle from './Subtitle.vue'; import Subtitle from './Subtitle.vue';
@ -39,6 +44,7 @@
}, },
data() { data() {
return { return {
viewsensitive: false,
sensitive: false, sensitive: false,
patient_dfn: null, patient_dfn: null,
patient_info: null patient_info: null
@ -49,42 +55,68 @@
return this.patient_info ? { return this.patient_info ? {
name: this.patient_info.name, name: this.patient_info.name,
items: [ items: [
{ name: 'Patient', href: '/patient/' + this.patient_dfn + (this.sensitive && '?viewsensitive' || '') }, { name: 'Patient', href: '/patient/' + this.patient_dfn },
{ name: 'Visits', href: '/patient/' + this.patient_dfn + '/visits' + (this.sensitive && '?viewsensitive' || '') }, { name: 'Visits', href: '/patient/' + this.patient_dfn + '/visits' },
{ name: 'Orders', href: '/patient/' + this.patient_dfn + '/orders' + (this.sensitive && '?viewsensitive' || '') }, { name: 'Orders', href: '/patient/' + this.patient_dfn + '/orders' },
{ name: 'Reports', href: '/patient/' + this.patient_dfn + '/reports' + (this.sensitive && '?viewsensitive' || '') }, { name: 'Reports', href: '/patient/' + this.patient_dfn + '/reports' },
{ name: 'Documents', href: '/patient/' + this.patient_dfn + '/document' + (this.sensitive && '?viewsensitive' || '') }, { name: 'Documents', href: '/patient/' + this.patient_dfn + '/document' },
] ]
} : null; } : null;
} }
}, },
methods: { methods: {
strptime_vista, strptime_vista
async loadinfo(dfn, viewsensitive) {
this.patient_dfn = dfn;
this.sensitive = await this.client.ORWPT_SELCHK(dfn);
this.patient_info = (this.sensitive) && (!viewsensitive) ? null : await this.client.ORWPT16_ID_INFO(dfn);
}
}, },
async mounted() { watch: {
if(this.$route.params.id.startsWith('$')) { '$route.params.id': {
var id = this.$route.params.id.substring(1); async handler(value) {
if(id.length == 9) { if(value.startsWith('$')) {
var patient = await this.client.ORWPT_FULLSSN(id); var id = value.substring(1);
this.$router.replace('/patient/' + patient[0].dfn); if(id.length == 9) {
} else if(id.length == 5) { var patient = await this.client.ORWPT_FULLSSN(id);
var name = this.$route.query.name.toUpperCase(); this.$router.replace('/patient/' + patient[0].dfn);
var patient = await this.client.ORWPT_LAST5(id); } else if(id.length == 5) {
for(var i = 0; i < patient.length; ++i) if(name == patient[i].name) { var name = this.$route.query.name.toUpperCase();
this.$router.replace('/patient/' + patient[i].dfn); var patient = await this.client.ORWPT_LAST5(id);
break; for(var i = 0; i < patient.length; ++i) if(name == patient[i].name) {
this.$router.replace('/patient/' + patient[i].dfn);
break;
}
}
} else {
this.sensitive = await this.client.ORWPT_SELCHK(value);
this.patient_dfn = value;
var viewsensitive = cookie.get('viewsensitive');
this.viewsensitive = viewsensitive ? viewsensitive.split(',').indexOf(value) >= 0 : false;
}
}, immediate: true
},
viewsensitive(value) {
var viewsensitive = cookie.get('viewsensitive'), viewsensitive = viewsensitive !== null ? viewsensitive.split(',') : [], idx = viewsensitive.indexOf(this.patient_dfn);
if(value) {
if(idx < 0) {
viewsensitive.push(this.patient_dfn);
cookie.set('viewsensitive', viewsensitive.join(','));
}
} else {
if(idx >= 0) {
viewsensitive.splice(idx, 1);
cookie.set('viewsensitive', viewsensitive.join(','));
} }
} }
} else this.loadinfo(this.$route.params.id, this.$route.query.hasOwnProperty('viewsensitive')); }
}, },
async beforeRouteUpdate(to, from, next) { created() {
this.loadinfo(to.params.id, to.query.hasOwnProperty('viewsensitive')); this.$watch(
next(); () => (this.client, this.patient_dfn, this.sensitive, this.viewsensitive, {}),
async function() {
if(this.client) {
if(this.patient_dfn) this.patient_info = (this.sensitive) && (!this.viewsensitive) ? null : await this.client.ORWPT16_ID_INFO(this.patient_dfn);
else this.patient_info = null;
}
},
{ immediate: true }
);
} }
}; };
</script> </script>

View File

@ -6,7 +6,7 @@
<div class="card mb-3 shadow"> <div class="card mb-3 shadow">
<div class="card-header"><template v-if="resultset.length > 0">{{resultset.length}}<template v-if="has_more">+</template></template><template v-else-if="is_loading">Loading</template><template v-else>No</template> record{{resultset.length == 1 ? '' : 's'}}</div> <div class="card-header"><template v-if="resultset.length > 0">{{resultset.length}}<template v-if="has_more">+</template></template><template v-else-if="is_loading">Loading</template><template v-else>No</template> record{{resultset.length == 1 ? '' : 's'}}</div>
<ul class="scroller list-group list-group-flush" ref="scroller"> <ul class="scroller list-group list-group-flush" ref="scroller">
<router-link v-for="item in resultset" :to="'/patient/' + patient_dfn + '/document/' + item.IEN + (sensitive ? '?viewsensitive' : '')" replace custom v-slot="{ navigate, href }"> <router-link v-for="item in resultset" :to="'/patient/' + patient_dfn + '/document/' + item.IEN" replace custom v-slot="{ navigate, href }">
<li :key="item" class="record" :class="{ 'active': selection == item.IEN }" :title="datetimestring(strptime_vista(item.time)) + '\n' + item.title + '\n' + item.location + '\n' + item.author.byline" @click="navigate"> <li :key="item" class="record" :class="{ 'active': selection == item.IEN }" :title="datetimestring(strptime_vista(item.time)) + '\n' + item.title + '\n' + item.location + '\n' + item.author.byline" @click="navigate">
<div class="row"> <div class="row">
<div class="cell col-4"><router-link :to="href" replace>{{datestring(strptime_vista(item.time))}}</router-link></div> <div class="cell col-4"><router-link :to="href" replace>{{datestring(strptime_vista(item.time))}}</router-link></div>
@ -177,14 +177,14 @@
); );
this.$watch( this.$watch(
() => (this.client, this.selection, {}), () => (this.client, this.selection, {}),
debounce(async function() { async function() {
try { try {
this.selection_text = (this.client) && (this.selection) ? await this.client.TIU_GET_RECORD_TEXT(this.selection) : null; this.selection_text = (this.client) && (this.selection) ? await this.client.TIU_GET_RECORD_TEXT(this.selection) : null;
} catch(ex) { } catch(ex) {
this.selection_text = null; this.selection_text = null;
console.warn(ex); console.warn(ex);
} }
}, 500), },
{ immediate: true } { immediate: true }
); );
}, },

View File

@ -357,9 +357,10 @@
} }
var dfn = this.patient_dfn, resultsets = this.resultsets, resultset, reports = this.reports, report, alpha = strftime_vista(this.date_begin).toFixed(4), omega = strftime_vista(this.date_end).toFixed(4); var dfn = this.patient_dfn, resultsets = this.resultsets, resultset, reports = this.reports, report, alpha = strftime_vista(this.date_begin).toFixed(4), omega = strftime_vista(this.date_end).toFixed(4);
for(var i = 0; i < reports.length; ++i) if(((report = reports[i]).enabled) && (!((resultset = resultsets[i]) && (alpha == resultset.alpha) && (omega == resultset.omega)))) { for(var i = 0; i < reports.length; ++i) if(((report = reports[i]).enabled) && (!((resultset = resultsets[i]) && (alpha == resultset.alpha) && (omega == resultset.omega)))) {
var data = [], batch, idmap = {}, omega0 = omega; var data = [], batch, count, idmap = {}, omega0 = omega;
do { do {
batch = await this.client.ORWRP_REPORT_TEXT(dfn, report.rpt_id + (report.rpt_id.endsWith(';') ? SZ_WINDOW : ''), '', SZ_RANGE, '', alpha, omega0); batch = await this.client.ORWRP_REPORT_TEXT(dfn, report.rpt_id + (report.rpt_id.endsWith(';') ? SZ_WINDOW : ''), '', SZ_RANGE, '', alpha, omega0);
count = batch.length;
if(report.singleton) data = [report.map(batch[0].join('\n'))]; if(report.singleton) data = [report.map(batch[0].join('\n'))];
else if((batch = batch.map(item => { else if((batch = batch.map(item => {
var res = [], line, brk, sub; var res = [], line, brk, sub;
@ -378,7 +379,7 @@
batch.map(x => x.id).reduce((acc, val) => (acc[val] = true, acc), idmap); batch.map(x => x.id).reduce((acc, val) => (acc[val] = true, acc), idmap);
omega0 = strftime_vista(data[data.length - 1].time); omega0 = strftime_vista(data[data.length - 1].time);
}; };
} while(batch.length >= SZ_WINDOW); } while(count >= SZ_WINDOW);
data.alpha = alpha; data.alpha = alpha;
data.omega = omega; data.omega = omega;
resultsets[i] = data; resultsets[i] = data;

View File

@ -4,7 +4,7 @@
<div class="card-header d-flex justify-content-between align-items-center"> <div class="card-header d-flex justify-content-between align-items-center">
<span>Schedule</span> <span>Schedule</span>
<router-link to="/settings">Select clinics<template v-if="selection.length > 0"> ({{selection.length}})</template></router-link> <router-link to="/settings">Select clinics<template v-if="selection.length > 0"> ({{selection.length}})</template></router-link>
<DateRangePicker range="1D" direction="+1" v-model:date="date" v-model:date_end="date_end" /> <DateRangePicker direction="+1" v-model:date="date" v-model:date_end="date_end" v-model:range="range" />
</div> </div>
<div class="card-body"> <div class="card-body">
<ViewSchedule :client="client" :selection="selection" :date_begin="date" :date_end="new Date(date_end.getTime() - 1)" /> <ViewSchedule :client="client" :selection="selection" :date_begin="date" :date_end="new Date(date_end.getTime() - 1)" />
@ -21,6 +21,12 @@
return new Date(date.getFullYear(), date.getMonth(), date.getDate()); return new Date(date.getFullYear(), date.getMonth(), date.getDate());
} }
function localtime(s) {
var date = new Date(s);
date.setTime(date.getTime() + 60000*date.getTimezoneOffset());
return date;
}
export default { export default {
components: { components: {
Subtitle, DateRangePicker, ViewSchedule Subtitle, DateRangePicker, ViewSchedule
@ -31,11 +37,31 @@
data() { data() {
return { return {
date: dateonly(new Date()), date: dateonly(new Date()),
date_end: dateonly(new Date()) date_end: dateonly(new Date()),
range: '1D'
}; };
}, },
computed: { computed: {
selection() { return (this.client) && (this.client.remotestate.resources) ? (this.client.remotestate.resources.split(',').filter(x => x) || []) : [] } selection() { return (this.client) && (this.client.remotestate.resources) ? (this.client.remotestate.resources.split(',').filter(x => x) || []) : [] }
},
watch: {
'$route.params.from': {
handler(value) {
this.date = dateonly(value ? localtime(value) : new Date());
}, immediate: true
},
'$route.params.to': {
handler(value) {
if(value) {
var date = localtime(value);
if(isNaN(date)) this.range = value;
else {
this.range = 'Range';
this.date_end = dateonly(date);
}
} else this.range = '1D';
}, immediate: true
}
} }
}; };
</script> </script>

View File

@ -7,7 +7,9 @@
<tr v-for="week in resultset"> <tr v-for="week in resultset">
<td v-for="day in [0, 1, 2, 3, 4, 5, 6]" class="datebox"> <td v-for="day in [0, 1, 2, 3, 4, 5, 6]" class="datebox">
<template v-if="week.values[day]"> <template v-if="week.values[day]">
<div class="datebox" :style="{ backgroundColor: resultset.max > 0 ? 'rgba(220, 53, 69, ' + week.values[day].length/resultset.max + ')' : null }"><span class="occupancy hidden">#{{week.values[day].length}}</span> {{day > 0 ? week.values[day][0]._START_OBJ.getDate() : week.key.toLocaleDateString('sv-SE')}} <span class="occupancy">#{{week.values[day].length}}</span></div> <router-link :to="'/schedule/' + week.values[day][0]._START_OBJ.toLocaleDateString('sv-SE')" custom v-slot="{ navigate }">
<div class="datebox linked" :style="{ backgroundColor: resultset.max > 0 ? 'rgba(220, 53, 69, ' + week.values[day].length/resultset.max + ')' : null }" @click="navigate"><span class="occupancy hidden">#{{week.values[day].length}}</span> {{day > 0 ? week.values[day][0]._START_OBJ.getDate() : week.key.toLocaleDateString('sv-SE')}} <span class="occupancy">#{{week.values[day].length}}</span></div>
</router-link>
<template v-for="appointment in week.values[day]"> <template v-for="appointment in week.values[day]">
<div v-if="appointment._BREAK" class="vacancy" :title="appointment._START_OBJ.toLocaleTimeString('en-GB').substring(0, 5) + '' + appointment._END_OBJ.toLocaleTimeString('en-GB').substring(0, 5)" /> <div v-if="appointment._BREAK" class="vacancy" :title="appointment._START_OBJ.toLocaleTimeString('en-GB').substring(0, 5) + '' + appointment._END_OBJ.toLocaleTimeString('en-GB').substring(0, 5)" />
<div v-else :title="appointment._START_OBJ.toLocaleTimeString('en-GB').substring(0, 5) + '' + appointment._END_OBJ.toLocaleTimeString('en-GB').substring(0, 5) + '\n' + appointment.PATIENTNAME + ' ' + appointment.HRN.slice(-4) + '\n' + appointment.NOTE"><span v-if="appointment._CONCURRENCY > 0" class="concurrency hidden">*<template v-if="appointment._CONCURRENCY > 1">{{appointment._CONCURRENCY}}</template></span>{{appointment._START_OBJ.toLocaleTimeString('en-GB').substring(0, 5)}} <router-link :to="'/patient/' + appointment.PATIENTID">{{appointment.PATIENTNAME.substring(0, 1)}}{{appointment.HRN.slice(-4)}}</router-link><span v-if="appointment._CONCURRENCY > 0" class="concurrency">*<template v-if="appointment._CONCURRENCY > 1">{{appointment._CONCURRENCY}}</template></span></div> <div v-else :title="appointment._START_OBJ.toLocaleTimeString('en-GB').substring(0, 5) + '' + appointment._END_OBJ.toLocaleTimeString('en-GB').substring(0, 5) + '\n' + appointment.PATIENTNAME + ' ' + appointment.HRN.slice(-4) + '\n' + appointment.NOTE"><span v-if="appointment._CONCURRENCY > 0" class="concurrency hidden">*<template v-if="appointment._CONCURRENCY > 1">{{appointment._CONCURRENCY}}</template></span>{{appointment._START_OBJ.toLocaleTimeString('en-GB').substring(0, 5)}} <router-link :to="'/patient/' + appointment.PATIENTID">{{appointment.PATIENTNAME.substring(0, 1)}}{{appointment.HRN.slice(-4)}}</router-link><span v-if="appointment._CONCURRENCY > 0" class="concurrency">*<template v-if="appointment._CONCURRENCY > 1">{{appointment._CONCURRENCY}}</template></span></div>
@ -29,8 +31,12 @@
border: 1px solid #dee2e6; border: 1px solid #dee2e6;
} }
div.datebox { div.datebox {
cursor: default;
font-weight: bold; font-weight: bold;
} }
div.datebox.linked {
cursor: pointer;
}
div.vacancy { div.vacancy {
width: 2em; width: 2em;
margin: auto; margin: auto;