Kaynağa Gözat

Claims report

Vijayakrishnan 3 yıl önce
ebeveyn
işleme
f6c14f59c3

+ 42 - 0
app/Helpers/helpers.php

@@ -14,6 +14,48 @@ use App\Models\Bill;
 use Illuminate\Support\Facades\Http;
 use Soundasleep\Html2Text as Html2Text;
 
+
+if(!function_exists('chargeForCPT')) {
+    function chargeForCPT($cpt) {
+        switch($cpt) {
+            case "99202": return '$' . 172;
+            case "99203": return '$' . 262;
+            case "99204": return '$' . 387;
+            case "99205": return '$' . 512;
+            case "99211": return '$' . 56;
+            case "99212": return '$' . 133;
+            case "99213": return '$' . 212;
+            case "99214": return '$' . 297;
+            case "99215": return '$' . 418;
+            case "99354": return '$' . 289;
+            case "G0506": return '$' . 144;
+            case "99441": return '$' . 132;
+            case "99442": return '$' . 211;
+            case "99443": return '$' . 297;
+            case "99454": return '$' . 138;
+            case "99457": return '$' . 117;
+            case "99458": return '$' . 93;
+            case "90791": return '$' . 394;
+            case "90792": return '$' . 444;
+            case "90832": return '$' . 171;
+            case "90834": return '$' . 226;
+            case "90837": return '$' . 332;
+            case "90833": return '$' . 158;
+            case "90836": return '$' . 199;
+            case "90838": return '$' . 261;
+            case "99355": return '$' . 130;
+            case "97802": return '$' . 60;
+            case "97803": return '$' . 50;
+            case "99495": return '$' . 275;
+            case "99406": return '$' . 35.56;
+            case "99091": return '$' . 75;
+            case "99453": return '$' . 40;
+        }
+        
+        return '-';
+    }
+}
+
 if(!function_exists('currentSortForKey')) {
     function currentSortForKey($current, $key) {
         $found = false;

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

@@ -2096,6 +2096,92 @@ WHERE
         return view('app.practice-management.rpm-matrix-for-admin', compact('patients', 'daysRemaining', 'careMonthStart', 'paginator', 'perPage'));
     }
 
+    public function claimsReport(Request $request) {
+
+        $performer = $this->performer();
+
+        $conditions = ["(claim.status = 'SUBMITTED')"];
+
+        // default sort
+        if(!$request->input('sort_by')) {
+            $orderBy = "cline.created_at DESC NULLS LAST";
+        }
+        else {
+            $sortBy = json_decode($request->input('sort_by'));
+            $orderByClause = [];
+            foreach ($sortBy as $sortCriteria) {
+                $orderByClause[] = "{$sortCriteria->key} {$sortCriteria->order} NULLS LAST";
+            }
+            $orderBy = implode(', ', $orderByClause);
+        }
+
+        // filters from the UI
+        if(trim($request->input('f_start'))) {
+            $v = trim($request->input('f_start'));
+            $conditions[] = "(cline.date_of_service >= '{$v}')";
+        }
+        if(trim($request->input('f_end'))) {
+            $v = trim($request->input('f_end'));
+            $conditions[] = "(cline.date_of_service <= '{$v}')";
+        }
+
+        $defaultPageSize = 25;
+
+        $page = $request->input('page') ?: 1;
+        $perPage = $request->input('per_page') ?: $defaultPageSize;
+        $offset = ($page - 1) * $perPage;
+
+        $countQuery = "
+SELECT COUNT(*)
+FROM claim_line cline
+    join claim on cline.claim_id = claim.id
+    join client on claim.client_id = client.id 
+    left join pro on claim.pro_id = pro.id
+    left join client_primary_coverage cpc on client.effective_client_primary_coverage_id = cpc.id
+    left join payer on cpc.commercial_payer_id = payer.id
+WHERE
+      " . implode(' AND ', $conditions) . "      
+";
+
+        $countResult = DB::select($countQuery);
+        $total = $countResult[0]->count;
+
+        $query = "
+SELECT (client.name_first || ' ' || client.name_last) as client_name,
+       client.uid as client_uid, 
+       client.dob,
+       client.age_in_years,
+       client.is_enrolled_in_rm,
+       client.mailing_address_state,
+       (pro.name_first || ' ' || pro.name_last) as pro_name,
+       (CASE 
+           WHEN cpc.plan_type LIKE 'COMMERCIAL' THEN payer.name
+           ELSE cpc.plan_type
+       END) as payer_name,
+       cline.date_of_service,
+       cline.cpt
+FROM claim_line cline 
+    join claim on cline.claim_id = claim.id
+    join client on claim.client_id = client.id 
+    left join pro on claim.pro_id = pro.id
+    left join client_primary_coverage cpc on client.effective_client_primary_coverage_id = cpc.id
+    left join payer on cpc.commercial_payer_id = payer.id
+WHERE
+      " . implode(' AND ', $conditions) . "
+      ORDER BY {$orderBy} OFFSET {$offset} LIMIT {$perPage}
+";
+
+        // dd($query);
+
+        $rows = DB::select($query);
+
+        $paginator = new LengthAwarePaginator($rows, $total, $request->input('per_page') ?: $defaultPageSize, $request->input('page') ?: 1);
+        $perPage = $request->input('per_page') ?: $defaultPageSize;
+        $paginator->setPath(route('practice-management.claims-report'));
+
+        return view('app.practice-management.claims-report', compact('rows', 'paginator', 'perPage'));
+    }
+
     public function remoteMonitoringMCP(Request $request) {
         return $this->rpmMatrixByProType($request, 'mcp');
     }

+ 123 - 0
resources/views/app/practice-management/claims-report.blade.php

@@ -0,0 +1,123 @@
+@extends ('layouts/template')
+
+@section('content')
+<style>
+	#rm-action-report-filters label {
+		font-weight: bold;
+	}
+
+	#rm-action-report-filters .mw-100px {
+		min-width: 100px;
+	}
+	.filter-container{
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+	.filter-container >div {
+		width: 165px;
+	}
+	.filter-container >div:not(:last-child) {
+		margin-right: 15px;
+	}
+	.sm-section {
+		width: 150px !important;
+	}
+    thead.border-bottom-0 tr th {
+        border-bottom: none;
+    }
+</style>
+<div id="rm-action-report" class="p-3 mcp-theme-1">
+    <div class="card">
+
+        <div class="card-header px-2 py-1 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-user"></i>
+                Claims Report
+            </strong>
+        </div>
+        <div class="card-body p-0 border-0 table-responsive">
+            <div class="m-2">
+                <form method="GET" action="{{ route('practice-management.claims-report') }}">
+                    <div class="d-flex align-items-baseline">
+                        <div class="form-group my-0 mr-2">
+                            <label class="font-weight-normal mb-1">DOS From</label>
+                            <input name="f_start" type="date" class="form-control form-control-sm" value="{{request()->input('f_start')}}">
+                        </div>
+                        <div class="form-group my-0 mr-2">
+                            <label class="font-weight-normal mb-1">DOS To</label>
+                            <input name="f_end" type="date" class="form-control form-control-sm" value="{{request()->input('f_end')}}">
+                        </div>
+                        <div class="form-group m-0">
+                            <label class="font-weight-normal mb-1">&nbsp;</label>
+                            <div class=" d-flex">
+                                <button type="button" onclick="return fastLoad('{{  route('practice-management.claims-report') }}?' + $(this).closest('form').serialize())" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+                                <a href="#" onclick="return fastLoad('{{  route('practice-management.claims-report') }}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+                            </div>
+                        </div>
+                    </div>
+                </form>
+            </div> 
+            <table class="table table-sm table-striped table-bordered border-0 p-0 m-0 text-nowrap">
+                <thead class="bg-light border-bottom-0">
+                    <tr>
+                        <th class="border-left-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'Insurance', 'key' => 'payer_name'])</th>
+                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'State', 'key' => 'mailing_address_state'])</th>
+                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'Patient', 'key' => 'client_name'])</th>
+                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'DOB', 'key' => 'dob'])</th>
+                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'Provider', 'key' => 'pro_name'])</th>
+                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'Date of Service', 'key' => 'date_of_service'])</th>
+                        <th class="text-secondary">POS</th>
+                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'CPT', 'key' => 'cpt'])</th>
+                        <th class="text-secondary">A</th>
+                        <th class="text-secondary">Units</th>
+                        <th class="text-secondary">Charges</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach ($rows as $row)
+                    <tr class="{{false ? 'bg-light' : ''}}">
+                        <td class="text-nowrap border-left-0">
+                            {{$row->payer_name}}
+                        </td>
+                        <td>
+                            {{$row->mailing_address_state}}
+                        </td>
+                        <td class="">
+                            <a href="/patients/view/{{$row->client_uid}}">
+                                {{$row->client_name}}
+                            </a>
+                        </td>
+                        <td>
+                            {{$row->dob}}
+                        </td>
+                        <td>
+                            {{$row->pro_name}}
+                        </td>
+                        <td>
+                            {{friendly_date($row->date_of_service)}}
+                        </td>
+                        <td>10</td>     <!-- dunno what these are!! -->
+                        <td>{{$row->cpt}}</td>
+                        <td>95</td>     <!-- dunno what these are!! -->
+                        <td>1</td>      <!-- dunno what these are!! -->
+                        <td>
+                            {{$row->cpt ? chargeForCPT($row->cpt) : '-'}}
+                        </td>
+                    </tr>
+                    @endforeach
+                </tbody>
+            </table>
+
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mt-3">
+        {!! $paginator->withQueryString()->links() !!}
+        <div class="mb-3">
+            <div class="ml-4 mb-3">Showing <b>{{$paginator->firstItem()}}</b> to <b>{{$paginator->lastItem()}}</b> (page {{$paginator->currentPage()}}) of <b>{{$paginator->total()}}</b> care months</div>
+        </div>
+    </div>
+
+</div>
+
+@endsection

+ 1 - 0
resources/views/layouts/template.blade.php

@@ -194,6 +194,7 @@
                             <i class="mr-1 fas fa-tasks"></i> Admin
                         </a>
                         <div class="dropdown-menu mcp-theme-1 no-overflow-menu p-0" aria-labelledby="practice-management">
+                            <a class="dropdown-item" href="{{ route('practice-management.claims-report') }}">Claims Reports</a>
                             <a class="dropdown-item" href="{{ route('practice-management.coverages') }}">Coverage Center</a>
                             <a class="dropdown-item" href="{{ route('practice-management.notes-resolution-center') }}">Notes Resolution Center</a>
                             <a class="dropdown-item" href="{{ route('practice-management.notes-resolution-center-v2') }}">Notes Resolution Center V2</a>

+ 2 - 0
routes/web.php

@@ -380,6 +380,8 @@ Route::middleware('pro.auth')->group(function () {
             Route::get('remote-monitoring-admin-count', 'PracticeManagementController@remoteMonitoringAdminCount')->name('remote-monitoring-admin-count');
 
             Route::get('rpm-admin', 'PracticeManagementController@rpmMatrixForAdmin')->name('rpm-matrix-admin');
+
+            Route::get('claims-report', 'PracticeManagementController@claimsReport')->name('claims-report');
         });
 
         Route::get('supply-orders/cancelled-but-unacknowledged', 'PracticeManagementController@supplyOrdersCancelledButUnacknowledged')->name('supply-orders-cancelled-but-unacknowledged');