Przeglądaj źródła

Patients list mods

Vijayakrishnan 3 lat temu
rodzic
commit
008f82a4b7
2 zmienionych plików z 47 dodań i 7 usunięć
  1. 12 2
      app/Models/Client.php
  2. 35 5
      resources/views/app/patients.blade.php

+ 12 - 2
app/Models/Client.php

@@ -279,9 +279,10 @@ class Client extends Model
     public function upcomingAppointments()
     {
         return $this->hasMany(Appointment::class, 'client_id', 'id')
-            // ->where('raw_start_time', '>', date('Y-m-d H:i:s'))
+            ->where('raw_date', '>=', date('Y-m-d'))
             ->whereIn('status', ['CREATED', 'CONFIRMED'])
-            ->orderBy('start_time', 'desc');
+            ->orderBy('start_time', 'desc')
+            ->limit(5);
     }
 
     public function appointmentsFromLastWeek()
@@ -635,4 +636,13 @@ class Client extends Model
         $count = Note::where('client_id', $this->id)->where('hcp_pro_id', $_pro->id)->where('is_cancelled', false)->where('new_or_fu_or_na', 'NEW')->count();
         return !!$count;
     }
+
+    public function recentNotes($_pro = null) {
+        $notes = Note::where('client_id', $this->id)->where('is_cancelled', false);
+        if($_pro) {
+            $notes = $notes->where('hcp_pro_id', $_pro->id);
+        }
+        $notes = $notes->orderBy('effective_dateest', 'DESC')->limit(5)->get();
+        return $notes;
+    }
 }

+ 35 - 5
resources/views/app/patients.blade.php

@@ -73,7 +73,8 @@
                     @if($showProgramsColumn)<th class="border-0">Program(s)</th>@endif
                     <th class="border-0">MCN</th>
                     <th class="border-0">PCP</th>
-                    {{--<th class="border-0">RMM</th>--}}
+                    <th class="border-0"><span class="text-nowrap">Recent Notes</span><br>(overall)</th>
+                    <th class="border-0"><span class="text-nowrap">Recent Notes</span><br>(me)</th>
                     <th class="border-0">Appointments</th>
                     <th class="border-0">Account</th>
                     <th class="border-0">Tags</th>
@@ -175,9 +176,38 @@
                         <td>
                             {{ $patient->mcp ? $patient->mcp->displayName() : '-' }}
                         </td>
-                        {{--<td>
-                            {{ $patient->rmm ? $patient->rmm->displayName() : '-' }}
-                        </td>--}}
+                        <td class="p-0">
+                            <?php $allNotes = $patient->recentNotes(); ?>
+                            <table class="table table-sm table-condensed table-bordered m-0 width-200px">
+                                <tbody>
+                                @foreach($allNotes as $note)
+                                    <tr>
+                                        <td>
+                                            <a href="{{route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $note])}}"><b class="text-nowrap">{{friendlier_date($note->effective_dateest)}}</b></a>
+                                            <br>
+                                            <span class="text-nowrap">{{$note->hcpPro->displayName()}}</span>
+                                        </td>
+                                        <td>{{$note->new_or_fu_or_na}}</td>
+                                    </tr>
+                                @endforeach
+                                </tbody>
+                            </table>
+                        </td>
+                        <td class="py-0 pl-2">
+                            <?php $myNotes = $patient->recentNotes($pro); ?>
+                            <table class="table table-sm table-condensed table-bordered m-0 width-200px">
+                                <tbody>
+                                @foreach($myNotes as $note)
+                                    <tr>
+                                        <td>
+                                            <a href="{{route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $note])}}"><b class="text-nowrap">{{friendlier_date($note->effective_dateest)}}</b></a>
+                                        </td>
+                                        <td>{{$note->new_or_fu_or_na}}</td>
+                                    </tr>
+                                @endforeach
+                                </tbody>
+                            </table>
+                        </td>
                         <td>
                             <table class="table table-sm border-0 my-0">
                                 <tbody>
@@ -189,7 +219,7 @@
                                             <div class="pb-0">
                                                 {{ friendly_date_time($appointment->start_time, false) }}, {{ friendly_time($appointment->raw_start_time) }}
                                                 <span class="d-inline-block text-secondary text-sm">({{ $appointment->timezone }})</span>
-                                                &nbsp;/&nbsp;
+                                                <br>
                                                 <b class="mr-1">{{$appointment->pro->displayName()}}</b>
                                                 <span class="text-secondary text-sm">({{ $appointment->status }})</span>
                                             </div>