Selaa lähdekoodia

All Hx, ROS - ability to toggle self-relevance to note from popup

Vijayakrishnan 3 vuotta sitten
vanhempi
commit
4f67293d71

+ 37 - 0
resources/views/app/patient/segment-templates/_common_actions/toggle-relevance.blade.php

@@ -0,0 +1,37 @@
+let parentPopup = $('{{$container}}').closest('.stag-popup');
+if(parentPopup.length) {
+    <?php $rel = $point->relevanceToNote($note); ?>
+    parentPopup.find('.toggle-relevance-ui').remove();
+    let relUI = $('<div/>')
+        .addClass('toggle-relevance-ui border p-2 ml-4 mr-auto {{ !!$rel ? 'bg-aliceblue' : 'bg-light' }}')
+        .html('Relevant to visit: <b>{{ !!$rel ? 'Yes' : 'No' }}</b>');
+    let toggleBtn = $('<a/>')
+        .attr('href', '#')
+        .addClass('ml-2')
+        .text('Toggle')
+        .on('click', function() {
+            @if(!!$rel)
+            $.post('/api/visitPoint/undoMarkPointRelevantToNote', {
+                'uid': '{{$rel->uid}}'
+            }, _data => {
+                if(!hasResponseError(_data)) {
+                    refreshDynamicStagPopup();
+                    $('.visit-segment[data-segment-template-name="{{$segmentName}}"]').find('.refresh-segment').trigger('click');
+                }
+            }, 'json');
+            @else
+            $.post('/api/visitPoint/markPointRelevantToNote', {
+                'noteUid': '{{$note->uid}}',
+                'pointUid': '{{$point->uid}}'
+            }, _data => {
+                if(!hasResponseError(_data)) {
+                    refreshDynamicStagPopup();
+                    $('.visit-segment[data-segment-template-name="{{$segmentName}}"]').find('.refresh-segment').trigger('click');
+                }
+            }, 'json');
+            @endif
+            return false;
+        })
+        .appendTo(relUI);
+    relUI.insertAfter($('{{$container}}').closest('.stag-popup').find('.stag-popup-title>span').first());
+}

+ 3 - 0
resources/views/app/patient/segment-templates/history_family/edit.blade.php

@@ -420,6 +420,9 @@ if(!$contentData) {
                 }
             });
 
+            // if in popup (omega template), add provision to toggle relevance
+            @include('app.patient.segment-templates._common_actions.toggle-relevance', ['container' => '#edit-univ_history_family-container', 'segmentName' => 'omega_history_family'])
+
         }
 
         window.segmentInitializers.history_family = init;

+ 2 - 0
resources/views/app/patient/segment-templates/history_social/edit.blade.php

@@ -233,6 +233,8 @@ for ($i = 0; $i < count($fields); $i++) {
                 }
             });
 
+            // if in popup (omega template), add provision to toggle relevance
+            @include('app.patient.segment-templates._common_actions.toggle-relevance', ['container' => '#edit-univ_history_social-container', 'segmentName' => 'omega_history_social'])
         }
 
         window.segmentInitializers.history_social = init;

+ 3 - 0
resources/views/app/patient/segment-templates/history_surgical/edit.blade.php

@@ -234,6 +234,9 @@ for ($i = 0; $i < count($fields); $i++) {
                 }
             });
 
+            // if in popup (omega template), add provision to toggle relevance
+            @include('app.patient.segment-templates._common_actions.toggle-relevance', ['container' => '#edit-univ_history_surgical-container', 'segmentName' => 'omega_history_surgical'])
+
         }
 
         window.segmentInitializers.history_surgical = init;

+ 3 - 1
resources/views/app/patient/segment-templates/omega_history_family/summary.blade.php

@@ -17,7 +17,9 @@ $point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'FAMILY_HISTORY',
 
 $contentData = $parsed = false;
 
-if ($point->lastChildReview && $point->lastChildReview->data) {
+$rel = !!$point->relevanceToNote($note);
+
+if ($point->lastChildReview && $point->lastChildReview->data && ($rel || $point->lastChildReview->added_in_note_id === $note->id)) {
     $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
     $contentData = $parsed = $point->lastChildReview->data;
 }

+ 3 - 1
resources/views/app/patient/segment-templates/omega_history_past_medical/summary.blade.php

@@ -54,7 +54,9 @@ $point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'PAST_MEDICAL_HIST
 
 $contentData = $parsed = false;
 
-if ($point->lastChildReview && $point->lastChildReview->data) {
+$rel = !!$point->relevanceToNote($note);
+
+if ($point->lastChildReview && $point->lastChildReview->data && ($rel || $point->lastChildReview->added_in_note_id === $note->id)) {
     $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
     $contentData = $parsed = $point->lastChildReview->data;
 }

+ 3 - 1
resources/views/app/patient/segment-templates/omega_history_social/summary.blade.php

@@ -36,7 +36,9 @@ $point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'SOCIAL_HISTORY',
 
 $contentData = $parsed = false;
 
-if ($point->lastChildReview && $point->lastChildReview->data) {
+$rel = !!$point->relevanceToNote($note);
+
+if ($point->lastChildReview && $point->lastChildReview->data && ($rel || $point->lastChildReview->added_in_note_id === $note->id)) {
     $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
     $contentData = $parsed = $point->lastChildReview->data;
 

+ 3 - 1
resources/views/app/patient/segment-templates/omega_history_surgical/summary.blade.php

@@ -33,7 +33,9 @@ $point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'SURGICAL_HISTORY'
 
 $contentData = $parsed = false;
 
-if ($point->lastChildReview && $point->lastChildReview->data) {
+$rel = !!$point->relevanceToNote($note);
+
+if ($point->lastChildReview && $point->lastChildReview->data && ($rel || $point->lastChildReview->added_in_note_id === $note->id)) {
     $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
     $contentData = $parsed = $point->lastChildReview->data;
 

+ 3 - 0
resources/views/app/patient/segment-templates/omega_ros/edit.blade.php

@@ -403,6 +403,9 @@ for ($i = 0; $i < count($fields); $i++) {
                 }
             });
 
+            // if in popup (omega template), add provision to toggle relevance
+            @include('app.patient.segment-templates._common_actions.toggle-relevance', ['container' => '#edit-ros-container', 'segmentName' => 'omega_ros'])
+
         }
 
         window.segmentInitializers.omega_ros = initROS;

+ 3 - 1
resources/views/app/patient/segment-templates/omega_ros/summary.blade.php

@@ -192,7 +192,9 @@ $fields = [
 
 $point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'ROS', $sessionKey, true);
 
-if ($point->lastChildReview && $point->lastChildReview->data) {
+$rel = !!$point->relevanceToNote($note);
+
+if ($point->lastChildReview && $point->lastChildReview->data && ($rel || $point->lastChildReview->added_in_note_id === $note->id)) {
     $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
     $contentData = $point->lastChildReview->data;
 

+ 3 - 0
resources/views/app/patient/segment-templates/past_medical_history/edit.blade.php

@@ -275,6 +275,9 @@ for ($i = 0; $i < count($fields); $i++) {
 
             window.segmentInitializers.past_medical_history = function() {};
 
+            // if in popup (omega template), add provision to toggle relevance
+            @include('app.patient.segment-templates._common_actions.toggle-relevance', ['container' => '#edit-univ_history_past_medical-container', 'segmentName' => 'omega_history_past_medical'])
+
         }
 
         window.segmentInitializers.past_medical_history = init;