Browse Source

latest-vitals: fix to work with new DS

Vijayakrishnan 3 years ago
parent
commit
0a3be00017
1 changed files with 15 additions and 79 deletions
  1. 15 79
      resources/views/app/patient/partials/latest-vitals.blade.php

+ 15 - 79
resources/views/app/patient/partials/latest-vitals.blade.php

@@ -22,90 +22,28 @@ $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">
+    @if($contentData && @$contentData['date'])
         <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"]); ?>
+            <?php $vital = @$contentData[$k]; ?>
+            @if($k === 'sbp')
+                <span>Blood Pressure:</span>
+                <b>{{ @$contentData['sbp'] ?: '-' }} / {{ @$contentData['dbp'] ?: '-' }}</b>
+            @elseif($k === 'dbp') <!--ignore-->
+
+            @else
+                <span>{{$v}}:</span>
+                <b>{{ !empty($vital) ? $vital : '-' }}</b>
+            @endif
+            @if($k === 'bmi' && !empty($vital))
+                <?php $bmi = floatval($vital); ?>
                 <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
+                    @endif
                     @if($bmi >= 18.5 && $bmi < 25)
                         <span class="text-sm text-success">(Healthy Weight)</span>
                     @endif
@@ -117,10 +55,8 @@ if(!$contentData) {
                     @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>
+    @endif
 </div>
 @endforeach