|
@@ -1998,6 +1998,20 @@ WHERE
|
|
|
$conditions[] = "(payer.name ILIKE '%{$v}%')";
|
|
|
}
|
|
|
|
|
|
+ if(trim($request->input('f_ins_type'))) {
|
|
|
+ switch($request->input('f_ins_type')) {
|
|
|
+ case 'Medicare':
|
|
|
+ $conditions[] = "(pic.carrier_category = 'MEDICARE')";
|
|
|
+ break;
|
|
|
+ case 'Medicaid':
|
|
|
+ $conditions[] = "(pic.carrier_category = 'MEDICAID')";
|
|
|
+ break;
|
|
|
+ case 'Commercial':
|
|
|
+ $conditions[] = "(pic.carrier_category = 'COMMERCIAL')";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if(trim($request->input('f_state'))) {
|
|
|
$v = trim($request->input('f_state'));
|
|
|
switch($v) {
|
|
@@ -2270,6 +2284,7 @@ FROM care_month
|
|
|
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 client_primary_coverage cpc on client.effective_client_primary_coverage_id = cpc.id
|
|
|
+ left join insurance_card pic on client.primary_insurance_card_id = pic.id
|
|
|
left join payer on cpc.commercial_payer_id = payer.id
|
|
|
{$genericBillJoinClause}
|
|
|
WHERE
|
|
@@ -2371,6 +2386,7 @@ FROM care_month join client on care_month.client_id = client.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 client_primary_coverage cpc on client.effective_client_primary_coverage_id = cpc.id
|
|
|
+ left join insurance_card pic on client.primary_insurance_card_id = pic.id
|
|
|
left join payer on cpc.commercial_payer_id = payer.id
|
|
|
left join appointment nv on nv.id = mrnote.follow_up_appointment_id
|
|
|
{$genericBillJoinClause}
|
|
@@ -2404,6 +2420,7 @@ WHERE
|
|
|
$commonStatSQL = "
|
|
|
SELECT COUNT(*)
|
|
|
FROM care_month join client on care_month.client_id = client.id
|
|
|
+ left join insurance_card pic on client.primary_insurance_card_id = pic.id
|
|
|
" . ($request->input('f_mcp') ? "left join pro mcpPro on care_month.mcp_pro_id = mcpPro.id" : "") . "
|
|
|
WHERE
|
|
|
";
|