Quellcode durchsuchen

moved max dslv to config

= vor 2 Jahren
Ursprung
Commit
7a84cacaf5

+ 8 - 7
app/Http/Controllers/PracticeManagementController.php

@@ -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))";
             }
         }
 

+ 2 - 2
app/Models/CareMonth.php

@@ -167,7 +167,7 @@ class CareMonth extends Model
         $hasMcpBilled20Minutes = $this->rm_total_time_in_seconds_by_mcp >= 1200;
         $hasMcpInteracted = $this->has_mcp_interacted_with_client_about_rm;
 
-        if (is_null($this->days_between_most_recent_mcp_note_date_and_end_of_care_month) || $this->days_between_most_recent_mcp_note_date_and_end_of_care_month > 120) {
+        if (is_null($this->days_between_most_recent_mcp_note_date_and_end_of_care_month) || $this->days_between_most_recent_mcp_note_date_and_end_of_care_month > config('app.maxDaysSinceLastVisit')) {
             return [
                 'billable' => false,
                 'reason' => "Patient has not had a visit recent enough to bill for RPM"
@@ -243,7 +243,7 @@ class CareMonth extends Model
         $hasRmmBilled20Minutes = $this->rm_total_time_in_seconds_by_rmm_pro >= 1200;
         $hasMcpInteracted = $this->has_mcp_interacted_with_client_about_rm;
 
-        if (is_null($this->days_between_most_recent_mcp_note_date_and_end_of_care_month) || $this->days_between_most_recent_mcp_note_date_and_end_of_care_month > 120) {
+        if (is_null($this->days_between_most_recent_mcp_note_date_and_end_of_care_month) || $this->days_between_most_recent_mcp_note_date_and_end_of_care_month > config('app.maxDaysSinceLastVisit')) {
             return [
                 'billable' => false,
                 'reason' => "Patient has not had a visit recent enough to bill for RPM"

+ 2 - 0
config/app.php

@@ -79,6 +79,8 @@ return [
 
     'nonMedicalVisitTemplateUid' => env('NON_MEDICAL_VISIT_TEMPLATE_UID'),
 
+    'maxDaysSinceLastVisit' => env('MAX_DAYS_SINCE_LAST_VISIT', 120),
+
     /*
     |--------------------------------------------------------------------------
     | Application Timezone

+ 2 - 2
resources/views/app/patient/care-month/dashboard.blade.php

@@ -213,10 +213,10 @@
                                         ?>
                                     @endif
                                     <span class="font-weight-bold text-secondary">Last Visit:</span>
-                                    <b class="{{$daysDiff === -1 ? 'text-secondary' : ($daysDiff <= 90 ? 'text-success' : 'text-warning-mellow')}}">
+                                    <b class="{{$daysDiff === -1 ? 'text-secondary' : ($daysDiff <= config('app.maxDaysSinceLastVisit') ? 'text-success' : 'text-warning-mellow')}}">
                                         {{friendly_date($careMonth->most_recent_mcp_note_date)}}
                                         @if($daysDiff !== -1)
-                                            @if($daysDiff > 90)
+                                            @if($daysDiff > config('app.maxDaysSinceLastVisit'))
                                                 <i class="fa fa-exclamation-triangle"></i>
                                                 <span class="ml-1 text-secondary text-sm font-weight-normal">({{$daysDiff}} days ago)</span>
                                             @else

+ 2 - 2
resources/views/app/patient/partials/caremonth-summary.blade.php

@@ -14,10 +14,10 @@
             ?>
         @endif
         <span class="font-weight-bold text-secondary">Last Visit:</span>
-        <b class="{{$daysDiff === -1 ? 'text-secondary' : ($daysDiff <= 90 ? 'text-success' : 'text-warning-mellow')}}">
+        <b class="{{$daysDiff === -1 ? 'text-secondary' : ($daysDiff <= config('app.maxDaysSinceLastVisit') ? 'text-success' : 'text-warning-mellow')}}">
             {{friendly_date($patient->most_recent_completed_mcp_note_date)}}
             @if($daysDiff !== -1)
-                @if($daysDiff > 90)
+                @if($daysDiff > config('app.maxDaysSinceLastVisit'))
                     <i class="fa fa-exclamation-triangle"></i>
                     <span class="ml-1 text-secondary text-sm font-weight-normal">({{$daysDiff}} days ago)</span>
                 @else

+ 4 - 4
resources/views/app/practice-management/remote-monitoring-admin-row-markup.blade.php

@@ -45,7 +45,7 @@
     </td>
     <td>
         <div class="d-flex align-items-baseline">
-            <i class="mr-1 text-sm fa {{$lastVisitWithin90Days ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
+            <i class="mr-1 text-sm fa {{$lastVisitWithinDays ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
             <span class="sort-data">{{$daysDiff !== -1 ? $daysDiff : '-'}}</span>
         </div>
     </td>
@@ -89,7 +89,7 @@
     <td>{{$iPatient->mcp_pro_name}}</td>
     <td>{{$iPatient->rmm_pro_name}}</td>
     <td>
-        @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_mcp >= 1200)
+        @if($lastVisitWithinDays && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_mcp >= 1200)
             <span class="text-success font-weight-bold">
                 <i class="fa fa-check"></i>
                 Yes
@@ -101,7 +101,7 @@
         @endif
     </td>
     <td>
-        @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200)
+        @if($lastVisitWithinDays && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200)
             <span class="text-success font-weight-bold">
                 <i class="fa fa-check"></i>
                 Yes
@@ -126,7 +126,7 @@
     </td>
     <td>
         @if($iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->has_anyone_interacted_with_client_about_rm &&
-            $lastVisitWithin90Days &&
+            $lastVisitWithinDays &&
             ($iPatient->rm_total_time_in_seconds_by_mcp + $iPatient->rm_total_time_in_seconds_by_rmm_pro) >= 1200)
             <span class="text-success font-weight-bold">
                 <i class="fa fa-check"></i>

+ 1 - 1
resources/views/app/practice-management/remote-monitoring-admin.blade.php

@@ -118,7 +118,7 @@
                                     $careMonthLastDay = date_sub($careMonthLastDay, date_interval_create_from_date_string("1 day"));
                                     $daysDiff = date_diff($careMonthLastDay, date_create($iPatient->most_recent_completed_mcp_note_date))->days;
                                 }
-                                $lastVisitWithin90Days = ($daysDiff !== -1 && $daysDiff <= 90);
+                                $lastVisitWithinDays = ($daysDiff !== -1 && $daysDiff <= config('app.maxDaysSinceLastVisit'));
 
                                 $performerRole = false;
                                 if ($pro->pro_type === 'ADMIN') {

+ 1 - 1
resources/views/app/practice-management/remote-monitoring-row-by-pro-type.blade.php

@@ -12,7 +12,7 @@ if($iPatient->most_recent_completed_mcp_note_date) {
     $careMonthLastDay = date_sub($careMonthLastDay, date_interval_create_from_date_string("1 day"));
     $daysDiff = date_diff($careMonthLastDay, date_create($iPatient->most_recent_completed_mcp_note_date))->days;
 }
-$lastVisitWithin90Days = ($daysDiff !== -1 && $daysDiff <= 90);
+$lastVisitWithinDays = ($iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month <= config('app.maxDaysSinceLastVisit'));
 
 ?>
 @include('app.practice-management.remote-monitoring-row-markup-by-pro-type')

+ 1 - 1
resources/views/app/practice-management/remote-monitoring-row-for-admin.blade.php

@@ -12,7 +12,7 @@ if($iPatient->most_recent_completed_mcp_note_date) {
     $careMonthLastDay = date_sub($careMonthLastDay, date_interval_create_from_date_string("1 day"));
     $daysDiff = date_diff($careMonthLastDay, date_create($iPatient->most_recent_completed_mcp_note_date))->days;
 }
-$lastVisitWithin90Days = ($daysDiff !== -1 && $daysDiff <= 90);
+$lastVisitWithinDays = ($iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month <= config('app.maxDaysSinceLastVisit'));
 
 ?>
 @include('app.practice-management.remote-monitoring-row-markup-for-admin')

+ 5 - 5
resources/views/app/practice-management/remote-monitoring-row-markup-by-pro-type.blade.php

@@ -41,8 +41,8 @@
     
     <td>
         <div class="d-flex align-items-baseline">
-            <i class="mr-1 text-sm fa {{$lastVisitWithin90Days ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
-            <span class="sort-data">{{$daysDiff !== -1 ? $daysDiff : '-'}}</span>
+            <i class="mr-1 text-sm fa {{$lastVisitWithinDays ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
+            <span class="sort-data">{{$iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month}}</span>
         </div>
     </td>
 
@@ -193,7 +193,7 @@
     @if(!request()->input('not-enrolled'))
     <td>
         @if($mode === 'mcp')
-            @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_mcp >= 1200)
+            @if($lastVisitWithinDays && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_mcp >= 1200)
                 @php
                     $careMonth = \App\Models\CareMonth::where('uid', $iPatient->care_month_uid)->first();
                 @endphp
@@ -245,7 +245,7 @@
                 </span>
             @endif
         @elseif($mode === 'rmm')
-            @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200)
+            @if($lastVisitWithinDays && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200)
                 <span class="text-success font-weight-bold">
                     <i class="fa fa-check"></i>
                 </span>
@@ -290,7 +290,7 @@
                 </span>
             @endif
         @elseif($mode === 'rme')
-            @if($lastVisitWithin90Days && $iPatient->number_of_days_with_remote_measurements >= 16)
+            @if($lastVisitWithinDays && $iPatient->number_of_days_with_remote_measurements >= 16)
                 <span class="text-success font-weight-bold">
                     <i class="fa fa-check"></i>
                 </span>

+ 2 - 2
resources/views/app/practice-management/remote-monitoring-row-markup-for-admin.blade.php

@@ -1,4 +1,4 @@
-<?php $lastVisitWithin90Days = !is_null($iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month) && $iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month <= 120; ?>
+<?php $lastVisitWithinDays = !is_null($iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month) && $iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month <= 120; ?>
 <tr data-client-uid="{{$iPatient->client_uid}}" data-care-month-uid="{{$iPatient->care_month_uid}}">
     <td>{{ $trIndex + 1 }}</td>
     <td>{{friendly_month_short($iPatient->start_date)}}</td>
@@ -57,7 +57,7 @@
     </td>
     <td>
         <div class="d-flex align-items-baseline">
-            <i class="mr-1 text-sm fa {{$lastVisitWithin90Days ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
+            <i class="mr-1 text-sm fa {{$lastVisitWithinDays ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
             <span class="sort-data">{{!is_null($iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month) ? $iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month : '-'}}</span>
         </div>
     </td>

+ 3 - 3
resources/views/app/practice-management/remote-monitoring-row-markup.blade.php

@@ -35,7 +35,7 @@
     
     <td>
         <div class="d-flex align-items-baseline">
-            <i class="mr-1 text-sm fa {{$lastVisitWithin90Days ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
+            <i class="mr-1 text-sm fa {{$lastVisitWithinDays ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
             <span class="sort-data">{{$daysDiff !== -1 ? $daysDiff : '-'}}</span>
         </div>
     </td>
@@ -187,7 +187,7 @@
     </td>
     <td>
         @if($performerRole === 'MCP')
-            @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_mcp >= 1200)
+            @if($lastVisitWithinDays && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_mcp >= 1200)
                 <span class="text-success font-weight-bold">
                                                     <i class="fa fa-check"></i>
                                                     Yes
@@ -198,7 +198,7 @@
                                                 </span>
             @endif
         @elseif($performerRole === 'RMM')
-            @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200)
+            @if($lastVisitWithinDays && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200)
                 <span class="text-success font-weight-bold">
                                                     <i class="fa fa-check"></i>
                                                     Yes

+ 1 - 1
resources/views/app/practice-management/remote-monitoring-row.blade.php

@@ -12,7 +12,7 @@ if($iPatient->most_recent_completed_mcp_note_date) {
     $careMonthLastDay = date_sub($careMonthLastDay, date_interval_create_from_date_string("1 day"));
     $daysDiff = date_diff($careMonthLastDay, date_create($iPatient->most_recent_completed_mcp_note_date))->days;
 }
-$lastVisitWithin90Days = ($daysDiff !== -1 && $daysDiff <= 90);
+$lastVisitWithinDays = ($iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month <= config('app.maxDaysSinceLastVisit'));
 
 $performerRole = false;
 if ($pro->pro_type === 'ADMIN') {

+ 1 - 1
resources/views/app/practice-management/remote-monitoring.blade.php

@@ -120,7 +120,7 @@
                                     $careMonthLastDay = date_sub($careMonthLastDay, date_interval_create_from_date_string("1 day"));
                                     $daysDiff = date_diff($careMonthLastDay, date_create($iPatient->most_recent_completed_mcp_note_date))->days;
                                 }
-                                $lastVisitWithin90Days = ($daysDiff !== -1 && $daysDiff <= 90);
+                                $lastVisitWithinDays = ($iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month <= config('app.maxDaysSinceLastVisit'));
 
                                 $performerRole = false;
                                 if ($pro->pro_type === 'ADMIN') {

+ 2 - 2
resources/views/app/practice-management/rpm-matrix-by-pro-type-table.blade.php

@@ -26,7 +26,7 @@
                 <th class="border-0 text-secondary">Cell. Scale?</th>
                 <th class="border-0 text-secondary">Latest BP</th>
                 <th class="border-0 text-secondary">Latest Wt</th>
-                <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'Days Since Last Visit', 'key' => 'most_recent_completed_mcp_note_date'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'Days Since Last Visit', 'key' => 'days_between_most_recent_mcp_note_date_and_end_of_care_month'])</th>
                 @if($mode === 'mcp' || $mode === 'rmm')
                     @if($strategy === 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM')
                         <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'Interacted?', 'key' => 'has_mcp_interacted_with_client_about_rm'])</th>
@@ -68,7 +68,7 @@
                     $careMonthLastDay = date_sub($careMonthLastDay, date_interval_create_from_date_string("1 day"));
                     $daysDiff = date_diff($careMonthLastDay, date_create($iPatient->most_recent_completed_mcp_note_date))->days;
                 }
-                $lastVisitWithin90Days = ($daysDiff !== -1 && $daysDiff <= 90);
+                $lastVisitWithinDays = ($iPatient->days_between_most_recent_mcp_note_date_and_end_of_care_month  <= config('app.maxDaysSinceLastVisit'));
 
                 ?>
                 @include('app.practice-management.remote-monitoring-row-markup-by-pro-type')