Преглед на файлове

Admin stat & matrix for pending coverage

Vijayakrishnan преди 3 години
родител
ревизия
08f533c446

+ 25 - 0
app/Http/Controllers/HomeController.php

@@ -569,6 +569,31 @@ WHERE ((client.mcp_pro_id = {$performer->pro->id}) OR (client.rmm_pro_id = {$per
         // num measurements that need stamping
         $keyNumbers['measurementsToBeStamped'] = $this->performer()->pro->getUnstampedMeasurementsFromCurrentMonth(true, null, null);
 
+        if($performer->pro->pro_type === 'ADMIN') {
+
+            // patients without coverage information
+            $keyNumbers['patientsWithoutCoverageInformation'] = DB::select(DB::raw("
+SELECT count(DISTINCT (cl.id)) as cnt
+FROM client cl
+WHERE cl.latest_client_primary_coverage_id IS NULL -- no coverage record"
+            ))[0]->cnt;
+
+            // patients pending coverage verification
+            $keyNumbers['patientsPendingCoverageVerification'] = DB::select(DB::raw("
+SELECT count(DISTINCT (cl.id)) as cnt
+FROM client cl
+         LEFT JOIN client_primary_coverage cpc ON cl.latest_client_primary_coverage_id = cpc.id
+WHERE (cl.latest_client_primary_coverage_id IS NOT NULL -- coverage exists, but status is null or unknown
+    AND (
+               (cpc.plan_type = 'MEDICARE' AND (cpc.is_partbprimary = 'UNKNOWN' OR cpc.is_partbprimary IS NULL))
+               OR
+               (cpc.plan_type != 'MEDICARE' AND
+                (cpc.manual_determination_category = 'UNKNOWN' OR cpc.manual_determination_category IS NULL))
+           ))"
+            ))[0]->cnt;
+
+        }
+
         return view('app/dashboard', compact('keyNumbers', 'reimbursement', 'milliseconds',
             'businessNumbers',
             'incomingReports', 'tickets', 'supplyOrders',

+ 39 - 0
app/Http/Controllers/PracticeManagementController.php

@@ -372,6 +372,45 @@ class PracticeManagementController extends Controller
         return view('app.practice-management.my-favorites', compact('myFavorites', 'filter'));
     }
 
+    public function patientsWithoutCoverage(Request $request, $filter = 'all')
+    {
+        $performer = $this->performer();
+
+        $sql = "SELECT cl.uid, cl.name_first, cl.name_last FROM client cl ";
+
+        $joinClause = 'LEFT JOIN client_primary_coverage cpc ON cl.latest_client_primary_coverage_id = cpc.id ';
+        $withoutCondition = "cl.latest_client_primary_coverage_id IS NULL";
+        $pendingCondition = "
+(cl.latest_client_primary_coverage_id IS NOT NULL -- coverage exists, but status is null or unknown
+    AND (
+               (cpc.plan_type = 'MEDICARE' AND (cpc.is_partbprimary = 'UNKNOWN' OR cpc.is_partbprimary IS NULL))
+               OR
+               (cpc.plan_type != 'MEDICARE' AND
+                (cpc.manual_determination_category = 'UNKNOWN' OR cpc.manual_determination_category IS NULL))
+           ))";
+
+        switch ($filter) {
+            case 'without-coverage-information':
+                $sql .= 'WHERE ';
+                $sql .= $withoutCondition;
+                break;
+            case 'pending-coverage-verification':
+                $sql .= $joinClause . 'WHERE ';
+                $sql .= $pendingCondition;
+                break;
+            default:
+                $sql .= $joinClause . 'WHERE ';
+                $sql .= $withoutCondition . ' OR ' . $pendingCondition;
+                break;
+        }
+
+        $sql .= ' ORDER BY cl.name_first ASC';
+
+        $pendingCoverage = DB::select(DB::raw($sql));
+
+        return view('app.practice-management.patients-without-coverage', compact('pendingCoverage', 'filter'));
+    }
+
     public function proAvailability(Request $request, $proUid = null)
     {
         $performer = $this->performer();

+ 10 - 0
resources/views/app/dashboard.blade.php

@@ -93,6 +93,16 @@
                                         <a href="/practice-management/rm-bills-to-sign">RM Bills to Sign</a>
                                     </th>
                                 </tr>
+                                @if($pro->pro_type === 'ADMIN')
+                                    <tr>
+                                        <th class="px-2 text-center">{{$keyNumbers['patientsWithoutCoverageInformation']}}</th>
+                                        <th class="pl-2"><a href="/practice-management/patients-without-coverage/without-coverage-information">Without coverage information</a></th>
+                                    </tr>
+                                    <tr>
+                                        <th class="px-2 text-center">{{$keyNumbers['patientsPendingCoverageVerification']}}</th>
+                                        <th class="pl-2"><a href="/practice-management/patients-without-coverage/pending-coverage-verification">Pending coverage verification</a></th>
+                                    </tr>
+                                @endif
                             </tbody>
                         </table>
                     </div>

+ 43 - 0
resources/views/app/practice-management/patients-without-coverage.blade.php

@@ -0,0 +1,43 @@
+@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="">
+                <i class="fas fa-user-injured"></i>
+                Patients pending coverage info/verification
+            </strong>
+            <select class="ml-auto max-width-300px form-control form-control-sm"
+                    onchange="fastLoad('/practice-management/patients-without-coverage/' + this.value, true, false, false)">
+                <option value="all" {{ !$filter || $filter === 'all' ? 'selected' : '' }}>All Pending</option>
+                <option value="without-coverage-information" {{ $filter === 'without-coverage-information' ? 'selected' : '' }}>Without coverage information</option>
+                <option value="pending-coverage-verification" {{ $filter === 'pending-coverage-verification' ? 'selected' : '' }}>Pending coverage verification</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 w-25">Patient</th>
+                    <th class="border-0">Coverage</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach($pendingCoverage as $pc)
+                    <tr>
+                        <td class="px-3 text-nowrap">{{ $pc->name_first }} {{ $pc->name_last }}</td>
+                        <td>
+                            <a href="/patients/view/client-primarycoverages/{{$pc->uid}}">Manage Coverage</a>
+                        </td>
+                    </tr>
+                @endforeach
+                </tbody>
+            </table>
+        </div>
+    </div>
+    </div>
+
+@endsection

+ 1 - 0
routes/web.php

@@ -95,6 +95,7 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('my-tickets/{filter?}', 'PracticeManagementController@myTickets')->name('myTickets');
         Route::get('my-text-shortcuts', 'PracticeManagementController@myTextShortcuts')->name('myTextShortcuts');
         Route::get('my-favorites/{filter?}', 'PracticeManagementController@myFavorites')->name('myFavorites');
+        Route::get('patients-without-coverage/{filter?}', 'PracticeManagementController@patientsWithoutCoverage')->name('patients-without-coverage');
         Route::get('pro-availability/{proUid?}', 'PracticeManagementController@proAvailability')->name('proAvailability');
         Route::get('calendar/{proUid?}', 'PracticeManagementController@calendar')->name('proCalendar');