|
@@ -174,11 +174,11 @@ class AdminController extends Controller
|
|
|
$insurance = $request->get('insurance');
|
|
|
if($insurance){
|
|
|
if($insurance === 'MEDICARE'){
|
|
|
- $patients = $patients->whereHas('latestClientPrimaryCoverage', function($cpcQuery){
|
|
|
+ $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($cpcQuery){
|
|
|
return $cpcQuery->where('is_partbprimary', '=', 'YES');
|
|
|
});
|
|
|
}else{
|
|
|
- $patients = $patients->whereDoesntHave('latestClientPrimaryCoverage', function($cpcQuery){
|
|
|
+ $patients = $patients->whereDoesntHave('effectiveClientPrimaryCoverage', function($cpcQuery){
|
|
|
return $cpcQuery->where('is_partbprimary', '=', 'YES');
|
|
|
});
|
|
|
}
|
|
@@ -265,33 +265,33 @@ class AdminController extends Controller
|
|
|
|
|
|
switch($keyName) {
|
|
|
case 'EXACTLY':
|
|
|
- $patients = $patients->whereHas('latestClientPrimaryCoverage', function($q) use ($request){
|
|
|
+ $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($q) use ($request){
|
|
|
return $q->where('auto_medicare_mpb_deductible', '=', $request->input('deductible_value_1'));
|
|
|
});
|
|
|
break;
|
|
|
case 'LESS_THAN':
|
|
|
if($request->input('deductible_value_1')) {
|
|
|
- $patients = $patients->whereHas('latestClientPrimaryCoverage', function($q) use ($request){
|
|
|
+ $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($q) use ($request){
|
|
|
return $q->where('auto_medicare_mpb_deductible', '<=', $request->input('deductible_value_1'));
|
|
|
});
|
|
|
}
|
|
|
break;
|
|
|
case 'GREATER_THAN':
|
|
|
if($request->input('deductible_value_1')) {
|
|
|
- $patients = $patients->whereHas('latestClientPrimaryCoverage', function($q) use ($request){
|
|
|
+ $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($q) use ($request){
|
|
|
return $q->where('auto_medicare_mpb_deductible', '>=', $request->input('deductible_value_1'));
|
|
|
});
|
|
|
}
|
|
|
break;
|
|
|
case 'BETWEEN':
|
|
|
- $patients = $patients->whereHas('latestClientPrimaryCoverage', function($q) use ($request){
|
|
|
+ $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($q) use ($request){
|
|
|
return $q->where('auto_medicare_mpb_deductible', '>=', $request->input('deductible_value_1'))
|
|
|
->where('auto_medicare_mpb_deductible', '<=', $request->input('deductible_value_2'));
|
|
|
});
|
|
|
break;
|
|
|
case 'NOT_BETWEEN':
|
|
|
if($request->input('deductible_value_1') && $request->input('deductible_value_2')) {
|
|
|
- $patients = $patients->whereHas('latestClientPrimaryCoverage', function($q) use ($request){
|
|
|
+ $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($q) use ($request){
|
|
|
|
|
|
return $q->where(function($qq) use ($request){
|
|
|
return $qq->where('auto_medicare_mpb_deductible', '<', $request->input('deductible_value_1'))
|
|
@@ -339,7 +339,7 @@ class AdminController extends Controller
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- $patients = $patients->whereHas('latestClientPrimaryCoverage', function($cpcQuery){
|
|
|
+ $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($cpcQuery){
|
|
|
return $cpcQuery->where('is_partbprimary', '=', 'YES');
|
|
|
});
|
|
|
|
|
@@ -527,24 +527,24 @@ class AdminController extends Controller
|
|
|
$insurance = $request->get('insurance');
|
|
|
if($insurance){
|
|
|
if($insurance === 'MEDICARE'){
|
|
|
- $patients = $patients->whereHas('latestClientPrimaryCoverage', function($cpcQuery){
|
|
|
+ $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($cpcQuery){
|
|
|
return $cpcQuery->where('is_partbprimary', '=', 'YES');
|
|
|
});
|
|
|
}elseif($insurance === 'MEDICARE_PENDING'){
|
|
|
- $patients = $patients->whereHas('latestClientPrimaryCoverage', function($cpcQuery){
|
|
|
+ $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($cpcQuery){
|
|
|
return $cpcQuery->where('plan_type', 'MEDICARE')->where('is_covered', '!=', 'YES');
|
|
|
});
|
|
|
}elseif($insurance === 'NOT_COVERED'){
|
|
|
- $patients = $patients->whereHas('latestClientPrimaryCoverage', function($cpcQuery){
|
|
|
+ $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($cpcQuery){
|
|
|
return $cpcQuery->where('is_covered', '!=', 'YES');
|
|
|
});
|
|
|
}elseif($insurance === 'PENDING'){
|
|
|
- $patients = $patients->whereHas('latestClientPrimaryCoverage', function($cpcQuery){
|
|
|
+ $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($cpcQuery){
|
|
|
return $cpcQuery->where('is_covered', '=', 'UNKNOWN');
|
|
|
});
|
|
|
}
|
|
|
else{
|
|
|
- $patients = $patients->whereDoesntHave('latestClientPrimaryCoverage', function($cpcQuery){
|
|
|
+ $patients = $patients->whereDoesntHave('effectiveClientPrimaryCoverage', function($cpcQuery){
|
|
|
return $cpcQuery->where('is_partbprimary', '=', 'YES');
|
|
|
});
|
|
|
}
|