|
@@ -878,13 +878,13 @@ class PracticeManagementController extends Controller
|
|
|
|
|
|
//Patient | MCP | # Notes Total | # Notes without Billing Closed | # Notes without Claiming Closed
|
|
//Patient | MCP | # Notes Total | # Notes without Billing Closed | # Notes without Claiming Closed
|
|
$patientsQuery = Client::where('is_dummy', '=', false)
|
|
$patientsQuery = Client::where('is_dummy', '=', false)
|
|
- ->select('id', 'uid', 'name_first', 'name_last', 'mcp_pro_id',
|
|
|
|
|
|
+ ->select('id', 'uid', 'name_first', 'name_last', 'mcp_pro_id','is_part_b_primary','medicare_advantage_plan',
|
|
DB::raw("(SELECT name_first||' '||name_last FROM pro where pro.id = client.mcp_pro_id) as mcp"),
|
|
DB::raw("(SELECT name_first||' '||name_last FROM pro where pro.id = client.mcp_pro_id) as mcp"),
|
|
DB::raw("(SELECT uid FROM pro where pro.id = mcp_pro_id) as mcp_pro_uid"),
|
|
DB::raw("(SELECT uid FROM pro where pro.id = mcp_pro_id) as mcp_pro_uid"),
|
|
DB::raw("(SELECT COUNT(*) FROM note where note.client_id = client.id) as notes_total"),
|
|
DB::raw("(SELECT COUNT(*) FROM note where note.client_id = client.id) as notes_total"),
|
|
DB::raw("(SELECT COUNT(*) FROM note where note.client_id = client.id AND is_bill_closed IS NOT true) as notes_without_billing_closed"),
|
|
DB::raw("(SELECT COUNT(*) FROM note where note.client_id = client.id AND is_bill_closed IS NOT true) as notes_without_billing_closed"),
|
|
DB::raw("(SELECT COUNT(*) FROM note where note.client_id = client.id AND is_claim_closed IS NOT true) as notes_without_claiming_closed")
|
|
DB::raw("(SELECT COUNT(*) FROM note where note.client_id = client.id AND is_claim_closed IS NOT true) as notes_without_claiming_closed")
|
|
- )->orderBy('notes_without_claiming_closed', 'desc');
|
|
|
|
|
|
+ )->orderBy('is_part_b_primary', 'desc')->orderBy('notes_without_claiming_closed', 'desc');
|
|
|
|
|
|
if($proUid){
|
|
if($proUid){
|
|
$mcpPro = Pro::where('uid', $proUid)->first();
|
|
$mcpPro = Pro::where('uid', $proUid)->first();
|