Pārlūkot izejas kodu

FDB Playground (wip)

Vijayakrishnan 3 gadi atpakaļ
vecāks
revīzija
fe1d77ab78

+ 16 - 0
app/Http/Controllers/FDBPGController.php

@@ -73,4 +73,20 @@ ORDER BY sm.side_sev DESC, sm.side_freq ASC
         );
         return view('app.fdb-pg.fdb-side-effects', compact('sides'));
     }
+
+    public function geriatricPrecautions(Request $request)
+    {
+        $gcnSeqNo = $request->input('gcn-seq-no') ? trim($request->input('gcn-seq-no')) : '';
+        if (empty($gcnSeqNo)) return '';
+        $precautions = DB::connection('pgsql_fdb')->select("
+SELECT r1.geri_code, gm.geri_sl, gm.geri_desc, gm.geri_narrative
+FROM rgerigc0_geri_gcnseqno_link r1 
+    JOIN rgerima1_geri_mstr gm ON r1.geri_code = gm.geri_code
+WHERE r1.gcn_seqno = :gcnSeqNo
+ORDER BY gm.geri_desc
+            ",
+            ['gcnSeqNo' => $gcnSeqNo]
+        );
+        return view('app.fdb-pg.fdb-geriatric-precautions', compact('precautions'));
+    }
 }

+ 24 - 0
resources/views/app/fdb-pg/fdb-geriatric-precautions.blade.php

@@ -0,0 +1,24 @@
+@if(!count($precautions))
+    <span class="d-block no-suggest-items">No geriatric precautions!</span>
+@else
+    <p class="font-weight-bold text-secondary mb-2">Geriatric Precautions</p>
+    <table class="table table-sm table-striped table-bordered">
+        <thead>
+        <tr>
+            <th>Desc</th>
+            <th>Severity</th>
+            <th>Narrative</th>
+        </tr>
+        </thead>
+        <tbody>
+        @foreach($precautions as $precaution)
+            <tr>
+                <td>{{$precaution->geri_desc}}</td>
+                <td>{{$precaution->geri_sl}}</td>
+                <td>{{$precaution->geri_narrative}}</td>
+            </tr>
+        @endforeach
+        </tbody>
+    </table>
+@endif
+

+ 1 - 0
resources/views/app/fdb-pg/fdb-side-effects.blade.php

@@ -1,6 +1,7 @@
 @if(!count($sides))
     <span class="d-block no-suggest-items">No side effects!</span>
 @else
+    <p class="font-weight-bold text-secondary mb-2">Side Effects</p>
     <table class="table table-sm table-striped table-bordered">
         <thead>
         <tr>

+ 11 - 0
resources/views/app/fdb-pg/index.blade.php

@@ -50,6 +50,9 @@
                     </div>
                     <div class="col-3 side-effects">
 
+                    </div>
+                    <div class="col-3 geriatric-precautions">
+
                     </div>
                 </div>
             </div>
@@ -152,6 +155,13 @@
                 });
             }
 
+            function fillGeriatricPrecautions(_gcn_seqno) {
+                $('.geriatric-precautions').empty();
+                $.get('/fdb-geriatric-precautions?gcn-seq-no=' + _gcn_seqno, _data => {
+                    $('.geriatric-precautions').html(_data);
+                });
+            }
+
             addMCInitializer('fdb-pg', function() {
 
                 $('[fdb-med-suggest-search]:not([fdb-suggest-initialized])').each(function() {
@@ -255,6 +265,7 @@
                 $(document).off('change', '[fdb-med-suggest-strength]');
                 $(document).on('change', '[fdb-med-suggest-strength]', function () {
                     fillSideEffects($(this).val());
+                    fillGeriatricPrecautions($(this).val());
                 });
 
             }, '#fdb-pg');

+ 1 - 0
routes/web.php

@@ -329,6 +329,7 @@ Route::middleware('pro.auth')->group(function () {
     Route::get('/fdb-routed-dosages', 'FDBPGController@routedDosages');
     Route::get('/fdb-meds', 'FDBPGController@meds');
     Route::get('/fdb-side-effects', 'FDBPGController@sideEffects');
+    Route::get('/fdb-geriatric-precautions', 'FDBPGController@geriatricPrecautions');
 });
 
 Route::post("/process_form_submit", 'NoteController@processFormSubmit')->name('process_form_submit');