|
@@ -244,6 +244,13 @@
|
|
else {
|
|
else {
|
|
this.loadingFaxes = false;
|
|
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');
|
|
@@ -602,8 +609,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});
|
|
@@ -615,11 +632,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);
|
|
@@ -642,7 +669,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', {
|
|
@@ -653,7 +680,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);
|
|
@@ -703,6 +735,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]')
|