Sfoglia il codice sorgente

Patients and notes top level lists with filters

Vijayakrishnan Krishnan 4 anni fa
parent
commit
ced9e15d9a

+ 36 - 12
app/Http/Controllers/HomeController.php

@@ -110,20 +110,44 @@ class HomeController extends Controller
         return view('app/dashboard', compact('keyNumbers', 'reimbursement', 'appointments'));
     }
 
-    public function patients(Request $request)
+    public function patients(Request $request, $filter = '')
     {
         $proID = $this->performer()->pro->id;
-        $patients = Client::where(function ($q) use($proID) {
-                $q->where('mcp_pro_id', $proID)
-                    ->orWhere('cm_pro_id', $proID)
-                    ->orWhere('rmm_pro_id', $proID)
-                    ->orWhere('rme_pro_id', $proID)
-                    ->orWhereRaw('id IN (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = ?)', [$proID]);
-            })
-            ->orderBy('name_last', 'asc')
-            ->orderBy('name_first', 'asc')
-            ->get();
-        return view('app/patients', ['patients' => $patients]);
+        $query = Client::where(function ($q) use($proID) {
+            $q->where('mcp_pro_id', $proID)
+                ->orWhere('cm_pro_id', $proID)
+                ->orWhere('rmm_pro_id', $proID)
+                ->orWhere('rme_pro_id', $proID)
+                ->orWhereRaw('id IN (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = ?)', [$proID]);
+        });
+        switch ($filter) {
+            case 'not-yet-seen':
+                $query = $query->where('has_mcp_done_onboarding_visit', '<>', 'YES');
+                break;
+
+            // more cases can be added as needed
+            default:
+                break;
+        }
+        $patients = $query->orderBy('name_last', 'asc')->orderBy('name_first', 'asc')->get();
+        return view('app/patients', compact('patients', 'filter'));
+    }
+
+    public function notes(Request $request, $filter = '')
+    {
+        $proID = $this->performer()->pro->id;
+        $query = Note::where('hcp_pro_id', $proID);
+        switch ($filter) {
+            case 'not-yet-signed':
+                $query = $query->where('is_signed_by_hcp', false);
+                break;
+
+            // more cases can be added as needed
+            default:
+                break;
+        }
+        $notes = $query->orderBy('created_at', 'desc')->get();
+        return view('app/notes', compact('notes', 'filter'));
     }
 
     public function newPatient(Request $request)

+ 3 - 0
public/css/style.css

@@ -188,6 +188,9 @@ body>nav.navbar {
 .mcp-theme-1 .min-width-200px {
     min-width: 200px;
 }
+.mcp-theme-1 .max-width-300px {
+    max-width: 300px;
+}
 .cancelled-item {
     opacity: 0.5;
 }

+ 3 - 3
resources/views/app/dashboard.blade.php

@@ -17,11 +17,11 @@
                             <tbody>
                                 <tr>
                                     <th>{{$keyNumbers['totalPatients']}}</th>
-                                    <th>Total patients</th>
+                                    <th><a href="/patients">Total patients</a></th>
                                 </tr>
                                 <tr>
                                     <th>{{$keyNumbers['patientsNotSeenYet']}}</th>
-                                    <th>Patients I have not seen yet</th>
+                                    <th><a href="/patients/not-yet-seen">Patients I have not seen yet</a></th>
                                 </tr>
                                 <tr>
                                     <th>{{$keyNumbers['pendingBillsToSign']}}</th>
@@ -29,7 +29,7 @@
                                 </tr>
                                 <tr>
                                     <th>{{$keyNumbers['pendingNotesToSign']}}</th>
-                                    <th>Pending notes to sign</th>
+                                    <th><a href="/notes/not-yet-signed">Pending notes to sign</a></th>
                                 </tr>
                             </tbody>
                         </table>

+ 61 - 0
resources/views/app/notes.blade.php

@@ -0,0 +1,61 @@
+@extends ('layouts/template')
+
+@section('content')
+
+    <div class="p-3 mcp-theme-1">
+    <div class="card">
+
+        <div class="card-header px-3 py-2 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-user-injured"></i>
+                Notes
+            </strong>
+            <select class="ml-auto max-width-300px form-control form-control-sm" onchange="fastLoad('/notes/' + this.value, true, false, false)">
+                <option value="" {{ $filter === '' ? 'selected' : '' }}>All notes</option>
+                <option value="not-yet-signed" {{ $filter === 'not-yet-signed' ? 'selected' : '' }}>Notes not yet signed</option>
+            </select>
+        </div>
+        <div class="card-body p-0">
+
+            <table class="table table-sm table-condensed p-0 m-0">
+                <thead class="bg-light">
+                <tr>
+                    <th class="px-3 border-0">Created</th>
+                    <th class="border-0">Effective Date</th>
+                    <th class="border-0">Patient</th>
+                    <th class="border-0 w-50">Content</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach ($notes as $note)
+                    <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
+                        <td class="px-3">
+                            {{ friendly_date_time($note->created_at, true) }}
+                        </td>
+                        <td class="">
+                            <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}" class="font-weight-bold">
+                                {{ friendly_date_time($note->effective_dateest, false) }}
+                            </a>
+                            <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
+                        </td>
+                        <td class="">
+                            <a href="/patients/view/{{ $note->client->uid }}">{{ $note->client->displayName() }}</a>
+                        </td>
+                        <td class="">
+                            <?php
+                            $textContent = strip_tags($note->free_text_html);
+                            if(strlen($textContent) > 200) {
+                                $textContent = substr($textContent, 0, 200) . '…';
+                            }
+                            ?>
+                            {!! empty($textContent) ? '-' : $textContent !!}
+                        </td>
+                    </tr>
+                @endforeach
+                </tbody>
+            </table>
+        </div>
+    </div>
+    </div>
+
+@endsection

+ 6 - 2
resources/views/app/patients.blade.php

@@ -5,11 +5,15 @@
     <div class="p-3 mcp-theme-1">
     <div class="card">
 
-        <div class="card-header px-3">
-            <strong>
+        <div class="card-header px-3 py-2 d-flex align-items-center">
+            <strong class="mr-4">
                 <i class="fas fa-user-injured"></i>
                 Patients
             </strong>
+            <select class="ml-auto max-width-300px form-control form-control-sm" onchange="fastLoad('/patients/' + this.value, true, false, false)">
+                <option value="" {{ $filter === '' ? 'selected' : '' }}>All patients</option>
+                <option value="not-yet-seen" {{ $filter === 'not-yet-seen' ? 'selected' : '' }}>Patients I have not seen yet</option>
+            </select>
         </div>
         <div class="card-body p-0">
             <table class="table table-condensed p-0 m-0">

+ 3 - 1
routes/web.php

@@ -33,7 +33,9 @@ Route::middleware('pro.auth')->group(function () {
 
     Route::get('/new-patient', 'HomeController@newPatient')->name('new-patient');
 
-    Route::get('/patients', 'HomeController@patients')->name('patients');
+    Route::get('/patients/{filter?}', 'HomeController@patients')->name('patients');
+
+    Route::get('/notes/{filter?}', 'HomeController@notes')->name('notes');
 
     Route::name('practice-management.')->prefix('practice-management')->group(function () {
         Route::get('rates', 'PracticeManagementController@rates')->name('rates');