|
@@ -175,70 +175,36 @@ class CareMonth extends Model
|
|
|
|
|
|
public function calculateBillabilityForMcp(){
|
|
|
|
|
|
-
|
|
|
- $strategy = $this->mcp_rpm_payment_strategy;
|
|
|
- if(!$strategy){
|
|
|
+ $tier1Strategy = $this->mcp_rpm_payment_tier_one_strategy;
|
|
|
+ $tier2Strategy = $this->mcp_rpm_payment_tier_two_strategy;
|
|
|
+ if(!$tier1Strategy || !$tier2Strategy){
|
|
|
return [
|
|
|
'billable' => false,
|
|
|
'reason' => 'MCP RPM strategy has not been set.'
|
|
|
];
|
|
|
}
|
|
|
-
|
|
|
- $mcpRpmPaymentAmount = $this->mcp_rpm_payment_amount;
|
|
|
- $has16PlusDays = $this->number_of_days_with_remote_measurements >= 16;
|
|
|
- $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 > config('app.maxDaysSinceLastVisit')) {
|
|
|
+ $tier = determineTier($this);
|
|
|
+
|
|
|
+ if (!$tier) {
|
|
|
return [
|
|
|
'billable' => false,
|
|
|
'reason' => "Patient has not had a visit recent enough to bill for RPM"
|
|
|
];
|
|
|
}
|
|
|
|
|
|
- if($strategy == 'X16_DAYS'){
|
|
|
- //only check for 16 days
|
|
|
- if($has16PlusDays){
|
|
|
- return [
|
|
|
- 'billable' => true,
|
|
|
- 'amount' => $mcpRpmPaymentAmount
|
|
|
- ];
|
|
|
- } else {
|
|
|
- //not billable
|
|
|
- return [
|
|
|
- 'billable' => false,
|
|
|
- 'reason' => "This care month does not have 16 or more measurement days."
|
|
|
- ];
|
|
|
- }
|
|
|
+ if($tier == 'TIER_1'){
|
|
|
+ return [
|
|
|
+ 'billable' => true,
|
|
|
+ 'amount' => $this->mcp_rpm_payment_tier_one_amount
|
|
|
+ ];
|
|
|
}
|
|
|
-
|
|
|
- if($strategy == 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM'){
|
|
|
- if ($has16PlusDays && $hasMcpBilled20Minutes && $hasMcpInteracted) {
|
|
|
- return [
|
|
|
- 'billable' => true,
|
|
|
- 'amount' => $mcpRpmPaymentAmount
|
|
|
- ];
|
|
|
- } else {
|
|
|
- if(!$has16PlusDays){
|
|
|
- return [
|
|
|
- 'billable' => false,
|
|
|
- 'reason' => 'Care month does not have 16 or more measurement days.'
|
|
|
- ];
|
|
|
- }
|
|
|
- if(!$hasMcpBilled20Minutes){
|
|
|
- return [
|
|
|
- 'billable' => false,
|
|
|
- 'reason' => 'Care month does not have 20 minutes billed time.'
|
|
|
- ];
|
|
|
- }
|
|
|
- if(!$hasMcpInteracted){
|
|
|
- return [
|
|
|
- 'billable' => false,
|
|
|
- 'reason' => 'Care month does MCP interaction.'
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
+ if($tier == 'TIER_2'){
|
|
|
+ return [
|
|
|
+ 'billable' => true,
|
|
|
+ 'amount' => $this->mcp_rpm_payment_tier_two_amount
|
|
|
+ ];
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -252,69 +218,39 @@ class CareMonth extends Model
|
|
|
];
|
|
|
}
|
|
|
|
|
|
- $strategy = $this->rmm_payment_strategy;
|
|
|
- if(!$strategy){
|
|
|
+ $tier1Strategy = $this->mcp_rpm_payment_tier_one_strategy;
|
|
|
+ $tier2Strategy = $this->mcp_rpm_payment_tier_two_strategy;
|
|
|
+
|
|
|
+ if(!$tier1Strategy || !$tier2Strategy){
|
|
|
return [
|
|
|
'billable' => false,
|
|
|
'reason' => 'RPM strategy has not been set.'
|
|
|
];
|
|
|
}
|
|
|
|
|
|
+ $tier = determineTier($this);
|
|
|
+
|
|
|
$rmmRpmPaymentAmount = $this->rmm_payment_amount;
|
|
|
- $has16PlusDays = $this->number_of_days_with_remote_measurements >= 16;
|
|
|
- $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 > config('app.maxDaysSinceLastVisit')) {
|
|
|
+ if (!$tier) {
|
|
|
return [
|
|
|
'billable' => false,
|
|
|
'reason' => "Patient has not had a visit recent enough to bill for RPM"
|
|
|
];
|
|
|
}
|
|
|
|
|
|
- if($strategy == 'X16_DAYS'){
|
|
|
- //only check for 16 days
|
|
|
- if($has16PlusDays){
|
|
|
- return [
|
|
|
- 'billable' => true,
|
|
|
- 'amount' => $rmmRpmPaymentAmount
|
|
|
- ];
|
|
|
- } else {
|
|
|
- //not billable
|
|
|
- return [
|
|
|
- 'billable' => false,
|
|
|
- 'reason' => "This care month does not have 16 or more measurement days."
|
|
|
- ];
|
|
|
- }
|
|
|
+ if($tier == 'TIER_1'){
|
|
|
+ return [
|
|
|
+ 'billable' => true,
|
|
|
+ 'amount' => $rmmRpmPaymentAmount
|
|
|
+ ];
|
|
|
}
|
|
|
|
|
|
- if($strategy == 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM'){
|
|
|
- if ($has16PlusDays && $hasRmmBilled20Minutes && $hasMcpInteracted) {
|
|
|
- return [
|
|
|
- 'billable' => true,
|
|
|
- 'amount' => $rmmRpmPaymentAmount
|
|
|
- ];
|
|
|
- } else {
|
|
|
- if(!$has16PlusDays){
|
|
|
- return [
|
|
|
- 'billable' => false,
|
|
|
- 'reason' => 'Care month does not have 16 or more measurement days.'
|
|
|
- ];
|
|
|
- }
|
|
|
- if(!$hasRmmBilled20Minutes){
|
|
|
- return [
|
|
|
- 'billable' => false,
|
|
|
- 'reason' => 'Care month does not have 20 minutes in entries.'
|
|
|
- ];
|
|
|
- }
|
|
|
- if(!$hasMcpInteracted){
|
|
|
- return [
|
|
|
- 'billable' => false,
|
|
|
- 'reason' => 'Care month does not have MCP interaction.'
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ if($tier == 'TIER_2'){
|
|
|
+ return [
|
|
|
+ 'billable' => true,
|
|
|
+ 'amount' => $rmmRpmPaymentAmount
|
|
|
+ ];
|
|
|
}
|
|
|
|
|
|
}
|