Selaa lähdekoodia

Show relevant historic meds (except entry error)

Vijayakrishnan 3 vuotta sitten
vanhempi
commit
4b26a9a094

+ 18 - 0
app/Models/Point.php

@@ -379,6 +379,24 @@ class Point extends Model
         return $points;
     }
 
+    public static function getPointsOfCategoryExceptEntryError(Client $_patient, Note $_note, String $_category, $_assoc = false) {
+        $points = Point
+            ::where('client_id', $_patient->id)
+            ->where('category', $_category)
+            ->where(function ($query2) use ($_note) {
+                $query2->where('is_removed', false)
+                    ->orWhereRaw("(is_removed_due_to_entry_error IS NOT TRUE AND ((SELECT count(id) from note_point WHERE is_active IS TRUE AND note_id = {$_note->id} AND point_id = point.id) > 0))");
+            })
+            ->orderBy('created_at')
+            ->get();
+        foreach ($points as $point) {
+            if ($point->data) {
+                $point->data = json_decode($point->data, $_assoc);
+            }
+        }
+        return $points;
+    }
+
     public static function getNumPointsOfCategory(Client $_patient, String $_category) {
         return Point
             ::where('client_id', $_patient->id)

+ 2 - 2
resources/views/app/patient/segment-templates/omega_medications/summary.blade.php

@@ -4,7 +4,7 @@ use App\Models\Point;
 
 /** @var \App\Models\Client $patient */
 
-$points = Point::getPointsOfCategory($patient, 'MEDICATION');
+$points = Point::getPointsOfCategoryExceptEntryError($patient, $note, 'MEDICATION');
 $tracker = Point::getGlobalSingletonOfCategory($patient, 'NO_KNOWN_TRACKER');
 $numRelevant = 0;
 $plural = 'Medications';
@@ -56,7 +56,7 @@ $plural = 'Medications';
 		</td>
 		<td class="width-300px">
 			<div class="d-flex align-items-baseline pl-2">
-				@if(@$review && isset($review->experience))
+				@if(@$review && isset($review->experience) && !!trim(strip_tags($review->experience)))
 					<span class="pr-2">{{trim(strip_tags($review->experience))}}</span>
 				@endif
 				<span class="text-nowrap">

+ 1 - 1
resources/views/app/patient/wizard-partials/state-badge.blade.php

@@ -13,7 +13,7 @@
             <div class="text-sm text-secondary">(New Historic Record)</div>
         @endif
     @elseif($point->removed_in_note_id === $note->id && $point->removal_reason_category === 'ON_INTAKE')
-        <div class="text-sm text-secondary">Marked {{@$removedVerb ?: 'Removed'}}  on Intake</div>
+        <div class="text-sm text-secondary">Marked Historic</div>
         @if($point->added_in_note_id === $note->id && $point->addition_reason_category === 'ON_INTAKE')
             <div class="text-sm text-secondary">(New Historic Record)</div>
         @endif