Ver código fonte

Don't include shadows in coverage DB stat & matrix

Vijayakrishnan 3 anos atrás
pai
commit
515d3ae985

+ 3 - 2
app/Http/Controllers/HomeController.php

@@ -575,7 +575,7 @@ WHERE ((client.mcp_pro_id = {$performer->pro->id}) OR (client.rmm_pro_id = {$per
             $keyNumbers['patientsWithoutCoverageInformation'] = DB::select(DB::raw("
 SELECT count(DISTINCT (cl.id)) as cnt
 FROM client cl
-WHERE cl.latest_client_primary_coverage_id IS NULL -- no coverage record"
+WHERE cl.shadow_pro_id IS NULL AND cl.latest_client_primary_coverage_id IS NULL -- no coverage record"
             ))[0]->cnt;
 
             // patients pending coverage verification
@@ -583,7 +583,8 @@ WHERE cl.latest_client_primary_coverage_id IS NULL -- no coverage record"
 SELECT count(DISTINCT (cl.id)) as cnt
 FROM client cl
          LEFT JOIN client_primary_coverage cpc ON cl.latest_client_primary_coverage_id = cpc.id
-WHERE (cl.latest_client_primary_coverage_id IS NOT NULL -- coverage exists, but status is null or unknown
+WHERE cl.shadow_pro_id IS NULL 
+    AND (cl.latest_client_primary_coverage_id IS NOT NULL -- coverage exists, but status is null or unknown
     AND (
                (cpc.plan_type = 'MEDICARE' AND (cpc.is_partbprimary = 'UNKNOWN' OR cpc.is_partbprimary IS NULL))
                OR

+ 4 - 4
app/Http/Controllers/PracticeManagementController.php

@@ -391,16 +391,16 @@ class PracticeManagementController extends Controller
 
         switch ($filter) {
             case 'without-coverage-information':
-                $sql .= 'WHERE ';
+                $sql .= 'WHERE cl.shadow_pro_id IS NULL AND ';
                 $sql .= $withoutCondition;
                 break;
             case 'pending-coverage-verification':
-                $sql .= $joinClause . 'WHERE ';
+                $sql .= $joinClause . 'WHERE cl.shadow_pro_id IS NULL AND ';
                 $sql .= $pendingCondition;
                 break;
             default:
-                $sql .= $joinClause . 'WHERE ';
-                $sql .= $withoutCondition . ' OR ' . $pendingCondition;
+                $sql .= $joinClause . 'WHERE cl.shadow_pro_id IS NULL AND ';
+                $sql .= '(' . $withoutCondition . ' OR ' . $pendingCondition . ')';
                 break;
         }