Browse Source

Process notes (wip)

Vijayakrishnan 4 years ago
parent
commit
3a7a7b8e4a

+ 16 - 20
app/Http/Controllers/PracticeManagementController.php

@@ -1105,6 +1105,9 @@ ORDER BY claim.created_at ASC
         if($mode < 1 || $mode > 5) $mode = 1;
 
         $counts = [
+            "picked" => Note::where('is_cancelled', false)
+                ->whereNotNull('current_note_pickup_for_processing_id')
+                ->count(),
             "mode-1" => Note::where('is_cancelled', false)
                 ->where('is_signed_by_hcp', false)
                 ->whereRaw("((detail_json)::json->>'isBad' is null OR ((detail_json)::json->>'isBad')::text != 'true')")
@@ -1155,26 +1158,6 @@ ORDER BY claim.created_at ASC
                 ->count(),
         ];
 
-        /*$notes = Note::where('is_cancelled', false);
-
-        $mode = $request->input('mode') ? $request->input('mode') : '1';
-        if($mode < 1 || $mode > 5) $mode = 1;
-
-        switch (+$mode) {
-            case 1:
-                break;
-            case 2:
-                break;
-            case 3:
-                break;
-            case 4:
-                break;
-            case 5:
-                break;
-        }
-
-        $notes = $notes->orderBy('effective_dateest', 'ASC')->skip(0)->take(1)->get();*/
-
         return  view('app.practice-management.process-notes', compact('mode', 'counts'));
     }
 
@@ -1239,6 +1222,19 @@ ORDER BY claim.created_at ASC
         return json_encode($note);
     }
 
+    public function pickedNotes(Request  $request) {
+        $counts = [
+            "unpicked" => Note::where('is_cancelled', false)
+                ->whereNull('current_note_pickup_for_processing_id')
+                ->count(),
+        ];
+        $notes = Note::where('is_cancelled', false)
+                ->whereNotNull('current_note_pickup_for_processing_id')
+                ->orderBy('effective_dateest', 'ASC')
+                ->paginate();
+        return  view('app.practice-management.picked-notes', compact('counts', 'notes'));
+    }
+
     public function currentMbClaim(Request $request, $claimUid) {
         $claim = Claim::where('uid', $claimUid)->first();
         return json_encode(MBClaim::where('claim_version_id', $claim->currentVersion->id)->first());

+ 5 - 0
app/Models/Note.php

@@ -87,4 +87,9 @@ class Note extends Model
     {
         return $this->hasOne(CompanyLocation::class, 'id', 'hcp_company_location_id');
     }
+
+    public function currentNotePickupForProcessing() {
+        return $this->hasOne(NotePickupForProcessing::class, 'id', 'current_note_pickup_for_processing_id');
+    }
+
 }

+ 16 - 0
app/Models/NotePickupForProcessing.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Models;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class NotePickupForProcessing extends Model
+{
+    protected $table = "note_pickup_for_processing";
+
+    public function pro()
+    {
+        return $this->hasOne(Pro::class, 'id', 'pro_id');
+    }
+
+}

+ 67 - 0
resources/views/app/practice-management/picked-notes.blade.php

@@ -0,0 +1,67 @@
+@extends ('layouts/template')
+
+@section('content')
+
+    <div class="p-3 mcp-theme-1">
+
+        <div class="d-flex align-items-baseline pb-3">
+            <h2 class="font-size-16 font-weight-bold m-0">Picked Notes</h2>
+            <a class="ml-auto" href="{{route('practice-management.process-notes')}}">Process Notes ({{$counts['unpicked']}})</a>
+        </div>
+
+        <div class="card">
+
+            <div class="card-body p-0">
+
+                <table class="table table-sm table-condensed table-striped p-0 m-0">
+                    <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Effective Date</th>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0 w-50">Picked Up By</th>
+                        <th class="border-0"></th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach ($notes as $note)
+                        <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
+                            <td class="">
+                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}" class="font-weight-bold text-nowrap">
+                                    {{ friendly_date_time($note->effective_dateest, false) }}
+                                </a>
+                                <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
+                            </td>
+                            <td class="">
+                                <a href="/patients/view/{{ $note->client->uid }}" class="text-nowrap">{{ $note->client->displayName() }}</a>
+                            </td>
+                            <td class="text-nowrap">
+                                @if(@$note->currentNotePickupForProcessing->pro)
+                                    <b>{{ $note->currentNotePickupForProcessing->pro->displayName()}}</b>
+                                    <span class="text-sm mx-1">at</span>
+                                    <span class="text-secondary">{{ friendlier_date_time($note->currentNotePickupForProcessing->created_at)}}</span>
+                                @else
+                                -
+                                @endif
+                            </td>
+                            <td class="">
+                                <a native target="_blank"
+                                   open-in-stag-popup
+                                   update-parent
+                                   mc-initer="note-single"
+                                   title="Note Details"
+                                   href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}">
+                                    View
+                                </a>
+                            </td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+            </div>
+        </div>
+        <div class="mt-3">
+            {{$notes->links()}}
+        </div>
+    </div>
+
+@endsection

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

@@ -12,7 +12,10 @@
     }
     ?>
     <div id="process-notes" class="p-3 mcp-theme-1">
-        <h2 class="font-size-16 font-weight-bold pb-3 border-bottom mb-3">Process Notes</h2>
+        <div class="d-flex align-items-baseline pb-3 border-bottom mb-3">
+            <h2 class="font-size-16 font-weight-bold m-0">Process Notes</h2>
+            <a class="ml-auto" href="{{route('practice-management.picked-notes')}}">Picked Notes ({{$counts['picked']}})</a>
+        </div>
         <div class="d-flex align-items-center border-bottom mb-3 pb-3">
             <span class="mr-3">Notes: </span>
             <a href="{{route('practice-management.process-notes')}}?mode=1"

+ 1 - 0
routes/web.php

@@ -96,6 +96,7 @@ Route::middleware('pro.auth')->group(function () {
 
         Route::get('process-claims', 'PracticeManagementController@processClaims')->name('process-claims');
         Route::get('process-notes', 'PracticeManagementController@processNotes')->name('process-notes');
+        Route::get('picked-notes', 'PracticeManagementController@pickedNotes')->name('picked-notes');
         Route::get('get-next-note/{mode}', 'PracticeManagementController@getNextNote')->name('get-next-note');