Explorar el Código

ClientMemo UI

Vijayakrishnan Krishnan hace 4 años
padre
commit
03fc85f10e

+ 5 - 0
app/Http/Controllers/PatientController.php

@@ -89,6 +89,11 @@ class PatientController extends Controller
         return view('app.patient.history', compact('patient', 'infoLines'));
     }
 
+    public function memos(Request $request, Client $patient )
+    {
+        return view('app.patient.memos', compact('patient'));
+    }
+
     public function sms(Request $request, Client $patient )
     {
         return view('app.patient.sms', compact('patient'));

+ 5 - 0
app/Models/Client.php

@@ -83,4 +83,9 @@ class Client extends Model
             ->orderBy('start_time', 'desc');
     }
 
+    public function memos() {
+        return $this->hasMany(ClientMemo::class, 'client_id', 'id')
+            ->orderBy('created_at', 'desc');
+    }
+
 }

+ 9 - 0
app/Models/ClientMemo.php

@@ -0,0 +1,9 @@
+<?php
+
+namespace App\Models;
+
+class ClientMemo extends Model
+{
+    protected $table = 'client_memo';
+
+}

+ 121 - 0
resources/views/app/patient/memos.blade.php

@@ -0,0 +1,121 @@
+@extends ('layouts.patient')
+@section('inner-content')
+    <div class="">
+        <div class="d-flex align-items-center pb-2">
+            <h4 class="font-weight-bold m-0">Client Memos</h4>
+            <span class="mx-2 text-secondary">|</span>
+            <div moe wide>
+                <a start show class="">Add</a>
+                <form url="/api/clientMemo/create">
+                    <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+                    <div class="mb-2">
+                        <select class="form-control form-control-sm" name="category" required>
+                            <option value="">-- select --</option>
+                            <option value="Incoming Call">Incoming Call</option>
+                            <option value="Outgoing Call">Outgoing Call</option>
+                            <option value="Call Unspecified">Call Unspecified</option>
+                            <option value="Other">Other</option>
+                        </select>
+                    </div>
+                    <div class="mb-2">
+                        <textarea class="form-control form-control-sm" rows="10" name="content" placeholder="Content"></textarea>
+                    </div>
+                    <div class="d-flex align-items-center">
+                        <button class="btn btn-sm btn-primary mr-2" type="button" submit>Save</button>
+                        <button class="btn btn-sm btn-default mr-2 border" type="button" cancel>Cancel</button>
+                    </div>
+                </form>
+            </div>
+        </div>
+        <table class="table table-striped table-sm table-bordered mb-0">
+            @if($patient->memos && count($patient->memos))
+                <thead>
+                <tr>
+                    <th class="px-2 text-secondary">Created</th>
+                    <th class="px-2 text-secondary">Category</th>
+                    <th class="px-2 text-secondary">Summary</th>
+                    <th class="px-2 text-secondary delete-column">&nbsp;</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach($patient->memos as $memo)
+                    <tr>
+                        <td class="px-2">{{ friendly_date_time($memo->created_at) }}</td>
+                        <td class="px-2">{{ $memo->category }}</td>
+                        <td class="px-2"><pre class="m-0">{{ $memo->content }}</pre></td>
+                        <td class="px-2 text-center delete-column">
+                            <div moe wide relative class="mr-2">
+                                <a class="on-hover-opaque" start show title="Edit">
+                                    <i class="font-size-11 fa fa-edit"></i>
+                                </a>
+                                <form url="/api/clientMemo/update" right>
+                                    <input type="hidden" name="uid" value="{{ $memo->uid }}">
+                                    <div class="mb-2">
+                                        <select class="form-control form-control-sm" name="category" required>
+                                            <option value="">-- select --</option>
+                                            <option {{ $memo->category === "Incoming Call" ? "selected" : "" }} value="Incoming Call">Incoming Call</option>
+                                            <option {{ $memo->category === "Outgoing Call" ? "selected" : "" }} value="Outgoing Call">Outgoing Call</option>
+                                            <option {{ $memo->category === "Call Unspecified" ? "selected" : "" }} value="Call Unspecified">Call Unspecified</option>
+                                            <option {{ $memo->category === "Other" ? "selected" : "" }} value="Other">Other</option>
+                                        </select>
+                                    </div>
+                                    <div class="mb-2">
+                                        <textarea class="form-control form-control-sm" name="content" rows="10"
+                                                  placeholder="Content"><?= $memo->content ?></textarea>
+                                    </div>
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-primary mr-2" type="button" submit>Save</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" type="button"
+                                                cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                            <div moe relative>
+                                <a start show class="on-hover-opaque"><i class="fa fa-trash-alt text-danger"></i></a>
+                                <form url="/api/clientMemo/cancel" right>
+                                    <input type="hidden" name="uid" value="{{ $memo->uid }}">
+                                    <p class="small">Are you sure you want to cancel this memo?</p>
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-danger mr-2" submit>Delete</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                        </td>
+                    </tr>
+                @endforeach
+                </tbody>
+            @else
+                <tbody>
+                    <tr>
+                        <td class="text-secondary p-3">No memos have been created for this patient</td>
+                    </tr>
+                </tbody>
+            @endif
+        </table>
+    </div>
+    <script>
+        (function() {
+            function init() {
+                $('input[type="text"][name="contentText"]').each(function() {
+                    var elem = this, dynID = 'rx-' + Math.ceil(Math.random() * 1000000);
+                    $(elem).attr('id', dynID);
+                    var strengthElem = $(elem).closest('form').find('[name="strength"]')[0],
+                        dynStrengthsID = 'rx-' + Math.ceil(Math.random() * 1000000) + '-strengths';
+                    $(strengthElem).attr('id', dynStrengthsID);
+                    new window.Def.Autocompleter.Prefetch(dynStrengthsID, []);
+                    new window.Def.Autocompleter.Search(dynID,
+                        'https://clinicaltables.nlm.nih.gov/api/rxterms/v3/search?ef=STRENGTHS_AND_FORMS');
+                    window.Def.Autocompleter.Event.observeListSelections(dynID, function() {
+                        var autocomp = elem.autocomp;
+                        var strengths =
+                            autocomp.getSelectedItemData()[0].data['STRENGTHS_AND_FORMS'];
+                        if (strengths)
+                            strengthElem.autocomp.setListAndField(strengths, '');
+                    });
+                });
+            }
+            addMCInitializer('patient-rx-list', init);
+        })();
+    </script>
+@endsection

+ 3 - 0
resources/views/layouts/patient.blade.php

@@ -35,6 +35,9 @@
                         <li class="nav-item">
                             <a class="nav-link" href="{{ route('patients.view.history', ['patient' => $patient]) }}">History</a>
                         </li>
+                        <li class="nav-item">
+                            <a class="nav-link" href="{{ route('patients.view.memos', ['patient' => $patient]) }}">Memos</a>
+                        </li>
                         <li class="nav-item">
                             <a class="nav-link" href="{{ route('patients.view.sms', ['patient' => $patient]) }}">SMS</a>
                         </li>

+ 1 - 0
routes/web.php

@@ -83,6 +83,7 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('measurements', 'PatientController@measurements')->name('measurements');
         Route::get('labs-and-studies', 'PatientController@labsAndStudies')->name('labs-and-studies');
         Route::get('history', 'PatientController@history')->name('history');
+        Route::get('memos', 'PatientController@memos')->name('memos');
         Route::get('sms', 'PatientController@sms')->name('sms');
         Route::get('sms-numbers', 'PatientController@smsNumbers')->name('sms-numbers');
         Route::get('documents', 'PatientController@documents')->name('documents');