|
@@ -39,7 +39,13 @@ class McpController extends Controller
|
|
|
public function patients(Request $request)
|
|
|
{
|
|
|
$filters = $request->all();
|
|
|
- $patients = Client::whereNull('shadow_pro_id')->where('mcp_pro_id', $this->performer->pro->id);
|
|
|
+ $patients = Client::whereNull('shadow_pro_id');
|
|
|
+
|
|
|
+ //TODO: implement in admin controller
|
|
|
+ if($this->performer->pro->pro_type != 'ADMIN'){
|
|
|
+ $patients->where('mcp_pro_id', $this->performer->pro->id);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// filters
|
|
|
/*
|
|
@@ -93,6 +99,17 @@ class McpController extends Controller
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
+ $initiative = $request->input('initiative');
|
|
|
+ if($initiative){
|
|
|
+ $wildCardedInitiative = '%'.$initiative.'%';
|
|
|
+ $patients->where('initiative', 'ilike', $wildCardedInitiative);
|
|
|
+ }
|
|
|
+
|
|
|
+ $include_test_records = $request->input('include_test_records');
|
|
|
+ if(!$include_test_records){
|
|
|
+ $patients->where('client_engagement_status_category', '<>', 'DUMMY');
|
|
|
+ }
|
|
|
+
|
|
|
$patients = $patients->orderBy('created_at', 'DESC')->paginate(50);
|
|
|
return view('app.mcp.patients', compact('patients', 'filters'));
|
|
|
}
|