|
@@ -0,0 +1,60 @@
|
|
|
|
+<?php
|
|
|
|
+$points = \App\Models\Point
|
|
|
|
+ ::where('client_id', $patient->id)
|
|
|
|
+ ->where('is_removed_due_to_entry_error', false)
|
|
|
|
+ ->where(function ($query1) use ($note) {
|
|
|
|
+ $query1
|
|
|
|
+ ->where(function ($query2) use ($note) {
|
|
|
|
+ $query2->where('is_removed', false)
|
|
|
|
+ ->where('addition_reason_category', 'DURING_VISIT')
|
|
|
|
+ ->where('added_in_note_id', $note->id);
|
|
|
|
+ })
|
|
|
|
+ ->orWhere('last_child_plan_point_scoped_note_id', $note->id)
|
|
|
|
+ ->orWhereRaw("(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();
|
|
|
|
+
|
|
|
|
+$problems = [];
|
|
|
|
+$allergies = [];
|
|
|
|
+
|
|
|
|
+foreach ($points as $point) {
|
|
|
|
+ if ($point->data) {
|
|
|
|
+ $point->data = json_decode($point->data);
|
|
|
|
+ }
|
|
|
|
+ if($point->category === 'ALLERGY' && @$point->data->name) $allergies[] = $point->data->name;
|
|
|
|
+ if($point->category === 'PROBLEM' && @$point->data->name) $problems[] = $point->data->name . (@$point->data->icd ? ' (' . $point->data->icd . ')' : '');
|
|
|
|
+}
|
|
|
|
+?>
|
|
|
|
+
|
|
|
|
+@if($allergies && count($allergies))
|
|
|
|
+ <div class="d-flex mb-1">
|
|
|
|
+ <a class="mr-2 min-width-110px font-weight-bold"
|
|
|
|
+ open-in-stag-popup
|
|
|
|
+ href="/allergies-center/{{$note->client->uid}}/{{$note->uid}}"
|
|
|
|
+ mc-initer="allergies-center-{{$note->id}}"
|
|
|
|
+ title="Allergies Center"
|
|
|
|
+ popup-style="medium-large overflow-visible">
|
|
|
|
+ Allergies
|
|
|
|
+ </a>
|
|
|
|
+ <div class="flex-grow-1 text-dark">
|
|
|
|
+ {{implode(", ", $allergies)}}
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+@endif
|
|
|
|
+
|
|
|
|
+@if($problems && count($problems))
|
|
|
|
+ <div class="d-flex mb-1">
|
|
|
|
+ <a class="mr-2 min-width-110px font-weight-bold"
|
|
|
|
+ open-in-stag-popup
|
|
|
|
+ href="/problems-center/{{$note->client->uid}}/{{$note->uid}}"
|
|
|
|
+ mc-initer="problems-center-{{$note->id}}"
|
|
|
|
+ title="Problems Center"
|
|
|
|
+ popup-style="medium-large overflow-visible">
|
|
|
|
+ Problems
|
|
|
|
+ </a>
|
|
|
|
+ <div class="flex-grow-1 text-dark">
|
|
|
|
+ {{implode(", ", $problems)}}
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+@endif
|