浏览代码

fixed segment suggestion

= 3 年之前
父节点
当前提交
b7438b45e6

+ 9 - 0
app/Http/Controllers/AdminController.php

@@ -143,6 +143,15 @@ class AdminController extends Controller
         return view('app.admin.notes_pending_summary_suggestion', $data);
     }
 
+    public function notes_rejected_summary_suggestion(Request $request){
+        $pro = $this->performer->pro;
+        $data = [
+            'records' => $pro->get_notes_rejected_summary_suggestion_as_admin()
+        ];
+        return view('app.admin.notes_rejected_summary_suggestion', $data);
+    }
+
+
     public function appointments(Request $request)
     {
         $appointments = Appointment::paginate(5);

+ 8 - 0
app/Http/Controllers/McpController.php

@@ -295,6 +295,14 @@ class McpController extends Controller
         return view('app.mcp.notes_pending_summary_suggestion', $data);
     }
 
+    public function notes_rejected_summary_suggestion(Request $request){
+        $pro = $this->performer->pro;
+        $data = [
+            'records' => $pro->get_notes_rejected_summary_suggestion_as_mcp()
+        ];
+        return view('app.mcp.notes_rejected_summary_suggestion', $data);
+    }
+
     public function notes_pending_billing(Request $request){
         $data = [
             'records' => Note::where('hcp_pro_id', $this->performer->pro->id)

+ 51 - 2
app/Models/Pro.php

@@ -370,7 +370,24 @@ class Pro extends Model
     }
 
     function get_notes_pending_summary_suggestion_as_mcp_query(){
-        $segmentsWithProposedSummarySuggestion = Segment::whereNotNull('proposed_segment_summary_suggestion_id')->get();
+        $segmentsWithProposedSummarySuggestion = Segment::whereHas('proposedSegmentSummarySuggestion', function($sugQuery){
+            return $sugQuery->where('status', '=', 'PENDING');
+        })->get();
+        $noteIDs = [];
+        foreach($segmentsWithProposedSummarySuggestion as $seg){
+            $noteIDs[] = $seg->note_id;
+        }
+        return Note::where('hcp_pro_id', $this->id)
+            ->where('is_cancelled', '<>', true)
+            ->where('is_core_note', '<>', true)
+            ->where('is_signed_by_hcp', true)
+            ->whereIn('id', $noteIDs);
+    }
+
+    function get_notes_rejected_summary_suggestion_as_mcp_query(){
+        $segmentsWithProposedSummarySuggestion = Segment::whereHas('proposedSegmentSummarySuggestion', function($sugQuery){
+            return $sugQuery->where('status', '=', 'REJECTED');
+        })->get();
         $noteIDs = [];
         foreach($segmentsWithProposedSummarySuggestion as $seg){
             $noteIDs[] = $seg->note_id;
@@ -390,8 +407,32 @@ class Pro extends Model
         return $this->get_notes_pending_summary_suggestion_as_mcp_query()->get();
     }
 
+    function get_notes_rejected_summary_suggestion_count_as_mcp(){
+        return $this->get_notes_rejected_summary_suggestion_as_mcp_query()->count();
+    }
+
+    function get_notes_rejected_summary_suggestion_as_mcp(){
+        return $this->get_notes_rejected_summary_suggestion_as_mcp_query()->get();
+    }
+
     function get_notes_pending_summary_suggestion_as_admin_query(){
-        $segmentsWithProposedSummarySuggestion = Segment::whereNotNull('proposed_segment_summary_suggestion_id')->get();
+        $segmentsWithProposedSummarySuggestion = Segment::whereHas('proposedSegmentSummarySuggestion', function($sugQuery){
+            return $sugQuery->where('status', '=', 'PENDING');
+        })->get();
+        $noteIDs = [];
+        foreach($segmentsWithProposedSummarySuggestion as $seg){
+            $noteIDs[] = $seg->note_id;
+        }
+        return Note::where('is_cancelled', '<>', true)
+            ->where('is_core_note', '<>', true)
+            ->where('is_signed_by_hcp', true)
+            ->whereIn('id', $noteIDs);
+    }
+
+    function get_notes_rejected_summary_suggestion_as_admin_query(){
+        $segmentsWithProposedSummarySuggestion = Segment::whereHas('proposedSegmentSummarySuggestion', function($sugQuery){
+            return $sugQuery->where('status', '=', 'REJECTED');
+        })->get();
         $noteIDs = [];
         foreach($segmentsWithProposedSummarySuggestion as $seg){
             $noteIDs[] = $seg->note_id;
@@ -410,6 +451,14 @@ class Pro extends Model
         return $this->get_notes_pending_summary_suggestion_as_admin_query()->get();
     }
 
+    function get_notes_rejected_summary_suggestion_count_as_admin(){
+        return $this->get_notes_rejected_summary_suggestion_as_admin_query()->count();
+    }
+
+    function get_notes_rejected_summary_suggestion_as_admin(){
+        return $this->get_notes_rejected_summary_suggestion_as_admin_query()->get();
+    }
+
     function get_notes_pending_billing_count_as_mcp() {
         return Note::where('hcp_pro_id', $this->id)
             ->where('is_cancelled', '<>', true)

+ 47 - 0
resources/views/app/admin/notes_rejected_summary_suggestion.blade.php

@@ -0,0 +1,47 @@
+<div class="p-3 mcp-theme-1">
+    <div class="card border-top-0">
+
+        <div class="card-header px-2 py-1 hide-inside-popup border-bottom-0">
+            <strong class="mr-4">
+                <i class="fas fa-sticky-note"></i>
+                Notes With Pending Summary Suggestion
+            </strong>
+        </div>
+
+        <div class="card-body p-0 border-top-0 pb-0">
+            <table class="table table-sm border-top table-striped mb-0">
+                <thead class="bg-light">
+                <tr>
+                    <th class="border-0">Date</th>
+                    <th class="border-0">Patient</th>
+                    <th class="border-0">ICD</th>
+                    <th class="border-0">Status</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach($records as $row)
+                    <tr>
+                        <td>
+                            <a native target="_blank" href="/patients/view/{{ $row->client->uid }}/notes/view/{{ $row->uid }}?suggestion_mode=on">
+                                {{ friendlier_date($row->effective_dateest) }}
+                            </a>
+                        </td>
+                        <td>{{$row->client->displayName()}}</td>
+                        <td>
+                            @foreach($row->reasons as $reason)
+                                <span class="pr-2">{{$reason->code}}</span>
+                            @endforeach
+                            @if(!$row->reasons || !count($row->reasons))
+                                -
+                            @endif
+                        </td>
+                        <td>
+                            {{$row->overallStatus()}}
+                        </td>
+                    </tr>
+                @endforeach
+                </tbody>
+            </table>
+        </div>
+    </div>
+</div>

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

@@ -48,6 +48,18 @@
                                         </a>
                                     </th>
                                 </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_notes_rejected_summary_suggestion_count_as_admin()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('admin.notes_rejected_summary_suggestion') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Notes With Rejected Summary Suggestion">
+                                            Notes With Rejected Summary Suggestion
+                                        </a>
+                                    </th>
+                                </tr>
                                 <tr>
                                     <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_mcp()}}</th>
                                     <th class="pl-2">Notes Pending Billing</th>

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

@@ -1,3 +1,4 @@
+
 @extends ('layouts.template')
 
 @section('content')
@@ -75,6 +76,18 @@
                                         </a>
                                     </th>
                                 </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_notes_rejected_summary_suggestion_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.notes_rejected_summary_suggestion') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Notes With Rejected Summary Suggestion">
+                                            Notes With Rejected Summary Suggestion
+                                        </a>
+                                    </th>
+                                </tr>
                                 <tr>
                                     <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_mcp()}}</th>
                                     <th class="pl-2">

+ 47 - 0
resources/views/app/mcp/notes_rejected_summary_suggestion.blade.php

@@ -0,0 +1,47 @@
+<div class="p-3 mcp-theme-1">
+    <div class="card border-top-0">
+
+        <div class="card-header px-2 py-1 hide-inside-popup border-bottom-0">
+            <strong class="mr-4">
+                <i class="fas fa-sticky-note"></i>
+                Notes With Pending Summary Suggestion
+            </strong>
+        </div>
+
+        <div class="card-body p-0 border-top-0 pb-0">
+            <table class="table table-sm border-top table-striped mb-0">
+                <thead class="bg-light">
+                <tr>
+                    <th class="border-0">Date</th>
+                    <th class="border-0">Patient</th>
+                    <th class="border-0">ICD</th>
+                    <th class="border-0">Status</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach($records as $row)
+                    <tr>
+                        <td>
+                            <a native target="_blank" href="/patients/view/{{ $row->client->uid }}/notes/view/{{ $row->uid }}?suggestion_mode=on">
+                                {{ friendlier_date($row->effective_dateest) }}
+                            </a>
+                        </td>
+                        <td>{{$row->client->displayName()}}</td>
+                        <td>
+                            @foreach($row->reasons as $reason)
+                                <span class="pr-2">{{$reason->code}}</span>
+                            @endforeach
+                            @if(!$row->reasons || !count($row->reasons))
+                                -
+                            @endif
+                        </td>
+                        <td>
+                            {{$row->overallStatus()}}
+                        </td>
+                    </tr>
+                @endforeach
+                </tbody>
+            </table>
+        </div>
+    </div>
+</div>

+ 15 - 3
resources/views/app/patient/note/segment/suggestions_and_updates.blade.php

@@ -42,11 +42,14 @@
         @endif
     @endif
 </div>
-@if($segment->proposedSegmentSummarySuggestion)
+@if($segment->proposedSegmentSummarySuggestion && ($segment->proposedSegmentSummarySuggestion->status == 'PENDING' || $segment->proposedSegmentSummarySuggestion->status == 'REJECTED') )
     <div class=" m-2 p-2">
         {!! $segment->proposedSegmentSummarySuggestion->summary_html !!}
+        @if($segment->proposedSegmentSummarySuggestion->status == 'REJECTED')
+        <div class="alert alert-info">Your suggestion has been rejected.</div>
+        @endif
         <div class="d-flex">
-            @if($note->hcp_pro_id == $performer->pro_id)
+            @if(($note->hcp_pro_id == $performer->pro_id ) && $segment->proposedSegmentSummarySuggestion->status == 'PENDING')
             <div class="d-block mt-1 mr-2" moe>
                 <form url="/api/segment/acceptProposedSegmentSummarySuggestion" show>
                     <input type="hidden" name="uid" value="{{$segment->uid}}">
@@ -65,7 +68,7 @@
             </div>
             @endif
 
-            <div class="d-block mt-1" moe>
+            <div class="d-block mt-1 mr-2" moe>
                 <a class="btn btn-outline-primary btn-sm " start>Override proposed suggestion</a>
                 <form url="/api/segment/overrideProposedSegmentSummarySuggestion">
                     <input type="hidden" name="uid" value="{{$segment->uid}}">
@@ -76,6 +79,15 @@
                     </div>
                 </form>
             </div>
+            <div class="d-block mt-1  mr-2" moe>
+                <form url="/api/segmentSummarySuggestion/update-status" show>
+                    <input type="hidden" name="uid" value="{{$segment->proposedSegmentSummarySuggestion->uid}}">
+                    <input type="hidden" name="status" value="DISCARDED">
+                    <div class="mb-0">
+                        <button class="btn btn-primary btn-sm" submit>Discard suggestion</button>
+                    </div>
+                </form>
+            </div>
         </div>
     </div>
 @else

+ 2 - 0
routes/web.php

@@ -92,6 +92,7 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('new-patients-awaiting-visit', 'McpController@new_patients_awaiting_visit')->name('new_patients_awaiting_visit');
         Route::get('notes-pending-signature', 'McpController@notes_pending_signature')->name('notes_pending_signature');
         Route::get('notes-pending-summary-suggestion', 'McpController@notes_pending_summary_suggestion')->name('notes_pending_summary_suggestion');
+        Route::get('notes-rejected-summary-suggestion', 'McpController@notes_rejected_summary_suggestion')->name('notes_rejected_summary_suggestion');
         Route::get('notes-pending-billing', 'McpController@notes_pending_billing')->name('notes_pending_billing');
         Route::get('bills-pending-signature', 'McpController@bills_pending_signature')->name('bills_pending_signature');
         Route::get('reports-pending-signature', 'McpController@reports_pending_signature')->name('reports_pending_signature');
@@ -196,6 +197,7 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('patients', 'AdminController@patients')->name('patients');
         Route::get('notes', 'AdminController@notes')->name('notes');
         Route::get('notes-pending-summary-suggestion', 'AdminController@notes_pending_summary_suggestion')->name('notes_pending_summary_suggestion');
+        Route::get('notes-rejected-summary-suggestion', 'AdminController@notes_rejected_summary_suggestion')->name('notes_rejected_summary_suggestion');
         Route::get('appointments', 'AdminController@appointments')->name('appointments');
         Route::get('bills', 'AdminController@bills')->name('bills');
         Route::get('erx-and-orders', 'AdminController@erx_and_orders')->name('erx_and_orders');