Bläddra i källkod

hcp note activity wip

= 3 år sedan
förälder
incheckning
1ddcd394a0

+ 8 - 65
app/Http/Controllers/PracticeManagementController.php

@@ -808,73 +808,16 @@ class PracticeManagementController extends Controller
             $query->where('uid', $proUid)->first();
         } 
 
-        $bills = Bill::where('is_cancelled', false);
+        $rows = DB::table('pro')
+        ->selectRaw(" *,
+            (SELECT id FROM note WHERE hcp_pro_id = p.id AND is_cancelled = false ORDER BY created_at DESC LIMIT 1) as last_note_id, 
+            (SELECT created_at FROM note WHERE hcp_pro_id = p.id AND is_cancelled = false ORDER BY created_at DESC LIMIT 1) as last_note_created_at,
+            (SELECT COUNT(*) FROM note WHERE hcp_pro_id = p.id AND is_cancelled = false ) AS note_count	")
+        ->orderBy('name_first')
+        ->paginate(50);
 
-        if(!$request->input('t') || $request->input('t') === 'hcp') {
-            $bills = $bills
-                ->where('has_hcp_been_paid', false)
-                ->where('hcp_expected_payment_amount', '>', 0)
-                ->where('is_signed_by_hcp', true);
-            if ($targetPro) {
-                $bills = $bills->where('hcp_pro_id', $targetPro->id);
-            }
-            if($request->input('c')) {
-                $bills = $bills->whereRaw('(SELECT company_id from company_pro where id = hcp_company_pro_id) = ' . $request->input('c'));
-            }
-        }
-        else if($request->input('t') === 'na') {
-            $bills = $bills
-                ->where('has_generic_pro_been_paid', false)
-                ->where('generic_pro_expected_payment_amount', '>', 0)
-                ->where('is_signed_by_generic_pro', true);
-            if ($targetPro) {
-                $bills = $bills->where('generic_pro_id', $targetPro->id);
-            }
-            if($request->input('c')) {
-                $bills = $bills->whereRaw('(SELECT company_id from company_pro where id = generic_company_pro_id) = ' . $request->input('c'));
-            }
-        }
 
-        $filter = $request->input('f');
-        switch ($filter) {
-            case 'verified':
-                $bills = $bills->where('is_verified', true);
-                break;
-            case 'not-verified':
-                $bills = $bills->where('is_verified', false);
-                break;
-        }
-
-        $filter = $request->input('bs');
-        if ($filter) {
-            $bills = $bills->where('balance_post_date', '>=', $filter);
-        }
-
-        $filter = $request->input('be');
-        if ($filter) {
-            $bills = $bills->where('balance_post_date', '<=', $filter);
-        }
-
-        $filter = $request->input('s');
-        if ($filter) {
-            $bills = $bills->where('code', '=', $filter);
-        }
-
-        $bills = $bills->orderBy('effective_date', 'desc')->paginate();
-
-        $companies = Company::where('is_active', true)->orderBy('name')->get();
-
-        $codes = DB::select(DB::raw("SELECT code, count(*) as count FROM bill WHERE is_cancelled IS FALSE GROUP BY code ORDER BY code"));
-
-        $viewData = [
-            'bills' => $bills,
-            'targetPro' => $targetPro,
-            'performerPro' => $performerPro,
-            'proUid' => $proUid,
-            'companies' => $companies,
-            'codes' => $codes
-        ];
-        return view('app.practice-management.processing-bill-matrix', $viewData);
+        return view('app.practice-management.hcp-note-activity', compact('rows'));
     }
 
 

+ 88 - 0
resources/views/app/practice-management/hcp-note-activity.blade.php

@@ -0,0 +1,88 @@
+@extends ('layouts/template')
+
+@section('content')
+
+<div id="practice-bills" 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>
+                HCP Note Activity
+            </strong>
+        </div>
+        <div class="card-body p-0 border-0 table-responsive">
+            <div class="m-2">
+               Filters here
+            </div>
+            <table class="table table-sm table-striped border-0 p-0 m-0 text-nowrap">
+                <thead class="bg-light">
+                    <tr>
+                        <th>First Name</th>
+                        <th>Last Name</th>
+                        <th>Last Note Created At</th>
+                        <th># Notes This Month</th>
+                        <th># Notes In the Period</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach ($rows as $row)
+                    <tr class="{{false ? 'bg-light' : ''}}">
+                        <td class="text-nowrap border-left-0">
+                            <a href="/patients/view/{{$row->client_uid}}">
+                                {{$row->clientDisplayName()}}
+                            </a>
+                        </td>
+                        <td class="text-nowrap border-left-0">
+                            <a href="/patients/view/{{$row->client_uid}}/notes/view/{{$row->note_uid}}">
+                                {{friendly_date_time($row->note_date, false)}}
+                            </a>
+                        </td>
+                        <td class="text-nowrap border-left-0">
+                            {{$row->proDisplayName()}}
+                        </td>
+                        <td class="text-nowrap border-left-0">
+                            {{$row->note_date}}
+                        </td>
+                        <td class="text-nowrap border-left-0">
+                            {{$row->new_or_fu_or_na}}
+                        </td>
+                        <td class="text-nowrap border-left-0">
+                            {{$row->method}}
+                        </td>
+                        <td class="text-nowrap border-left-0">
+                            {{$row->is_billing_closed}}
+                        </td>
+                        <td class="text-nowrap border-left-0">
+                            {{$row->is_claiming_closed}}
+                        </td>
+                        <td class="text-nowrap border-left-0">
+                            <pre>{{$row->claim_lines}}</pre>
+                        </td>
+                        <td class="text-nowrap border-left-0">
+                            <pre>{{$row->bills}}</pre>
+                        </td>
+                        <td class="text-nowrap border-left-0">
+                            <pre>{{$row->icds}}</pre>
+                        </td>
+                        <td class="text-nowrap border-left-0">
+                            @foreach($row->note->claims as $claim)
+                            {{ $claim->status }}<br />
+                            <?php foreach ($claim->mbClaims as $mbClaim) : continue; ?>
+                                {{$mbClaim->status}} {{$mbClaim->status_memo}}
+                            <?php endforeach; ?>
+                            @endforeach
+                        </td>
+                    </tr>
+                    @endforeach
+                </tbody>
+            </table>
+
+        </div>
+    </div>
+    <div class="mt-3">
+        {{$rows->appends(request()->input())->links()}}
+    </div>
+
+</div>
+@endsection