浏览代码

fixed launch queries

= 3 年之前
父节点
当前提交
5da7628413

+ 23 - 0
app/Http/Controllers/PracticeManagementController.php

@@ -1404,6 +1404,17 @@ ORDER BY claim.created_at ASC
             ->where('has_anyone_interacted_with_client_about_rm_outside_note', '=', true)
             ->count();
 
+        $keyNumbers['careMonthsEligibleForBillGeneration_RM30_HCP_PLUS_40_ifHadInteraction'] = CareMonth::where('is_bill_closed', false)
+            ->whereNotNull('company_pro_id')
+            ->whereNotNull('company_pro_payer_id')
+            ->whereNotNull('company_location_id')
+            ->whereRaw('(SELECT count(id) FROM care_month_cm_rm_reason WHERE care_month_id = care_month.id) > 0')
+            ->where('rm_total_time_in_seconds_by_mcp', '>=', 1800)
+            ->where('rm_total_time_in_seconds', '>=', 4200) // at 4200 (70 minutes, it becomes eligible for plus40)
+            ->where('number_of_days_with_remote_measurements', '>=', 16 )
+            ->where('has_anyone_interacted_with_client_about_rm_outside_note', '=', false)
+            ->count();
+
         $keyNumbers['careMonthsEligibleForBillGeneration_RM30_HCP_PLUS_20'] = CareMonth::where('is_bill_closed', false)
             ->whereNotNull('company_pro_id')
             ->whereNotNull('company_pro_payer_id')
@@ -1416,6 +1427,18 @@ ORDER BY claim.created_at ASC
             ->where('has_anyone_interacted_with_client_about_rm_outside_note', '=', true)
             ->count();
 
+        $keyNumbers['careMonthsEligibleForBillGeneration_RM30_HCP_PLUS_20_ifHadInteraction'] = CareMonth::where('is_bill_closed', false)
+            ->whereNotNull('company_pro_id')
+            ->whereNotNull('company_pro_payer_id')
+            ->whereNotNull('company_location_id')
+            ->whereRaw('(SELECT count(id) FROM care_month_cm_rm_reason WHERE care_month_id = care_month.id) > 0')
+            ->where('rm_total_time_in_seconds_by_mcp', '>=', 1800)
+            ->where('rm_total_time_in_seconds', '<', 4200)
+            ->where('rm_total_time_in_seconds', '>=', 3000) // at 3000 (50 minutes, it becomes eligible for plus20)
+            ->where('number_of_days_with_remote_measurements', '>=', 16 )
+            ->where('has_anyone_interacted_with_client_about_rm_outside_note', '=', false)
+            ->count();
+
         $keyNumbers['careMonthsEligibleForBillGeneration_RM30_HCP'] = CareMonth::where('is_bill_closed', false)
             ->whereNotNull('company_pro_id')
             ->whereNotNull('company_pro_payer_id')

+ 8 - 0
resources/views/app/practice-management/rm-launch-and-clean.blade.php

@@ -13,10 +13,18 @@
                 <td class="text-nowrap">Care Months Eligible For <b>RM30 HCP + 40 EXTRA</b></td>
                 <td class="text-success font-weight-bold px-3">{{$keyNumbers['careMonthsEligibleForBillGeneration_RM30_HCP_PLUS_40']}}</td>
             </tr>
+            <tr>
+                <td class="text-nowrap">Care Months Eligible For <b>RM30 HCP + 40 EXTRA IF HAD INTERACTION</b></td>
+                <td class="text-success font-weight-bold px-3">{{$keyNumbers['careMonthsEligibleForBillGeneration_RM30_HCP_PLUS_40_ifHadInteraction']}}</td>
+            </tr>
             <tr>
                 <td class="text-nowrap">Care Months Eligible For <b>RM30 HCP + 20 EXTRA</b></td>
                 <td class="text-success font-weight-bold px-3">{{$keyNumbers['careMonthsEligibleForBillGeneration_RM30_HCP_PLUS_20']}}</td>
             </tr>
+            <tr>
+                <td class="text-nowrap">Care Months Eligible For <b>RM30 HCP + 20 EXTRA IF HAD INTERACTION</b></td>
+                <td class="text-success font-weight-bold px-3">{{$keyNumbers['careMonthsEligibleForBillGeneration_RM30_HCP_PLUS_20_ifHadInteraction']}}</td>
+            </tr>
             <tr>
                 <td class="text-nowrap">Care Months Eligible For <b>RM30 HCP Only</b></td>
                 <td class="text-success font-weight-bold px-3">{{$keyNumbers['careMonthsEligibleForBillGeneration_RM30_HCP']}}</td>