|
@@ -3655,8 +3655,12 @@ ORDER BY c.name_last, c.name_first
|
|
|
JOIN bill AS b ON (b.note_id = n.id AND b.is_cancelled IS NOT TRUE AND b.code ILIKE '%treatment%')
|
|
|
";
|
|
|
$where = "WHERE
|
|
|
- n.is_signed_by_hcp IS TRUE AND
|
|
|
- -- n.is_claim_closed IS NOT TRUE AND
|
|
|
+
|
|
|
+ -- n.visit_number = 2 AND
|
|
|
+ n.is_signed_by_hcp IS TRUE AND
|
|
|
+ -- n.effective_dateest < '2022-03-01' AND
|
|
|
+ -- n.id IN (SELECT note_id FROM segment WHERE summary_html ILIKE '%n95%') AND
|
|
|
+ n.is_claim_closed IS NOT TRUE AND
|
|
|
n.is_cancelled IS NOT TRUE AND
|
|
|
n.created_at::DATE >= '2022-01-01'::DATE AND
|
|
|
c.client_engagement_status_category <> 'DUMMY' AND
|
|
@@ -3666,8 +3670,8 @@ ORDER BY c.name_last, c.name_first
|
|
|
-- n.id NOT IN (SELECT note_id FROM claim WHERE note_id IS NOT NULL) AND
|
|
|
c.is_part_b_primary = 'YES' AND
|
|
|
c.latest_eligible_refresh_at::DATE >= '2022-01-01' AND
|
|
|
- c.mpb_remaining = 0 AND
|
|
|
- c.created_at::DATE >= '2022-01-01'::DATE
|
|
|
+ c.mpb_remaining = 0 -- AND
|
|
|
+ -- c.created_at::DATE >= '2022-01-01'::DATE
|
|
|
";
|
|
|
$filters = [];
|
|
|
if($request->input('f')) {
|
|
@@ -3683,7 +3687,9 @@ ORDER BY c.name_last, c.name_first
|
|
|
$filters = '';
|
|
|
}
|
|
|
// $filters = '';
|
|
|
- $orderBy = "ORDER BY c.id ASC, n.effective_dateest ASC";
|
|
|
+ $orderBy = "ORDER BY
|
|
|
+ c.id ASC,
|
|
|
+ n.id ASC, n.effective_dateest ASC";
|
|
|
|
|
|
$countQuery = "SELECT count(*) {$from} {$where} {$filters}";
|
|
|
// dd($countQuery);
|