Vijayakrishnan 4 anni fa
parent
commit
4da4e25ced

+ 80 - 12
resources/views/app/patient/canvas-sections/vitals/form.blade.php

@@ -1,4 +1,16 @@
 <?php
+$vitalLabels = [
+    "heightInches" => "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²)",
+];
 if(!$contentData) {
     $contentData = [
         "heightInches" => [
@@ -16,28 +28,28 @@ if(!$contentData) {
             "value" => "",
             "date" => "",
         ],
-        "pulseRatePerMinute" => [
-            "label" => "Pulse",
+        "systolicBP" => [
+            "label" => "SBP",
             "value" => "",
             "date" => "",
         ],
-        "respirationRatePerMinute" => [
-            "label" => "Resp.",
+        "diastolicBP" => [
+            "label" => "DBP",
             "value" => "",
             "date" => "",
         ],
-        "pulseOx" => [
-            "label" => "Pulse Ox.",
+        "pulseRatePerMinute" => [
+            "label" => "Pulse",
             "value" => "",
             "date" => "",
         ],
-        "systolicBP" => [
-            "label" => "SBP",
+        "respirationRatePerMinute" => [
+            "label" => "Resp.",
             "value" => "",
             "date" => "",
         ],
-        "diastolicBP" => [
-            "label" => "DBP",
+        "pulseOx" => [
+            "label" => "Pulse Ox.",
             "value" => "",
             "date" => "",
         ],
@@ -53,6 +65,18 @@ if(!$contentData) {
         ],
     ];
 }
+else {
+    // ensure $contentData has all the expected vitals and correct labels!
+    foreach ($vitalLabels as $k => $v) {
+        if(!isset($contentData[$k])) {
+            $contentData[$k] = [
+                "label" => $v,
+                "value" => "",
+                "date" => "",
+            ];
+        }
+    }
+}
 
 $formID = rand(0, 100000);
 ?>
@@ -76,7 +100,51 @@ $formID = rand(0, 100000);
         </tr>
         </thead>
         <tbody>
-        <tr v-for="(item, index) in items">
+        @foreach($vitalLabels as $k => $v)
+            <tr>
+                <td>
+                    <input type="text" tabindex="-1"
+                           class="form-control form-control-sm events-none"
+                           data-field="title" value="{{ $v }}" readonly>
+                </td>
+                <td class="position-relative">
+                    @if($k === "bmi")
+                        <input type="text" readonly
+                               class="form-control form-control-sm vitals-title"
+                               data-field="value" v-model="bmi">
+                        <p class="py-1 m-0 px-2 font-weight-bold bg-white" v-if="!!bmi">
+                            <span class="text-sm text-warning-mellow" v-if="+bmi < 18.5">Underweight</span>
+                            <span class="text-sm text-success" v-if="+bmi >= 18.5 && +bmi < 25">Healthy Weight</span>
+                            <span class="text-sm text-warning-mellow" v-if="+bmi >= 25 && +bmi < 30">Overweight</span>
+                            <span class="text-sm text-warning-mellow" v-if="+bmi >= 30">Obese</span>
+                        </p>
+                    @elseif($k === "smokingStatus")
+                        <input type="text"
+                               class="form-control form-control-sm"
+                               data-field="value" v-model="items['smokingStatus'].value"
+                               data-option-list="smokingStatus"
+                               v-on:change="autoDate(items['smokingStatus'], 'smokingStatus')" v-on:keyup="autoDate(items['smokingStatus'], 'smokingStatus')">
+                        <div id="smoking-status-options" class="data-option-list">
+                            <div>Current</div>
+                            <div>Former</div>
+                            <div>Never</div>
+                        </div>
+                    @else
+                        <input type="text"
+                               class="form-control form-control-sm"
+                               data-field="value" v-model="items['{{ $k }}'].value"
+                               v-on:change="autoDate(items['{{ $k }}'], '{{ $k }}')" v-on:keyup="autoDate(items['{{ $k }}'], '{{ $k }}')">
+                    @endif
+                </td>
+                <td>
+                    <input type="date" {{ $k === 'bmi' ? 'readonly' : '' }}
+                           class="form-control form-control-sm vitals-title"
+                           data-field="date" v-model="items['{{ $k }}'].date">
+                </td>
+            </tr>
+        @endforeach
+
+        {{--<tr v-for="(item, index) in items">
             <td>
                 <input type="text" :data-index="index" tabindex="-1"
                        class="form-control form-control-sm events-none"
@@ -108,7 +176,7 @@ $formID = rand(0, 100000);
                        class="form-control form-control-sm vitals-title"
                        data-field="date" v-model="item.date">
             </td>
-        </tr>
+        </tr>--}}
         </tbody>
     </table>
 </div>

+ 41 - 13
resources/views/app/patient/canvas-sections/vitals/summary.php

@@ -1,5 +1,16 @@
 <?php
-
+$vitalLabels = [
+    "heightInches" => "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 = [
     "heightInches" => [
         "label" => "Ht. (in.)",
@@ -16,28 +27,28 @@ $contentData = [
         "value" => "",
         "date" => "",
     ],
-    "pulseRatePerMinute" => [
-        "label" => "Pulse",
+    "systolicBP" => [
+        "label" => "SBP",
         "value" => "",
         "date" => "",
     ],
-    "respirationRatePerMinute" => [
-        "label" => "Resp.",
+    "diastolicBP" => [
+        "label" => "DBP",
         "value" => "",
         "date" => "",
     ],
-    "pulseOx" => [
-        "label" => "Pulse Ox.",
+    "pulseRatePerMinute" => [
+        "label" => "Pulse",
         "value" => "",
         "date" => "",
     ],
-    "systolicBP" => [
-        "label" => "SBP",
+    "respirationRatePerMinute" => [
+        "label" => "Resp.",
         "value" => "",
         "date" => "",
     ],
-    "diastolicBP" => [
-        "label" => "DBP",
+    "pulseOx" => [
+        "label" => "Pulse Ox.",
         "value" => "",
         "date" => "",
     ],
@@ -57,14 +68,31 @@ if($patient->canvas_data) {
     $canvasData = json_decode($patient->canvas_data, true);
     if(isset($canvasData["vitals"])) {
         $contentData = $canvasData["vitals"];
+        // ensure $contentData has all the expected vitals and correct labels!
+        foreach ($vitalLabels as $k => $v) {
+            if(!isset($contentData[$k])) {
+                $contentData[$k] = [
+                    "label" => $v,
+                    "value" => "",
+                    "date" => "",
+                ];
+            }
+        }
+
     }
 }
 
-foreach ($contentData as $k => $vital) {
+foreach ($vitalLabels as $k => $v) {
 ?>
     <div class="d-flex vital-item align-items-center">
         <span class="content-html text-nowrap">
-            <span><?= $vital["label"] ?>:</span>
+            <span><?= $v ?>:</span>
+            <?php
+            $vital = [];
+            if(isset($contentData[$k])) {
+                $vital = $contentData[$k];
+            }
+            ?>
             <b><?= isset($vital["value"]) && !empty($vital["value"]) ? $vital["value"] : '-' ?></b>
             <?php if($k === 'bmi' && isset($vital["value"]) && !empty($vital["value"])):
                 $bmi = floatval($vital["value"]);