= преди 4 години
родител
ревизия
dcac39db57

+ 37 - 24
app/Http/Controllers/PracticeManagementController.php

@@ -89,7 +89,7 @@ class PracticeManagementController extends Controller
                 $query = $query->where('is_signed_by_hcp', false);
                 break;
 
-                // more cases can be added as needed
+            // more cases can be added as needed
             default:
                 break;
         }
@@ -138,7 +138,7 @@ class PracticeManagementController extends Controller
                     });
                 break;
 
-                // more cases can be added as needed
+            // more cases can be added as needed
             default:
                 break;
         }
@@ -245,7 +245,7 @@ class PracticeManagementController extends Controller
         $startDate = date('Y-m-d', strtotime("sunday -1 week"));
         $endDateTime = new DateTime($startDate);
         $endDateTime->modify('+6 day');
-        $endDate =  $endDateTime->format("Y-m-d");
+        $endDate = $endDateTime->format("Y-m-d");
 
         $eventsData = $pro->getAvailabilityEvents($startDate, $endDate);
         $events = json_encode($eventsData);
@@ -295,14 +295,16 @@ class PracticeManagementController extends Controller
     }
 
     // check video page
-    public function checkVideo(Request $request, $uid) {
+    public function checkVideo(Request $request, $uid)
+    {
         $session = AppSession::where('session_key', $request->cookie('sessionKey'))->first();
         $client = !empty($uid) ? Client::where('uid', $uid)->first() : null;
         $publish = false;
         return view('app.video.check-video-minimal', compact('session', 'client'));
     }
 
-    public function getParticipantInfo(Request $request) {
+    public function getParticipantInfo(Request $request)
+    {
         $sid = intval($request->get('uid')) - 1000000;
         $session = AppSession::where('id', $sid)->first();
         $result = [
@@ -382,27 +384,38 @@ class PracticeManagementController extends Controller
         return view('app.practice-management.calendar', compact('pros'));
     }
 
-    public function cellularDeviceManager(Request $request, $proUid = null){
+    public function cellularDeviceManager(Request $request, $proUid = null)
+    {
         $proUid = $proUid ? $proUid : $request->get('pro-uid');
         $performerPro = $this->performer->pro;
         $targetPro = null;
         $allPros = [];
         $expectedForHcp = null;
-        if($performerPro->pro_type == 'ADMIN'){
+        if ($performerPro->pro_type == 'ADMIN') {
             $allPros = Pro::all();
             $targetPro = Pro::where('uid', $proUid)->first();
-        }else{
+        } else {
             $targetPro = $performerPro;
         }
         $clients = [];
-        if($targetPro){
+        if ($targetPro) {
             $clients = Client::where('mcp_pro_id', $targetPro->id)->orderBy('created_at', 'desc')->paginate(100);
-        }else{
+        } else {
             $clients = Client::orderBy('created_at', 'desc')->paginate(100);
         }
         return view('app.practice-management.cellular-device-manager', compact('clients', 'allPros', 'targetPro'));
     }
 
+    public function treatmentServiceUtil(Request $request){
+        $view_treatment_service_utilization_org = DB::select(DB::raw("SELECT * FROM view_treatment_service_utilization_org ORDER BY effective_date DESC"));
+        $view_treatment_service_utilization = DB::select(DB::raw("SELECT * FROM view_treatment_service_utilization ORDER BY effective_date DESC, total_hrs DESC"));
+        $view_treatment_service_utilization_by_patient = DB::select(DB::raw("SELECT * FROM view_treatment_service_utilization_by_patient ORDER BY pro_lname ASC, pro_fname ASC, hcp_pro_id ASC, total_hrs DESC"));
+        return view('app.practice-management.treatment-services-util', compact(
+            'view_treatment_service_utilization_org',
+            'view_treatment_service_utilization',
+            'view_treatment_service_utilization_by_patient'));
+    }
+
     public function hcpBillMatrix(Request $request, $proUid = null)
     {
         $proUid = $proUid ? $proUid : $request->get('pro-uid');
@@ -410,20 +423,19 @@ class PracticeManagementController extends Controller
         $targetPro = null;
         $allPros = [];
         $expectedForHcp = null;
-        if($performerPro->pro_type == 'ADMIN'){
+        if ($performerPro->pro_type == 'ADMIN') {
             $allPros = Pro::all();
             $targetPro = Pro::where('uid', $proUid)->first();
-        }else{
+        } else {
             $targetPro = $performerPro;
         }
         $bills = [];
-        if($targetPro){
-            $expectedForHcp = DB::select(DB::raw("SELECT coalesce(SUM(hcp_expected_payment_amount),0) as expected_pay FROM bill WHERE hcp_pro_id = :targetProID  AND is_signed_by_hcp IS TRUE AND is_cancelled = false"), ['targetProID' => $targetPro->id])[0]->expected_pay;
-            $bills = Bill::where('hcp_pro_id', $targetPro->id)->orderBy('created_at', 'desc')->paginate(500);
-        }else{
-            $bills = Bill::orderBy('created_at', 'desc')->paginate(500);
+        if ($targetPro) {
+            $rows = DB::select(DB::raw("SELECT * FROM aemish_bill_report WHERE hcp_pro_id = :targetProID"), ['targetProID' => $targetPro->id]);
+        } else {
+            $rows = DB::select(DB::raw("SELECT * FROM aemish_bill_report"));
         }
-        return view('app.practice-management.hcp-bill-matrix', compact('bills', 'allPros', 'expectedForHcp', 'targetPro'));
+        return view('app.practice-management.hcp-bill-matrix', compact('rows', 'allPros', 'targetPro'));
     }
 
     public function billingManager(Request $request, $proUid = null)
@@ -433,17 +445,17 @@ class PracticeManagementController extends Controller
         $targetPro = null;
         $allPros = [];
         $expectedForHcp = null;
-        if($performerPro->pro_type == 'ADMIN'){
+        if ($performerPro->pro_type == 'ADMIN') {
             $allPros = Pro::all();
             $targetPro = Pro::where('uid', $proUid)->first();
-        }else{
+        } else {
             $targetPro = $performerPro;
         }
         $notes = [];
-        if($targetPro){
+        if ($targetPro) {
             $expectedForHcp = DB::select(DB::raw("SELECT coalesce(SUM(hcp_expected_payment_amount),0) as expected_pay FROM bill WHERE hcp_pro_id = :targetProID  AND is_signed_by_hcp IS TRUE AND is_cancelled = false"), ['targetProID' => $targetPro->id])[0]->expected_pay;
             $notes = Note::where('hcp_pro_id', $targetPro->id)->orderBy('effective_dateest', 'desc')->paginate();
-        }else{
+        } else {
             $notes = Note::orderBy('effective_dateest', 'desc')->paginate();
         }
         return view('app.practice-management.billing-manager', compact('notes', 'allPros', 'expectedForHcp', 'targetPro'));
@@ -456,14 +468,15 @@ class PracticeManagementController extends Controller
     }
 
     // Generate PDF
-    public function downloadClaims() {
+    public function downloadClaims()
+    {
         $claims = Claim::where('was_submitted', false)->orWhere('was_submitted', null)->orderBy('created_at', 'desc')->limit(100)->get();
         view()->share('claims', $claims);
 
         $pdf = PDF::loadView('app.practice-management.claims-pdf', $claims);
 
         return $pdf->download('pdf_file.pdf');
-      }
+    }
 
     public function tickets(Request $request, $proUid = null)
     {

+ 8 - 10
resources/views/app/practice-management/hcp-bill-matrix.blade.php

@@ -23,7 +23,6 @@
                     <i class="fas fa-user-injured"></i>
                     Notes
                 </strong>
-
             </div>
             <div class="card-body p-0">
                 <table class="table table-sm table-condensed p-0 m-0">
@@ -54,22 +53,21 @@
                     </tr>
                     </thead>
                     <tbody>
-                    @foreach ($bills as $bill)
-                        <?php $note = $bill->note; ?>
-                        <?php if(!$note) { continue; } ?>
+                    @foreach ($rows as $row)
                         <tr class="">
-
                             <td class="">
-                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}">{{ $note->client->displayName() }}</a>
+                                <a href="/patients/view/{{ $row->client_uid }}/notes/view/{{ $row->note_uid }}">
+                                    {{ $row->client->name_last . ', ', $row->name_first }}
+                                </a>
                             </td>
                             <td class="">
-                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}"
+                                <a href="/patients/view/{{ $row->client_uid }}/notes/view/{{ $row->note_uid }}"
                                    class="font-weight-bold">
-                                    {{ friendly_date_time($note->effective_dateest, false) }}
+                                    {{ friendly_date_time($row->effective_dateest, false) }}
                                 </a>
-                                <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
+                                <span class="ml-1">{{ $row->is_note_cancelled ? '[cancelled]' : '' }}</span>
                             </td>
-                            <td>{{$note->hcpPro->name_first}} {{$note->hcpPro->name_first}}</td>
+                            <td>{{$row->hcpPro->name_first}} {{$note->hcpPro->name_first}}</td>
                             <td>{{$note->is_signed_by_hcp?'Yes':'No'}}</td>
 
 

+ 104 - 0
resources/views/app/practice-management/treatment-services-util.blade.php

@@ -0,0 +1,104 @@
+@extends ('layouts/template')
+
+@section('content')
+    <style>
+        .report-table-header {
+            font-size: large;
+            font-weight: bolder;
+        }
+    </style>
+    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.23/css/jquery.dataTables.css">
+    <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.23/js/jquery.dataTables.js"></script>
+    <div class="p-3 mcp-theme-1">
+
+        <div class="card">
+            <div class="card-body">
+                <h1 class="report-table-header">Treatment Service Utilization - Org.</h1>
+                <table class="table table-bordered table-striped table-sm" id="table0">
+                    <thead>
+                    <tr>
+                        <th>Date</th>
+                        <th>Day</th>
+                        <th>Total hrs.</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach($view_treatment_service_utilization_org as $x)
+                        <tr>
+                            <td>{{$x->effective_date}}</td>
+                            <td>
+                                {{ date('w', strtotime($x->effective_date)) }}
+                            </td>
+                            <td>{{$x->total_hrs}}</td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+            </div>
+        </div>
+
+        <div class="card mt-4">
+            <div class="card-body">
+                <h1 class="report-table-header">Treatment Service Utilization</h1>
+                <table class="table table-bordered table-striped table-sm" id="table1">
+                    <thead>
+                    <tr>
+                        <th>HCP</th>
+                        <th>Date</th>
+                        <th>Total hrs.</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach($view_treatment_service_utilization as $x)
+                        <tr>
+                            <td>{{$x->name_last}}, {{$x->name_first}}</td>
+                            <td>{{$x->effective_date}}</td>
+                            <td>{{$x->total_hrs}}</td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+            </div>
+        </div>
+
+        <div class="card mt-4">
+            <div class="card-body">
+                <h1 class="report-table-header">Treatment Service Utilization By Patient</h1>
+                <table class="table table-bordered table-striped table-sm" id="table2">
+                    <thead>
+                    <tr>
+                        <th>HCP</th>
+                        <th>Pt.</th>
+                        <th>Total hrs.</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach($view_treatment_service_utilization_by_patient as $x)
+                        <tr>
+                            <td>
+                                {{$x->pro_lname}}, {{$x->pro_fname}}
+                            </td>
+                            <td>
+                                <a href="{{route('patients.view.notes', $x->pt_uid)}}">
+                                    {{$x->pt_lname}}, {{$x->pt_fname}}
+                                </a>
+                            </td>
+                            <td>{{$x->total_hrs}}</td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+
+    <script>
+        $(document).ready( function () {
+            setTimeout(function(){
+                $('#table1').DataTable();
+                $('#table2').DataTable();
+            }, 3000);
+        } );
+    </script>
+
+@endsection

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

@@ -119,6 +119,7 @@
                             <a class="dropdown-item" href="{{ route('practice-management.cellularDeviceManager') }}">Cellular Device Manager</a>
                             <a class="dropdown-item" href="{{ route('practice-management.claims') }}">Claims</a>
                             <a class="dropdown-item" href="{{ route('practice-management.hcpBillMatrix') }}">HCP Bill Matrix</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.treatmentServiceUtil') }}">Treatment Service Util.</a>
                             <a class="dropdown-item" href="/practice-management/tickets">Tickets</a>
                         @endif
                     </div>

+ 5 - 0
routes/web.php

@@ -94,6 +94,11 @@ Route::middleware('pro.auth')->group(function () {
             Route::get('claims', 'PracticeManagementController@claims')->name('claims');
             Route::get('claims-download', 'PracticeManagementController@downloadClaims')->name('download-claims');
 
+<<<<<<< HEAD
+=======
+            Route::get('treatment-service-util', 'PracticeManagementController@treatmentServiceUtil')->name('treatmentServiceUtil');
+
+>>>>>>> ae6aa8a9b12939e98ef8c66d20a43bdda7277d99
         });
     });