Samson Mutunga 3 лет назад
Родитель
Сommit
ee3796abc0

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

@@ -3684,6 +3684,18 @@ ORDER BY c.name_last, c.name_first
 
     }
 
+    public function notesPendingPhysicianSupervisorStamping(Request $request){
+        $hideTitle = $request->get('hideTitle');
+        $pro = $this->performer->pro;
+        //All companyProIds that I am supervisor
+        $flaggedNotes = Note::where('is_stamped_by_supervising_physician', false)->where('is_flagged_for_supervising_physician_review', true)->whereHas('hcpCompanyPro', function($qry) use($pro){
+            return $qry->whereHas('supervisingPhysicianCompanyPro', function($qr) use($pro){
+                return $qr->where('pro_id', $pro->id);
+            });
+        })->get();
+        return view('app.notes-pending-physician-supervisor-stamping', compact('flaggedNotes', 'hideTitle'));
+    }
+
     public function notesResolutionCenter(Request $request) {
 
         $columns = "(c.name_first || ' ' || c.name_last) as client_name,

+ 4 - 0
app/Models/CompanyPro.php

@@ -33,5 +33,9 @@ class CompanyPro extends Model
     {
         return $this->company->name . ' / ' . $this->pro->displayName();
     }
+    public function supervisingPhysicianCompanyPro()
+    {
+        return $this->hasOne(CompanyPro::class, 'id', 'supervising_physician_company_pro_id');
+    }
 
 }

+ 15 - 0
app/Models/Note.php

@@ -168,6 +168,14 @@ class Note extends Model
         return $this->hasOne(CompanyLocation::class, 'id', 'hcp_company_location_id');
     }
 
+    public function flaggedForSupervisingPhysicianReviewBySession(){
+        return $this->hasOne(AppSession::class, 'id', 'flagged_for_supervising_physician_review_by_session_id');
+    }
+    public function stampedBySupervisingPhysicianBySession(){
+        return $this->hasOne(AppSession::class, 'id', 'stamped_by_by_supervising_physician_by_session_id');
+    }
+    
+
     public function currentNotePickupForProcessing() {
         return $this->hasOne(NotePickupForProcessing::class, 'id', 'current_note_pickup_for_processing_id');
     }
@@ -212,4 +220,11 @@ class Note extends Model
             ->where('status', '!=', 'CANCELLED')
             ->count();
     }
+
+    public function isProPhysicianSupervisor($proID){
+        $companyProIds = CompanyPro::where('pro_id', $proID)->pluck('id')->toArray();
+        $noteCompanyProId = $this->hcpCompanyPro->supervising_physician_company_pro_id;
+        if(!$noteCompanyProId) return false;
+        return in_array($noteCompanyProId, $companyProIds);
+    }
 }

+ 10 - 1
app/Models/Pro.php

@@ -1328,7 +1328,16 @@ ORDER BY cm.created_at DESC
         return Bill::where('bill_service_type', 'GENERIC')
             ->where('generic_pro_id', $this->id)
             ->orderBy('created_at', 'DESC')->get();
-    }       
+    }   
+    
+    public function myNotesPendingSupervisorPhysicianStamping(){
+        $pro = $this;
+        return Note::where('is_stamped_by_supervising_physician', false)->where('is_flagged_for_supervising_physician_review', true)->whereHas('hcpCompanyPro', function($qry) use($pro){
+            return $qry->whereHas('supervisingPhysicianCompanyPro', function($qr) use($pro){
+                return $qr->where('pro_id', $pro->id);
+            });
+        })->count();
+    }
 
 
 }

+ 12 - 0
resources/views/app/dashboard-admin.blade.php

@@ -106,6 +106,18 @@
                                         </a>
                                     </th>
                                 </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{ $pro->myNotesPendingSupervisorPhysicianStamping() }}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('practice-management.notes-pending-physician-supervisor-stamping', ['hideTitle' => true]) }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall stag-popup-md"
+                                           title="Notes Pending Physician Supervisor Stamping">
+                                            Notes Pending Physician Supervisor Stamping
+                                        </a>
+                                    </th>
+                                </tr>
 
                                 </tbody>
                             </table>

+ 12 - 0
resources/views/app/dashboard-mcp.blade.php

@@ -255,6 +255,18 @@
                                         </th>
                                     </tr>
                                 @endif
+                                <tr>
+                                    <th class="px-2 text-center">{{ $pro->myNotesPendingSupervisorPhysicianStamping() }}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('practice-management.notes-pending-physician-supervisor-stamping', ['hideTitle' => true]) }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall stag-popup-md"
+                                           title="Notes Pending Physician Supervisor Stamping">
+                                            Notes Pending Physician Supervisor Stamping
+                                        </a>
+                                    </th>
+                                </tr>
                                 </tbody>
                             </table>
                         </div>

+ 85 - 0
resources/views/app/notes-pending-physician-supervisor-stamping.blade.php

@@ -0,0 +1,85 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="mcp-theme-1">
+    <div class="card-body">
+
+        <div class="mcp-theme-1">
+
+            <div class="card">
+                @if(!$hideTitle)
+                <div class="card-header px-3 py-2 d-flex align-items-center">
+                    <strong class="text-nowrap">
+                        <i class="fas fa-clipboard"></i>
+                        My Notes Flagged By Supervisor
+                    </strong>
+                </div>
+                @endif
+                <div class="card-body p-0">
+
+                    <table class="table table-sm table-striped p-0 m-0">
+                        <thead class="bg-light">
+                            <tr>
+                                <th class="border-0">Created At</th>
+                                <th class="border-0">Effective Date</th>
+                                <th class="border-0">Patient</th>
+                                <th class="border-0">Ally Pro</th>
+                                <th class="border-0">&nbsp;</th>
+                            </tr>
+                        </thead>
+                        <tbody>
+                            @foreach($flaggedNotes as $note)
+                            <tr>
+                                <td>{{ friendly_date_time($note->created_at, true) }}</td>
+                                <td>
+                                    <a native href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}">
+                                        {{ friendly_date_time($note->effective_dateest, false) }}
+                                    </a>
+                                </td>
+                                <td>{{ $note->hcpPro ? $note->hcpPro->displayName() : '-' }}</td>
+                                <td>{{ $note->allyPro ? $note->allyPro->displayName() : '-' }}</td>
+                                <td>
+                                    @if($note->isProPhysicianSupervisor($performer->pro->id))
+                                        @if($note->is_stamped_by_supervising_physician)
+                                        <div moe class="ml-2">
+                                            <a href="#" start show class="text-danger"><i class="fas fa-stamp"></i> Undo Stamp</a>
+                                            <form url="/api/note/undoStampAsSupervisingPhysician">
+                                                <input type="hidden" name="uid" value="{{ $note->uid }}">
+                                                <div class="mb-2">
+                                                    <label>Are you sure?</label>
+                                                </div>
+                                                <div class="mt-3">
+                                                    <button submit class="btn btn-sm btn-danger mr-2">Undo Stamp</button>
+                                                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                                </div>
+                                            </form>
+                                        </div>
+                                        @else
+                                        <div moe class="">
+                                            <a href="#" start show class="text-success"><i class="fas fa-stamp"></i> Stamp Note</a>
+                                            <form url="/api/note/stampAsSupervisingPhysician">
+                                                <input type="hidden" name="uid" value="{{ $note->uid }}">
+                                                <div class="mb-2">
+                                                    <label>Are you sure?</label>
+                                                    <textarea name="memo" class="form-control"></textarea>
+                                                </div>
+                                                <div class="mt-3">
+                                                    <button submit class="btn btn-sm btn-success mr-2">Stamp Note</button>
+                                                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                                </div>
+                                            </form>
+                                        </div>
+                                        @endif
+                                    @endif
+                                </td>
+                            </tr>
+                            @endforeach
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>
+@endsection

+ 5 - 1
resources/views/app/patient/note/dashboard.blade.php

@@ -519,7 +519,11 @@ use App\Models\Handout;
 
             <div class="ml-auto d-flex align-items-start">
                 <div class="">
-                    <div>
+                    <div class="d-flex">
+                        <div class="d-flex">
+                            @include('app.patient.note.partials.flag-note-by-supervisor')
+                        </div>
+                        
 
                         @if($note->is_signed_by_hcp )
                             <div class="d-flex align-items-baseline">

+ 79 - 0
resources/views/app/patient/note/partials/flag-note-by-supervisor.blade.php

@@ -0,0 +1,79 @@
+
+<div class="d-flex align-items-center mr-2">
+    @if($note->is_stamped_by_supervising_physician)
+        <div class="d-flex align-items-center">
+            <span class="text-success mr-2"><i class="fas fa-badge-check"></i> Stamped</span>
+            <span class="mr-1">by {{ $note->stampedBySupervisingPhysicianBySession->pro->displayName() }}</span>
+            <span class="mr-1">at {{ friendlier_date($note->stamped_by_supervising_physician_at) }} <i class="fas fa-info-circle" title="{{ $note->stamping_note_by_supervising_physician }}"></i></span>
+            @if($note->isProPhysicianSupervisor($pro->id))
+            <div moe class="ml-2">
+                <a href="#" start show class="text-danger"><i class="fas fa-stamp"></i> Undo Stamp</a>
+                <form url="/api/note/undoStampAsSupervisingPhysician">
+                    <input type="hidden" name="uid" value="{{ $note->uid }}">
+                    <div class="mb-2">
+                        <label>Are you sure?</label>
+                    </div>
+                    <div class="mt-3">
+                        <button submit class="btn btn-sm btn-danger mr-2">Undo Stamp</button>
+                        <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                    </div>
+                </form>
+            </div>
+            @endif
+        </div>        
+    @else
+        @if($note->is_flagged_for_supervising_physician_review)
+            @if($performer->pro->pro_type === 'ADMIN')
+                <div class="d-flex align-items-center">
+                    <span class="text-danger mr-2"><i class="fas fa-flag text-danger"></i> Flagged for Review</span>
+                    <span class="mr-2">by <b>{{ $note->flaggedForSupervisingPhysicianReviewBySession->pro->displayName() }}</b> at {{ friendlier_date($note->flagged_for_supervising_physician_review_at) }}</span>            
+                    <div moe class="">
+                        <a href="#" start show title="Undo flag"><i class="fas fa-undo"></i> Undo</a>
+                        <form url="/api/note/undoMarkAsFlaggedForSupervisingPhysicianReview">
+                            <input type="hidden" name="uid" value="{{ $note->uid }}">
+                            <div class="mb-2">
+                                <label>Are you sure?</label>
+                            </div>
+                            <div class="mt-3">
+                                <button submit class="btn btn-sm btn-primary mr-2">Undo Flag</button>
+                                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            @endif
+            @if($note->isProPhysicianSupervisor($performer->pro->id)) 
+                <div moe class="ml-2">
+                    <a href="#" start show class="text-success"><i class="fas fa-stamp"></i> Stamp Note</a>
+                    <form url="/api/note/stampAsSupervisingPhysician">
+                        <input type="hidden" name="uid" value="{{ $note->uid }}">
+                        <div class="mb-2">
+                            <label>Are you sure?</label>
+                            <textarea name="memo" class="form-control"></textarea>
+                        </div>
+                        <div class="mt-3">
+                            <button submit class="btn btn-sm btn-success mr-2">Stamp Note</button>
+                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                        </div>
+                    </form>
+                </div>
+            @endif
+        @else
+            @if($performer->pro->pro_type === 'ADMIN')
+            <div moe class="mr-2">
+                <a href="#" start show><i class="fas fa-flag text-danger"></i> Flag Note for Review</a>
+                <form url="/api/note/markAsFlaggedForSupervisingPhysicianReview">
+                    <input type="hidden" name="uid" value="{{ $note->uid }}">
+                    <div class="mb-2">
+                        <label>Are you sure?</label>
+                    </div>
+                    <div class="mt-3">
+                        <button submit class="btn btn-sm btn-danger mr-2">Flag Note</button>
+                        <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                    </div>
+                </form>
+            </div>
+            @endif
+        @endif
+    @endif
+</div>

+ 1 - 1
resources/views/app/practice-management/all-notes.blade.php

@@ -25,7 +25,7 @@
                         <th class="border-0">Effective Date</th>
                         <th class="border-0">Patient</th>
                         <th class="border-0">MCP</th>
-                        <th class="border-0">All Pro</th>
+                        <th class="border-0">Ally Pro</th>
                         <th class="border-0 w-50">Content</th>
                     </tr>
                 </thead>

+ 1 - 1
resources/views/layouts/patient.blade.php

@@ -341,7 +341,7 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 					</div>
 					</div>
 
-					<div>
+					<div class="d-flex">
 						<span class="mr-2"><b>Best Time to Call:</b> {{ $patient->best_time_to_call ?? '-' }}</span>
 						@include('app.patient.partials.update-best-time-to-call')
 					</div>

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

@@ -175,6 +175,7 @@
                             <a class="dropdown-item" href="{{ route('dna.myClinicalTeams') }}">My Clinical Teams</a>
                         @endif
                         <a class="dropdown-item" href="{{ route('practice-management.my-flyers') }}">My Flyers</a>
+                        <a class="dropdown-item" href="{{ route('practice-management.notes-pending-physician-supervisor-stamping') }}">Notes Pending Physician Supervisor Stamping</a>
                     </div>
                 </li>
 

+ 1 - 0
routes/web.php

@@ -227,6 +227,7 @@ Route::middleware('pro.auth')->group(function () {
 
 
         Route::get('my-flyers', 'PracticeManagementController@myFlyers')->name('my-flyers');
+        Route::get('notes-pending-physician-supervisor-stamping', 'PracticeManagementController@notesPendingPhysicianSupervisorStamping')->name('notes-pending-physician-supervisor-stamping');
 
         Route::get('rpm-matrix', 'PracticeManagementController@rpmMatrix')->name('rpmMatrix');