|
@@ -116,6 +116,26 @@ class AdminController extends Controller
|
|
|
$this->filterMultiQuery($request, $patients, 'created_at', 'created_at', 'created_at_value_1', 'created_at_value_2');
|
|
|
$this->filterMultiQuery($request, $patients, 'most_recent_completed_mcp_note_date', 'last_visit_category', 'last_visit_value_1', 'last_visit_value_2');
|
|
|
|
|
|
+ $hasEmail = $request->input('has_email');
|
|
|
+ if($hasEmail) {
|
|
|
+ if($hasEmail === 'YES') {
|
|
|
+ $patients = $patients->whereRaw("(email_address IS NOT NULL AND TRIM(email_address) != '')");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $patients = $patients->whereRaw("(email_address IS NULL OR TRIM(email_address) = '')");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $hasAccount = $request->input('has_account');
|
|
|
+ if($hasAccount) {
|
|
|
+ if($hasAccount === 'YES') {
|
|
|
+ $patients = $patients->whereRaw("((SELECT COUNT(ac.id) FROM account_client ac WHERE ac.client_id = client.id) > 0)");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $patients = $patients->whereRaw("((SELECT COUNT(ac.id) FROM account_client ac WHERE ac.client_id = client.id) = 0)");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if($request->input('number_of_measurements')){
|
|
|
$keyName = $request->input('number_of_measurements');
|
|
|
$measurementCountQuery = '(SELECT COUNT(*) FROM measurement WHERE measurement.client_id = client.id AND is_active IS TRUE AND is_cellular IS TRUE AND is_cellular_zero IS NOT TRUE)';
|