|
@@ -53,8 +53,16 @@
|
|
<script src="/select2/select2.min.js"></script>
|
|
<script src="/select2/select2.min.js"></script>
|
|
<div id="ticketsApp" v-cloak>
|
|
<div id="ticketsApp" v-cloak>
|
|
<div class="d-flex align-items-end pb-0">
|
|
<div class="d-flex align-items-end pb-0">
|
|
- <h4 class="font-weight-bold m-0 font-size-14">Tickets</h4>
|
|
|
|
- <select class="ml-auto max-width-300px form-control form-control-sm pr-2"
|
|
|
|
|
|
+ <h4 class="font-weight-bold m-0 font-size-16">ERx / Orders</h4>
|
|
|
|
+ <select class="ml-auto max-width-200px form-control form-control-sm pr-2"
|
|
|
|
+ onchange="return fastLoad('/patients/view/{{$patient->uid}}/tickets/' + this.value, true, false, false)">
|
|
|
|
+ <option value="" {{$type === '' ? 'selected' : ''}}>All</option>
|
|
|
|
+ <option value="erx" {{$type === 'erx' ? 'selected' : ''}}>ERx</option>
|
|
|
|
+ <option value="lab" {{$type === 'lab' ? 'selected' : ''}}>Lab Orders</option>
|
|
|
|
+ <option value="imaging" {{$type === 'imaging' ? 'selected' : ''}}>Imaging Orders</option>
|
|
|
|
+ <option value="equipment" {{$type === 'equipment' ? 'selected' : ''}}>Equipment Orders</option>
|
|
|
|
+ </select>
|
|
|
|
+ <select class="ml-2 max-width-200px form-control form-control-sm pr-2"
|
|
v-model="statusFilter">
|
|
v-model="statusFilter">
|
|
<option value="open">Open tickets (@{{ numOpen }})</option>
|
|
<option value="open">Open tickets (@{{ numOpen }})</option>
|
|
<option value="closed">Closed tickets (@{{ numClosed }})</option>
|
|
<option value="closed">Closed tickets (@{{ numClosed }})</option>
|
|
@@ -62,11 +70,20 @@
|
|
</select>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- @include('app.patient.tickets.erx')
|
|
|
|
- @include('app.patient.tickets.lab')
|
|
|
|
- @include('app.patient.tickets.imaging')
|
|
|
|
- @include('app.patient.tickets.equipment')
|
|
|
|
-
|
|
|
|
|
|
+ @if($type === '' || $type === 'erx')
|
|
|
|
+ @include('app.patient.tickets.erx')
|
|
|
|
+ @endif
|
|
|
|
+ @if($type === '' || $type === 'lab')
|
|
|
|
+ @include('app.patient.tickets.lab')
|
|
|
|
+ @endif
|
|
|
|
+ @if($type === '' || $type === 'imaging')
|
|
|
|
+ @include('app.patient.tickets.imaging')
|
|
|
|
+ @endif
|
|
|
|
+ @if($type === '' || $type === 'equipment')
|
|
|
|
+ @include('app.patient.tickets.equipment')
|
|
|
|
+ @endif
|
|
|
|
+
|
|
|
|
+ @include('app.patient.tickets.ticket_send_fax_form')
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
@@ -147,6 +164,9 @@
|
|
proToUpdate: '',
|
|
proToUpdate: '',
|
|
proTypes: ['Assigned', 'Manager', 'Initiating', 'Ordering'],
|
|
proTypes: ['Assigned', 'Manager', 'Initiating', 'Ordering'],
|
|
newProUid: '',
|
|
newProUid: '',
|
|
|
|
+ faxes: [],
|
|
|
|
+ loadingFaxes: false,
|
|
|
|
+ faxNumber: '',
|
|
reloading: false,
|
|
reloading: false,
|
|
comment: '',
|
|
comment: '',
|
|
preparing: false,
|
|
preparing: false,
|
|
@@ -199,6 +219,8 @@
|
|
// common show popup
|
|
// common show popup
|
|
preparePopup: function(_type, _item) {
|
|
preparePopup: function(_type, _item) {
|
|
this.preparing = true;
|
|
this.preparing = true;
|
|
|
|
+ this.loadingFaxes = true;
|
|
|
|
+ this.faxes = [];
|
|
this[_type + 'PopupMode'] = _item ? 'edit' : 'add';
|
|
this[_type + 'PopupMode'] = _item ? 'edit' : 'add';
|
|
this[_type + 'PopupItem'] = _item ? JSON.parse(JSON.stringify(_item)) : JSON.parse(JSON.stringify(this[_type + 'Model']));
|
|
this[_type + 'PopupItem'] = _item ? JSON.parse(JSON.stringify(_item)) : JSON.parse(JSON.stringify(this[_type + 'Model']));
|
|
this[_type + 'PopupItem'].assigned_pro_uid = '';
|
|
this[_type + 'PopupItem'].assigned_pro_uid = '';
|
|
@@ -211,6 +233,24 @@
|
|
}
|
|
}
|
|
this.comment = '';
|
|
this.comment = '';
|
|
this.preparing = false;
|
|
this.preparing = false;
|
|
|
|
+
|
|
|
|
+ // load tickets
|
|
|
|
+ if(_item) {
|
|
|
|
+ $.get('/get-ticket-faxes/' + _item.uid, (_data) => {
|
|
|
|
+ this.faxes = _data;
|
|
|
|
+ this.loadingFaxes = false;
|
|
|
|
+ }, 'json')
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this.loadingFaxes = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // empty additional items
|
|
|
|
+ if((!this[_type + 'PopupItem'].data.items || !this[_type + 'PopupItem'].data.items.length) ||
|
|
|
|
+ (!_item && _type === 'erx' && this[_type + 'PopupItem'].data.items.length === 1)) {
|
|
|
|
+ this[_type + 'PopupItem'].data.items = [];
|
|
|
|
+ }
|
|
|
|
+
|
|
},
|
|
},
|
|
reinitProSuggest: function() {
|
|
reinitProSuggest: function() {
|
|
$('#ticketsApp [pro-suggest-initialized]').removeAttr('pro-suggest-initialized');
|
|
$('#ticketsApp [pro-suggest-initialized]').removeAttr('pro-suggest-initialized');
|
|
@@ -288,7 +328,10 @@
|
|
(_data) => {
|
|
(_data) => {
|
|
console.log(_data);
|
|
console.log(_data);
|
|
if(!_autoSave) {
|
|
if(!_autoSave) {
|
|
- fastReload();
|
|
|
|
|
|
+ if(_data.data) {
|
|
|
|
+ window.localStorage.autoOpen = 'erx|' + _data.data;
|
|
|
|
+ fastReload();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
this.reloadPopupItem('erx');
|
|
this.reloadPopupItem('erx');
|
|
@@ -338,7 +381,10 @@
|
|
(_data) => {
|
|
(_data) => {
|
|
console.log(_data);
|
|
console.log(_data);
|
|
if(!_autoSave) {
|
|
if(!_autoSave) {
|
|
- fastReload();
|
|
|
|
|
|
+ if(_data.data) {
|
|
|
|
+ window.localStorage.autoOpen = 'lab|' + _data.data;
|
|
|
|
+ fastReload();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
this.reloadPopupItem('lab');
|
|
this.reloadPopupItem('lab');
|
|
@@ -390,7 +436,10 @@
|
|
(_data) => {
|
|
(_data) => {
|
|
console.log(_data);
|
|
console.log(_data);
|
|
if(!_autoSave) {
|
|
if(!_autoSave) {
|
|
- fastReload();
|
|
|
|
|
|
+ if(_data.data) {
|
|
|
|
+ window.localStorage.autoOpen = 'imaging|' + _data.data;
|
|
|
|
+ fastReload();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
this.reloadPopupItem('imaging');
|
|
this.reloadPopupItem('imaging');
|
|
@@ -442,7 +491,10 @@
|
|
(_data) => {
|
|
(_data) => {
|
|
console.log(_data);
|
|
console.log(_data);
|
|
if(!_autoSave) {
|
|
if(!_autoSave) {
|
|
- fastReload();
|
|
|
|
|
|
+ if(_data.data) {
|
|
|
|
+ window.localStorage.autoOpen = 'equipment|' + _data.data;
|
|
|
|
+ fastReload();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
this.reloadPopupItem('equipment');
|
|
this.reloadPopupItem('equipment');
|
|
@@ -502,6 +554,80 @@
|
|
this.reloadPopupItem(this.currentCategory);
|
|
this.reloadPopupItem(this.currentCategory);
|
|
}, 'json');
|
|
}, 'json');
|
|
},
|
|
},
|
|
|
|
+ showSendFaxPopup: function() {
|
|
|
|
+ this.faxNumber = this[this.currentCategory + 'PopupItem'].data.pharmacyFax;
|
|
|
|
+ Vue.nextTick(() => {
|
|
|
|
+ showStagPopup('send-fax-popup');
|
|
|
|
+ this.sendFaxModalPDFPreview();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ sendFaxModalPDFPreview: function() {
|
|
|
|
+
|
|
|
|
+ let _loadedPDF = null, _numPages = 1, _page = 1;
|
|
|
|
+
|
|
|
|
+ function _load(_url) {
|
|
|
|
+
|
|
|
|
+ _loadedPDF = null;
|
|
|
|
+ _numPages = 1;
|
|
|
|
+ _page = 1;
|
|
|
|
+
|
|
|
|
+ $('#send-fax-pdf-preview>canvas').remove();
|
|
|
|
+
|
|
|
|
+ let url = _url;
|
|
|
|
+ let pdfjsLib = window['pdfjs-dist/build/pdf'];
|
|
|
|
+ pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js';
|
|
|
|
+ let loadingTask = pdfjsLib.getDocument(url);
|
|
|
|
+ loadingTask.promise.then(function (pdf) {
|
|
|
|
+ _numPages = pdf.numPages;
|
|
|
|
+ _loadedPDF = pdf;
|
|
|
|
+ _page = 1;
|
|
|
|
+ _render();
|
|
|
|
+ }, function (reason) {
|
|
|
|
+ // reason.message;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ function _render() {
|
|
|
|
+
|
|
|
|
+ _loadedPDF.getPage(_page).then(function (page) {
|
|
|
|
+
|
|
|
|
+ // create canvas
|
|
|
|
+ let canvasElement = $('<canvas/>')
|
|
|
|
+ .addClass('pdf-viewer-page pdf-preview-page')
|
|
|
|
+ .appendTo('#send-fax-pdf-preview');
|
|
|
|
+
|
|
|
|
+ let canvas = canvasElement[0];
|
|
|
|
+ let viewport = page.getViewport({scale: 0.75});
|
|
|
|
+ let context = canvas.getContext('2d');
|
|
|
|
+ canvas.height = viewport.height;
|
|
|
|
+ canvas.width = viewport.width;
|
|
|
|
+ const $canvas = $(canvas);
|
|
|
|
+ let renderContext = {
|
|
|
|
+ canvasContext: context,
|
|
|
|
+ viewport: viewport
|
|
|
|
+ };
|
|
|
|
+ let renderTask = page.render(renderContext);
|
|
|
|
+ renderTask.promise.then(function () {
|
|
|
|
+ if(_page < _numPages) {
|
|
|
|
+ _page++;
|
|
|
|
+ _render();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ _load('/ticket-download-as-pdf/' + this[this.currentCategory + 'PopupItem'].uid);
|
|
|
|
+ },
|
|
|
|
+ sendFax: function(_item) {
|
|
|
|
+ $.post('/api/ticketFax/create', {
|
|
|
|
+ faxNumber: this.faxNumber,
|
|
|
|
+ ticketUid: this[this.currentCategory + 'PopupItem'].uid
|
|
|
|
+ },
|
|
|
|
+ (_data) => {
|
|
|
|
+ this.reloadPopupItem(this.currentCategory);
|
|
|
|
+ closeStagPopup();
|
|
|
|
+ },
|
|
|
|
+ 'json');
|
|
|
|
+ },
|
|
signAsOrderingPro: function(_item) {
|
|
signAsOrderingPro: function(_item) {
|
|
$.post('/api/ticket/signAsOrderingPro', {
|
|
$.post('/api/ticket/signAsOrderingPro', {
|
|
uid: _item.uid
|
|
uid: _item.uid
|
|
@@ -552,8 +678,18 @@
|
|
randPart = Math.ceil(Math.random() * 1000000),
|
|
randPart = Math.ceil(Math.random() * 1000000),
|
|
dynID = 'rx-' + randPart;
|
|
dynID = 'rx-' + randPart;
|
|
$(elem).attr('id', dynID);
|
|
$(elem).attr('id', dynID);
|
|
- var strengthElem = $(elem).closest('.stag-popup').find('[data-field="strength"]')[0],
|
|
|
|
- dynStrengthsID = 'rx-' + randPart + '-strengths';
|
|
|
|
|
|
+ var dynStrengthsID = 'rx-' + randPart + '-strengths';
|
|
|
|
+ var strengthElem = null;
|
|
|
|
+ if($(elem).closest('.erx-line-item').length) {
|
|
|
|
+ strengthElem = $(elem).closest('.erx-line-item').find('[data-field="strength"]')[0]
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ strengthElem = $(elem).closest('.stag-popup').find('[data-field="strength"]')[0]
|
|
|
|
+ }
|
|
|
|
+ var lineItemIndex = -1;
|
|
|
|
+ if($(elem).is('[data-index]')) {
|
|
|
|
+ lineItemIndex = $(elem).attr('data-index');
|
|
|
|
+ }
|
|
$(strengthElem).attr('id', dynStrengthsID);
|
|
$(strengthElem).attr('id', dynStrengthsID);
|
|
$(strengthElem).attr('rx-id', dynID);
|
|
$(strengthElem).attr('rx-id', dynID);
|
|
new window.Def.Autocompleter.Prefetch(dynStrengthsID, [], {matchListValue: false});
|
|
new window.Def.Autocompleter.Prefetch(dynStrengthsID, [], {matchListValue: false});
|
|
@@ -565,11 +701,21 @@
|
|
if (strengths) {
|
|
if (strengths) {
|
|
strengthElem.autocomp.setListAndField(strengths, '');
|
|
strengthElem.autocomp.setListAndField(strengths, '');
|
|
}
|
|
}
|
|
- self.erxPopupItem.data.medication = $(elem).val();
|
|
|
|
|
|
+ if(lineItemIndex === -1) {
|
|
|
|
+ self.erxPopupItem.data.medication = $(elem).val();
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ self.erxPopupItem.data.items[lineItemIndex].medication = $(elem).val();
|
|
|
|
+ }
|
|
});
|
|
});
|
|
window.Def.Autocompleter.Event.observeListSelections(dynStrengthsID, function() {
|
|
window.Def.Autocompleter.Event.observeListSelections(dynStrengthsID, function() {
|
|
var autocomp = elem.autocomp, acData = autocomp.getSelectedItemData();
|
|
var autocomp = elem.autocomp, acData = autocomp.getSelectedItemData();
|
|
- self.erxPopupItem.data.strength = $(strengthElem).val();
|
|
|
|
|
|
+ if(lineItemIndex === -1) {
|
|
|
|
+ self.erxPopupItem.data.strength = $(strengthElem).val();
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ self.erxPopupItem.data.items[lineItemIndex].strength = $(strengthElem).val();
|
|
|
|
+ }
|
|
});
|
|
});
|
|
$(elem).attr('ac-initialized', 1);
|
|
$(elem).attr('ac-initialized', 1);
|
|
$(strengthElem).attr('ac-initialized', 1);
|
|
$(strengthElem).attr('ac-initialized', 1);
|
|
@@ -592,7 +738,7 @@
|
|
$('#ticketsApp [stag-popup-key="erx-popup"] input[type="text"][data-field="icd"]:not([ac-initialized])').each(function() {
|
|
$('#ticketsApp [stag-popup-key="erx-popup"] input[type="text"][data-field="icd"]:not([ac-initialized])').each(function() {
|
|
var elem = this,
|
|
var elem = this,
|
|
dynID = 'icd-' + Math.ceil(Math.random() * 1000000),
|
|
dynID = 'icd-' + Math.ceil(Math.random() * 1000000),
|
|
- vueIndex = $(this).attr('data-index');
|
|
|
|
|
|
+ vueIndex = $(this).is('[data-index]') ? $(this).attr('data-index') : -1;
|
|
$(elem).attr('id', dynID);
|
|
$(elem).attr('id', dynID);
|
|
new window.Def.Autocompleter.Search(dynID,
|
|
new window.Def.Autocompleter.Search(dynID,
|
|
'https://clinicaltables.nlm.nih.gov/api/icd10cm/v3/search?sf=code,name&ef=name', {
|
|
'https://clinicaltables.nlm.nih.gov/api/icd10cm/v3/search?sf=code,name&ef=name', {
|
|
@@ -603,7 +749,12 @@
|
|
);
|
|
);
|
|
window.Def.Autocompleter.Event.observeListSelections(dynID, function() {
|
|
window.Def.Autocompleter.Event.observeListSelections(dynID, function() {
|
|
let autocomp = elem.autocomp, acData = autocomp.getSelectedItemData();
|
|
let autocomp = elem.autocomp, acData = autocomp.getSelectedItemData();
|
|
- self.erxPopupItem.data.purpose = acData[0].code + ' - ' + acData[0].data.name;
|
|
|
|
|
|
+ if(vueIndex === -1) {
|
|
|
|
+ self.erxPopupItem.data.purpose = acData[0].code + ' - ' + acData[0].data.name;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ self.erxPopupItem.data.items[vueIndex].purpose = acData[0].code + ' - ' + acData[0].data.name;
|
|
|
|
+ }
|
|
return false;
|
|
return false;
|
|
});
|
|
});
|
|
$(elem).attr('ac-initialized', 1);
|
|
$(elem).attr('ac-initialized', 1);
|
|
@@ -653,6 +804,25 @@
|
|
$(elem).attr('ac-initialized', 1);
|
|
$(elem).attr('ac-initialized', 1);
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ addERxLineItem: function() {
|
|
|
|
+ this.erxPopupItem.data.items.push({
|
|
|
|
+ medication: '',
|
|
|
|
+ strength: '',
|
|
|
|
+ amount: '',
|
|
|
|
+ route: '',
|
|
|
|
+ frequency: '',
|
|
|
|
+ dispense: '',
|
|
|
|
+ refills: '',
|
|
|
|
+ purpose: '',
|
|
|
|
+ });
|
|
|
|
+ Vue.nextTick(() => {
|
|
|
|
+ this.initRxAutoSuggest();
|
|
|
|
+ this.erxInitICDAutoSuggest();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ removeERxLineItem: function(_index) {
|
|
|
|
+ this.erxPopupItem.data.items.splice(_index, 1);
|
|
|
|
+ },
|
|
initDomElementEvents: function() {
|
|
initDomElementEvents: function() {
|
|
let self = this;
|
|
let self = this;
|
|
$(document).off('pro-changed', '#ticketsApp select[provider-search]')
|
|
$(document).off('pro-changed', '#ticketsApp select[provider-search]')
|
|
@@ -736,15 +906,34 @@
|
|
_item.pharmacyFax,*/
|
|
_item.pharmacyFax,*/
|
|
].filter(Boolean).join(', ');
|
|
].filter(Boolean).join(', ');
|
|
},
|
|
},
|
|
- @include('app.patient.tickets.pharmacy-suggest')
|
|
|
|
|
|
+ initAutoOpen: function() {
|
|
|
|
+ if(window.localStorage.autoOpen) {
|
|
|
|
+ var parts = window.localStorage.autoOpen.split('|');
|
|
|
|
+ if(parts.length === 2 && this.ticketsByType[parts[0]]) {
|
|
|
|
+ for (let i = 0; i < this.ticketsByType[parts[0]].length; i++) {
|
|
|
|
+ if(this.ticketsByType[parts[0]][i].uid === parts[1]) {
|
|
|
|
+ this[parts[0] + 'ShowPopup'](this.ticketsByType[parts[0]][i]);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ window.localStorage.autoOpen = '';
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ @include('app.patient.tickets.pharmacy-suggest', ['category' => 'erx'])
|
|
|
|
+ @include('app.patient.tickets.pharmacy-suggest', ['category' => 'lab'])
|
|
|
|
+ @include('app.patient.tickets.pharmacy-suggest', ['category' => 'imaging'])
|
|
@include('app.patient.tickets.ticket_vue_methods')
|
|
@include('app.patient.tickets.ticket_vue_methods')
|
|
},
|
|
},
|
|
mounted: function () {
|
|
mounted: function () {
|
|
this.initRxAutoSuggest();
|
|
this.initRxAutoSuggest();
|
|
this.erxInitICDAutoSuggest();
|
|
this.erxInitICDAutoSuggest();
|
|
this.labInitICDAutoSuggest();
|
|
this.labInitICDAutoSuggest();
|
|
- this.initPharmacySearch();
|
|
|
|
|
|
+ this.erxInitPharmacySearch();
|
|
|
|
+ this.labInitPharmacySearch();
|
|
|
|
+ this.imagingInitPharmacySearch();
|
|
this.initDomElementEvents();
|
|
this.initDomElementEvents();
|
|
|
|
+ this.initAutoOpen();
|
|
|
|
|
|
<?php for ($i=0; $i<count($categories); $i++) { ?>
|
|
<?php for ($i=0; $i<count($categories); $i++) { ?>
|
|
this.{{ $categories[$i] }}AutoSave = debounce(() => {
|
|
this.{{ $categories[$i] }}AutoSave = debounce(() => {
|
|
@@ -758,5 +947,4 @@
|
|
addMCInitializer('patient-tickets', init, '#ticketsApp');
|
|
addMCInitializer('patient-tickets', init, '#ticketsApp');
|
|
})();
|
|
})();
|
|
</script>
|
|
</script>
|
|
-
|
|
|
|
@endsection
|
|
@endsection
|