Bläddra i källkod

added number of clients on hr activity

= 3 år sedan
förälder
incheckning
0a0f8cfa31

+ 3 - 1
app/Http/Controllers/PracticeManagementController.php

@@ -829,7 +829,9 @@ class PracticeManagementController extends Controller
         ->selectRaw(" *,
             (SELECT id FROM note WHERE note.hcp_pro_id = pro.id AND is_cancelled = false ORDER BY created_at DESC LIMIT 1) as last_note_id, 
             (SELECT note.created_at FROM note WHERE note.hcp_pro_id = pro.id AND note.is_cancelled = false ORDER BY note.created_at DESC LIMIT 1) as last_note_created_at,
-            (SELECT COUNT(*) FROM note WHERE note.hcp_pro_id = pro.id AND note.is_cancelled = false AND created_at::DATE >= '${startOfCurrentMonth}'::DATE AND created_at::DATE <= '${endOfCurrentMonth}'::DATE ) AS notes_this_month
+            (SELECT COUNT(*) FROM note WHERE note.hcp_pro_id = pro.id AND note.is_cancelled = false AND created_at::DATE >= '${startOfCurrentMonth}'::DATE AND created_at::DATE <= '${endOfCurrentMonth}'::DATE ) AS notes_this_month,
+            (SELECT COUNT(*) FROM client WHERE client.mcp_pro_id = pro.id AND client.client_engagement_status_category <> 'DUMMY' AND client.client_engagement_status_category <> 'DUPLICATE') as total_client_count,
+            (SELECT COUNT(*) FROM client WHERE client.mcp_pro_id = pro.id AND client.client_engagement_status_category <> 'DUMMY' AND client.client_engagement_status_category <> 'DUPLICATE' AND client.most_recent_completed_mcp_note_date >= (NOW() - interval '60 days')::DATE) as active_client_count
             " . (!!$from_date && !!$to_date ? ",(SELECT COUNT(*) FROM note WHERE note.hcp_pro_id = pro.id AND note.is_cancelled = false AND created_at::DATE >= '${from_date}'::DATE AND created_at::DATE <= '${to_date}'::DATE  ) AS notes_this_period" : ""));
 
         $prosIDs = $request->get('pros_ids');

+ 4 - 0
resources/views/app/practice-management/hcp-note-activity.blade.php

@@ -92,6 +92,8 @@
                         @if(request()->input('from_date') && request()->input('from_date'))
                             <th>@include('app.practice-management._sort_header', ['label' => '# Notes In the Period', 'key' => 'notes_this_period'])</th>
                         @endif
+                        <th>@include('app.practice-management._sort_header', ['label' => '# Clients', 'key' => 'total_client_count'])</th>
+                        <th>@include('app.practice-management._sort_header', ['label' => '# Active Clients', 'key' => 'active_client_count'])</th>
                     </tr>
                 </thead>
                 <tbody>
@@ -106,6 +108,8 @@
                         @if(request()->input('from_date') && request()->input('from_date'))
                             <td>{{$row->notes_this_period}}</td>
                         @endif
+                        <td>{{$row->total_client_count}}</td>
+                        <td>{{$row->active_client_count}}</td>
                     </tr>
                     @endforeach
                 </tbody>