|
@@ -42,7 +42,7 @@
|
|
<tbody>
|
|
<tbody>
|
|
<tr v-for="(prescription, index) in prescriptions" :class="currentPrescription && currentPrescription.id === prescription.id ? 'bg-aliceblue' : ''">
|
|
<tr v-for="(prescription, index) in prescriptions" :class="currentPrescription && currentPrescription.id === prescription.id ? 'bg-aliceblue' : ''">
|
|
<td class="px-2">
|
|
<td class="px-2">
|
|
- <a href="#" v-on:click.prevent="currentPrescription=prescription"
|
|
|
|
|
|
+ <a href="#" v-on:click.prevent="setCurrentPrescription(prescription)"
|
|
:class="currentPrescription && currentPrescription.id === prescription.id ? 'font-weight-bold' : ''">@{{prescription.created_at_friendly_short}}</a>
|
|
:class="currentPrescription && currentPrescription.id === prescription.id ? 'font-weight-bold' : ''">@{{prescription.created_at_friendly_short}}</a>
|
|
@if(@$note)
|
|
@if(@$note)
|
|
<div v-if="prescription.note_id === {{$note->id}}" class="text-info mt-1">* Create on this note</div>
|
|
<div v-if="prescription.note_id === {{$note->id}}" class="text-info mt-1">* Create on this note</div>
|
|
@@ -115,7 +115,7 @@
|
|
<h3 class="font-size-16 m-0">
|
|
<h3 class="font-size-16 m-0">
|
|
<span class="mr-1 font-size-16">@{{ currentPrescription.erx_category }} / @{{ currentPrescription.created_at_friendly_short }}</span>
|
|
<span class="mr-1 font-size-16">@{{ currentPrescription.erx_category }} / @{{ currentPrescription.created_at_friendly_short }}</span>
|
|
</h3>
|
|
</h3>
|
|
- <a class="ml-auto" href="#" v-on:click.prevent="currentPrescription=null">
|
|
|
|
|
|
+ <a class="ml-auto" href="#" v-on:click.prevent="setCurrentPrescription(null)">
|
|
<i class="fa fa-times-circle on-hover-opaque"></i>
|
|
<i class="fa fa-times-circle on-hover-opaque"></i>
|
|
</a>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
@@ -193,9 +193,9 @@
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="d-flex align-items-baseline">
|
|
<div class="d-flex align-items-baseline">
|
|
- <a href="#" v-on:click.prevent="addDrugToErxMode='existing'">+ Existing Medication</a>
|
|
|
|
|
|
+ <a href="#" v-on:click.prevent="setAddMode('existing')">+ Existing Medication</a>
|
|
<span class="mx-2">|</span>
|
|
<span class="mx-2">|</span>
|
|
- <a href="#" v-on:click.prevent="addDrugToErxMode='new'">+ New Medication</a>
|
|
|
|
|
|
+ <a href="#" v-on:click.prevent="setAddMode('new')">+ New Medication</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -203,7 +203,7 @@
|
|
<div v-if="addDrugToErxMode === 'existing'" class="border border-info p-2 bg-aliceblue mb-2 rounded">
|
|
<div v-if="addDrugToErxMode === 'existing'" class="border border-info p-2 bg-aliceblue mb-2 rounded">
|
|
<div class="d-flex align-items-baseline mb-2">
|
|
<div class="d-flex align-items-baseline mb-2">
|
|
<label for="" class="text-secondary font-weight-bold m-0">Add From Existing Medications</label>
|
|
<label for="" class="text-secondary font-weight-bold m-0">Add From Existing Medications</label>
|
|
- <a href="#" v-on:click.prevent="addDrugToErxMode = ''" class="ml-auto">Close</a>
|
|
|
|
|
|
+ <a href="#" v-on:click.prevent="setAddMode('')" class="ml-auto">Close</a>
|
|
</div>
|
|
</div>
|
|
<table class="m-0 table table-sm border bg-white table-hover">
|
|
<table class="m-0 table table-sm border bg-white table-hover">
|
|
<tr>
|
|
<tr>
|
|
@@ -241,7 +241,7 @@
|
|
|
|
|
|
<div class="d-flex align-items-baseline mb-2">
|
|
<div class="d-flex align-items-baseline mb-2">
|
|
<label for="" class="text-secondary font-weight-bold m-0">Add New Medication</label>
|
|
<label for="" class="text-secondary font-weight-bold m-0">Add New Medication</label>
|
|
- <a href="#" v-on:click.prevent="addDrugToErxMode = ''" class="ml-auto">Close</a>
|
|
|
|
|
|
+ <a href="#" v-on:click.prevent="setAddMode('')" class="ml-auto">Close</a>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="row mb-2">
|
|
<div class="row mb-2">
|
|
@@ -988,6 +988,7 @@
|
|
let temp = this.currentPrescription;
|
|
let temp = this.currentPrescription;
|
|
this.currentPrescription = null;
|
|
this.currentPrescription = null;
|
|
this.currentPrescription = temp;
|
|
this.currentPrescription = temp;
|
|
|
|
+ this.setCurrentPrescription(temp);
|
|
|
|
|
|
// save erx
|
|
// save erx
|
|
$.post('/api/erx/updateClinicalDetail', {
|
|
$.post('/api/erx/updateClinicalDetail', {
|
|
@@ -1016,6 +1017,119 @@
|
|
// nothing to do
|
|
// nothing to do
|
|
}
|
|
}
|
|
}, 'json');
|
|
}, 'json');
|
|
|
|
+ },
|
|
|
|
+ setCurrentPrescription: function(_prescription) {
|
|
|
|
+ this.currentPrescription = _prescription;
|
|
|
|
+ },
|
|
|
|
+ setAddMode: function(_mode) {
|
|
|
|
+ let self = this;
|
|
|
|
+ this.addDrugToErxMode = _mode;
|
|
|
|
+ if(this.addDrugToErxMode === 'new') {
|
|
|
|
+ Vue.nextTick(() => {
|
|
|
|
+
|
|
|
|
+ let parentSegment = $('#prescriptions-popup-{{$patient->id}}');
|
|
|
|
+
|
|
|
|
+ parentSegment.find('[stag-suggest-initialized]').removeAttr('stag-suggest-initialized');
|
|
|
|
+ initStagSuggest();
|
|
|
|
+
|
|
|
|
+ parentSegment.find('input[stag-suggest][data-name="name"]')
|
|
|
|
+ .off('stag-suggest-selected')
|
|
|
|
+ .on('stag-suggest-selected', (_e, _input, _data) => {
|
|
|
|
+ $(_input).closest('form').find('input[data-name="routedMedId"]').val(_data.routed_med_id);
|
|
|
|
+ $(_input).closest('form').find('input[data-name="routedDosageFormMedId"]').val(_data.routed_dosage_form_med_id);
|
|
|
|
+ $(_input).closest('form').find('input[data-name="gcnSeqno"]').val(_data.gcn_seqno);
|
|
|
|
+ $(_input).closest('form').find('input[data-name="medId"]').val(_data.medid);
|
|
|
|
+ return false;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // bind events for add-new-med and add-to-erx in one shot
|
|
|
|
+ parentSegment.find('#frm-add-medication-and-add-to-erx')
|
|
|
|
+ .off('submit')
|
|
|
|
+ .on('submit', function () {
|
|
|
|
+
|
|
|
|
+ let form = $(this);
|
|
|
|
+
|
|
|
|
+ if (!form[0].checkValidity()) {
|
|
|
|
+ form[0].reportValidity();
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // add [data-name] values to payload
|
|
|
|
+ let dataField = form.find('[name="data"]').first();
|
|
|
|
+ let parsed = null;
|
|
|
|
+ if (dataField.val()) {
|
|
|
|
+ parsed = JSON.parse(dataField.val());
|
|
|
|
+ }
|
|
|
|
+ form.find('[data-name]').each(function () {
|
|
|
|
+ if (!parsed) parsed = {};
|
|
|
|
+
|
|
|
|
+ let keys = $(this).attr('data-name').split('->');
|
|
|
|
+ let currentNode = parsed;
|
|
|
|
+ for (let i = 0; i < keys.length; i++) {
|
|
|
|
+ if (i !== keys.length - 1) {
|
|
|
|
+ if (typeof currentNode[keys[i]] === 'undefined') {
|
|
|
|
+ currentNode[keys[i]] = {};
|
|
|
|
+ }
|
|
|
|
+ currentNode = currentNode[keys[i]];
|
|
|
|
+ } else {
|
|
|
|
+ if ($(this).is(':checkbox')) {
|
|
|
|
+ currentNode[keys[i]] = $(this).prop('checked');
|
|
|
|
+ } else {
|
|
|
|
+ currentNode[keys[i]] = $(this).val();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ if (parsed) {
|
|
|
|
+ dataField.val(JSON.stringify(parsed));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let newERxItem = {
|
|
|
|
+ medication: form.find('[data-name="name"]').val(),
|
|
|
|
+ frequency: form.find('[data-name="frequency"]').val(),
|
|
|
|
+ dispense: form.find('[name="dispense"]').val(),
|
|
|
|
+ refills: form.find('[name="refills"]').val(),
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ $.post(form.attr('action'), form.serialize(), _data => {
|
|
|
|
+ if (!hasResponseError(_data)) {
|
|
|
|
+ hideMask();
|
|
|
|
+ // refreshDynamicStagPopup();
|
|
|
|
+ // $('.visit-segment[data-segment-template-name="intake_medications"]').find('.refresh-segment').trigger('click');
|
|
|
|
+
|
|
|
|
+ if(!self.currentPrescription.clinical_detail_json) {
|
|
|
|
+ self.currentPrescription.clinical_detail_json = {};
|
|
|
|
+ }
|
|
|
|
+ if(!self.currentPrescription.clinical_detail_json.items) {
|
|
|
|
+ self.currentPrescription.clinical_detail_json.items = [];
|
|
|
|
+ }
|
|
|
|
+ self.currentPrescription.clinical_detail_json.items.push(newERxItem);
|
|
|
|
+ self.currentPrescription.clinical_detail_json.items = JSON.parse(JSON.stringify(self.currentPrescription.clinical_detail_json.items));
|
|
|
|
+ let temp = self.currentPrescription;
|
|
|
|
+ self.currentPrescription = null;
|
|
|
|
+ self.currentPrescription = temp;
|
|
|
|
+ self.setCurrentPrescription(temp);
|
|
|
|
+
|
|
|
|
+ // save erx
|
|
|
|
+ $.post('/api/erx/updateClinicalDetail', {
|
|
|
|
+ uid: self.currentPrescription.uid,
|
|
|
|
+ clinicalDetailJson: JSON.stringify(self.currentPrescription.clinical_detail_json)
|
|
|
|
+ }, _data => {
|
|
|
|
+ if(!hasResponseError(_data)) {
|
|
|
|
+ // nothing to do
|
|
|
|
+
|
|
|
|
+ self.setAddMode('');
|
|
|
|
+ }
|
|
|
|
+ }, 'json');
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }, 'json');
|
|
|
|
+ return false;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted: function() {
|
|
mounted: function() {
|
|
@@ -1028,7 +1142,7 @@
|
|
Vue.nextTick(() => {
|
|
Vue.nextTick(() => {
|
|
if(!this.currentPrescription) {
|
|
if(!this.currentPrescription) {
|
|
for(let x in this.prescriptions) {
|
|
for(let x in this.prescriptions) {
|
|
- this.currentPrescription = this.prescriptions[x];
|
|
|
|
|
|
+ this.setCurrentPrescription(this.prescriptions[x]);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|