Эх сурвалжийг харах

Plan segments - show only relevant points

Vijayakrishnan 3 жил өмнө
parent
commit
3b5ea02ccc

+ 17 - 1
resources/views/app/patient/segment-templates/plan_allergies/summary.blade.php

@@ -7,6 +7,7 @@ use App\Models\Point;
 $allergies = Point::getPlanPointsOfCategory($patient, 'ALLERGY', $note);
 
 $numRelevant = 0;
+$numVisible = 0;
 ?>
 
 <?php if (!count($allergies)): ?>
@@ -15,6 +16,16 @@ $numRelevant = 0;
     <?php foreach ($allergies as $allergy): ?>
         <?php if($allergy->is_removed && $allergy->is_removed_due_to_entry_error) continue; ?>
         <?php $rel = $allergy->relevanceToNote($note); ?>
+        <?php $review = $allergy->childPlanAddedInNote($note); ?>
+
+        <!--show only if: relevant || added-in-note || removed-in-note || added-plan-in-note-->
+        @if($rel ||
+            (!$allergy->is_removed && $allergy->added_in_note_id === $note->id) ||
+            ($allergy->is_removed && $allergy->removed_in_note_id === $note->id) ||
+            !!$review
+            )
+
+            <?php $numVisible++; ?>
         <div class="mb-2">
             <div class="d-flex align-items-baseline">
                 @if($rel)
@@ -41,7 +52,6 @@ $numRelevant = 0;
                     <?php endif;?>
                 <?php endif; ?>
             </div>
-            <?php $review = $allergy->childPlanAddedInNote($note); ?>
             <?php if(!!$review): ?>
             <div class="pl-3 mt-1">
                 <div class="text-secondary font-weight-bold">Plan</div>
@@ -51,7 +61,13 @@ $numRelevant = 0;
             <div class="relevant-without-plan text-danger text-sm mt-1" data-target-segment="<?= $segment->segmentTemplate->internal_name ?>"><i class="fa fa-exclamation-triangle mr-1"></i>Plan missing</div>
             <?php endif; ?>
         </div>
+        @endif
     <?php endforeach; ?>
+    @if(!$numVisible)
+        <div class="d-flex align-items-baseline mr-1">
+            <span class="text-secondary">No allergies</span>
+        </div>
+    @endif
     @if($numRelevant)
         <div class="d-flex align-items-baseline text-info mr-1 mt-3">
             <span class="text-sm mr-1"><i class="fa fa-star text-sm"></i></span>

+ 17 - 1
resources/views/app/patient/segment-templates/plan_care_team/summary.blade.php

@@ -7,6 +7,7 @@ use App\Models\Point;
 $careTeamMembers = Point::getPlanPointsOfCategory($patient, 'CARE_TEAM_MEMBER', $note);
 
 $numRelevant = 0;
+$numVisible = 0;
 ?>
 
 <?php if (!count($careTeamMembers)): ?>
@@ -15,6 +16,16 @@ $numRelevant = 0;
     <?php foreach($careTeamMembers as $careTeamMember): ?>
         <?php if($careTeamMember->is_removed && $careTeamMember->is_removed_due_to_entry_error) continue; ?>
         <?php $rel = $careTeamMember->relevanceToNote($note); ?>
+        <?php $review = $careTeamMember->childPlanAddedInNote($note); ?>
+
+        <!--show only if: relevant || added-in-note || removed-in-note || added-plan-in-note-->
+        @if($rel ||
+            (!$careTeamMember->is_removed && $careTeamMember->added_in_note_id === $note->id) ||
+            ($careTeamMember->is_removed && $careTeamMember->removed_in_note_id === $note->id) ||
+            !!$review
+            )
+
+            <?php $numVisible++; ?>
         <div class="mb-2">
             <div class="d-flex align-items-baseline">
                 @if($rel)
@@ -45,7 +56,6 @@ $numRelevant = 0;
                     <?php endif;?>
                 <?php endif; ?>
             </div>
-            <?php $review = $careTeamMember->childPlanAddedInNote($note); ?>
             <?php if(!!$review): ?>
             <div class="pl-3 mt-1">
                 <div class="text-secondary font-weight-bold">Plan</div>
@@ -55,7 +65,13 @@ $numRelevant = 0;
             <div class="relevant-without-plan text-danger text-sm mt-1" data-target-segment="<?= $segment->segmentTemplate->internal_name ?>"><i class="fa fa-exclamation-triangle mr-1"></i>Plan missing</div>
             <?php endif; ?>
         </div>
+        @endif
     <?php endforeach; ?>
+    @if(!$numVisible)
+        <div class="d-flex align-items-baseline mr-1">
+            <span class="text-secondary">No care team members</span>
+        </div>
+    @endif
     @if($numRelevant)
         <div class="d-flex align-items-baseline text-info mr-1 mt-3">
             <span class="text-sm mr-1"><i class="fa fa-star text-sm"></i></span>

+ 9 - 0
resources/views/app/patient/segment-templates/plan_goals/summary.blade.php

@@ -6,6 +6,15 @@ use App\Models\Point;
 
 $goals = Point::getPlanPointsOfCategory($patient, 'GOAL', $note);
 
+$goals = $goals->filter(function ($_x) use ($note) {
+    $rel = $_x->relevanceToNote($note);
+    $review = $_x->childPlanAddedInNote($note);
+    return ($rel ||
+        (!$_x->is_removed && $_x->added_in_note_id === $note->id) ||
+        ($_x->is_removed && $_x->removed_in_note_id === $note->id) ||
+        !!$review);
+});
+
 $grouped = [];
 foreach($goals as $goal) {
     if(!@($goal->data->category)) continue;

+ 20 - 0
resources/views/app/patient/segment-templates/plan_medications/summary.blade.php

@@ -7,6 +7,7 @@ use App\Models\Point;
 $medications = Point::getPlanPointsOfCategory($patient, 'MEDICATION', $note);
 
 $numRelevant = 0;
+$numVisible = 0;
 ?>
 
 <?php if (!count($medications)): ?>
@@ -15,6 +16,17 @@ $numRelevant = 0;
     <?php foreach ($medications as $medication): ?>
         <?php if($medication->is_removed && $medication->is_removed_due_to_entry_error) continue; ?>
         <?php $rel = $medication->relevanceToNote($note); ?>
+        <?php $review = $medication->childPlanAddedInNote($note); ?>
+
+        <!--show only if: relevant || added-in-note || removed-in-note || added-plan-in-note-->
+        @if($rel ||
+            (!$medication->is_removed && $medication->added_in_note_id === $note->id) ||
+            ($medication->is_removed && $medication->removed_in_note_id === $note->id) ||
+            !!$review
+            )
+
+            <?php $numVisible++; ?>
+
         <div class="mb-2">
             <div class="d-flex align-items-baseline">
                 @if($rel)
@@ -50,7 +62,15 @@ $numRelevant = 0;
             <div class="relevant-without-plan text-danger text-sm mt-1" data-target-segment="<?= $segment->segmentTemplate->internal_name ?>"><i class="fa fa-exclamation-triangle mr-1"></i>Plan missing</div>
             <?php endif; ?>
         </div>
+
+        @endif
+
     <?php endforeach; ?>
+    @if(!$numVisible)
+        <div class="d-flex align-items-baseline mr-1">
+            <span class="text-secondary">No medications</span>
+        </div>
+    @endif
     @if($numRelevant)
         <div class="d-flex align-items-baseline text-info mr-1 mt-3">
             <span class="text-sm mr-1"><i class="fa fa-star text-sm"></i></span>

+ 17 - 1
resources/views/app/patient/segment-templates/plan_problems/summary.blade.php

@@ -7,6 +7,7 @@ use App\Models\Point;
 $problems = Point::getPlanPointsOfCategory($patient, 'PROBLEM', $note);
 
 $numRelevant = 0;
+$numVisible = 0;
 $numRelevantWithICD = 0;
 ?>
 
@@ -16,6 +17,16 @@ $numRelevantWithICD = 0;
     <?php foreach ($problems as $problem): ?>
         <?php if($problem->is_removed && $problem->is_removed_due_to_entry_error) continue; ?>
         <?php $rel = $problem->relevanceToNote($note); ?>
+        <?php $review = $problem->childPlanAddedInNote($note); ?>
+
+        <!--show only if: relevant || added-in-note || removed-in-note || added-plan-in-note-->
+        @if($rel ||
+            (!$problem->is_removed && $problem->added_in_note_id === $note->id) ||
+            ($problem->is_removed && $problem->removed_in_note_id === $note->id) ||
+            !!$review
+            )
+
+            <?php $numVisible++; ?>
         <div class="mb-2">
             <div class="d-flex align-items-baseline">
                 @if($rel)
@@ -46,7 +57,6 @@ $numRelevantWithICD = 0;
                     <?php endif;?>
                 <?php endif; ?>
             </div>
-            <?php $review = $problem->childPlanAddedInNote($note); ?>
             <?php if(!!$review): ?>
             <div class="pl-3 mt-1">
                 <div class="text-secondary font-weight-bold">Plan</div>
@@ -58,7 +68,13 @@ $numRelevantWithICD = 0;
             </div>
             <?php endif; ?>
         </div>
+        @endif
     <?php endforeach; ?>
+    @if(!$numVisible)
+        <div class="d-flex align-items-baseline mr-1">
+            <span class="text-secondary">No problems</span>
+        </div>
+    @endif
     @if($numRelevant)
         <div class="d-flex align-items-baseline text-info mr-1 mt-3">
             <span class="text-sm mr-1"><i class="fa fa-star text-sm"></i></span>