Patient visits page

This commit is contained in:
Jiang Yio 2023-04-24 21:23:35 -04:00
parent 2ecce6be8c
commit 1d68749525
5 changed files with 140 additions and 0 deletions

View File

@ -14,6 +14,7 @@
import RouteSchedule from './RouteSchedule.vue';
import RoutePatientLookup from './RoutePatientLookup.vue';
import RoutePatientDetail from './RoutePatientDetail.vue';
import RoutePatientVisits from './RoutePatientVisits.vue';
import RouteScheduleOverview from './RouteScheduleOverview.vue';
import RouteRecall from './RouteRecall.vue';
@ -42,6 +43,7 @@
{ path: '/', component: RouteSchedule },
{ path: '/patient', component: RoutePatientLookup },
{ path: '/patient/:id', component: RoutePatientDetail },
{ path: '/patient/:id/visits', component: RoutePatientVisits },
{ path: '/overview', component: RouteScheduleOverview },
{ path: '/recall', component: RouteRecall },
].forEach(route => this.$root.$router.addRoute(route));

View File

@ -13,6 +13,11 @@
<li class="nav-item">
<router-link class="nav-link" to="/patient">Patient</router-link>
</li>
<template v-if="($route.matched.length > 0) && ($route.matched[0].path == '/patient/:id')">
<li class="nav-item">
<router-link class="nav-link" :to="'/patient/' + $route.params.id + '/visits'">Visits</router-link>
</li>
</template>
<li class="nav-item">
<router-link class="nav-link" to="/overview">Overview</router-link>
</li>

View File

@ -0,0 +1,77 @@
<template>
<div v-if="(sensitive) && (!info)" class="alert alert-danger text-center mb-3 shadow" role="alert">
<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>
<router-link class="btn btn-danger" :to="'/patient/' + dfn + '/orders?viewsensitive'">Proceed</router-link>
</div>
<div v-if="info">
<div class="card mb-3 shadow">
<div class="card-header">{{info.name}} <span :title="info.pid">{{info.pid.slice(-4)}}</span> #{{dfn}}</div>
<div class="card-body row" style="font-family: monospace;">
<div class="col" v-if="info.dob"><strong>DOB:</strong> {{strptime_vista(info.dob).toLocaleDateString('sv-SE')}}</div>
<div class="col" v-if="info.age"><strong>Age:</strong> {{info.age}}</div>
<div class="col" v-if="info.sex"><strong>Sex:</strong> {{info.sex}}</div>
<div class="col" v-if="info.sc_percentage"><strong>SC%:</strong> {{info.sc_percentage}}</div>
<div class="col" v-if="info.type"><strong>Type:</strong> {{info.type}}</div>
<div class="col" v-if="info.ward"><strong>Ward:</strong> {{info.ward}}</div>
<div class="col" v-if="info.room_bed"><strong>Room/bed:</strong> {{info.room_bed}}</div>
</div>
</div>
<div class="card mb-3 shadow">
<div class="card-header d-flex justify-content-between align-items-center">
<span>Visits</span>
<DateRangePicker range="6M" direction="-1" v-model:date="visits_date" v-model:date_end="visits_date_begin" />
</div>
<div class="card-body"><ViewVisits :client="client" :dfn="dfn" :date_begin="visits_date_begin" :date_end="visits_date" /></div>
</div>
</div>
</template>
<script>
import { strptime_vista } from './util.mjs';
import DateRangePicker from './DateRangePicker.vue';
import OrderFilterPicker from './OrderFilterPicker.vue';
import ViewVisits from './ViewVisits.vue';
var now = new Date();
export default {
components: {
DateRangePicker, OrderFilterPicker, ViewVisits
},
props: {
client: Object
},
data() {
return {
dfn: null,
sensitive: false,
info: null,
orders_filter: 2,
visits_date: now,
visits_date_begin: now
};
},
watch: {
info(value) {
if((value) && (value.name)) document.title = value.name;
}
},
methods: {
strptime_vista,
async loadinfo(dfn, viewsensitive) {
this.dfn = dfn;
this.sensitive = viewsensitive ? false : await this.client.ORWPT_SELCHK(dfn);
this.info = this.sensitive ? null : await this.client.ORWPT16_ID_INFO(dfn);
}
},
async mounted() {
this.loadinfo(this.$route.params.id, this.$route.query.hasOwnProperty('viewsensitive'));
},
async beforeRouteUpdate(to, from, next) {
this.loadinfo(to.params.id, to.query.hasOwnProperty('viewsensitive'));
next();
}
};
</script>

54
htdocs/ViewVisits.vue Normal file
View File

@ -0,0 +1,54 @@
<template>
<table v-if="resultset.length > 0" class="table table-striped">
<thead>
<tr>
<th>Date/Time</th>
<th>Location</th>
<th style="text-align: right;">Status</th>
</tr>
</thead>
<tbody>
<tr v-for="item in resultset">
<td>{{item.timestr}} {{item.datestr}}</td>
<td>{{item.location}}</td>
<td style="text-align: right;">{{item.status}}</td>
</tr>
</tbody>
</table>
</template>
<script>
import { strftime_vista, strptime_vista } from './util.mjs';
export default {
props: {
client: Object,
dfn: String,
date_begin: Date,
date_end: Date
},
data() {
return {
resultset: []
};
},
computed: {
params() {
return { dfn: this.dfn, date_begin: strftime_vista(this.date_begin), date_end: strftime_vista(this.date_end) };
}
},
watch: {
async params(value) {
try {
this.resultset = (await this.client.ORWCV_VST(value.dfn, value.date_begin, value.date_end, '')).map(item => Object.assign({
datestr: strptime_vista(item.datetime).toLocaleDateString('sv-SE'),
timestr: strptime_vista(item.datetime).toLocaleTimeString('en-GB')
}, item));
} catch(ex) {
this.resultset = [];
console.warn(ex);
}
}
}
};
</script>

View File

@ -209,6 +209,8 @@ export function Client(cid, secret) {
this.TIU_TEMPLATE_LOCK = unwrapped(logged((...args) => this.callctx(['OR CPRS GUI CHART'], 'TIU_TEMPLATE_LOCK', ...args), 'TIU_TEMPLATE_LOCK'));
this.TIU_TEMPLATE_UNLOCK = unwrapped(logged((...args) => this.callctx(['OR CPRS GUI CHART'], 'TIU_TEMPLATE_UNLOCK', ...args), 'TIU_TEMPLATE_UNLOCK'));
this.ORWCV_VST = memoized(caretseparated(unwrapped(logged((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWCV_VST', ...args), 'ORWCV_VST')), ['apptinfo', 'datetime', 'location', 'status']));
return this;
}
Client._registry = {};