|
@@ -92,7 +92,7 @@ class PracticeManagementController extends Controller
|
|
|
//$rows = $isAdmin ? ClientMeasurementDaysPerMonth::all() : ClientMeasurementDaysPerMonth::where('mcp_pro_id', $proID)->orderBy('year_month', 'asc')->orderBy('num_of_days_with_measurement', 'asc')->get();
|
|
|
$query = CareMonth::whereNotNull('mcp_pro_id')
|
|
|
->where('number_of_days_with_remote_measurements', '>=', 16)
|
|
|
- ->where('days_between_most_recent_mcp_note_date_and_end_of_care_month', '<=', 90);
|
|
|
+ ->where('days_between_most_recent_mcp_note_date_and_end_of_care_month', '<=', config('app.maxDaysSinceLastVisit'));
|
|
|
if(!$isAdmin) $query->where('mcp_pro_id', '=', $proID);
|
|
|
|
|
|
if($request->get('show_billing_not_closed_only')){
|
|
@@ -1850,6 +1850,7 @@ SELECT client.name_first, client.name_last,
|
|
|
care_month.rm_num_measurements_not_stamped_by_rme,
|
|
|
care_month.mcp_pro_id as care_month_mcp_pro_id,
|
|
|
care_month.rmm_pro_id as care_month_rmm_pro_id,
|
|
|
+ care_month.days_between_most_recent_mcp_note_date_and_end_of_care_month,
|
|
|
client.mcp_pro_id,
|
|
|
client.default_na_pro_id,
|
|
|
client.rmm_pro_id,
|
|
@@ -2835,8 +2836,8 @@ WHERE
|
|
|
$c_isMCP = "client.mcp_pro_id = {$performer->pro->id}";
|
|
|
$c_enrolledInRPM = "care_month.is_client_enrolled_in_rm IS TRUE";
|
|
|
$c_hasDevice = "(SELECT COUNT(client_bdt_device.id) FROM client_bdt_device JOIN bdt_device bd on client_bdt_device.device_id = bd.id WHERE client_bdt_device.client_id = client.id) > 0";
|
|
|
- $c_lastVisitBefore90Days = "DATE_PART('day', care_month.start_date::timestamp - client.most_recent_completed_mcp_note_date::timestamp) > 90";
|
|
|
- $c_lastVisitWithin90Days = "DATE_PART('day', care_month.start_date::timestamp - client.most_recent_completed_mcp_note_date::timestamp) <= 90";
|
|
|
+ $c_lastVisitBefore90Days = "DATE_PART('day', care_month.start_date::timestamp - client.most_recent_completed_mcp_note_date::timestamp) > ".config('app.maxDaysSinceLastVisit');
|
|
|
+ $c_lastVisitWithin90Days = "DATE_PART('day', care_month.start_date::timestamp - client.most_recent_completed_mcp_note_date::timestamp) <= ".config('app.maxDaysSinceLastVisit');
|
|
|
$c_notSpokenToThisMonth = "(care_month.has_anyone_interacted_with_client_about_rm_outside_note IS NULL OR care_month.has_anyone_interacted_with_client_about_rm_outside_note = FALSE)";
|
|
|
$c_spokenToThisMonth = "care_month.has_anyone_interacted_with_client_about_rm_outside_note = TRUE";
|
|
|
$c_hasUnstamped = "care_month.rm_num_measurements_not_stamped_by_mcp > 0";
|
|
@@ -2889,8 +2890,8 @@ WHERE
|
|
|
|
|
|
$c_enrolledInRPM = "care_month.is_client_enrolled_in_rm IS TRUE";
|
|
|
$c_hasDevice = "(SELECT COUNT(client_bdt_device.id) FROM client_bdt_device JOIN bdt_device bd on client_bdt_device.device_id = bd.id WHERE client_bdt_device.client_id = client.id) > 0";
|
|
|
- $c_lastVisitBefore90Days = "DATE_PART('day', care_month.start_date::timestamp - client.most_recent_completed_mcp_note_date::timestamp) > 90";
|
|
|
- $c_lastVisitWithin90Days = "DATE_PART('day', care_month.start_date::timestamp - client.most_recent_completed_mcp_note_date::timestamp) <= 90";
|
|
|
+ $c_lastVisitBefore90Days = "DATE_PART('day', care_month.start_date::timestamp - client.most_recent_completed_mcp_note_date::timestamp) > ".config('app.maxDaysSinceLastVisit');
|
|
|
+ $c_lastVisitWithin90Days = "DATE_PART('day', care_month.start_date::timestamp - client.most_recent_completed_mcp_note_date::timestamp) <= ".config('app.maxDaysSinceLastVisit');
|
|
|
$c_notSpokenToThisMonth = "(care_month.has_anyone_interacted_with_client_about_rm_outside_note IS NULL OR care_month.has_anyone_interacted_with_client_about_rm_outside_note = FALSE)";
|
|
|
$c_spokenToThisMonth = "care_month.has_anyone_interacted_with_client_about_rm_outside_note = TRUE";
|
|
|
$c_hasUnstamped = "care_month.rm_num_measurements_not_stamped_by_mcp > 0";
|
|
@@ -4338,9 +4339,9 @@ ORDER BY c.name_last, c.name_first
|
|
|
// days since last visit
|
|
|
if($hasRecentVisit){
|
|
|
if($hasRecentVisit == 'YES'){
|
|
|
- $conditions[] = "(c.most_recent_completed_mcp_note_date >= ((NOW() - interval '90 days')::DATE))";
|
|
|
+ $conditions[] = "(c.most_recent_completed_mcp_note_date >= ((NOW() - interval '".config('app.maxDaysSinceLastVisit')." days')::DATE))";
|
|
|
}else{
|
|
|
- $conditions[] = "(c.most_recent_completed_mcp_note_date::DATE < ((NOW() - interval '90 days')::DATE))";
|
|
|
+ $conditions[] = "(c.most_recent_completed_mcp_note_date::DATE < ((NOW() - interval '".config('app.maxDaysSinceLastVisit')." days')::DATE))";
|
|
|
}
|
|
|
}
|
|
|
|