Sfoglia il codice sorgente

ERx logic and UI updates

Vijayakrishnan 3 anni fa
parent
commit
a269c7a557
1 ha cambiato i file con 33 aggiunte e 6 eliminazioni
  1. 33 6
      resources/views/app/patient/prescriptions/list.blade.php

+ 33 - 6
resources/views/app/patient/prescriptions/list.blade.php

@@ -192,8 +192,8 @@
                     </div>
 
                     @if(@$note)
-                    <div class="" v-if="!currentPrescription.has_hcp_pro_signed">
-                        <a href="#" class="d-block mb-1" v-on:click.prevent="setAddMode('existing')">+ Existing</a>
+                    <div class="d-flex align-items-center mt-3" v-if="!currentPrescription.has_hcp_pro_signed">
+                        <a href="#" class="d-block mb-1 mr-2" v-on:click.prevent="setAddMode('existing')">+ Existing</a>
                         <a href="#" class="d-block mb-1" v-on:click.prevent="setAddMode('new')">+ New</a>
                     </div>
                     @endif
@@ -374,11 +374,13 @@
             </div>
             <div class="pb-2 d-flex align-items-start" v-if="currentPrescription.has_hcp_pro_signed">
                 <span class="min-width-140px text-secondary text-sm">PDF</span>
-                <div class="">
+                <div class="d-flex align-items-baseline">
                     <a class="pdf-viewer-trigger d-block mb-1" native target="_blank"
                        :href="'/prescription-download-as-pdf/' + currentPrescription.uid">View</a>
+                    <span class="mx-2 text-sm text-secondary">|</span>
                     <a native target="_blank" class="d-block mb-1"
                        :href="'/prescription-download-as-pdf/' + currentPrescription.uid">Download</a>
+                    <span class="mx-2 text-sm text-secondary">|</span>
                     <a href="#" class="d-block mb-1"
                        v-on:click.prevent="transmit(currentPrescription)">Transmit</a>
                 </div>
@@ -819,6 +821,7 @@ GROUP BY erx_category");
                                 showStagPopup('new-prescription-popup-' + _type, true);
                                 $('[stag-popup-key="new-prescription-popup-' + _type + '"] [stag-suggest-initialized]').removeAttr('stag-suggest-initialized');
                                 initStagSuggest();
+                                this.initICDAutoSuggest();
                             });
                         }
                         return false;
@@ -839,6 +842,12 @@ GROUP BY erx_category");
                         });
                     },
                     addTest: function(_item) {
+                        for (let i = 0; i < _item.tests.length; i++) {
+                            if(!_item.tests[i].desc) {
+                                toastr.error('One or more existing tests are empty/invalid!');
+                                return false;
+                            }
+                        }
                         _item.tests.push({
                             desc: ''
                         });
@@ -847,7 +856,14 @@ GROUP BY erx_category");
                         });
                     },
                     addICD: function(_item) {
+                        for (let i = 0; i < _item.icds.length; i++) {
+                            if(!_item.icds[i].code) {
+                                toastr.error('One or more existing icds are empty/invalid!');
+                                return false;
+                            }
+                        }
                         _item.icds.push({
+                            code: '',
                             desc: ''
                         });
                         Vue.nextTick(() => {
@@ -1387,6 +1403,8 @@ GROUP BY erx_category");
                         this.currentPrescription = temp;
                         this.setCurrentPrescription(temp);
 
+                        showMask();
+
                         // save erx
                         $.post('/api/erx/updateClinicalDetail', {
                             uid: this.currentPrescription.uid,
@@ -1498,6 +1516,8 @@ GROUP BY erx_category");
                                             refills: form.find('[name="refills"]').val(),
                                         };
 
+                                        showMask();
+
                                         $.post(form.attr('action'), form.serialize(), _data => {
                                             if (!hasResponseError(_data)) {
                                                 hideMask();
@@ -1545,7 +1565,8 @@ GROUP BY erx_category");
                                 dynID = 'icd-' + Math.ceil(Math.random() * 1000000),
                                 itemIndex = $(this).attr('data-item-index'),
                                 icdIndex = $(this).attr('data-icd-index'),
-                                category = $(this).attr('data-category');
+                                category = $(this).attr('data-category'),
+                                existing = $(this).closest('[stag-popup-key]').length === 0;
                             $(elem).attr('id', dynID);
                             new window.Def.Autocompleter.Search(dynID,
                                 'https://clinicaltables.nlm.nih.gov/api/icd10cm/v3/search?sf=code,name&ef=name', {
@@ -1556,8 +1577,14 @@ GROUP BY erx_category");
                             );
                             window.Def.Autocompleter.Event.observeListSelections(dynID, function() {
                                 let autocomp = elem.autocomp, acData = autocomp.getSelectedItemData();
-                                self['currentPrescription_' + category].clinicalDetailJson.items[itemIndex].icds[icdIndex].code = acData[0].code;
-                                self['currentPrescription_' + category].clinicalDetailJson.items[itemIndex].icds[icdIndex].desc = acData[0].data['name'];
+                                if(existing) {
+                                    self['currentPrescription_' + category].clinicalDetailJson.items[itemIndex].icds[icdIndex].code = acData[0].code;
+                                    self['currentPrescription_' + category].clinicalDetailJson.items[itemIndex].icds[icdIndex].desc = acData[0].data['name'];
+                                }
+                                else {
+                                    self['newPrescription_' + category].clinicalDetailJson.items[itemIndex].icds[icdIndex].code = acData[0].code;
+                                    self['newPrescription_' + category].clinicalDetailJson.items[itemIndex].icds[icdIndex].desc = acData[0].data['name'];
+                                }
                                 return false;
                             });
                             $(elem).attr('ac-initialized', 1);