Просмотр исходного кода

Allergies wizard - show fdb info on allergy selection

Vijayakrishnan 3 лет назад
Родитель
Сommit
cc1d3a5130

+ 4 - 4
app/Helpers/fdb.php

@@ -112,7 +112,7 @@ ORDER BY r1.routed_med_id, r3.dxid_desc56, r2.ddxcn_sl
 }
 
 if(!function_exists('drug_allergy_info')) {
-    function drug_allergy_info($_drugs, $_allergies) {
+    function drug_allergy_info($_drugs, $_allergies, $_rxPivot = true) {
         $output = [];
 
         /*
@@ -134,17 +134,17 @@ if(!function_exists('drug_allergy_info')) {
             foreach ($_drugs as $rxItem) {
                 if($allergy->data->damConceptIdType == 6) { // ingredient
                     if (drugAllergyIngredientAllergenVsSingleRx($allergy, $rxItem)) {
-                        $output[] = "<b>{$rxItem->data->name}</b> can cause allergic reactions since the patient is allergic to <b>{$allergy->data->name}</b>.";
+                        $output[] = "<b>{$rxItem->data->name}</b> can cause allergic reactions " . ($_rxPivot ? 'since' : 'if') . " the patient is allergic to <b>{$allergy->data->name}</b>.";
                     }
                 }
                 else if($allergy->data->damConceptIdType == 2) { // medication
                     if (drugAllergyMedicationAllergenVsSingleRx($allergy, $rxItem)) {
-                        $output[] = "<b>{$rxItem->data->name}</b> can cause allergic reactions since the patient is allergic to <b>{$allergy->data->name}</b>.";
+                        $output[] = "<b>{$rxItem->data->name}</b> (medication) can cause allergic reactions " . ($_rxPivot ? 'since' : 'if') . " the patient is allergic to <b>{$allergy->data->name}</b>.";
                     }
                 }
                 else if($allergy->data->damConceptIdType == 1) { // allergen group
                     if (drugAllergyGroupAllergenVsSingleRx($allergy, $rxItem)) {
-                        $output[] = "<b>{$rxItem->data->name}</b> can cause allergic reactions since the patient is allergic to <b>{$allergy->data->name}</b>.";
+                        $output[] = "<b>{$rxItem->data->name}</b> can cause allergic reactions " . ($_rxPivot ? 'since' : 'if') . " the patient is allergic to <b>{$allergy->data->name}</b>.";
                     }
                 }
             }

+ 39 - 0
resources/views/app/fdb-pg/allergy-vigilance.blade.php

@@ -0,0 +1,39 @@
+<?php
+
+// info from patient chart
+$drugs = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");
+
+// filter out drugs without fdb info on them
+$drugs = $drugs->filter(function ($_drug) {
+    return @$_drug->data &&
+        $_drug->data->name &&
+        $_drug->data->medId &&
+        $_drug->data->routedMedId &&
+        $_drug->data->routedDosageFormMedId &&
+        $_drug->data->gcnSeqno;
+});
+
+// get pivot allergy
+$pivotAllergy = json_decode(json_encode([
+    "data" => [
+        "name" => request()->input('name'),
+        "damConceptId" => request()->input('damConceptId'),
+        "damConceptIdType" => request()->input('damConceptIdType')
+    ]
+]));
+
+// dam
+$dam = drug_allergy_info($drugs, [$pivotAllergy], false);
+
+?>
+
+@if(!!$dam)
+    <div class="p-3 mb-3 mt-2 border bg-white mr-0">
+        <p class="font-weight-bold m-0 font-size-14 text-info">Drug Allergy Notes</p>
+        <div class="mt-3">
+            {!! $dam !!}
+        </div>
+    </div>
+@endif
+
+

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

@@ -67,10 +67,6 @@ $dam = drug_allergy_info([$pivotRx], $allergies);
 
 ?>
 
-
-
-
-
 @if(!!$dptInfo)
     <div class="p-3 mb-3 mt-2 border bg-white mr-0">
         <p class="font-weight-bold m-0 font-size-14 text-info">Duplicate Therapy Notes</p>

+ 21 - 11
resources/views/app/patient/allergies-center.blade.php

@@ -305,7 +305,7 @@ $allergies = $points;
         </table>
 
         <div class="d-flex align-items-center">
-            <div class="mt-1 w-100 border p-2 bg-aliceblue border-info rounded">
+            <div class="mt-1 w-100 border p-3 bg-aliceblue border-info rounded">
                 <form action="/api/visitPoint/addTopLevel" class="mcp-theme-1 w-100" id="frm-add-allergy">
                     <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
                     <input type="hidden" name="category" value="ALLERGY">
@@ -314,18 +314,15 @@ $allergies = $points;
                     <input type="hidden" data-name="damConceptId">
                     <input type="hidden" data-name="damConceptIdType">
 
-                    <p class="mb-2"><b>Add Allergy</b></p>
-
                     <div class="row">
                         <div class="col-7">
-                            <div class="row mb-2">
-                                <div class="col-12">
-                                    <label class="text-sm mb-0">Name</label>
-                                    <input type="text" data-name="name" class="form-control form-control-sm"
-                                           stag-suggest
-                                           stag-suggest-ep="/fdb-allergy-suggest/json"
-                                           required>
-                                </div>
+                            <p class="mb-2"><b>Add Allergy</b></p>
+                            <div class="mb-2">
+                                <label class="text-sm mb-0">Name</label>
+                                <input type="text" data-name="name" class="form-control form-control-sm"
+                                       stag-suggest
+                                       stag-suggest-ep="/fdb-allergy-suggest/json"
+                                       required>
                             </div>
                             <div class="row mb-2">
                                 <div class="col-6 pr-0">
@@ -403,7 +400,9 @@ $allergies = $points;
 
                         </div>
                         <div class="col-5 border-left">
+                            <div class="fdb-allergy-vigilance max-height-400px overflow-auto">
 
+                            </div>
                         </div>
                     </div>
 
@@ -481,6 +480,17 @@ $allergies = $points;
                 .on('stag-suggest-selected', (_e, _input, _data) => {
                     _input.closest('form').find('input[data-name="damConceptId"]').val(_data.dam_concept_id);
                     _input.closest('form').find('input[data-name="damConceptIdType"]').val(_data.dam_concept_id_typ);
+
+                    $('.fdb-allergy-vigilance').html('<span class="text-secondary font-italic">Please wait ...</span>');
+                    $.post('/fdb-allergy-vigilance/{{$patient->uid}}', {
+                        _token: '{{csrf_token()}}',
+                        name: _input.val(),
+                        damConceptId: _data.dam_concept_id,
+                        damConceptIdType: _data.dam_concept_id_typ
+                    }, _data => {
+                        $('.fdb-allergy-vigilance').html(_data);
+                    });
+
                 });
 
             parentSegment.find('.additionReasonCategory_ui')