Browse Source

https://marylandhg.atlassian.net/browse/EC-317

= 3 years ago
parent
commit
b8e3a82e5c

+ 19 - 0
app/Models/CareMonth.php

@@ -4,6 +4,7 @@ namespace App\Models;
 
 # use Illuminate\Database\Eloquent\Model;
 
+use DateTime;
 use Illuminate\Support\Collection;
 
 class CareMonth extends Model
@@ -123,4 +124,22 @@ class CareMonth extends Model
         return $this->hasOne(Bill::class, 'id', 'rmm_rm_generic_bill_id');
     }
 
+    public function showMeasurementDaysWarning(){
+        return ($this->daysSinceLastMeasurement() >= 2) || (16 - $this->number_of_days_with_remote_measurements) >= $this->daysTillEndOfMonth();
+    }
+
+    public function daysSinceLastMeasurement(){
+
+        if(!$this->most_recent_cellular_measurement_at) {
+            return 999;
+        }
+
+        $d1 = new DateTime($this->most_recent_cellular_measurement_at);
+        return $d1->diff(new DateTime())->days;
+    }
+
+    public function daysTillEndOfMonth(){
+        return  date('t') - date('j');
+
+    }
 }

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

@@ -259,7 +259,7 @@
                                         </div>
                                     @endif
                                 </div>
-                                @if($careMonth->number_of_days_with_remote_measurements < 16)
+                                @if($careMonth->showMeasurementDaysWarning())
                                     <div class="alert alert-warning p-2 mt-1">
                                         Need <b>{{16 - $careMonth->number_of_days_with_remote_measurements}} more days</b> with measurements before RM becomes billable.
                                     </div>

+ 4 - 0
resources/views/app/patient/note/dashboard.blade.php

@@ -955,7 +955,11 @@ use App\Models\Handout;
                                 <p class="font-weight-bold text-secondary m-0 font-size-14">Remote Monitoring</p>
                             </div>
                             @include('app.patient.note.rm-setup')
+                            <div class="p-2">
+                                @include('app.patient.partials.client_bp_weight_phone_number_status')
+                            </div>
                         </div>
+                       
                     </div>
                 </div>
 

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

@@ -59,7 +59,7 @@
             </div>
         @endif
     </div>
-    @if($careMonth->number_of_days_with_remote_measurements < 16)
+    @if($careMonth->showMeasurementDaysWarning())
         <div class="alert alert-warning p-2 mt-1">
             Need <b>{{16 - $careMonth->number_of_days_with_remote_measurements}} more days</b> with measurements before RM becomes billable.
         </div>

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

@@ -12,9 +12,9 @@
     </div>
     
     <div>Has client saved BP phone number: <b>{{ $patient->clientBpWeightPhoneNumberStatus && $patient->clientBpWeightPhoneNumberStatus->has_client_saved_bp_phone_number ? 'Yes': 'No' }}</b></div>
-    <div>Saved BP Phone number: <b>{{ $patient->clientBpWeightPhoneNumberStatus && $patient->clientBpWeightPhoneNumberStatus->saved_bp_phone_number }}</b></div>
+    <div>Saved BP Phone number: <b>{{ $patient->clientBpWeightPhoneNumberStatus ?  $patient->clientBpWeightPhoneNumberStatus->saved_bp_phone_number: '-'}}</b></div>
     <div>Has client saved Weight phone number: <b>{{ $patient->clientBpWeightPhoneNumberStatus && $patient->clientBpWeightPhoneNumberStatus->has_client_saved_weight_phone_number ? 'Yes': 'No' }}</b></div>
-    <div>Saved Weight Phone number: <b>{{ $patient->clientBpWeightPhoneNumberStatus && $patient->clientBpWeightPhoneNumberStatus->saved_weight_phone_number }}</b></div>
+    <div>Saved Weight Phone number: <b>{{ $patient->clientBpWeightPhoneNumberStatus ? $patient->clientBpWeightPhoneNumberStatus->saved_weight_phone_number : '-' }}</b></div>
     <div moe>
         <a start show><i class="fa fa-edit"></i></a>
         <form url="/api/client/updateClientBpWeightPhoneNumberStatus" class="mcp-theme-1">