ソースを参照

Admin: stat links from dashboard

Vijayakrishnan 3 年 前
コミット
4417c9a549
2 ファイル変更37 行追加4 行削除
  1. 10 1
      app/Models/Pro.php
  2. 27 3
      resources/views/app/dashboard-admin.blade.php

+ 10 - 1
app/Models/Pro.php

@@ -591,10 +591,15 @@ WHERE mcp_pro_id = :pro_id
 
     function get_patients_without_appointment_count_as_admin() {
         return Client::whereNull('shadow_pro_id')
+            ->where('is_active', true)
+            ->where(function ($q) {
+                $q->whereNull('client_engagement_status_category')
+                    ->orWhere('client_engagement_status_category', '<>', 'DUMMY');
+            })
             ->whereNull('today_mcp_appointment_date')
             ->where(function($q){
                 $q->whereNull('next_mcp_appointment_id')
-                    ->orWhere('next_mcp_appointment_date', '<=', DB::raw('NOW()::DATE'));
+                    ->orWhere('next_mcp_appointment_date', '<', DB::raw('NOW()::DATE'));
             })->count();
     }
 
@@ -1078,6 +1083,10 @@ WHERE
         return $this->hasOne(NotePickupForProcessing::class, 'id', 'current_note_pickup_for_processing_id');
     }
 
+    public function get_patients_not_seen_in_45_days_count_as_admin() {
+
+    }
+
     public function get_patients_not_seen_in_45_days_count_as_mcp(){
         return 0;
     }

+ 27 - 3
resources/views/app/dashboard-admin.blade.php

@@ -71,11 +71,35 @@
 
                                 <tr>
                                     <th class="px-2 text-center">{{$pro->get_patients_without_appointment_count_as_admin()}}</th>
-                                    <th class="pl-2 font-weight-normal">Patients w/o Appointments</th>
+                                    <th class="pl-2 font-weight-normal">
+                                        <a href="/a/patients?next_appointment_category=NONE">
+                                            Patients w/o Appointments
+                                        </a>
+                                    </th>
                                 </tr>
                                 <tr>
-                                    <th class="px-2 text-center">{{$pro->get_patients_not_seen_in_45_days_count_as_mcp()}}</th>
-                                    <th class="pl-2 font-weight-normal">Patients Not Seen in 45 Days</th>
+                                    <?php
+                                    $dateBefore45Days = date_sub(date_create(), date_interval_create_from_date_string("45 days"));
+                                    $dateBefore45Days = date_format($dateBefore45Days, "Y-m-d");
+                                    ?>
+                                    <th class="px-2 text-center">
+                                        <?php
+                                        $count = \App\Models\Client::whereNull('shadow_pro_id')
+                                            ->where('is_active', true)
+                                            ->where(function ($q) {
+                                                $q->whereNull('client_engagement_status_category')
+                                                    ->orWhere('client_engagement_status_category', '<>', 'DUMMY');
+                                            })
+                                            ->where('most_recent_completed_mcp_note_date', '<', $dateBefore45Days)
+                                            ->count();
+                                        ?>
+                                        {{$count}}
+                                    </th>
+                                    <th class="pl-2 font-weight-normal">
+                                        <a href="/a/patients?last_visit_category=LESS_THAN&last_visit_value_1={{$dateBefore45Days}}&sort_by=most_recent_completed_mcp_note_date&sort_dir=DESC">
+                                            Patients Not Seen in 45 Days
+                                        </a>
+                                    </th>
                                 </tr>
                                 <tr>
                                     <th class="px-2 text-center">{{$pro->get_cancelled_appointments_pending_acknowledgement_count_as_mcp()}}</th>