|
@@ -93,11 +93,12 @@ class McpController extends Controller
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2');
|
|
|
+ $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2', false);
|
|
|
$this->filterSimpleQuery($request, $patients, 'sex', 'sex');
|
|
|
- $this->filterMultiQuery($request, $patients, 'usual_bmi_max', 'bmi_category', 'bmi_value_1', 'bmi_value_2');
|
|
|
+ $this->filterMultiQuery($request, $patients, 'usual_bmi_max', 'bmi_category', 'bmi_value_1', 'bmi_value_2', false);
|
|
|
$this->filterMultiQuery($request, $patients, 'most_recent_weight_at', 'last_weighed_in_category', 'last_weighed_in_value_1', 'last_weighed_in_value_2');
|
|
|
$this->filterMultiQuery($request, $patients, 'most_recent_bp_at', 'last_bp_category', 'last_bp_value_1', 'last_bp_value_2');
|
|
|
+ $this->filterMultiQuery($request, $patients, 'most_recent_completed_mcp_note_date', 'last_visit_category', 'last_visit_value_1', 'last_visit_value_2');
|
|
|
|
|
|
switch($request->input('status')) {
|
|
|
case 'ACTIVE':
|
|
@@ -125,6 +126,17 @@ class McpController extends Controller
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ if ($request->input('next_appointment_category')) {
|
|
|
+ if($request->input('next_appointment_category') == 'NONE'){
|
|
|
+ $patients = $patients->whereNull('next_mcp_appointment_id');
|
|
|
+ }else{
|
|
|
+ $self = $this;
|
|
|
+ $patients = $patients->whereHas('nextMcpAppointment', function($pQry) use ($request, $self){
|
|
|
+ return $self->filterMultiQuery($request, $pQry, 'raw_date', 'next_appointment_category', 'next_appointment_value_1', 'next_appointment_value_2');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
if ($request->input('chart_number')) {
|
|
|
$patients = $patients->where('chart_number', 'ILIKE' , '%'.$request->input('chart_number').'%');
|