Selaa lähdekoodia

Dashboard update - vitals from point

Vijayakrishnan 3 vuotta sitten
vanhempi
commit
71c376bff3

+ 22 - 1
resources/views/app/patient/dashboard.blade.php

@@ -232,7 +232,7 @@
                 {{--@include('app/patient/partials/vitals')--}}
 
                 {{-- canvas based vitals --}}
-                <div class="pt-2 border-top">
+                {{-- <div class="pt-2 border-top">
                     <div class="d-flex align-items-center pb-2">
                         <h6 class="my-0 font-weight-bold text-secondary">Vitals</h6>
                         <span class="mx-2 text-secondary">|</span>
@@ -241,6 +241,27 @@
                     <div class="bg-light border p-2 mb-3">
                         @include('app.patient.canvas-sections.vitals.summary')
                     </div>
+                </div> --}}
+
+                <!-- vitals - point -->
+                <?php $latestVitals = \App\Models\Point::where('client_id', $patient->id)->where('category', 'VITALS')->orderBy('id', 'DESC')->first(); ?>
+                <div class="pt-2 mt-2">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Vitals
+                            @if(!!$latestVitals && $latestVitals->note && $latestVitals->note->effective_dateest)
+                                <span class="text-secondary font-weight-normal pl-1">(as on
+                                    <a href="{{route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $latestVitals->note])}}">{{friendlier_date($latestVitals->note->effective_dateest)}}</a>)
+                                </span>
+                            @endif
+                        </h6>
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @if(!!$latestVitals)
+                            @include('app.patient.partials.latest-vitals', ['patient' => $patient, 'point' => $latestVitals])
+                        @else
+                            <div class="text-secondary">Nothing here yet</div>
+                        @endif
+                    </div>
                 </div>
 
             </div>

+ 126 - 0
resources/views/app/patient/partials/latest-vitals.blade.php

@@ -0,0 +1,126 @@
+<?php
+
+use App\Models\Point;
+
+$category = 'VITALS';
+$endPoint = 'upsertNoteSingleton';
+
+$vitalLabels = [
+    "heightInInches" => "Ht. (in.)",
+    "weightPounds" => "Wt. (lbs.)",
+    "temperatureF" => "Temp. (F)",
+    "systolicBP" => "SBP",
+    "diastolicBP" => "DBP",
+    "pulseRatePerMinute" => "Pulse",
+    "respirationRatePerMinute" => "Resp.",
+    "pulseOx" => "Pulse Ox.",
+    "smokingStatus" => "Smoking Status",
+    "bmi" => "BMI (kg/m²)",
+];
+
+$contentData = null;
+if (!!@$point->data) {
+    $contentData = json_decode($point->data, true);
+}
+
+if(!$contentData) {
+    $contentData = [
+        "heightInInches" => [
+            "label" => "Ht. (in.)",
+            "value" => "",
+            "date" => "",
+        ],
+        "weightPounds" => [
+            "label" => "Wt. (lbs.)",
+            "value" => "",
+            "date" => "",
+        ],
+        "temperatureF" => [
+            "label" => "Temp. (F)",
+            "value" => "",
+            "date" => "",
+        ],
+        "systolicBP" => [
+            "label" => "SBP",
+            "value" => "",
+            "date" => "",
+        ],
+        "diastolicBP" => [
+            "label" => "DBP",
+            "value" => "",
+            "date" => "",
+        ],
+        "pulseRatePerMinute" => [
+            "label" => "Pulse",
+            "value" => "",
+            "date" => "",
+        ],
+        "respirationRatePerMinute" => [
+            "label" => "Resp.",
+            "value" => "",
+            "date" => "",
+        ],
+        "pulseOx" => [
+            "label" => "Pulse Ox.",
+            "value" => "",
+            "date" => "",
+        ],
+        "smokingStatus" => [
+            "label" => "Smoking Status",
+            "value" => "",
+            "date" => "",
+        ],
+        "bmi" => [
+            "label" => "BMI (kg/m²)",
+            "value" => "",
+            "date" => "",
+        ],
+    ];
+}else {
+    foreach ($vitalLabels as $k => $v) {
+        if (!isset($contentData[$k])) {
+            $contentData[$k] = [
+                "label" => $v,
+                "value" => "",
+                "date" => "",
+            ];
+        }
+    }
+}
+?>
+
+@foreach ($vitalLabels as $k => $v)
+<div class="d-flex vital-item align-items-center">
+        <span class="content-html text-nowrap">
+            <span>{{$v}}:</span>
+            <?php
+            $vital = [];
+            if(isset($contentData[$k])) {
+                $vital = $contentData[$k];
+            }
+            ?>
+            <b>{{ isset($vital["value"]) && !empty($vital["value"]) ? $vital["value"] : '-' }}</b>
+            @if($k === 'bmi' && isset($vital["value"]) && !empty($vital["value"]))
+                <?php $bmi = floatval($vital["value"]); ?>
+                <span class="ml-2 py-1 m-0 font-weight-bold">
+                     @if($bmi < 18.5)
+                        <span class="text-sm text-warning-mellow">(Underweight)</span>
+                     @endif
+                    @if($bmi >= 18.5 && $bmi < 25)
+                        <span class="text-sm text-success">(Healthy Weight)</span>
+                    @endif
+                    @if($bmi >= 25 && $bmi < 30)
+                        <span class="text-sm text-warning-mellow">(Overweight)</span>
+                    @endif
+                    @if($bmi >= 30)
+                        <span class="text-sm text-warning-mellow">(Obese)</span>
+                    @endif
+                </span>
+            @endif
+            @if(!!$vital["date"])
+                <span class="font-weight-normal text-secondary ml-2 text-sm">(as on {{ friendly_date_time($vital["date"], false) }})</span>
+            @endif
+        </span>
+</div>
+@endforeach
+