|
@@ -1956,6 +1956,24 @@ WHERE
|
|
$conditions[] = "(client.is_enrolled_in_rm = 'YES')";
|
|
$conditions[] = "(client.is_enrolled_in_rm = 'YES')";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if($request->input('f_claim_closed')) {
|
|
|
|
+ if($request->input('f_claim_closed') === 'no') {
|
|
|
|
+ $conditions[] = "(care_month.is_claim_closed IS NULL OR care_month.is_claim_closed IS FALSE)";
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $conditions[] = "(care_month.is_claim_closed IS TRUE)";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if($request->input('f_visit_90_days')) {
|
|
|
|
+ /*if($request->input('f_visit_90_days') === 'yes') {
|
|
|
|
+ $conditions[] = "(care_month.is_claim_closed IS " . ($request->input('f_claim_closed') === 'yes' ? 'TRUE' : 'FALSE') . ")";
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $conditions[] = "(care_month.is_claim_closed IS " . ($request->input('f_claim_closed') === 'yes' ? 'TRUE' : 'FALSE') . ")";
|
|
|
|
+ }*/
|
|
|
|
+ }
|
|
|
|
+
|
|
$genericBillIdColumns = "care_month.mcp_rm_generic_bill_id,
|
|
$genericBillIdColumns = "care_month.mcp_rm_generic_bill_id,
|
|
mcpBill.uid as mcp_rm_generic_bill_uid,
|
|
mcpBill.uid as mcp_rm_generic_bill_uid,
|
|
mcpBill.generic_pro_id as mcp_rm_generic_bill_generic_pro_id,
|
|
mcpBill.generic_pro_id as mcp_rm_generic_bill_generic_pro_id,
|
|
@@ -2005,9 +2023,11 @@ SELECT client.name_first, client.name_last,
|
|
client.cell_number,
|
|
client.cell_number,
|
|
client.is_assigned_cellular_bp_device,
|
|
client.is_assigned_cellular_bp_device,
|
|
client.is_assigned_cellular_weight_scale_device,
|
|
client.is_assigned_cellular_weight_scale_device,
|
|
|
|
+ nv.raw_date as next_visit_date,
|
|
DATE_PART('day', NOW() - client.most_recent_cellular_measurement_at) as dslm,
|
|
DATE_PART('day', NOW() - client.most_recent_cellular_measurement_at) as dslm,
|
|
care_month.uid as care_month_uid,
|
|
care_month.uid as care_month_uid,
|
|
care_month.id as care_month_id,
|
|
care_month.id as care_month_id,
|
|
|
|
+ care_month.is_claim_closed,
|
|
care_month.start_date,
|
|
care_month.start_date,
|
|
care_month.rm_total_time_in_seconds_by_mcp,
|
|
care_month.rm_total_time_in_seconds_by_mcp,
|
|
care_month.rm_total_time_in_seconds_by_rmm_pro,
|
|
care_month.rm_total_time_in_seconds_by_rmm_pro,
|
|
@@ -2047,11 +2067,12 @@ SELECT client.name_first, client.name_last,
|
|
(SELECT COUNT(*) FROM claim_line where claim_line.cpt = '99457' AND claim_line.claim_id IN (SELECT claim.id FROM claim WHERE claim.care_month_id = care_month.id AND claim.status != 'CANCELLED')) as claim_457,
|
|
(SELECT COUNT(*) FROM claim_line where claim_line.cpt = '99457' AND claim_line.claim_id IN (SELECT claim.id FROM claim WHERE claim.care_month_id = care_month.id AND claim.status != 'CANCELLED')) as claim_457,
|
|
{$genericBillIdColumns}
|
|
{$genericBillIdColumns}
|
|
FROM care_month join client on care_month.client_id = client.id
|
|
FROM care_month join client on care_month.client_id = client.id
|
|
- join note mrnote on client.most_recent_completed_mcp_note_id = mrnote.id
|
|
|
|
|
|
+ left join note mrnote on client.most_recent_completed_mcp_note_id = mrnote.id
|
|
left join pro mcpPro on care_month.mcp_pro_id = mcpPro.id
|
|
left join pro mcpPro on care_month.mcp_pro_id = mcpPro.id
|
|
left join pro rmmPro on care_month.rmm_pro_id = rmmPro.id
|
|
left join pro rmmPro on care_month.rmm_pro_id = rmmPro.id
|
|
left join client_primary_coverage cpc on client.effective_client_primary_coverage_id = cpc.id
|
|
left join client_primary_coverage cpc on client.effective_client_primary_coverage_id = cpc.id
|
|
left join payer on cpc.commercial_payer_id = payer.id
|
|
left join payer on cpc.commercial_payer_id = payer.id
|
|
|
|
+ left join appointment nv on nv.id = mrnote.follow_up_appointment_id
|
|
{$genericBillJoinClause}
|
|
{$genericBillJoinClause}
|
|
WHERE
|
|
WHERE
|
|
EXTRACT(MONTH from care_month.start_date) = " . ($request->input('m') ?: 'EXTRACT(MONTH from now())') . "
|
|
EXTRACT(MONTH from care_month.start_date) = " . ($request->input('m') ?: 'EXTRACT(MONTH from now())') . "
|