Explorar o código

Client-pro-changes - at patient and PM level

Vijayakrishnan %!s(int64=3) %!d(string=hai) anos
pai
achega
9c0c71bffe

+ 5 - 0
app/Http/Controllers/PatientController.php

@@ -344,6 +344,11 @@ class PatientController extends Controller
         return view('app.patient.pros', compact('patient'));
     }
 
+    public function proChanges(Request $request, Client $patient )
+    {
+        return view('app.patient.client-pro-changes', compact('patient'));
+    }
+
     public function account(Request $request, Client $patient )
     {
         return view('app.patient.account', compact('patient'));

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

@@ -6,6 +6,7 @@ use App\Models\AppSession;
 use App\Models\BillingReport;
 use App\Models\CareMonth;
 use App\Models\ClaimEDI;
+use App\Models\ClientProChange;
 use App\Models\Company;
 use App\Models\Handout;
 use App\Models\MBClaim;
@@ -110,6 +111,12 @@ SELECT effective_date, count(*), sum(number_of_units) as units FROM bill WHERE c
         return view ('app.practice-management.daily-treatment-services', compact('rows'));
     }
 
+    public function clientProChanges(Request $request)
+    {
+        $rows = ClientProChange::orderByRaw('created_at::date DESC')->orderBy('client_id', 'desc')->paginate(20);
+        return view ('app.practice-management.client-pro-changes', compact('rows'));
+    }
+
     public function billingReport(Request $request)
     {
 

+ 5 - 0
app/Models/Client.php

@@ -890,6 +890,11 @@ ORDER BY m.ts DESC
             ->orderBy('created_at', 'desc');
     }
 
+    public function clientProChanges() {
+        return $this->hasMany(ClientProChange::class, 'client_id', 'id')
+            ->orderBy('created_at', 'desc');
+    }
+
     public function mostRecentWeightMeasurement(){        
         return $this->hasOne(Measurement::class, 'id', 'most_recent_weight_measurement_id');
     }

+ 7 - 0
app/Models/ClientProChange.php

@@ -16,4 +16,11 @@ class ClientProChange extends Model
     public function client(){
         return $this->hasOne(Client::class, 'id', 'client_id');
     }
+
+    public function previousPro(){
+        return $this->hasOne(Pro::class, 'id', 'previous_pro_id');
+    }
+    public function newPro(){
+        return $this->hasOne(Pro::class, 'id', 'new_pro_id');
+    }
 }

+ 40 - 0
resources/views/app/patient/client-pro-changes.blade.php

@@ -0,0 +1,40 @@
+@extends ('layouts.patient')
+@section('inner-content')
+    <div class="">
+        <div class="d-flex align-items-center pb-2">
+            <h4 class="font-weight-bold m-0">Pro Changes</h4>
+        </div>
+        <table class="table table-striped table-sm table-bordered mb-3">
+            @if($patient->clientProChanges && count($patient->clientProChanges))
+                <thead class="bg-light">
+                <tr>
+                    <th class="border-0 text-secondary width-200px">Created</th>
+                    <th class="border-0 text-secondary width-150px">Association</th>
+                    <th class="border-0 text-secondary width-200px">Old Pro</th>
+                    <th class="border-0 text-secondary width-200px">New Pro</th>
+                    <th class="border-0 text-secondary width-200px">Change Memo</th>
+                    <th></th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach($patient->clientProChanges as $change)
+                    <tr>
+                        <td>{{friendly_date_time($change->created_at)}}</td>
+                        <td>{{$change->responsibility_type}}</td>
+                        <td>{{$change->previousPro ? $change->previousPro->displayName() : '-'}}</td>
+                        <td>{{$change->newPro ? $change->newPro->displayName() : '-'}}</td>
+                        <td>{{$change->custom_memo}}</td>
+                        <td></td>
+                    </tr>
+                @endforeach
+                </tbody>
+            @else
+                <tbody>
+                    <tr>
+                        <td class="text-secondary p-3">No client pro changes for this patient</td>
+                    </tr>
+                </tbody>
+            @endif
+        </table>
+    </div>
+@endsection

+ 52 - 0
resources/views/app/practice-management/client-pro-changes.blade.php

@@ -0,0 +1,52 @@
+@extends ('layouts.template')
+@section('content')
+    <div class="p-3 mcp-theme-1">
+        <div class="card">
+            <div class="card-header px-2 py-2 d-flex align-items-center">
+                <strong class="">
+                    <i class="fas fa-user"></i>
+                    Client Pro Changes
+                </strong>
+            </div>
+            <div class="card-body p-0">
+                <table class="table table-striped table-sm table-bordered mb-3">
+                    @if($rows && count($rows))
+                        <thead class="bg-light">
+                        <tr>
+                            <th class="border-0 text-secondary width-200px">Created</th>
+                            <th class="border-0 text-secondary width-150px">Patient</th>
+                            <th class="border-0 text-secondary width-150px">Association</th>
+                            <th class="border-0 text-secondary width-200px">Old Pro</th>
+                            <th class="border-0 text-secondary width-200px">New Pro</th>
+                            <th class="border-0 text-secondary width-200px">Change Memo</th>
+                            <th></th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        @foreach($rows as $change)
+                            <tr>
+                                <td>{{friendly_date_time($change->created_at)}}</td>
+                                <td><a href="{{route('patients.view.dashboard', $change->client)}}">{{$change->client->displayName()}}</a></td>
+                                <td>{{$change->responsibility_type}}</td>
+                                <td>{{$change->previousPro ? $change->previousPro->displayName() : '-'}}</td>
+                                <td>{{$change->newPro ? $change->newPro->displayName() : '-'}}</td>
+                                <td>{{$change->custom_memo}}</td>
+                                <td></td>
+                            </tr>
+                        @endforeach
+                        </tbody>
+                    @else
+                        <tbody>
+                        <tr>
+                            <td class="text-secondary p-3">No client pro changes!</td>
+                        </tr>
+                        </tbody>
+                    @endif
+                </table>
+                <div class="px-3">
+                    {!! $rows->links() !!}
+                </div>
+            </div>
+        </div>
+    </div>
+@endsection

+ 4 - 0
resources/views/layouts/patient.blade.php

@@ -248,6 +248,10 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 							   href="{{ route('patients.view.pros', ['patient' => $patient]) }}">Pros</a>
 						</li>
 						@if($performer->pro->pro_type == 'ADMIN')
+						<li class="nav-item">
+							<a class="nav-link {{ strpos($routeName, 'patients.view.pro-changes') === 0 ? 'active' : '' }}"
+							   href="{{ route('patients.view.pro-changes', ['patient' => $patient]) }}">Client Pro Changes</a>
+						</li>
 						<li class="nav-item">
 							<a class="nav-link {{ strpos($routeName, 'patients.view.client-pro-access') === 0 ? 'active' : '' }}"
 							   href="{{ route('patients.view.client-pro-access', ['patient' => $patient]) }}">Client Pro Access</a>

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

@@ -131,6 +131,7 @@
                             <a class="dropdown-item" href="{{ route('practice-management.daily-treatment-services') }}">Daily Treatment Services</a>
                         @endif
                         @if($pro->pro_type == 'ADMIN')
+                            <a class="dropdown-item" href="{{ route('practice-management.client-pro-changes') }}">Client Pro Changes</a>
                             <a class="dropdown-item" href="{{ route('practice-management.rpmMatrix') }}">RPM Matrix</a>
                             {{--<a class="dropdown-item" href="{{ route('practice-management.previousBills') }}">Previous Bills</a>--}}
                             <a class="dropdown-item" href="{{ route('practice-management.financialTransactions') }}">Financial Transactions</a>

+ 2 - 0
routes/web.php

@@ -269,6 +269,7 @@ Route::middleware('pro.auth')->group(function () {
         	
 		    Route::get('remote-monitoring-report', 'PracticeManagementController@remoteMonitoringReport')->name('remoteMonitoringReport');
             Route::get('daily-treatment-services', 'PracticeManagementController@dailyTreatmentServices')->name('daily-treatment-services');
+            Route::get('client-pro-changes', 'PracticeManagementController@clientProChanges')->name('client-pro-changes');
 
             // BILLING REPORT
             Route::get('billing-report', 'PracticeManagementController@billingReport')->name('billing-report');
@@ -457,6 +458,7 @@ Route::middleware('pro.auth')->group(function () {
             Route::get('sms-reminders', 'PatientController@smsReminders')->name('sms-reminders');
             Route::get('measurement-confirmation-numbers', 'PatientController@measurementConfirmationNumbers')->name('measurement-confirmation-numbers');
             Route::get('pros', 'PatientController@pros')->name('pros');
+            Route::get('pro-changes', 'PatientController@proChanges')->name('pro-changes');
             Route::get('account', 'PatientController@account')->name('account');
             Route::get('care-checklist', 'PatientController@careChecklist')->name('care-checklist');
             Route::get('documents', 'PatientController@documents')->name('documents');