Bläddra i källkod

New main dashboard (wip)

Vijayakrishnan 4 år sedan
förälder
incheckning
be9d5119a3

+ 31 - 1
app/Http/Controllers/HomeController.php

@@ -7,6 +7,7 @@ use App\Models\Appointment;
 use App\Models\AppSession;
 use App\Models\ClientSMS;
 use App\Models\Facility;
+use App\Models\IncomingReport;
 use App\Models\MBPayer;
 use App\Models\ProProAccess;
 use App\Models\Ticket;
@@ -306,7 +307,36 @@ class HomeController extends Controller
             ->whereRaw('(SELECT count(id) FROM bill WHERE note_id = note.id AND (is_cancelled = true OR is_verified = true)) = 0')
             ->count();
 
-        return view('app/dashboard', compact('keyNumbers', 'reimbursement', 'milliseconds', 'measurements', 'businessNumbers'));
+        // incoming reports not signed
+        $incomingReports = IncomingReport::where('hcp_pro_id', $performerProID)
+            ->where('has_hcp_pro_signed', false)
+            ->where('is_entry_error', false)
+            ->orderBy('created_at', 'ASC')
+            ->get();
+        // erx, labs & imaging that are not closed
+        $tickets = Ticket::where('ordering_pro_id', $performerProID)
+            // ->where('is_entry_error', false)
+            // ->where('is_open', true)
+            ->orderBy('created_at', 'ASC')
+            ->get();
+        $numERx = Ticket::where('ordering_pro_id', $performerProID)
+            ->where('category', 'erx')
+            ->where('is_entry_error', false)
+            ->where('is_open', true)
+            ->count();
+        $numLabs = Ticket::where('ordering_pro_id', $performerProID)
+            ->where('category', 'lab')
+            ->where('is_entry_error', false)
+            ->where('is_open', true)
+            ->count();
+        $numImaging = Ticket::where('ordering_pro_id', $performerProID)
+            ->where('category', 'imaging')
+            ->where('is_entry_error', false)
+            ->where('is_open', true)
+            ->count();
+
+        return view('app/dashboard', compact('keyNumbers', 'reimbursement', 'milliseconds', 'measurements', 'businessNumbers',
+            'incomingReports', 'tickets', 'numERx', 'numLabs', 'numImaging'));
     }
 
     public function dashboardAppointments(Request $request, $from, $to) {

+ 36 - 0
resources/views/app/dashboard.blade.php

@@ -121,6 +121,30 @@
                     <li class="nav-item">
                         <a class="nav-link" :class="tab == 'measurements' ? 'active' : ''" href="#" v-on:click.prevent="tab='measurements'">Measurements</a>
                     </li>
+                    <li class="nav-item">
+                        <a class="nav-link {{count($incomingReports) ? 'text-danger font-weight-bold' : ''}}"
+                           :class="tab == 'incoming_reports' ? 'active' : ''" href="#" v-on:click.prevent="tab='incoming_reports'">
+                            Incoming Reports ({{count($incomingReports)}})
+                        </a>
+                    </li>
+                    <li class="nav-item">
+                        <a class="nav-link {{$numERx ? 'text-danger font-weight-bold' : ''}}"
+                           :class="tab == 'erx' ? 'active' : ''" href="#" v-on:click.prevent="tab='erx'">
+                            ERx ({{$numERx}})
+                        </a>
+                    </li>
+                    <li class="nav-item">
+                        <a class="nav-link {{$numLabs ? 'text-danger font-weight-bold' : ''}}"
+                           :class="tab == 'labs' ? 'active' : ''" href="#" v-on:click.prevent="tab='labs'">
+                            Labs ({{$numLabs}})
+                        </a>
+                    </li>
+                    <li class="nav-item">
+                        <a class="nav-link {{$numImaging ? 'text-danger font-weight-bold' : ''}}"
+                           :class="tab == 'imaging' ? 'active' : ''" href="#" v-on:click.prevent="tab='imaging'">
+                            Imaging ({{$numImaging}})
+                        </a>
+                    </li>
                 </ul>
 
                 <div class="border-left border-right border-bottom p-3">
@@ -189,6 +213,18 @@
                     <div v-show="tab==='measurements'">
                         @include('app.dashboard.measurements')
                     </div>
+                    <div v-show="tab==='incoming_reports'">
+                        @include('app.dashboard.incoming_reports')
+                    </div>
+                    <div v-show="tab==='erx'">
+                        @include('app.dashboard.erx')
+                    </div>
+                    <div v-show="tab==='labs'">
+                        @include('app.dashboard.labs')
+                    </div>
+                    <div v-show="tab==='imaging'">
+                        @include('app.dashboard.imaging')
+                    </div>
                 </div>
             </div>
         </div>

+ 72 - 0
resources/views/app/dashboard/erx.blade.php

@@ -0,0 +1,72 @@
+<div class="d-flex align-items-end mb-3">
+    <b class="large">Open ERx Orders</b>
+</div>
+<table class="table table-sm table-bordered mb-0">
+    <thead>
+    <tr class="bg-light">
+        <th class="px-2 text-secondary border-bottom-0 width-30px">Created</th>
+        <th class="px-2 text-secondary border-bottom-0 width-30px">Patient</th>
+        <th class="px-2 text-secondary border-bottom-0">Medication</th>
+    </tr>
+    </thead>
+    <tbody>
+    @foreach($tickets as $ticket)
+        @if($ticket->category === 'erx')
+            <?php $data = json_decode($ticket->data); ?>
+            <tr>
+                <td class="px-2 text-nowrap">{{friendlier_date_time($ticket->created_at)}}</td>
+                <td class="px-2 text-nowrap">
+                    <a href="/patients/view/{{$ticket->patient->uid}}/tickets/erx">
+                        {{$ticket->patient->displayName()}}
+                    </a>
+                </td>
+                <td class="px-2">
+                    <div class="d-flex align-items-center flex-wrap">
+                        <span class="font-weight-bold font-size-13">{{$data->medication}}</span>
+                        @if($data->strength)
+                            <span class="d-inline-flex align-items-center">
+                            <span class="mx-2 text-secondary">•</span>
+                            <span>{{$data->strength}}</span>
+                        </span>
+                        @endif
+                        @if($data->route)
+                            <span class="d-inline-flex align-items-center">
+                            <span class="mx-2 text-secondary">•</span>
+                            <span>{{$data->route}}</span>
+                        </span>
+                        @endif
+                        @if($data->frequency)
+                            <span class="d-inline-flex align-items-center">
+                            <span class="mx-2 text-secondary">•</span>
+                            <span>{{$data->frequency}}</span>
+                        </span>
+                        @endif
+                        @if($data->dispense)
+                            <span class="d-inline-flex align-items-center">
+                            <span class="mx-2 text-secondary">•</span>
+                            <span>Dispense:</span> {{$data->dispense}}
+                        </span>
+                        @endif
+                        @if($data->frequency)
+                            <span class="d-inline-flex align-items-center">
+                            <span class="mx-2 text-secondary">•</span>
+                            <span><span>Refills:</span> {{$data->refills}}</span>
+                        </span>
+                        @endif
+                        @if($data->dispense)
+                            <span class="d-inline-flex align-items-center">
+                            <span class="mx-2 text-secondary">•</span>
+                            <span><span>Purpose:</span> {{$data->purpose}}</span>
+                        </span>
+                        @endif
+                    </div>
+                </td>
+<!--                <td class="px-2">
+                    <span class="" v-html="pharmacy(item)"></span>
+                </td>-->
+            </tr>
+        @endif
+    @endforeach
+
+    </tbody>
+</table>

+ 41 - 0
resources/views/app/dashboard/imaging.blade.php

@@ -0,0 +1,41 @@
+<div class="d-flex align-items-end mb-3">
+    <b class="large">Open Imaging Orders</b>
+</div>
+<table class="table table-sm table-bordered mb-0">
+    <thead>
+    <tr class="bg-light">
+        <th class="px-2 text-secondary border-bottom-0 width-30px">Created</th>
+        <th class="px-2 text-secondary border-bottom-0 width-30px">Patient</th>
+        <th class="px-2 text-secondary border-bottom-0">Imaging</th>
+    </tr>
+    </thead>
+    <tbody>
+    @foreach($tickets as $ticket)
+        @if($ticket->category === 'lab')
+            <?php $data = json_decode($ticket->data); ?>
+            <tr>
+                <td class="px-2 text-nowrap">{{friendlier_date_time($ticket->created_at)}}</td>
+                <td class="px-2 text-nowrap">
+                    <a href="/patients/view/{{$ticket->patient->uid}}/tickets/lab">
+                        {{$ticket->patient->displayName()}}
+                    </a>
+                </td>
+                <td class="px-2">
+                    @if(@$data->tests)
+                        <div>
+                            <span class="text-secondary">Tests:</span>
+                            {{implode(", ", $data->tests)}}
+                        </div>
+                    @endif
+                    @if(@$data->icds)
+                        <div>
+                            <span class="text-secondary">ICDs:</span>
+                            {{implode(", ", $data->icds)}}
+                        </div>
+                    @endif
+                </td>
+            </tr>
+        @endif
+    @endforeach
+    </tbody>
+</table>

+ 67 - 0
resources/views/app/dashboard/incoming_reports.blade.php

@@ -0,0 +1,67 @@
+<div class="d-flex align-items-end mb-3">
+    <b class="large">Incoming Reports not signed</b>
+</div>
+<table class="table table-striped table-sm table-bordered mb-0">
+    <thead>
+    <tr>
+        <th class="px-2 text-secondary">Created</th>
+        <th class="px-2 text-secondary">Report</th>
+        <th class="px-2 text-secondary">Sign</th>
+        <th class="px-2 text-secondary">Title</th>
+        <th class="px-2 text-secondary">Category</th>
+        <th class="px-2 text-secondary">Memo</th>
+    </tr>
+    </thead>
+    <tbody>
+    @foreach($incomingReports as $document)
+        <tr class="{{$document->is_entry_error ? 'entry-error' : ''}}">
+            <td class="px-2">{{ friendly_date_time($document->created_at) }}</td>
+            <td class="px-2">
+                <div class="d-flex align-items-center">
+                    <a class="pdf-viewer-trigger" native target="_blank"
+                       href="/api/incomingReport/download/{{ $document->uid }}"
+                       title="View">View</a>
+                    @if($document->is_entry_error)
+                        <span class="ml-auto text-danger on-hover-opaque" title="Entry Error">
+                                    <i class="fa fa-exclamation-triangle"></i>
+                                </span>
+                    @endif
+                </div>
+            </td>
+            <td class="px-2">
+                @if(!$document->has_hcp_pro_signed)
+                    @if($document->hcp_pro_id === $pro->id)
+                        <div moe relative class="mr-2">
+                            <a start show class="">Sign</a>
+                            <form url="/api/incomingReport/signAsHcp" right>
+                                <input type="hidden" name="uid" value="{{ $document->uid }}">
+                                <p class="small">Are you sure you want to sign this report as HCP?</p>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-success mr-2" submit>Sign</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    @else
+                        -
+                    @endif
+                @else
+                    <div class="text-success mb-1">
+                        <i class="fa fa-check"></i>
+                        Signed
+                    </div>
+                    @if($document->hcp)
+                        <div class="text-secondary">
+                            <div class="text-sm font-weight-bold">{{$document->hcp->displayName()}}</div>
+                            <div class="text-sm">{{friendlier_date_time($document->hcp_pro_signed_at)}}</div>
+                        </div>
+                    @endif
+                @endif
+            </td>
+            <td class="px-2">{{ $document->title }}</td>
+            <td class="px-2">{{ $document->category }}{{ $document->subcategory ? ' / ' . $document->subcategory : '' }}</td>
+            <td class="px-2">{{ $document->memo }}</td>
+        </tr>
+    @endforeach
+    </tbody>
+</table>

+ 41 - 0
resources/views/app/dashboard/labs.blade.php

@@ -0,0 +1,41 @@
+<div class="d-flex align-items-end mb-3">
+    <b class="large">Open Lab Orders</b>
+</div>
+<table class="table table-sm table-bordered mb-0">
+    <thead>
+    <tr class="bg-light">
+        <th class="px-2 text-secondary border-bottom-0 width-30px">Created</th>
+        <th class="px-2 text-secondary border-bottom-0 width-30px">Patient</th>
+        <th class="px-2 text-secondary border-bottom-0">Tests</th>
+    </tr>
+    </thead>
+    <tbody>
+    @foreach($tickets as $ticket)
+        @if($ticket->category === 'lab')
+            <?php $data = json_decode($ticket->data); ?>
+            <tr>
+                <td class="px-2 text-nowrap">{{friendlier_date_time($ticket->created_at)}}</td>
+                <td class="px-2 text-nowrap">
+                    <a href="/patients/view/{{$ticket->patient->uid}}/tickets/lab">
+                        {{$ticket->patient->displayName()}}
+                    </a>
+                </td>
+                <td class="px-2">
+                        @if(@$data->tests)
+                            <div>
+                                <span class="text-secondary">Tests:</span>
+                                {{implode(", ", $data->tests)}}
+                            </div>
+                        @endif
+                        @if(@$data->icds)
+                            <div>
+                                <span class="text-secondary">ICDs:</span>
+                                {{implode(", ", $data->icds)}}
+                            </div>
+                        @endif
+                </td>
+            </tr>
+        @endif
+    @endforeach
+    </tbody>
+</table>