Browse Source

Merge branch 'master' of rav.triplestart.com:jmudaka/stagfe2

= 3 years ago
parent
commit
8347a7a164

+ 14 - 0
app/Helpers/helpers.php

@@ -675,6 +675,20 @@ if(!function_exists('friendly_month')) {
     }
 }
 
+if(!function_exists('friendly_month_short')) {
+    function friendly_month_short($value) {
+        if(!$value || empty($value)) return "-";
+        try {
+            $result = strtotime($value);
+            $result = date("M y", $result);
+            return $result;
+        }
+        catch (Exception $e) {
+            return $value;
+        }
+    }
+}
+
 if(!function_exists('day_part_from_date')) {
     function day_part_from_date($value) {
         if(!$value || empty($value)) return "-";

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

@@ -1861,7 +1861,7 @@ WHERE
         $rc = $request->input('rc') ?: 1;
         $rc2 = $request->input('rc2') ?: 2;
 
-        $conditions = [];// $this->rpmConditions($performer, $rc, $rc2);
+        $conditions = []; // ["(care_month.start_date >= '2022-01-01')"];
 
         $sortBy = $request->input('sort_by') ?: 'name_first';
         $sortDir = $request->input('sort_dir') ?: 'ASC';
@@ -1879,7 +1879,7 @@ WHERE
 
         // default sort
         if(!$request->input('sort_by')) {
-            $orderBy = "ORDER BY care_month.number_of_days_with_remote_measurements DESC NULLS LAST, care_month.rm_total_time_in_seconds_by_mcp DESC NULLS LAST, care_month.rm_total_time_in_seconds_by_rmm_pro DESC NULLS LAST";
+            $orderBy = "ORDER BY care_month.start_date DESC, care_month.number_of_days_with_remote_measurements DESC NULLS LAST, care_month.rm_total_time_in_seconds_by_mcp DESC NULLS LAST, care_month.rm_total_time_in_seconds_by_rmm_pro DESC NULLS LAST";
         }
         else {
             $sortBy = json_decode($request->input('sort_by'));
@@ -1900,6 +1900,15 @@ WHERE
         }
 
         // filters from the UI
+        if(trim($request->input('m'))) {
+            $v = trim($request->input('m'));
+            $conditions[] = "(EXTRACT(MONTH from care_month.start_date) = $v)";
+        }
+        if(trim($request->input('y'))) {
+            $v = trim($request->input('y'));
+            $conditions[] = "(EXTRACT(YEAR from care_month.start_date) = $v)";
+        }
+
         if(trim($request->input('f_ces'))) {
             $v = trim($request->input('f_ces'));
             if($v === 'ACTIVE') {
@@ -2061,6 +2070,12 @@ WHERE
             $conditions[] = "(DATE_PART('day', NOW() - client.most_recent_cellular_measurement_at) {$o} {$v})";
         }
 
+        if(trim($request->input('f_dslv_op')) && trim($request->input('f_dslv')) !== '') {
+            $o = trim($request->input('f_dslv_op'));
+            $v = trim($request->input('f_dslv'));
+            $conditions[] = "(care_month.days_between_most_recent_mcp_note_date_and_end_of_care_month {$o} {$v})";
+        }
+
         if($request->input('not-enrolled')) {
             $conditions[] = "(care_month.is_client_enrolled_in_rm IS NOT TRUE)";
         }
@@ -2077,6 +2092,96 @@ WHERE
             }
         }
 
+        if($request->input('f_mcp_billable')) {
+            if($request->input('f_mcp_billable') === 'no') {
+                $conditions[] = "(care_month.is_billable_by_mcp IS NULL OR care_month.is_billable_by_mcp IS FALSE)";
+            }
+            else {
+                $conditions[] = "(care_month.is_billable_by_mcp IS TRUE)";
+            }
+        }
+
+        if($request->input('f_rmm_billable')) {
+            if($request->input('f_rmm_billable') === 'no') {
+                $conditions[] = "(care_month.is_billable_by_rmm IS NULL OR care_month.is_billable_by_rmm IS FALSE)";
+            }
+            else {
+                $conditions[] = "(care_month.is_billable_by_rmm IS TRUE)";
+            }
+        }
+
+        switch($request->input('f_454')) {
+            case 'Claimable':
+                $conditions[] = "(care_month.is_99454_claimable IS TRUE)";
+                break;
+            case 'Not Claimable':
+                $conditions[] = "(care_month.is_99454_claimable IS NULL OR care_month.is_99454_claimable IS FALSE)";
+                break;
+            case 'Claimed':
+                $conditions[] = "(care_month.is_99454_claimable IS TRUE AND care_month.is_99454_claimed IS TRUE)";
+                break;
+            case 'Not Claimed':
+                $conditions[] = "(care_month.is_99454_claimable IS TRUE AND (care_month.is_99454_claimed IS NULL OR care_month.is_99454_claimed IS FALSE))";
+                break;
+            case 'Waived':
+                $conditions[] = "(care_month.is_99454_claimable IS TRUE AND care_month.is_99454_claiming_waived IS TRUE)";
+                break;
+        }
+
+        switch($request->input('f_454')) {
+            case 'Claimable':
+                $conditions[] = "(care_month.is_99454_claimable IS TRUE)";
+                break;
+            case 'Not Claimable':
+                $conditions[] = "(care_month.is_99454_claimable IS NULL OR care_month.is_99454_claimable IS FALSE)";
+                break;
+            case 'Claimed':
+                $conditions[] = "(care_month.is_99454_claimable IS TRUE AND care_month.is_99454_claimed IS TRUE)";
+                break;
+            case 'Not Claimed':
+                $conditions[] = "(care_month.is_99454_claimable IS TRUE AND (care_month.is_99454_claimed IS NULL OR care_month.is_99454_claimed IS FALSE))";
+                break;
+            case 'Waived':
+                $conditions[] = "(care_month.is_99454_claimable IS TRUE AND care_month.is_99454_claiming_waived IS TRUE)";
+                break;
+        }
+
+        switch($request->input('f_457')) {
+            case 'Claimable':
+                $conditions[] = "(care_month.is_99457_claimable IS TRUE)";
+                break;
+            case 'Not Claimable':
+                $conditions[] = "(care_month.is_99457_claimable IS NULL OR care_month.is_99457_claimable IS FALSE)";
+                break;
+            case 'Claimed':
+                $conditions[] = "(care_month.is_99457_claimable IS TRUE AND care_month.is_99457_claimed IS TRUE)";
+                break;
+            case 'Not Claimed':
+                $conditions[] = "(care_month.is_99457_claimable IS TRUE AND (care_month.is_99457_claimed IS NULL OR care_month.is_99457_claimed IS FALSE))";
+                break;
+            case 'Waived':
+                $conditions[] = "(care_month.is_99457_claimable IS TRUE AND care_month.is_99457_claiming_waived IS TRUE)";
+                break;
+        }
+
+        switch($request->input('f_458')) {
+            case 'Claimable':
+                $conditions[] = "(care_month.is_99458_claimable IS TRUE)";
+                break;
+            case 'Not Claimable':
+                $conditions[] = "(care_month.is_99458_claimable IS NULL OR care_month.is_99458_claimable IS FALSE)";
+                break;
+            case 'Claimed':
+                $conditions[] = "(care_month.is_99458_claimable IS TRUE AND care_month.is_99458_claimed IS TRUE)";
+                break;
+            case 'Not Claimed':
+                $conditions[] = "(care_month.is_99458_claimable IS TRUE AND (care_month.is_99458_claimed IS NULL OR care_month.is_99458_claimed IS FALSE))";
+                break;
+            case 'Waived':
+                $conditions[] = "(care_month.is_99458_claimable IS TRUE AND care_month.is_99458_claiming_waived IS TRUE)";
+                break;
+        }
+
         if($request->input('f_visit_90_days')) {
             /*if($request->input('f_visit_90_days') === 'yes') {
                 $conditions[] = "(care_month.is_claim_closed IS " . ($request->input('f_claim_closed') === 'yes' ? 'TRUE' : 'FALSE') . ")";
@@ -2115,9 +2220,7 @@ FROM care_month join client on care_month.client_id = client.id
     left join payer on cpc.commercial_payer_id = payer.id
     {$genericBillJoinClause}
 WHERE
-      EXTRACT(MONTH from care_month.start_date) = " . ($request->input('m') ?: 'EXTRACT(MONTH from now())') . "
-      AND EXTRACT(YEAR from care_month.start_date) = " . ($request->input('y') ?: 'EXTRACT(YEAR from now())') . "
-      " . (count($conditions) > 0 ? 'AND ' . implode(" AND ", $conditions) : '') . "      
+      " . (count($conditions) > 0 ? implode(" AND ", $conditions) : '') . "      
 ";
 
         $countResult = DB::select($countQuery);
@@ -2141,6 +2244,7 @@ SELECT client.name_first, client.name_last,
        care_month.id as care_month_id,
        care_month.is_claim_closed,
        care_month.start_date,
+       care_month.rm_total_time_in_seconds,
        care_month.rm_total_time_in_seconds_by_mcp,
        care_month.rm_total_time_in_seconds_by_rmm_pro,
        care_month.number_of_days_with_remote_measurements,
@@ -2150,6 +2254,23 @@ SELECT client.name_first, client.name_last,
        care_month.rm_num_measurements_not_stamped_by_non_hcp,
        care_month.rm_num_measurements_not_stamped_by_rmm,
        care_month.rm_num_measurements_not_stamped_by_rme,
+       care_month.is_99454_claimable,
+       care_month.is_99454_claimed,
+       care_month.is_99454_claiming_waived,
+       care_month.is_99457_claimable,
+       care_month.is_99457_claimed,
+       care_month.is_99457_claiming_waived,
+       care_month.is_99458_claimable,
+       care_month.is_99458_claimed,
+       care_month.is_99458_claiming_waived,
+       care_month.is_billable_by_mcp,
+       care_month.is_billable_by_rmm,
+       care_month.why_99454_not_claimable_reason,
+       care_month.why_99457_not_claimable_reason,
+       care_month.why_99458_not_claimable_reason,
+       care_month.why_claiming_99454_waived,
+       care_month.why_claiming_99457_waived,
+       care_month.why_claiming_99458_waived,
        care_month.mcp_pro_id as care_month_mcp_pro_id,
        care_month.rmm_pro_id as care_month_rmm_pro_id,
        client.mcp_pro_id,
@@ -2169,6 +2290,7 @@ SELECT client.name_first, client.name_last,
        rmmPro.rmm_payment_amount,
        client.mailing_address_state,
        care_month.most_recent_cellular_weight_measurement_at,
+       care_month.days_between_most_recent_mcp_note_date_and_end_of_care_month,
        cpc.plan_type,
        cpc.auto_medicare_is_partbprimary,
        (CASE 
@@ -2177,6 +2299,7 @@ SELECT client.name_first, client.name_last,
        END) as payer_name,
        (SELECT COUNT(*) FROM claim_line where claim_line.cpt = '99454' AND claim_line.claim_id IN (SELECT claim.id FROM claim WHERE claim.care_month_id = care_month.id AND claim.status != 'CANCELLED')) as claim_454,
        (SELECT COUNT(*) FROM claim_line where claim_line.cpt = '99457' AND claim_line.claim_id IN (SELECT claim.id FROM claim WHERE claim.care_month_id = care_month.id AND claim.status != 'CANCELLED')) as claim_457,
+       (SELECT COUNT(*) FROM claim_line where claim_line.cpt = '99458' AND claim_line.claim_id IN (SELECT claim.id FROM claim WHERE claim.care_month_id = care_month.id AND claim.status != 'CANCELLED')) as claim_458,
        {$genericBillIdColumns}
 FROM care_month join client on care_month.client_id = client.id 
     left join note mrnote on client.most_recent_completed_mcp_note_id = mrnote.id
@@ -2187,9 +2310,7 @@ FROM care_month join client on care_month.client_id = client.id
     left join appointment nv on nv.id = mrnote.follow_up_appointment_id
     {$genericBillJoinClause}
 WHERE
-      EXTRACT(MONTH from care_month.start_date) = " . ($request->input('m') ?: 'EXTRACT(MONTH from now())') . "
-      AND EXTRACT(YEAR from care_month.start_date) = " . ($request->input('y') ?: 'EXTRACT(YEAR from now())') . "
-      " . (count($conditions) > 0 ? 'AND ' . implode(" AND ", $conditions) : '') . "
+      " . (count($conditions) > 0 ? implode(" AND ", $conditions) : '') . "
       {$orderBy} OFFSET {$offset} LIMIT {$perPage}
       
 ";

+ 16 - 0
app/Models/CareMonth.php

@@ -158,6 +158,14 @@ class CareMonth extends Model
         $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 > 120) {
+            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){
@@ -226,6 +234,14 @@ class CareMonth extends Model
         $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 > 120) {
+            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){

+ 1 - 1
config/app.php

@@ -65,7 +65,7 @@ return [
 
     'hrm2_url' => env('HRM2_URL'),
 
-    'asset_version' => 103,
+    'asset_version' => 104,
 
 
     'temp_dir' => env('TEMP_DIR'),

+ 11 - 0
public/css/style.css

@@ -3709,6 +3709,17 @@ table.v-top th {
     line-height: 12px;
     right: calc(50% - 7px);
 }
+.multi-sort-index {
+    font-weight: bold;
+    font-size: 8px !important;
+    width: 14px;
+    height: 14px;
+    color: #0d59af;
+    border: 1px solid #0d59af;
+    border-radius: 100%;
+    text-align: center;
+    line-height: 12px;
+}
 .note-content-divider {
     background: #ddd;
     height: 20px;

+ 3 - 3
resources/views/app/dashboard-mcp.blade.php

@@ -300,8 +300,8 @@
                                            open-in-stag-popup
                                            update-parent
                                            popup-style="tall"
-                                           title="Measurements Pending Stamping">
-                                            Measurements Pending Stamping
+                                           title="Measurements Feed">
+                                            Measurements Feed
                                         </a>
                                     </th>
                                 </tr>
@@ -421,7 +421,7 @@
                             <div class="card mb-4">
                                 <div class="card-header pl-2">
                                     <strong>
-                                        Measurements Pending Stamping
+                                        Measurements Feed
                                     </strong>
                                 </div>
                                 <div class="card-body p-0">

+ 0 - 75
resources/views/app/dashboard/measurements.blade.php

@@ -9,7 +9,6 @@
             <th class="border-0 px-2 text-secondary">Value</th>
             <th class="border-0 px-2 text-secondary">Timestamp</th>
             <th class="border-0 px-2 text-secondary">Mins this month</th>
-            <th class="border-0 px-2 text-secondary">Stamp</th>
         </tr>
     </thead>
     <tbody>
@@ -42,80 +41,6 @@
                             0
                         @endif
                     </td>
-                    <?php /*
-                    <td colspan="px-2">
-                        <?php
-                        $stampEndPoint = '';
-                        if ($measurement->mcp_pro_id === $pro->id) {
-                            $stampEndPoint = '/api/measurement/stampAsMcp';
-                        } elseif ($measurement->default_na_pro_id === $pro->id || $measurement->rmm_pro_id === $pro->id || $measurement->rme_pro_id === $pro->id) {
-                            $stampEndPoint = '/api/measurement/stampAsNonHcp';
-                        }
-                        ?>
-                        @if(!empty($stampEndPoint))
-                            <div moe relative>
-                                <a href="#" start show>Stamp</a>
-                                <form url="{{$stampEndPoint}}" right class="width-300px">
-                                    <input type="hidden" name="uid" value="{{$measurement->uid}}">
-                                    <p class="mb-1">Stamp this measurement?</p>
-                                    <div class="mt-2 bg-light border p-2">
-                                        <div class="mb-1 text-secondary">{{ $measurement->label }}</div>
-                                        <div class="font-weight-bold mb-1">
-                                            @if($measurement->label === 'BP')
-                                                {{ round($measurement->sbp_mm_hg, 2) }}/{{ round($measurement->dbp_mm_hg, 2) }} mmHg
-                                                <span class="font-weight-normal d-inline-block pl-2">Pulse:</span>
-                                                {{ $measurement->value_pulse }} {{ $measurement->value_irregular === 0?'Irregular':'' }} {{ $measurement->value_irregular === 1?'Regular':'' }}
-                                            @elseif($measurement->label === 'Wt. (lbs.)')
-                                                {{ round($measurement->numeric_value, 2) }} lbs
-                                            @else
-                                                {{ $measurement->value }}
-                                            @endif
-                                        </div>
-                                        <div class="text-sm">
-                                            <?php $timestampInSec = floor($measurement->ts / 1000); ?>
-                                            {{ friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN') }} EST
-                                        </div>
-                                    </div>
-                                    @if($measurement->mcp_pro_id !== $pro->id)
-                                        <div class="mb-2 border border-info p-2 mt-2 bg-light">
-                                            <span>I have had interactive communication with {{$measurement->name_first}} {{$measurement->name_last}}.</span>
-                                            <div class="d-flex border-top mt-2">
-                                                <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
-                                                    <input type="radio" class="mr-2" name="communicatedToPatient" value="true">
-                                                    <span>Yes</span>
-                                                </label>
-                                                <label class="mt-2 mb-0 d-inline-flex align-items-center">
-                                                    <input type="radio" class="mr-2" name="communicatedToPatient" value="false" checked>
-                                                    <span>No</span>
-                                                </label>
-                                            </div>
-                                        </div>
-                                    @else
-                                        <input type="hidden" name="communicatedToPatient" value="false">
-                                    @endif
-                                    <div class="mb-2">
-                                        <label class="mb-1 text-secondary text-sm">Memo</label>
-                                        <textarea class="form-control form-control-sm" name="memo"></textarea>
-                                    </div>
-                                    <div class="form-group m-0">
-                                        <button submit class="btn btn-primary btn-sm mr-2">Submit</button>
-                                        <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
-                                    </div>
-                                </form>
-                            </div>
-                        @endif
-                    </td>
-                    */ ?>
-                    <td class="px-2">
-                        <a native target="_blank"
-                           open-in-stag-popup
-                           update-parent
-                           mc-initer="cm-matrix-{{$measurement->client_id}}"
-                           title="Care Month Matrix: {{date('M Y', strtotime($measurement->care_month_start_date))}}"
-                           href="/patient-care-month-matrix/{{$measurement->care_month_uid}}">
-                            View &amp; Stamp
-                        </a>
-                    </td>
                 </tr>
             <?php endforeach ?>
         @else

+ 70 - 46
resources/views/app/mcp/dashboard/notifications.blade.php

@@ -21,38 +21,52 @@ $apptsPending = [
                 </div>
             @endif
             @if(count($apptsPending['status']))
-                @foreach($apptsPending['status'] as $appt)
-                    <div class="d-flex mb-1 {{ $loop->last ? '':'border-bottom' }} px-2 py-1" discardable-container>
-                        <div class="flex-grow-1 d-inline-flex align-items-baseline">
-                            <div>
+                <table class="table table-sm table-striped">
+                    <thead>
+                    <tr>
+                        <th>Patient</th>
+                        <th>Time</th>
+                        <th>Memo</th>
+                        <th>Status</th>
+                        <th></th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach($apptsPending['status'] as $appt)
+                        <tr discardable-container>
+                            <td>
                                 <a class="d-block"
-                                   href="/patients/view/{{$appt->client->uid}}"><b>{{$appt->client->displayName()}}</b></a>
-                                <span class="d-block text-sm">{{friendlier_date_time($appt->start_time)}}</span>
-                            </div>
-                            <div class="ml-auto mr-3 text-right">
-                                <span class="font-weight-bold text-secondary">{{$appt->status}}</span>
+                                   href="/patients/view/{{$appt->client->uid}}">{{$appt->client->displayName()}}</a>
+                            </td>
+                            <td>
+                                {{friendlier_date_time($appt->start_time)}}
+                            </td>
+                            <td>
                                 @if($appt->status_memo)
-                                    <div class="text-secondary text-sm">{{$appt->status_memo}} This is a status memo
-                                    </div>
-                                @endif
-                            </div>
-                        </div>
-                        <div class="">
-                            <form url="/api/appointment/acknowledgeStatusAsAppointmentPro" discardable>
-                                <input type="hidden" name="uid" value="{{$appt->uid}}">
-                                <input type="hidden" name="currentStatus" value="{{$appt->status}}">
-                                @if($appt->status_memo !== null)
-                                    <input type="hidden" name="currentStatusMemo" value="{{$appt->status_memo}}">
+                                    <div class="text-secondary text-sm">{{$appt->status_memo}}</div>
                                 @endif
-                                <input type="hidden" name="currentRawDate" value="{{$appt->raw_date}}">
-                                <input type="hidden" name="currentRawStartTime" value="{{$appt->raw_start_time}}">
-                                <input type="hidden" name="currentRawEndTime" value="{{$appt->raw_end_time}}">
-                                <input type="hidden" name="currentTimezone" value="{{$appt->timezone}}">
-                                <button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
-                            </form>
-                        </div>
-                    </div>
-                @endforeach
+                            </td>
+                            <td>
+                                <span class="font-weight-bold text-secondary">{{$appt->status}}</span>
+                            </td>
+                            <td>
+                                <form url="/api/appointment/acknowledgeStatusAsAppointmentPro" discardable>
+                                    <input type="hidden" name="uid" value="{{$appt->uid}}">
+                                    <input type="hidden" name="currentStatus" value="{{$appt->status}}">
+                                    @if($appt->status_memo !== null)
+                                        <input type="hidden" name="currentStatusMemo" value="{{$appt->status_memo}}">
+                                    @endif
+                                    <input type="hidden" name="currentRawDate" value="{{$appt->raw_date}}">
+                                    <input type="hidden" name="currentRawStartTime" value="{{$appt->raw_start_time}}">
+                                    <input type="hidden" name="currentRawEndTime" value="{{$appt->raw_end_time}}">
+                                    <input type="hidden" name="currentTimezone" value="{{$appt->timezone}}">
+                                    <button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
+                                </form>
+                            </td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
             @endif
         </div>
     </div>
@@ -70,24 +84,34 @@ $apptsPending = [
                 </div>
             @endif
             @if(count($apptsPending['decision']))
-                @foreach($apptsPending['decision'] as $appt)
-                    <div class="d-flex mb-1 {{ $loop->last ? '':'border-bottom' }} px-2 py-1" discardable-container>
-                        <div class="flex-grow-1 d-inline-flex align-items-baseline">
-                            <div>
+                <table class="table table-sm table-striped">
+                    <thead>
+                    <tr>
+                        <th>Patient</th>
+                        <th>Time</th>
+                        <th>Status</th>
+                        <th></th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach($apptsPending['decision'] as $appt)
+                        <tr discardable-container>
+                            <td>
                                 <a class="d-block"
-                                   href="/patients/view/{{$appt->client->uid}}"><b>{{$appt->client->displayName()}}</b></a>
-                                <span class="d-block text-sm">{{friendlier_date_time($appt->start_time)}}</span>
-                            </div>
-                            <span class="ml-auto mr-3 font-weight-bold text-secondary">{{$appt->latestConfirmationDecision->decision_enum}}</span>
-                        </div>
-                        <div class="">
-                            <form url="/api/appointment/acknowledgeDecisionAsAppointmentPro" discardable>
-                                <input type="hidden" name="uid" value="{{$appt->uid}}">
-                                <button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
-                            </form>
-                        </div>
-                    </div>
-                @endforeach
+                                   href="/patients/view/{{$appt->client->uid}}">{{$appt->client->displayName()}}</a>
+                            </td>
+                            <td>{{friendlier_date_time($appt->start_time)}}</td>
+                            <td>{{$appt->latestConfirmationDecision->decision_enum}}</td>
+                            <td>
+                                <form url="/api/appointment/acknowledgeDecisionAsAppointmentPro" discardable>
+                                    <input type="hidden" name="uid" value="{{$appt->uid}}">
+                                    <button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
+                                </form>
+                            </td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
             @endif
         </div>
     </div>

+ 0 - 34
resources/views/app/patient/measurements.blade.php

@@ -74,7 +74,6 @@
                     <th class="border-0 text-secondary w-25">Category</th>
                     <th class="border-0 text-secondary w-25">Value</th>
                     <th class="border-0 text-secondary">Source</th>
-                    <th class="border-0 text-secondary">Stamp</th>
                     <th class="border-0 text-secondary"></th>
                     <th class="border-0 text-secondary"></th>
                 </tr>
@@ -106,39 +105,6 @@
                                 @endif
                             </td>
                             <td>{{$measurement->source}}</td>
-                            <td>
-                                @if($measurement->is_cellular_zero || !$measurement->ts)
-                                    -
-                                @else
-                                    @if($measurement->careMonth)
-                                        @if($measurement->careMonth->mcp && $measurement->careMonth->mcp->id == $pro->id && $measurement->has_been_stamped_by_mcp)
-                                            <i class="fa fa-check text-success mr-2" title="Stamped"></i>
-                                        @elseif($measurement->careMonth->rmePro && $measurement->careMonth->rmePro->id == $pro->id && $measurement->has_been_stamped_by_rme)
-                                        <i class="fa fa-check text-success mr-2" title="Stamped"></i>
-                                        @elseif($measurement->careMonth->rmmPro && $measurement->careMonth->rmmPro->id == $pro->id && $measurement->has_been_stamped_by_rmm)
-                                        <i class="fa fa-check text-success mr-2" title="Stamped"></i>
-                                        @else
-                                            @if($measurement->careMonth->mcp && $measurement->careMonth->mcp->id == $pro->id || $measurement->careMonth->rmePro && $measurement->careMonth->rmePro->id == $pro->id || $measurement->careMonth->rmmPro && $measurement->careMonth->rmmPro->id == $pro->id)
-                                                <div moe relative>
-                                                    <a href="#" start show>Stamp</a>
-                                                    <form url="/api/measurement/stamp" class="width-300px" right>
-                                                        <input type="hidden" name="uid" value="{{$measurement->uid}}">
-                                                        <p class="mb-1">Stamp this measurement?</p>
-                                                        <div class="mb-2">
-                                                            <label class="mb-1 text-secondary text-sm">Memo</label>
-                                                            <textarea class="form-control form-control-sm" name="memo"></textarea>
-                                                        </div>
-                                                        <div class="form-group m-0">
-                                                            <button submit class="btn btn-primary btn-sm mr-2">Submit</button>
-                                                            <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
-                                                        </div>
-                                                    </form>
-                                                </div>
-                                            @endif
-                                        @endif
-                                    @endif
-                                @endif
-                            </td>
                             <td class="px-2 text-nowrap">
                                 <span moe relative class="mr-2">
                                     <a class="on-hover-opaque" start show title="Delete">

+ 0 - 57
resources/views/app/patient/partials/measurements.blade.php

@@ -23,63 +23,6 @@
                 <tr>
                     <td class="text-black p-0 border-0">
                         <div class="d-flex align-items-center">
-                            @if($measurement->has_been_stamped_by_mcp)
-                                <i class="fa fa-check text-success mr-2" title="Stamped"></i>
-                            @else
-                                <div moe relative>
-                                    <a href="#" start show>
-                                        <i class="fa fa-check text-secondary on-hover-opaque mr-2" title="Not Stamped. Click to stamp."></i>
-                                    </a>
-                                    <form url="/api/measurement/stamp" class="width-300px" target="#patient-dashboard-measurements">
-                                        <input type="hidden" name="uid" value="{{$measurement->uid}}">
-                                        <p class="mb-1">Stamp this measurement?</p>
-                                        <div class="mb-2">
-                                            <label class="mb-1 text-secondary text-sm">Memo</label>
-                                            <textarea class="form-control form-control-sm" name="memo"></textarea>
-                                        </div>
-                                        <div class="form-group m-0">
-                                            <button submit class="btn btn-primary btn-sm mr-2">Submit</button>
-                                            <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
-                                        </div>
-                                    </form>
-                                </div>
-                            @endif
-                            {{--
-                            <div moe relative class="mr-2">
-                                <a class="on-hover-opaque" start show title="Delete">
-                                    <i class="font-size-11 fa fa-trash-alt text-danger"></i>
-                                </a>
-                                <form url="/api/measurement/remove">
-                                    <input type="hidden" name="uid" value="{{ $measurement->uid }}">
-                                    <p class="small min-width-200px">Are you sure you want to delete this entry?</p>
-                                    <div class="d-flex align-items-center">
-                                        <button class="btn btn-sm btn-danger mr-2" submit>Delete</button>
-                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                    </div>
-                                </form>
-                            </div>
-                            <div moe class="mr-2">
-                                <a class="on-hover-opaque" start show title="Update">
-                                    <i class="font-size-11 fa fa-edit text-primary"></i>
-                                </a>
-                                <form url="/api/measurement/updateBasic">
-                                    <input type="hidden" name="uid" value="{{ $measurement->uid }}">
-                                    <div class="mb-2">
-                                        <input required type="text" class="form-control form-control-sm" name="label" value="{{ $measurement->label }}" placeholder="Type">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input required autofocus type="text" class="form-control form-control-sm" name="value" value="{{ $measurement->value }}" placeholder="Value">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input required type="date" class="form-control form-control-sm" name="effectiveDate" max="{{ date('Y-m-d') }}" value="{{ date('Y-m-d') }}">
-                                    </div>
-                                    <div class="d-flex align-items-center">
-                                        <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                    </div>
-                                </form>
-                            </div>
-                            --}}
                             <span class="text-secondary">
                                 {{ $measurement->label == 'Wt. (lbs.)' ? 'WT' : $measurement->label}}:
                             </span>

+ 39 - 0
resources/views/app/practice-management/_sort_header_multi_v2.blade.php

@@ -0,0 +1,39 @@
+@if($key !== '__clear_sort__')
+    <?php
+    // sort=key:order,key:order...
+    $current = request()->input('sort_by');
+    $current = $current ? json_decode($current, true) : [];
+    $currentSortForKey = currentSortForKey($current, $key);
+    $targetSortParamForInclusionOrReversal = json_encode(includeOrReverseInMultiSort($current, $key));
+    $targetSortParamForRemoval = json_encode(removeFromMultiSort($current, $key));
+    ?>
+    <div class="">
+        <a href="{{ $route }}?{{queryLineExcept(['sort_by', 'page'])}}&sort_by={!! urlencode($targetSortParamForInclusionOrReversal) !!}" class="text-decoration-none d-block">
+            <b class="{{$currentSortForKey ? 'text-primary' : 'text-secondary'}}">{!! $label !!}</b>
+        </a>
+        <div class="mb-1 d-flex align-items-end position-relative sort-header-arrows flex-nowrap">
+            <i class="mr-1 text-sm fa fa-chevron-up {{$currentSortForKey && $currentSortForKey['order'] === 'DESC' ? 'text-primary' : 'on-hover-opaque text-secondary'}}"></i>
+            <i class="mr-1 text-sm fa fa-chevron-down {{$currentSortForKey && $currentSortForKey['order'] === 'ASC' ? 'text-primary' : 'on-hover-opaque text-secondary'}}"></i>
+            @if($currentSortForKey)
+                <div class="multi-sort-index mr-1">{{$currentSortForKey['index']}}</div>
+            @endif
+            @if($currentSortForKey)
+                <a href="{{ $route }}?{{queryLineExcept(['sort_by', 'page'])}}&sort_by={!! $targetSortParamForRemoval !== '[]' ? urlencode($targetSortParamForRemoval) : '' !!}" class="text-sm on-hover-opaque text-secondary">
+                    <i class="fa fa-times"></i>
+                </a>
+            @endif
+        </div>
+    </div>
+@else
+    <div class="">
+        @if(request()->input('sort_by'))
+            <a href="{{ $route }}?{{queryLineExcept(['sort_by', 'page'])}}" class="text-sm font-weight-normal d-block lh-16px">
+                Clear<br>Sort
+            </a>
+        @else
+            <span class="text-sm font-weight-normal text-secondary">Sort</span>
+        @endif
+    </div>
+
+
+@endif

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

@@ -1,6 +1,8 @@
+<?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; ?>
 <tr data-client-uid="{{$iPatient->client_uid}}" data-care-month-uid="{{$iPatient->care_month_uid}}">
     <td>{{ $trIndex + 1 }}</td>
-    <td class="pl-2">
+    <td>{{friendly_month_short($iPatient->start_date)}}</td>
+    <td>
         <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}"
            native target="_blank"
            open-in-stag-popup
@@ -56,7 +58,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 on-hover-opaque'}}"></i>
-            <span class="sort-data">{{$daysDiff !== -1 ? $daysDiff : '-'}}</span>
+            <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>
 
@@ -102,81 +104,95 @@
     </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)
+        <div class="d-flex align-items-baseline">
+            <i class="mr-1 text-sm fa {{$iPatient->rm_total_time_in_seconds >= 1200 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger on-hover-opaque'}}"></i>
+            <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds / 60)}}:{{round($iPatient->rm_total_time_in_seconds % 60)}}</span>
+            <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds}}</span>
+        </div>
+    </td>
+
+    <td>
+        @if($iPatient->is_billable_by_mcp)
             <span class="text-success">
-                <i class="fa fa-check text-sm"></i>{{--
-                ${{friendly_money($pro->mcp_rpm_payment_amount, 0)}}--}}
+                <i class="fa fa-check text-sm"></i>
             </span>
         @else
-            <span class="text-danger font-weight-normal">
-                No
-            </span>
+            <span class="text-danger font-weight-normal">No</span>
         @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($iPatient->is_billable_by_rmm)
             <span class="text-success">
-                <i class="fa fa-check text-sm"></i>{{--
-                ${{friendly_money($pro->rmm_payment_amount, 0)}}--}}
+                <i class="fa fa-check text-sm"></i>
             </span>
         @else
-            <span class="text-danger font-weight-normal">
-                No
-            </span>
+            <span class="text-danger font-weight-normal">No</span>
         @endif
     </td>
     <td>
-        <?php
-        $codeStatus = 'No';
-        if($iPatient->number_of_days_with_remote_measurements >= 16 && $lastVisitWithin90Days) {
-            $codeStatus = 'Ready';
-            if($iPatient->claim_454) {
-                $codeStatus = 'Claimed';
-            }
-        }
-        ?>
-        @if($codeStatus === 'No')
-            <span class="text-nowrap text-danger font-weight-normal">
-                {{$codeStatus}}
+        @if($iPatient->is_99454_claimable)
+            <span class="text-success">
+                <i class="fa fa-check text-sm"></i>
             </span>
-        @elseif($codeStatus === 'Ready')
-            <span class="text-nowrap text-dark">
-                <i class="fa fa-thumbs-up text-sm"></i>
-                {{$codeStatus}}
+        @else
+            <span class="text-danger font-weight-normal {{$iPatient->why_99454_not_claimable_reason ? 'font-underline c-pointer' : ''}}" title="{{$iPatient->why_99454_not_claimable_reason}}">No</span>
+        @endif
+    </td>
+    <td>
+        @if($iPatient->is_99454_claimed)
+            <span class="text-success">
+                <i class="fa fa-check text-sm"></i>
             </span>
-        @elseif($codeStatus === 'Claimed')
-            <span class="text-nowrap text-success">
+        @else
+            @if($iPatient->is_99454_claiming_waived)
+                <span class="text-secondary font-weight-normal {{$iPatient->why_claiming_99454_waived ? 'font-underline c-pointer' : ''}}" title="{{$iPatient->why_claiming_99454_waived}}">Waived</span>
+            @else
+                <span class="text-danger font-weight-normal">No</span>
+            @endif
+        @endif
+    </td>
+    <td>
+        @if($iPatient->is_99457_claimable)
+            <span class="text-success">
                 <i class="fa fa-check text-sm"></i>
-                {{$codeStatus}}
             </span>
+        @else
+            <span class="text-danger font-weight-normal {{$iPatient->why_99457_not_claimable_reason ? 'font-underline c-pointer' : ''}}" title="{{$iPatient->why_99457_not_claimable_reason}}">No</span>
         @endif
     </td>
     <td>
-        <?php
-        $codeStatus = 'No';
-        if($iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->has_anyone_interacted_with_client_about_rm &&
-            $lastVisitWithin90Days &&
-            ($iPatient->rm_total_time_in_seconds_by_mcp + $iPatient->rm_total_time_in_seconds_by_rmm_pro) >= 1200) {
-            $codeStatus = 'Ready';
-            if($iPatient->claim_457) {
-                $codeStatus = 'Claimed';
-            }
-        }
-        ?>
-        @if($codeStatus === 'No')
-            <span class="text-nowrap text-danger font-weight-normal">
-                {{$codeStatus}}
+        @if($iPatient->is_99457_claimed)
+            <span class="text-success">
+                <i class="fa fa-check text-sm"></i>
             </span>
-        @elseif($codeStatus === 'Ready')
-            <span class="text-nowrap text-dark">
-                <i class="fa fa-thumbs-up text-sm"></i>
-                {{$codeStatus}}
+        @else
+            @if($iPatient->is_99457_claiming_waived)
+                <span class="text-secondary font-weight-normal {{$iPatient->why_claiming_99457_waived ? 'font-underline c-pointer' : ''}}" title="{{$iPatient->why_claiming_99457_waived}}">Waived</span>
+            @else
+                <span class="text-danger font-weight-normal">No</span>
+            @endif
+        @endif
+    </td>
+    <td>
+        @if($iPatient->is_99458_claimable)
+            <span class="text-success">
+                <i class="fa fa-check text-sm"></i>
             </span>
-        @elseif($codeStatus === 'Claimed')
-            <span class="text-nowrap text-success">
+        @else
+            <span class="text-danger font-weight-normal {{$iPatient->why_99458_not_claimable_reason ? 'font-underline c-pointer' : ''}}" title="{{$iPatient->why_99458_not_claimable_reason}}">No</span>
+        @endif
+    </td>
+    <td>
+        @if($iPatient->is_99458_claimed)
+            <span class="text-success">
                 <i class="fa fa-check text-sm"></i>
-                {{$codeStatus}}
             </span>
+        @else
+            @if($iPatient->is_99458_claiming_waived)
+                <span class="text-secondary font-weight-normal {{$iPatient->why_claiming_99458_waived ? 'font-underline c-pointer' : ''}}" title="{{$iPatient->why_claiming_99458_waived}}">Waived</span>
+            @else
+                <span class="text-danger font-weight-normal">No</span>
+            @endif
         @endif
     </td>
 </tr>

+ 23 - 28
resources/views/app/practice-management/rpm-matrix-for-admin-table.blade.php

@@ -24,41 +24,36 @@
         <table class="table table-sm table-striped table-hover p-0 m-0 min-width-1100px" id="table-rm-matrix">
             <thead class="bg-light">
             <tr>
-		        <th class="border-0"></th>
-                <th class="border-0 pl-2">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Name', 'key' => 'client_name'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Insurance', 'key' => 'payer_name'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'State', 'key' => 'mailing_address_state'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'CM MCP', 'key' => 'mcp_name'])</th>
+                <th class="border-0 pr-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'key' => '__clear_sort__'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Month', 'key' => 'start_date'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Name', 'key' => 'client_name'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Insurance', 'key' => 'payer_name'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'State', 'key' => 'mailing_address_state'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'CM MCP', 'key' => 'mcp_name'])</th>
                 <th class="border-0 text-secondary">BP</th>
                 <th class="border-0 text-secondary">Scale</th>
-                <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'DSLM', 'key' => 'dslm'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'DSLV', 'key' => 'most_recent_completed_mcp_note_date'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Next<br>Visit', 'key' => 'next_visit_date'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '<i class="text-sm fa fa-phone rotateh"></i> MCP', 'key' => 'has_mcp_interacted_with_client_about_rm'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '<i class="text-sm fa fa-phone rotateh"></i> Any', 'key' => 'has_anyone_interacted_with_client_about_rm'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '#Meas.<br>Days', 'key' => 'number_of_days_with_remote_measurements'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '#MCP<br>Mins.', 'key' => 'rm_total_time_in_seconds_by_mcp'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '#RMM<br>Mins.', 'key' => 'rm_total_time_in_seconds_by_rmm_pro'])</th>
-                <th class="border-0 text-secondary">MCP</th>
-                <th class="border-0 text-secondary">RMM</th>
-                <th class="border-0 text-secondary">454</th>
-                <th class="border-0 text-secondary">457</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'DSLM', 'key' => 'dslm'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'DSLV', 'key' => 'days_between_most_recent_mcp_note_date_and_end_of_care_month'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Next<br>Visit', 'key' => 'next_visit_date'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '<i class="text-sm fa fa-phone rotateh"></i> MCP', 'key' => 'has_mcp_interacted_with_client_about_rm'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '<i class="text-sm fa fa-phone rotateh"></i> Any', 'key' => 'has_anyone_interacted_with_client_about_rm'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Meas.<br>Days', 'key' => 'number_of_days_with_remote_measurements'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'MCP<br>Mins.', 'key' => 'rm_total_time_in_seconds_by_mcp'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'RMM<br>Mins.', 'key' => 'rm_total_time_in_seconds_by_rmm_pro'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Total<br>Mins.', 'key' => 'rm_total_time_in_seconds'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'MCP', 'key' => 'is_billable_by_mcp'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'RMM', 'key' => 'is_billable_by_rmm'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Can<br>454', 'key' => 'is_99454_claimable'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Done<br>454', 'key' => 'is_99454_claimed'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Can<br>457', 'key' => 'is_99457_claimable'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Done<br>457', 'key' => 'is_99457_claimed'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Can<br>458', 'key' => 'is_99458_claimable'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Done<br>458', 'key' => 'is_99458_claimed'])</th>
             </tr>
             </thead>
             <tbody>
             <?php $trIndex = 0; ?>
             @foreach ($patients as $iPatient)
-                <?php
-
-                $daysDiff = -1;
-                if ($iPatient->most_recent_completed_mcp_note_date) {
-                    $careMonthLastDay = date_add(date_create($rcmStartDate), date_interval_create_from_date_string("1 month"));
-                    $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);
-
-                ?>
                 @include('app.practice-management.remote-monitoring-row-markup-for-admin')
                 <?php $trIndex++; ?>
             @endforeach

+ 115 - 101
resources/views/app/practice-management/rpm-matrix-for-admin.blade.php

@@ -30,48 +30,41 @@
 
                     <div class="d-flex align-items-end">
                         <span class="mr-4">
-                            <span class="font-size-14">Remote Monitoring</span>
-                            <i class="fas fa-arrow-right text-sm mx-1"></i>
-                            <b class="font-size-14">{{friendly_month(date((request()->input('y') ?: 'Y') . '-' . (request()->input('m') ?: 'm') . '-d'))}}</b>
+                            <span class="font-size-14">RPM (Admin)</span>
                         </span>
-                        <?php
-
-                        $mStr = request()->input('m') ? request()->input('m') : date('m');
-                        $yStr = request()->input('y') ? request()->input('y') : date('Y');
-                        $rcmStartDate = $yStr . '-' . $mStr . '-' . '01';
-                        $m = +$mStr;
-                        $y = +$yStr;
-                        ?>
-
-                        <div class="ml-auto d-inline-flex flex-nowrap align-items-baseline">
-                            <span class="mr-2">Month</span>
-                            <select class="form-control form-control-sm min-width-unset width-100px mr-3" name="m"
-                                    onchange="fastLoad('{{route('practice-management.rpm-matrix-admin')}}?' + $(this).closest('form').serialize())">
-                                <option value="01" {{$m === 1 ? 'selected' : ''}}>Jan</option>
-                                <option value="02" {{$m === 2 ? 'selected' : ''}}>Feb</option>
-                                <option value="03" {{$m === 3 ? 'selected' : ''}}>Mar</option>
-                                <option value="04" {{$m === 4 ? 'selected' : ''}}>Apr</option>
-                                <option value="05" {{$m === 5 ? 'selected' : ''}}>May</option>
-                                <option value="06" {{$m === 6 ? 'selected' : ''}}>Jun</option>
-                                <option value="07" {{$m === 7 ? 'selected' : ''}}>Jul</option>
-                                <option value="08" {{$m === 8 ? 'selected' : ''}}>Aug</option>
-                                <option value="09" {{$m === 9 ? 'selected' : ''}}>Sep</option>
-                                <option value="10" {{$m === 10 ? 'selected' : ''}}>Oct</option>
-                                <option value="11" {{$m === 11 ? 'selected' : ''}}>Nov</option>
-                                <option value="12" {{$m === 12 ? 'selected' : ''}}>Dec</option>
-                            </select>
-                            <span class="mr-2">Year</span>
-                            <select class="form-control form-control-sm min-width-unset width-100px" name="y"
-                                    onchange="fastLoad('{{route('practice-management.rpm-matrix-admin')}}?' + $(this).closest('form').serialize())">
-                                <option value="2020" {{$y === 2020 ? 'selected' : ''}}>2020</option>
-                                <option value="2021" {{$y === 2021 ? 'selected' : ''}}>2021</option>
-                                <option value="2022" {{$y === 2022 ? 'selected' : ''}}>2022</option>
-                            </select>
-                        </div>
                     </div>
 
                     <div class="d-flex align-items-start mt-2 pt-1 border-top">
 
+                        <div class="max-width-110px mr-2">
+                            <label class="mb-0 text-sm {{request()->input('m') && request()->input('m') !== 'ACTIVE' ? 'font-weight-bold text-info' : 'text-secondary'}}">Month</label>
+                            <select name="m" class="mr-2 form-control form-control-sm min-width-unset max-width-110px pl-0">
+                                <option value="">All</option>
+                                <option value="01" {{request()->input('m') === '1' ? 'selected' : ''}}>Jan</option>
+                                <option value="02" {{request()->input('m') === '2' ? 'selected' : ''}}>Feb</option>
+                                <option value="03" {{request()->input('m') === '3' ? 'selected' : ''}}>Mar</option>
+                                <option value="04" {{request()->input('m') === '4' ? 'selected' : ''}}>Apr</option>
+                                <option value="05" {{request()->input('m') === '5' ? 'selected' : ''}}>May</option>
+                                <option value="06" {{request()->input('m') === '6' ? 'selected' : ''}}>Jun</option>
+                                <option value="07" {{request()->input('m') === '7' ? 'selected' : ''}}>Jul</option>
+                                <option value="08" {{request()->input('m') === '8' ? 'selected' : ''}}>Aug</option>
+                                <option value="09" {{request()->input('m') === '9' ? 'selected' : ''}}>Sep</option>
+                                <option value="10" {{request()->input('m') === '10' ? 'selected' : ''}}>Oct</option>
+                                <option value="11" {{request()->input('m') === '11' ? 'selected' : ''}}>Nov</option>
+                                <option value="12" {{request()->input('m') === '12' ? 'selected' : ''}}>Dec</option>
+                            </select>
+                        </div>
+
+                        <div class="max-width-110px mr-2">
+                            <label class="mb-0 text-sm {{request()->input('y') && request()->input('y') !== 'ACTIVE' ? 'font-weight-bold text-info' : 'text-secondary'}}">Year</label>
+                            <select name="y" class="mr-2 form-control form-control-sm min-width-unset max-width-110px pl-0">
+                                <option value="">All</option>
+                                <option value="2020" {{request()->input('y') === 2020 ? 'selected' : ''}}>2020</option>
+                                <option value="2021" {{request()->input('y') === 2021 ? 'selected' : ''}}>2021</option>
+                                <option value="2022" {{request()->input('y') === 2022 ? 'selected' : ''}}>2022</option>
+                            </select>
+                        </div>
+
                         <div>
                             <label class="mb-0 text-sm {{request()->input('f_ces') && request()->input('f_ces') !== 'ACTIVE' ? 'font-weight-bold text-info' : 'text-secondary'}}">Status</label>
                             <select name="f_ces" class="mr-2 form-control form-control-sm min-width-unset max-width-110px pl-0">
@@ -211,6 +204,28 @@
                             </div>
                         </div>
 
+                        <div class="width-70px mr-2">
+                            <label class="mb-0 text-sm {{request()->input('f_mcp_billable') ? 'font-weight-bold text-info' : 'text-secondary'}}">MCP Billable</label>
+                            <div class="d-flex align-items-start">
+                                <select name="f_mcp_billable" class=" form-control form-control-sm min-width-unset pl-0">
+                                    <option value="">Any</option>
+                                    <option {{request()->input('f_mcp_billable') === 'Yes' ? 'selected' : ''}} value="Medicare">Yes</option>
+                                    <option {{request()->input('f_mcp_billable') === 'No' ? 'selected' : ''}} value="Non Medicare">No</option>
+                                </select>
+                            </div>
+                        </div>
+
+                        <div class="width-70px mr-2">
+                            <label class="mb-0 text-sm {{request()->input('f_rmm_billable') ? 'font-weight-bold text-info' : 'text-secondary'}}">RMM Billable</label>
+                            <div class="d-flex align-items-start">
+                                <select name="f_rmm_billable" class=" form-control form-control-sm min-width-unset pl-0">
+                                    <option value="">Any</option>
+                                    <option {{request()->input('f_rmm_billable') === 'Yes' ? 'selected' : ''}} value="Medicare">Yes</option>
+                                    <option {{request()->input('f_rmm_billable') === 'No' ? 'selected' : ''}} value="Non Medicare">No</option>
+                                </select>
+                            </div>
+                        </div>
+
                     </div>
 
                     <div class="d-flex align-items-start mt-2">
@@ -323,6 +338,69 @@
                             </div>
                         </div>
 
+                        <div>
+                            <label class="mb-0 text-sm {{request()->input('f_dslv') ? 'font-weight-bold text-info' : 'text-secondary'}}">DSLV</label>
+                            <div class="d-flex align-items-start">
+                                <select name="f_dslv_op"
+                                        class="mr-1 form-control form-control-sm min-width-unset width-40px pl-0">
+                                    <option {{request()->input('f_dslv_op') === '=' ? 'selected' : ''}} value="=">&equals;</option>
+                                    <option {{request()->input('f_dslv_op') === '>' ? 'selected' : ''}} value=">">&gt;</option>
+                                    <option {{request()->input('f_dslv_op') === '<' ? 'selected' : ''}} value="<">&lt;</option>
+                                    <option {{request()->input('f_dslv_op') === '>=' ? 'selected' : ''}} value=">=">&ge;</option>
+                                    <option {{request()->input('f_dslv_op') === '<=' ? 'selected' : ''}} value="<=">&le;</option>
+                                </select>
+                                <input type="number" name="f_dslv"
+                                       value="{{request()->input('f_dslv')}}"
+                                       class="mr-2 form-control form-control-sm min-width-unset width-70px">
+                            </div>
+                        </div>
+
+                        <div class="min-width-110px mr-2">
+                            <label class="mb-0 text-sm {{request()->input('f_454') ? 'font-weight-bold text-info' : 'text-secondary'}}">454</label>
+                            <div class="d-flex align-items-start">
+                                <select name="f_454"
+                                        class=" form-control form-control-sm min-width-unset pl-0">
+                                    <option value="">Any</option>
+                                    <option {{request()->input('f_454') === 'Claimable' ? 'selected' : ''}} value="Claimable">Claimable</option>
+                                    <option {{request()->input('f_454') === 'Not Claimable' ? 'selected' : ''}} value="Not Claimable">Not Claimable</option>
+                                    <option {{request()->input('f_454') === 'Claimed' ? 'selected' : ''}} value="Claimed">Claimed</option>
+                                    <option {{request()->input('f_454') === 'Not Claimed' ? 'selected' : ''}} value="Not Claimed">Not Claimed</option>
+                                    <option {{request()->input('f_454') === 'Waived' ? 'selected' : ''}} value="Waived">Waived</option>
+                                </select>
+                            </div>
+                        </div>
+
+                        <div class="min-width-110px mr-2">
+                            <label class="mb-0 text-sm {{request()->input('f_457') ? 'font-weight-bold text-info' : 'text-secondary'}}">457</label>
+                            <div class="d-flex align-items-start">
+                                <select name="f_457"
+                                        class=" form-control form-control-sm min-width-unset pl-0">
+                                    <option value="">Any</option>
+                                    <option {{request()->input('f_457') === 'Claimable' ? 'selected' : ''}} value="Claimable">Claimable</option>
+                                    <option {{request()->input('f_457') === 'Not Claimable' ? 'selected' : ''}} value="Not Claimable">Not Claimable</option>
+                                    <option {{request()->input('f_457') === 'Claimed' ? 'selected' : ''}} value="Claimed">Claimed</option>
+                                    <option {{request()->input('f_457') === 'Not Claimed' ? 'selected' : ''}} value="Not Claimed">Not Claimed</option>
+                                    <option {{request()->input('f_457') === 'Waived' ? 'selected' : ''}} value="Waived">Waived</option>
+                                </select>
+                            </div>
+                        </div>
+
+                        <div class="min-width-110px mr-2">
+                            <label class="mb-0 text-sm {{request()->input('f_458') ? 'font-weight-bold text-info' : 'text-secondary'}}">458</label>
+                            <div class="d-flex align-items-start">
+                                <select name="f_458"
+                                        class=" form-control form-control-sm min-width-unset pl-0">
+                                    <option value="">Any</option>
+                                    <option {{request()->input('f_458') === 'Claimable' ? 'selected' : ''}} value="Claimable">Claimable</option>
+                                    <option {{request()->input('f_458') === 'Not Claimable' ? 'selected' : ''}} value="Not Claimable">Not Claimable</option>
+                                    <option {{request()->input('f_458') === 'Claimed' ? 'selected' : ''}} value="Claimed">Claimed</option>
+                                    <option {{request()->input('f_458') === 'Not Claimed' ? 'selected' : ''}} value="Not Claimed">Not Claimed</option>
+                                    <option {{request()->input('f_458') === 'Waived' ? 'selected' : ''}} value="Waived">Waived</option>
+                                </select>
+                            </div>
+                        </div>
+
+
                         <!--<div class="max-width-110px">
                             <label class="mb-0 text-sm {{request()->input('f_visit_90_days') ? 'font-weight-bold text-info' : 'text-secondary'}}">Visit 90 Days</label>
                             <div class="d-flex align-items-start">
@@ -385,68 +463,8 @@
     </div>
     <script>
         (function () {
-            let dataTableInst = null;
-            window.refreshRpmRow = function (_index) {
-                let tr = $('#table-rm-matrix tbody tr:eq(' + _index + ')');
-                if (!tr.length) return;
-                let clientUid = tr.attr('data-client-uid'), careMonthUid = tr.attr('data-care-month-uid');
-                $.get('/rpm-matrix-row-for-admin?m={{$mStr}}&y={{$yStr}}&clientUid=' + clientUid + '&careMonthUid=' + careMonthUid + '&trIndex=' + _index, _data => {
-                    let row = $(_data);
-                    @if(request()->input('dt'))
-                    row.find('>td').each(function (_columnIndex) {
-                        dataTableInst.cell(_index, _columnIndex).data(this.innerHTML); //.draw();
-                    });
-                    @else
-                    tr.replaceWith(row);
-                    @endif
-                    $('#practice-remote-monitoring [moe][initialized]').removeAttr('initialized');
-                    initMoes();
-                    tr.addClass('post-refresh-highlight');
-                    setTimeout(function () {
-                        tr.removeClass('post-refresh-highlight');
-                    }, 1000);
-                });
-            }
 
             function init() {
-                @if(request()->input('dt'))
-                    dataTableInst = $('#table-rm-matrix').DataTable({
-                    paging: false,
-                    columnDefs: [
-                        {
-                            targets: [0, 8],
-                            type: 'string',
-                            render: function (data, type, row, meta) {
-                                if (type === 'sort') {
-                                    return $(data).find('.sort-data').first().text();
-                                }
-                                return data;
-                            },
-                        },
-                        {targets: 1, type: 'date'},
-                        {
-                            targets: 7,
-                            type: 'num',
-                            render: function (data, type, row, meta) {
-                                if (type === 'sort') {
-                                    return $(data).find('.sort-data').first().text();
-                                }
-                                return data;
-                            },
-                        },
-                        {
-                            targets: [5, 6, 10, 11, 12],
-                            type: 'num',
-                            render: function (data, type, row, meta) {
-                                if (type === 'sort') {
-                                    return +($(data).find('.sort-data').first().text());
-                                }
-                                return data;
-                            },
-                        },
-                    ]
-                });
-                @endif
                 $('#practice-remote-monitoring').removeAttr('v-cloak');
                 $('#practice-remote-monitoring [moe][initialized]').removeAttr('initialized');
 
@@ -467,10 +485,6 @@
                     });
 
                 initMoes();
-
-                // hack - init split at 22%
-                localStorage['v-split-rounded-rpm-matrix-split'] = 22;
-                initVSplitter('rpm-matrix-split', $('.rpm-matrix-left-column'), $('.rpm-matrix-right-column'), null, {marginLeft: '-3px', width: '5px', height: '100%', marginTop: 0, borderRadius: 0});
             }
 
             addMCInitializer('practice-remote-monitoring', init, '#practice-remote-monitoring');