浏览代码

Use careMonth->days_between_most_recent_mcp_note_date_and_end_of_care_month in billability checks

Vijayakrishnan 3 年之前
父节点
当前提交
0620b62d45
共有 1 个文件被更改,包括 16 次插入0 次删除
  1. 16 0
      app/Models/CareMonth.php

+ 16 - 0
app/Models/CareMonth.php

@@ -158,6 +158,14 @@ class CareMonth extends Model
         $has16PlusDays = $this->number_of_days_with_remote_measurements >= 16;
         $has16PlusDays = $this->number_of_days_with_remote_measurements >= 16;
         $hasMcpBilled20Minutes = $this->rm_total_time_in_seconds_by_mcp >= 1200;
         $hasMcpBilled20Minutes = $this->rm_total_time_in_seconds_by_mcp >= 1200;
         $hasMcpInteracted = $this->has_mcp_interacted_with_client_about_rm;
         $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) {
+            return [
+                'billable' => false,
+                'reason' => "Patient has not had a visit recent enough to bill for RPM"
+            ];
+        }
+
         if($strategy == 'X16_DAYS'){
         if($strategy == 'X16_DAYS'){
             //only check for 16 days
             //only check for 16 days
             if($has16PlusDays){
             if($has16PlusDays){
@@ -226,6 +234,14 @@ class CareMonth extends Model
         $has16PlusDays = $this->number_of_days_with_remote_measurements >= 16;
         $has16PlusDays = $this->number_of_days_with_remote_measurements >= 16;
         $hasRmmBilled20Minutes = $this->rm_total_time_in_seconds_by_rmm_pro >= 1200;
         $hasRmmBilled20Minutes = $this->rm_total_time_in_seconds_by_rmm_pro >= 1200;
         $hasMcpInteracted = $this->has_mcp_interacted_with_client_about_rm;
         $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) {
+            return [
+                'billable' => false,
+                'reason' => "Patient has not had a visit recent enough to bill for RPM"
+            ];
+        }
+
         if($strategy == 'X16_DAYS'){
         if($strategy == 'X16_DAYS'){
             //only check for 16 days
             //only check for 16 days
             if($has16PlusDays){
             if($has16PlusDays){