|
@@ -0,0 +1,234 @@
|
|
|
+@extends ('layouts.patient')
|
|
|
+
|
|
|
+@section('inner-content')
|
|
|
+ <div id="prescriptions-{{$patient->id}}">
|
|
|
+ <div class="d-flex align-items-baseline pt-2">
|
|
|
+ <h6 class="my-0 font-weight-bold text-secondary">Prescriptions</h6>
|
|
|
+ <span class="mx-2 text-secondary">|</span>
|
|
|
+ <a v-on:click.prevent="newPrescription('DRUG')">+ Drug</a>
|
|
|
+ </div>
|
|
|
+ <table class="table table-striped table-sm table-bordered mt-2 mb-0">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0">Created</th>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0">Type</th>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0">Clinical</th>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0">Logistics</th>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0">Prescriber</th>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0">Pro Status</th>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0">Client Status</th>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0">Sign</th>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0"></th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr v-for="(prescription, index) in prescriptions">
|
|
|
+ <td class="px-2">@{{prescription.created_at_friendly}}</td>
|
|
|
+ <td class="px-2">@{{prescription.erx_category}}</td>
|
|
|
+ <td class="px-2">
|
|
|
+ <div class="d-flex align-items-baseline">
|
|
|
+ <a class="mr-2" href="#" v-on:click.prevent="editClinicalDetails(prescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
|
|
|
+ <div v-if="prescription.clinical_detail_json" class="d-inline-flex align-items-baseline">
|
|
|
+ <div class="d-flex align-items-baseline">
|
|
|
+ <b class="mr-2">@{{prescription.clinical_detail_json.medication ?? '-'}}</b>
|
|
|
+ <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.strength ?? '-'}}</span>
|
|
|
+ <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.amount ?? '-'}}</span>
|
|
|
+ <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.route ?? '-'}}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-else>-</div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td class="px-2">
|
|
|
+ <div class="d-flex align-items-baseline">
|
|
|
+ <a class="mr-2" href="#" v-on:click.prevent="editLogisticsDetails(prescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
|
|
|
+ <div v-if="prescription.logistics_detail_json" class="d-flex align-items-baseline">
|
|
|
+ <div class="d-flex align-items-baseline">
|
|
|
+ <b class="mr-2">@{{prescription.logistics_detail_json.facilityName ?? '-'}}</b>
|
|
|
+ <span class="text-secondary mr-1">@{{prescription.logistics_detail_json.facilityCity ?? '-'}}</span>
|
|
|
+ <span class="text-secondary mr-1">@{{prescription.logistics_detail_json.facilityState ?? '-'}}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-else>-</div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td class="px-2">@{{prescription.hcpProDisplayName}}</td>
|
|
|
+ <td class="px-2">@{{prescription.pro_declared_status}}</td>
|
|
|
+ <td class="px-2">@{{prescription.client_declared_status}}</td>
|
|
|
+ <td class="px-2"></td>
|
|
|
+ <td class="px-2"></td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ @include('app.patient.prescriptions.drug-form')
|
|
|
+ @include('app.patient.prescriptions.logistics-form')
|
|
|
+ </div>
|
|
|
+ <script>
|
|
|
+ (function() {
|
|
|
+
|
|
|
+ <?php
|
|
|
+ $prescriptions = $patient->prescriptions;
|
|
|
+ foreach ($prescriptions as $prescription) {
|
|
|
+ if($prescription->clinical_detail_json) {
|
|
|
+ $prescription->clinical_detail_json = json_decode($prescription->clinical_detail_json);
|
|
|
+ }
|
|
|
+ if($prescription->logistics_detail_json) {
|
|
|
+ $prescription->logistics_detail_json = json_decode($prescription->logistics_detail_json);
|
|
|
+ }
|
|
|
+ $prescription->created_at_friendly = friendlier_date_time($prescription->created_at);
|
|
|
+ $prescription->hcpProDisplayName = $prescription->hcpPro ? $prescription->hcpPro->displayName() : '-';
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+
|
|
|
+ function init() {
|
|
|
+
|
|
|
+ new Vue({
|
|
|
+ el: '#prescriptions-{{$patient->id}}',
|
|
|
+ delimiters: ['@{{', '}}'],
|
|
|
+ data: {
|
|
|
+ prescriptions: <?= json_encode($prescriptions) ?>,
|
|
|
+
|
|
|
+ currentPrescriptionAction: '',
|
|
|
+ currentPrescriptionType: '',
|
|
|
+ currentPrescription_DRUG: {
|
|
|
+ noteUid: null, // TODO: this won't be null if created from a note
|
|
|
+ clientUid: '{{ $patient->uid }}',
|
|
|
+ replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
|
|
|
+ hcpProUid: '{{$pro->uid}}',
|
|
|
+ erxCategory: 'DRUG',
|
|
|
+ clinicalDetailJson: {
|
|
|
+ medication: '',
|
|
|
+ strength: '',
|
|
|
+ amount: '',
|
|
|
+ route: '',
|
|
|
+ frequency: '',
|
|
|
+ dispense: '',
|
|
|
+ refills: '',
|
|
|
+ purpose: '',
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ currentPrescriptionLogistics: {
|
|
|
+ uid: '',
|
|
|
+ logisticsDetailJson: {
|
|
|
+ facilityName: '',
|
|
|
+ facilityCity: '',
|
|
|
+ facilityState: '',
|
|
|
+ facilityAddressMemo: '',
|
|
|
+ facilityPhone: '',
|
|
|
+ facilityFax: '',
|
|
|
+ facilityZip: '',
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+
|
|
|
+ // new/edit/save-clinical
|
|
|
+ newPrescription: function(_type) {
|
|
|
+ this.currentPrescriptionAction = 'ADD';
|
|
|
+ this.currentPrescriptionType = _type;
|
|
|
+ if (_type === 'DRUG') {
|
|
|
+ this.currentPrescription_DRUG = {
|
|
|
+ noteUid: null, // TODO: this won't be null if created from a note
|
|
|
+ clientUid: '{{ $patient->uid }}',
|
|
|
+ replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
|
|
|
+ hcpProUid: '{{$pro->uid}}',
|
|
|
+ erxCategory: 'DRUG',
|
|
|
+ clinicalDetailJson: {
|
|
|
+ medication: '',
|
|
|
+ strength: '',
|
|
|
+ amount: '',
|
|
|
+ route: '',
|
|
|
+ frequency: '',
|
|
|
+ dispense: '',
|
|
|
+ refills: '',
|
|
|
+ purpose: '',
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Vue.nextTick(() => {
|
|
|
+ showStagPopup('prescription-popup-' + this.currentPrescriptionType, true);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ editClinicalDetails: function(_prescription) {
|
|
|
+ this.currentPrescriptionAction = 'EDIT_CLINICAL';
|
|
|
+ this.currentPrescriptionType = _prescription.erx_category;
|
|
|
+ if (this.currentPrescriptionType === 'DRUG') {
|
|
|
+ this.currentPrescription_DRUG = {
|
|
|
+ uid: _prescription.uid,
|
|
|
+ clinicalDetailJson: JSON.parse(JSON.stringify(_prescription.clinical_detail_json))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Vue.nextTick(() => {
|
|
|
+ showStagPopup('prescription-popup-' + this.currentPrescriptionType, true);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ savePrescription: function() {
|
|
|
+ let payload = JSON.parse(JSON.stringify(this['currentPrescription_' + this.currentPrescriptionType]));
|
|
|
+ payload.clinicalDetailJson = JSON.stringify(payload.clinicalDetailJson);
|
|
|
+ switch (this.currentPrescriptionAction) {
|
|
|
+ case 'ADD':
|
|
|
+ $.post('/api/erx/create', payload, _data => {
|
|
|
+ if(!hasResponseError(_data)) {
|
|
|
+ toastr.success('Prescription added');
|
|
|
+ closeStagPopup();
|
|
|
+ fastReload();
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+ break;
|
|
|
+ case 'EDIT_CLINICAL':
|
|
|
+ $.post('/api/erx/updateClinicalDetail', payload, _data => {
|
|
|
+ if(!hasResponseError(_data)) {
|
|
|
+ toastr.success('Prescription updated');
|
|
|
+ closeStagPopup();
|
|
|
+ fastReload();
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // edit logistics
|
|
|
+ editLogisticsDetails: function(_prescription) {
|
|
|
+ this.currentPrescriptionAction = 'EDIT_LOGISTICS';
|
|
|
+ this.currentPrescriptionLogistics = {
|
|
|
+ uid: _prescription.uid,
|
|
|
+ logisticsDetailJson: _prescription.logistics_detail_json ? JSON.parse(JSON.stringify(_prescription.logistics_detail_json)) : {
|
|
|
+ facilityName: '',
|
|
|
+ facilityCity: '',
|
|
|
+ facilityState: '',
|
|
|
+ facilityAddressMemo: '',
|
|
|
+ facilityPhone: '',
|
|
|
+ facilityFax: '',
|
|
|
+ facilityZip: '',
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Vue.nextTick(() => {
|
|
|
+ showStagPopup('logistics-popup', true);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ saveLogistics: function() {
|
|
|
+ let payload = JSON.parse(JSON.stringify(this.currentPrescriptionLogistics));
|
|
|
+ payload.logisticsDetailJson = JSON.stringify(payload.logisticsDetailJson);
|
|
|
+ $.post('/api/erx/updateLogisticsDetail', payload, _data => {
|
|
|
+ if(!hasResponseError(_data)) {
|
|
|
+ toastr.success('Logistics updated');
|
|
|
+ closeStagPopup();
|
|
|
+ fastReload();
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+ }
|
|
|
+
|
|
|
+ // edit hcp (ordering) pro
|
|
|
+
|
|
|
+ },
|
|
|
+ mounted: function() {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ addMCInitializer('prescriptions-{{$patient->id}}', init, '#prescriptions-{{$patient->id}}')
|
|
|
+ }).call(window);
|
|
|
+ </script>
|
|
|
+@endsection
|