Jelajahi Sumber

Rx wizard - highlight ci if patient has it in dx

Vijayakrishnan 3 tahun lalu
induk
melakukan
c339eb46ba

+ 12 - 4
app/Helpers/fdb.php

@@ -62,7 +62,7 @@ if(!function_exists('precautions_info')) {
 }
 
 if(!function_exists('contraindications_info')) {
-    function contraindications_info($_drugs) {
+    function contraindications_info($_drugs, $_problems) {
 
         $result = [];
 
@@ -99,14 +99,22 @@ ORDER BY r1.routed_med_id, r3.dxid_desc56, r2.ddxcn_sl
                 $ciMap[$rxMap[$ci->routed_med_id]] = [];
             }
 
+            $flag = false;
+            foreach ($_problems as $_problem) {
+                if($_problem->data->dxid === $ci->dxid) {
+                    $flag = true;
+                    break;
+                }
+            }
+
             $ciMap[$rxMap[$ci->routed_med_id]][] = [
+                "dxid" => $ci->dxid,
                 "dxid_desc56" => $ci->dxid_desc56,
+                "flag" => $flag
             ];
         }
 
-        $result = $ciMap;
-
-        return $result;
+        return $ciMap;
 
     }
 }

+ 2 - 2
resources/views/app/fdb-pg/rx-vigilance.blade.php

@@ -3,7 +3,7 @@
 // info from patient chart
 $drugs = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");
 $allergies = \App\Models\Point::getPointsOfCategory($patient, "ALLERGY");
-$problems = \App\Models\Point::getPointsOfCategory($patient, "PROBLEMS");
+$problems = \App\Models\Point::getPointsOfCategory($patient, "PROBLEM");
 
 // filter out drugs without fdb info on them
 $drugs = $drugs->filter(function ($_drug) {
@@ -119,7 +119,7 @@ $dam = drug_allergy_info([$pivotRx], $allergies);
                 <p class="font-weight-bold mb-2">{{$drug}}</p>
                 <div class="flex-grow-1 d-inline-flex flex-wrap">
                     @foreach($contraindication as $ci)
-                        <span class="mr-2 px-2 py-0 border bg-light mb-1">{{$ci['dxid_desc56']}}</span>
+                        <span class="mr-2 px-2 py-0 border bg-light mb-1 {{@$ci['flag'] ? 'text-danger border-danger' : ''}}">{{$ci['dxid_desc56']}}</span>
                     @endforeach
                 </div>
             </div>

+ 1 - 1
resources/views/app/patient/medications-center.blade.php

@@ -433,7 +433,7 @@ $medications = $points;
                     </div>
 
                     <div class="d-flex align-items-center">
-                        <button type="submit" class="btn btn-sm btn-primary mr-2 my-1">Save Medication</button>
+                        <button type="submit" class="btn btn-sm btn-primary mr-2 mt-1">Save Medication</button>
                     </div>
                 </form>
             </div>