Kaynağa Gözat

Note rhs sidebar - show recent meas. + click to popup full care month

Vijayakrishnan 3 yıl önce
ebeveyn
işleme
f28d601b2b

+ 45 - 4
resources/views/app/patient/note/rhs-sidebar.blade.php

@@ -126,12 +126,12 @@
         </div>
     </div>
     <div id="note-prescriptions" class="p-2 border-bottom c-pointer on-hover-aliceblue {{$note->is_signed_by_hcp ? 'events-none' : ''}}" data-non-segment-target="Prescriptions">
-        <div class="font-weight-bold mb-2">
+        <div class="font-weight-bold">
             ERx &amp; Orders
         </div>
         @if($prescriptions && count($prescriptions))
             @foreach($prescriptions as $prescription)
-                <div class="d-flex align-items-baseline px-1">
+                <div class="d-flex align-items-baseline px-1 pt-2">
                     <span class="mr-2 text-secondary text-sm font-weight-bold">{{$prescription->erx_category}}</span>
                     <?php $parsed = json_decode($prescription->clinical_detail_json) ?>
                     <span class="flex-grow-1">
@@ -161,8 +161,49 @@
                     </span>
                 </div>
             @endforeach
-        @else
-            <span class="px-1 text-secondary">-</span>
+        @endif
+    </div>
+    <?php
+    $cmStartDate = date('Y-m-01', strtotime($note->effective_dateest));
+    $careMonth = \App\Models\CareMonth::where('client_id', $patient->id)->where('start_date', $cmStartDate)->first();
+    ?>
+    <div id="recent-measurements"
+         class="p-2 border-bottom c-pointer on-hover-aliceblue {{$note->is_signed_by_hcp ? 'events-none' : ''}}"
+         open-in-stag-popup
+         mc-initer="care-month-dashboard-{{$patient->uid}}"
+         title="Care Month: {{friendly_month($careMonth->start_date)}}"
+         popup-style="medium-large overflow-visible"
+         href="/patients/view/{{ $note->client->uid }}/care-months/view/{{$careMonth->uid}}">
+        <div class="font-weight-bold">
+            Recent Measurements
+        </div>
+        <?php
+        $date = date('Y-m-d');
+        $end = strtotime($date);
+        $start = date_sub(date_create($date), date_interval_create_from_date_string("12 days"))->getTimestamp();
+        $start *= 1000;
+        $end *= 1000;
+        $recentMeasurements = \App\Models\Measurement
+            ::where('client_id', $patient->id)
+            ->whereRaw("(is_removed IS NULL OR is_removed = FALSE)")
+            ->whereNotNull('ts')
+            ->whereRaw("(is_cellular_zero IS NULL OR is_cellular_zero = FALSE)")
+            ->whereRaw("(label = 'BP' OR label = 'Wt. (lbs.)')")
+            ->where('ts', '>=', $start)
+            ->where('ts', '<=', $end)
+            ->orderBy('ts', 'desc')
+            ->get();
+        ?>
+        @if($recentMeasurements && count($recentMeasurements))
+            <div class="pt-2">
+                @foreach($recentMeasurements as $m)
+                    @if($m->label === 'BP')
+                        <div class="text-sm">BP: {{round($m->sbp_mm_hg)}}/{{round($m->dbp_mm_hg)}} ({{date('m/d/Y', $m->ts/1000)}})</div>
+                    @elseif($m->label === 'Wt. (lbs.)')
+                        <div class="text-sm">Wt: {{round($m->value, 1)}} ({{date('m/d/Y', $m->ts/1000)}})</div>
+                    @endif
+                @endforeach
+            </div>
         @endif
     </div>