Sfoglia il codice sorgente

Main dashboard - new stat "patients awaiting program OB"

Vijayakrishnan 4 anni fa
parent
commit
4167363b21

+ 23 - 0
app/Http/Controllers/HomeController.php

@@ -198,6 +198,29 @@ class HomeController extends Controller
             })->count();
         $keyNumbers['patientsNotSeenYet'] = $patientNotSeenYet;
 
+        // patientsPendingProgramOB
+        $proID = $this->performer()->pro->id;
+        if ($this->performer()->pro->pro_type === 'ADMIN') {
+            $query = Client::where('id', '>', 0);
+        } else {
+            $query = Client::where(function ($q) use ($proID) {
+                $q->where('mcp_pro_id', $proID)
+                    ->orWhere('cm_pro_id', $proID)
+                    ->orWhere('rmm_pro_id', $proID)
+                    ->orWhere('rme_pro_id', $proID)
+                    ->orWhereRaw('id IN (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = ?)', [$proID])
+                    ->orWhereRaw('id IN (SELECT client_id FROM appointment WHERE pro_id = ?)', [$proID]);
+            });
+        }
+        $query = $query->where(function ($_query) {
+            $_query->select(DB::raw('COUNT(id)'))
+                ->from('client_program')
+                ->whereColumn('client_id', 'client.id')
+                ->where('has_mcp_done_onboarding_visit', '!=', 'YES');
+        }, '>=', 1);
+        $keyNumbers['patientsPendingProgramOB'] = $query->count();
+
+
         $pendingBillsToSign = Bill::where(function ($query) use ($performerProID) {
             $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false);
         })

+ 8 - 4
resources/views/app/dashboard.blade.php

@@ -20,19 +20,23 @@
                             <tbody>
                                 <tr>
                                     <th class="px-2 text-center">{{$keyNumbers['totalPatients']}}</th>
-                                    <th class="pl-2"><a target="_top" href="/mc/patients">Total patients</a></th>
+                                    <th class="pl-2"><a native target="_top" href="/patients">Total patients</a></th>
                                 </tr>
                                 <tr>
                                     <th class="px-2 text-center">{{$keyNumbers['patientsNotSeenYet']}}</th>
-                                    <th class="pl-2"><a target="_top" href="/mc/patients/not-yet-seen">Patients I have not seen yet</a></th>
+                                    <th class="pl-2"><a native target="_top" href="/patients/not-yet-seen">Patients I have not seen yet</a></th>
+                                </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$keyNumbers['patientsPendingProgramOB']}}</th>
+                                    <th class="pl-2"><a native target="_top" href="/patients/program-onboarding-pending">Patients awaiting program OB</a></th>
                                 </tr>
                                 <tr>
                                     <th class="px-2 text-center">{{$keyNumbers['pendingBillsToSign']}}</th>
-                                    <th class="pl-2"><a target="_top" href="/mc/practice-management/bills/not-yet-signed">Pending bills to sign</a></th>
+                                    <th class="pl-2"><a native target="_top" href="/practice-management/bills/not-yet-signed">Pending bills to sign</a></th>
                                 </tr>
                                 <tr>
                                     <th class="px-2 text-center">{{$keyNumbers['pendingNotesToSign']}}</th>
-                                    <th class="pl-2"><a target="_top" href="/mc/practice-management/notes/not-yet-signed">Pending notes to sign</a></th>
+                                    <th class="pl-2"><a native target="_top" href="/practice-management/notes/not-yet-signed">Pending notes to sign</a></th>
                                 </tr>
                             </tbody>
                         </table>