|
@@ -175,12 +175,12 @@ class AdminController extends Controller
|
|
|
$insurance = $request->get('insurance');
|
|
|
if($insurance){
|
|
|
if($insurance === 'MEDICARE'){
|
|
|
- $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($cpcQuery){
|
|
|
+ $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($cpcQuery) {
|
|
|
return $cpcQuery->where('is_partbprimary', '=', 'YES');
|
|
|
});
|
|
|
}else{
|
|
|
- $patients = $patients->whereDoesntHave('effectiveClientPrimaryCoverage', function($cpcQuery){
|
|
|
- return $cpcQuery->where('is_partbprimary', '=', 'YES');
|
|
|
+ $patients = $patients->whereHas('effectiveClientPrimaryCoverage', function($cpcQuery) use ($insurance){
|
|
|
+ return $cpcQuery->where('commercial_payer_id', '=', $insurance);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -192,7 +192,10 @@ class AdminController extends Controller
|
|
|
|
|
|
|
|
|
$patients = $patients->orderBy('created_at', 'DESC')->paginate(25);
|
|
|
- return view('app.admin.patients', compact('patients', 'filters'));
|
|
|
+
|
|
|
+ $insurances = DB::select('SELECT DISTINCT commercial_payer_name, commercial_payer_id FROM client_primary_coverage WHERE commercial_payer_name IS NOT NULL ORDER BY commercial_payer_name ASC');
|
|
|
+
|
|
|
+ return view('app.admin.patients', compact('patients', 'filters', 'insurances'));
|
|
|
}
|
|
|
|
|
|
public function partBPatients(Request $request){
|