nuVistA/htdocs/RoutePatient.vue

124 lines
4.9 KiB
Vue
Raw Normal View History

2023-05-08 18:48:29 -04:00
<template>
<Subtitle value="Patient" />
2023-05-16 23:21:15 -04:00
<div v-if="(sensitive) && (!viewsensitive)" class="alert alert-danger text-center mb-3 shadow" role="alert">
2023-05-08 18:48:29 -04:00
<Subtitle value="Restricted Record" />
<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>
2023-05-16 23:21:15 -04:00
<button class="btn btn-danger" @click="viewsensitive = true">Proceed</button>
2023-05-08 18:48:29 -04:00
</div>
<template v-if="patient_info">
2023-05-08 20:19:10 -04:00
<Submenu :value="menu" />
2023-05-08 18:48:29 -04:00
<div class="card mb-3 shadow">
2023-05-16 23:21:15 -04:00
<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>
2023-05-08 18:48:29 -04:00
<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.age"><strong>Age:</strong> {{patient_info.age}}</div>
<div class="col" v-if="patient_info.sex"><strong>Sex:</strong> {{patient_info.sex}}</div>
<div class="col" v-if="patient_info.sc_percentage"><strong>SC%:</strong> {{patient_info.sc_percentage}}</div>
<div class="col" v-if="patient_info.type"><strong>Type:</strong> {{patient_info.type}}</div>
<div class="col" v-if="patient_info.ward"><strong>Ward:</strong> {{patient_info.ward}}</div>
<div class="col" v-if="patient_info.room_bed"><strong>Room/bed:</strong> {{patient_info.room_bed}}</div>
</div>
</div>
<router-view :client="client" :sensitive="sensitive" :patient_dfn="patient_dfn" :patient_info="patient_info"></router-view>
</template>
</template>
<script>
2023-05-16 23:21:15 -04:00
import cookie from './cookie.mjs';
2023-05-08 18:48:29 -04:00
import { strptime_vista } from './util.mjs';
import Subtitle from './Subtitle.vue';
2023-05-08 20:19:10 -04:00
import Submenu from './Submenu.vue';
2023-05-08 18:48:29 -04:00
export default {
components: {
2023-05-08 20:19:10 -04:00
Subtitle, Submenu
2023-05-08 18:48:29 -04:00
},
props: {
client: Object
},
data() {
return {
2023-05-16 23:21:15 -04:00
viewsensitive: false,
2023-05-08 18:48:29 -04:00
sensitive: false,
patient_dfn: null,
patient_info: null
};
},
2023-05-08 20:19:10 -04:00
computed: {
menu() {
return this.patient_info ? {
name: this.patient_info.name,
items: [
2023-05-16 23:21:15 -04:00
{ name: 'Patient', href: '/patient/' + this.patient_dfn },
{ name: 'Visits', href: '/patient/' + this.patient_dfn + '/visits' },
{ name: 'Orders', href: '/patient/' + this.patient_dfn + '/orders' },
{ name: 'Reports', href: '/patient/' + this.patient_dfn + '/reports' },
{ name: 'Documents', href: '/patient/' + this.patient_dfn + '/document' },
2023-08-09 23:12:16 -04:00
{ name: 'Consults', href: '/patient/' + this.patient_dfn + '/consult' },
2023-05-08 20:19:10 -04:00
]
} : null;
}
},
2023-05-08 18:48:29 -04:00
methods: {
2023-05-16 23:21:15 -04:00
strptime_vista
2023-05-08 18:48:29 -04:00
},
2023-05-16 23:21:15 -04:00
watch: {
'$route.params.id': {
async handler(value) {
if(value.startsWith('$')) {
var id = value.substring(1);
if(id.length == 9) {
var patient = await this.client.ORWPT_FULLSSN(id);
this.$router.replace('/patient/' + patient[0].dfn);
} else if(id.length == 5) {
var name = this.$route.query.name.toUpperCase();
var patient = await this.client.ORWPT_LAST5(id);
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(','));
2023-05-08 18:48:29 -04:00
}
}
2023-05-16 23:21:15 -04:00
}
2023-05-08 18:48:29 -04:00
},
2023-05-16 23:21:15 -04:00
created() {
this.$watch(
() => (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 }
);
2023-05-08 18:48:29 -04:00
}
};
</script>