Эх сурвалжийг харах

RPM admin logic/ui updates #2

Vijayakrishnan 3 жил өмнө
parent
commit
f5c218d9a3

+ 30 - 2
app/Http/Controllers/PracticeManagementController.php

@@ -1827,11 +1827,34 @@ WHERE
         $genericBillJoinClause = "left join bill mcpBill on care_month.mcp_rm_generic_bill_id = mcpBill.id
                    left join bill rmmBill on care_month.rmm_rm_generic_bill_id = rmmBill.id";
 
+        $defaultPageSize = 25;
+
+        $page = $request->input('page') ?: 1;
+        $perPage = $request->input('per_page') ?: $defaultPageSize;
+        $offset = ($page - 1) * $perPage;
+
+        $countQuery = "
+SELECT COUNT(*)
+FROM care_month join client on care_month.client_id = client.id 
+    join note mrnote on client.most_recent_completed_mcp_note_id = mrnote.id
+    left join pro mcpPro on care_month.mcp_pro_id = mcpPro.id
+    left join pro rmmPro on care_month.rmm_pro_id = rmmPro.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) : '') . "      
+";
+
+        $countResult = DB::select($countQuery);
+        $total = $countResult[0]->count;
+
         $query = "
 SELECT client.name_first, client.name_last,
        (client.name_first || ' ' || client.name_last) as client_name,
        client.uid as client_uid, 
        client.dob,
+       client.age_in_years,
        client.is_enrolled_in_rm,
        client.most_recent_completed_mcp_note_date,
        client.most_recent_completed_mcp_note_id,
@@ -1879,7 +1902,8 @@ 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) : '') . "
-      $orderBy
+      {$orderBy} OFFSET {$offset} LIMIT {$perPage}
+      
 ";
 
         // dd($query);
@@ -1889,7 +1913,11 @@ WHERE
         $timestamp = strtotime(date('Y-m-d'));
         $daysRemaining = (int)date('t', $timestamp) - (int)date('j', $timestamp);
 
-        return view('app.practice-management.rpm-matrix-for-admin', compact('patients', 'daysRemaining', 'careMonthStart'));
+        $paginator = new LengthAwarePaginator($patients, $total, $request->input('per_page') ?: $defaultPageSize, $request->input('page') ?: 1);
+        $perPage = $request->input('per_page') ?: $defaultPageSize;
+        $paginator->setPath(route('practice-management.rpm-matrix-admin'));
+
+        return view('app.practice-management.rpm-matrix-for-admin', compact('patients', 'daysRemaining', 'careMonthStart', 'paginator', 'perPage'));
     }
 
     public function remoteMonitoringMCP(Request $request) {

+ 3 - 0
public/css/style.css

@@ -3602,3 +3602,6 @@ table.v-top th {
 .note-container .segments-list p:empty {
     display: none;
 }
+.mcp-theme-1 .mb-0-pagination .pagination {
+    margin-bottom: 0 !important;
+}

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

@@ -11,37 +11,44 @@
         ><span class="sort-data">{{ $iPatient->client_name }}</span></a>
     </td>
     <td>{{$iPatient->mcp_name}}</td>
-    <td>{{friendly_date($iPatient->dob)}}</td>
+    <td>{{$iPatient->age_in_years}}</td>
     {{--<td>{!! $iPatient->is_enrolled_in_rm === 'YES' ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>--}}
-    <td>{!! $iPatient->is_assigned_cellular_bp_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
-    <td>{!! $iPatient->is_assigned_cellular_weight_scale_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
     <td>
-        @if($iPatient->most_recent_cellular_bp_sbp_mm_hg && $iPatient->most_recent_cellular_bp_dbp_mm_hg)
-            <div class="text-nowrap">
-                <span class="sort-data">{{$iPatient->most_recent_cellular_bp_sbp_mm_hg ?: '-'}}</span>/{{$iPatient->most_recent_cellular_bp_dbp_mm_hg ?: '-'}}
-                @if($iPatient->most_recent_cellular_bp_measurement_at)
-                    <span class="text-sm text-secondary text-nowrap ml-1"
-                          title="{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}">({{friendly_date_est($iPatient->most_recent_cellular_bp_measurement_at)}})</span>
-                @endif
+        @if($iPatient->is_assigned_cellular_bp_device)
+            <div class="d-flex align-items-baseline">
+            <i class="fa fa-check text-success"></i>
+            @if($iPatient->most_recent_cellular_bp_sbp_mm_hg && $iPatient->most_recent_cellular_bp_dbp_mm_hg)
+                <div class="text-nowrap ml-1">
+                    <span class="sort-data">{{$iPatient->most_recent_cellular_bp_sbp_mm_hg ?: '-'}}</span>/{{$iPatient->most_recent_cellular_bp_dbp_mm_hg ?: '-'}}
+                    @if($iPatient->most_recent_cellular_bp_measurement_at)
+                        <span class="text-sm text-secondary text-nowrap"
+                              title="{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}">{{friendly_date_est($iPatient->most_recent_cellular_bp_measurement_at)}}</span>
+                    @endif
+                </div>
+            @endif
             </div>
         @else
-            -
+            <span class="text-secondary">No</span>
         @endif
     </td>
     <td>
-        @if($iPatient->most_recent_cellular_weight_value)
-            <div class="text-nowrap">
-                <span class="sort-data">{{$iPatient->most_recent_cellular_weight_value ? round($iPatient->most_recent_cellular_weight_value, 1) : '-'}}</span>
-                @if($iPatient->most_recent_cellular_weight_measurement_at)
-                    <span class="text-sm text-secondary text-nowrap ml-1"
-                          title="{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}">({{friendly_date_est($iPatient->most_recent_cellular_weight_measurement_at)}})</span>
+        @if($iPatient->is_assigned_cellular_weight_scale_device)
+            <div class="d-flex align-items-baseline">
+                <i class="fa fa-check text-success"></i>
+                @if($iPatient->most_recent_cellular_weight_value)
+                    <div class="text-nowrap ml-1">
+                        <span class="sort-data">{{$iPatient->most_recent_cellular_weight_value ? round($iPatient->most_recent_cellular_weight_value, 1) : '-'}}</span>
+                        @if($iPatient->most_recent_cellular_weight_measurement_at)
+                            <span class="text-sm text-secondary text-nowrap"
+                                  title="{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}">{{friendly_date_est($iPatient->most_recent_cellular_weight_measurement_at)}}</span>
+                        @endif
+                    </div>
                 @endif
             </div>
         @else
-            -
+            <span class="text-secondary">No</span>
         @endif
     </td>
-    
     <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>
@@ -81,7 +88,7 @@
     <td>
         <div class="d-flex align-items-baseline">
             <i class="mr-1 text-sm fa {{$iPatient->rm_total_time_in_seconds_by_mcp >= 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_by_mcp / 60)}}m {{round($iPatient->rm_total_time_in_seconds_by_mcp % 60)}}s</span>
+            <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_mcp / 60)}}:{{round($iPatient->rm_total_time_in_seconds_by_mcp % 60)}}</span>
             <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_mcp}}</span>
         </div>
     </td>
@@ -89,7 +96,7 @@
     <td>
         <div class="d-flex align-items-baseline">
             <i class="mr-1 text-sm fa {{$iPatient->rm_total_time_in_seconds_by_rmm_pro >= 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_by_rmm_pro / 60)}}m {{round($iPatient->rm_total_time_in_seconds_by_rmm_pro % 60)}}s</span>
+            <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_rmm_pro / 60)}}:{{round($iPatient->rm_total_time_in_seconds_by_rmm_pro % 60)}}</span>
             <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_rmm_pro}}</span>
         </div>
     </td>
@@ -97,8 +104,8 @@
     <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)
             <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>{{--
+                ${{friendly_money($pro->mcp_rpm_payment_amount, 0)}}--}}
             </span>
         @else
             <span class="text-danger font-weight-normal">
@@ -109,8 +116,8 @@
     <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)
             <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>{{--
+                ${{friendly_money($pro->rmm_payment_amount, 0)}}--}}
             </span>
         @else
             <span class="text-danger font-weight-normal">
@@ -129,16 +136,16 @@
         }
         ?>
         @if($codeStatus === 'No')
-            <span class="text-danger font-weight-normal">
+            <span class="text-nowrap text-danger font-weight-normal">
                 {{$codeStatus}}
             </span>
         @elseif($codeStatus === 'Ready')
-            <span class="text-dark">
+            <span class="text-nowrap text-dark">
                 <i class="fa fa-thumbs-up text-sm"></i>
                 {{$codeStatus}}
             </span>
         @elseif($codeStatus === 'Billed')
-            <span class="text-success">
+            <span class="text-nowrap text-success">
                 <i class="fa fa-check text-sm"></i>
                 {{$codeStatus}}
             </span>
@@ -157,16 +164,16 @@
         }
         ?>
         @if($codeStatus === 'No')
-            <span class="text-danger font-weight-normal">
+            <span class="text-nowrap text-danger font-weight-normal">
                 {{$codeStatus}}
             </span>
         @elseif($codeStatus === 'Ready')
-            <span class="text-dark">
+            <span class="text-nowrap text-dark">
                 <i class="fa fa-thumbs-up text-sm"></i>
                 {{$codeStatus}}
             </span>
         @elseif($codeStatus === 'Billed')
-            <span class="text-success">
+            <span class="text-nowrap text-success">
                 <i class="fa fa-check text-sm"></i>
                 {{$codeStatus}}
             </span>

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

@@ -1,4 +1,13 @@
 <div class="d-flex align-items-stretch m-0 h-100">
+    @if(!request()->input('not-enrolled'))
+        <div class="overflow-auto border-right h-100 rpm-matrix-left-column">
+            @if(request()->input('f_mcp'))
+                @include('app.stat-tree.summary', ['slug' => 'rm-tree-mcp', 'showForPro' => $pro, 'noDropVisualize' => true, 'stParams' => ['start_date' => $rcmStartDate]])
+            @else
+                @include('app.stat-tree.summary', ['slug' => 'rm-tree-admin', 'noDropVisualize' => true, 'stParams' => ['start_date' => $rcmStartDate]])
+            @endif
+        </div>
+    @endif
     <div class="flex-grow-1 px-0 overflow-auto h-100 rpm-matrix-right-column">
         <?php $trIndex = 0; ?>
         @foreach ($patients as $iPatient)
@@ -18,15 +27,13 @@
 
                 <th class="border-0 pl-2">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Name', 'key' => 'client_name'])</th>
                 <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'CM MCP', 'key' => 'mcp_name'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'DOB', 'key' => 'dob'])</th>
+                <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Age', 'key' => 'age_in_years'])</th>
                 {{--<th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'RPM?', 'key' => 'is_enrolled_in_rm'])</th>--}}
-                <th class="border-0 text-secondary">BP?</th>
-                <th class="border-0 text-secondary">Scale?</th>
-                <th class="border-0 text-secondary">Latest BP</th>
-                <th class="border-0 text-secondary">Latest Wt</th>
-                <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Days Since<br>Last Visit', 'key' => 'most_recent_completed_mcp_note_date'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'MCP<br>Comm?', 'key' => 'has_mcp_interacted_with_client_about_rm'])</th>
-                <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => 'Any<br>Comm?', 'key' => 'has_anyone_interacted_with_client_about_rm'])</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', ['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', ['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', ['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', ['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', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '#MCP<br>Unst.', 'key' => 'rm_num_measurements_not_stamped_by_mcp'])</th>
                 <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '#RMM<br>Unst.', 'key' => 'rm_num_measurements_not_stamped_by_rmm'])</th>

+ 12 - 2
resources/views/app/practice-management/rpm-matrix-for-admin.blade.php

@@ -276,8 +276,8 @@
             <?php $rc = request()->input('rc') ? request()->input('rc') : 1; ?>
 
             <div class="card-body p-0">
-                <div>
-                    <div class="d-flex align-items-baseline p-2 border-bottom" tab-links="">
+                <div class="d-flex align-items-baseline p-2 border-bottom">
+                    <div class="d-inline-flex align-items-baseline" tab-links="">
                         <a class="{{ !request()->input('not-enrolled') ? 'tab-link-active' : '' }} text-dark c-pointer"
                            onclick="$('[name=not-enrolled]').val(''); return fastLoad('{{route('practice-management.rpm-matrix-admin')}}?' + $('#rpm-matrix-filter').serialize());"
                            tab-link="rpm">Enrolled in RPM</a>
@@ -285,6 +285,16 @@
                            onclick="$('[name=not-enrolled]').val('1'); return fastLoad('{{route('practice-management.rpm-matrix-admin')}}?' + $('#rpm-matrix-filter').serialize());"
                            tab-link="no-rpm">Not Enrolled in RPM</a>
                     </div>
+                    <div class="d-inline-flex align-items-baseline ml-auto mb-0-pagination">
+                        <div class="mr-2"><b>{{$paginator->firstItem()}}</b> to <b>{{$paginator->lastItem()}}</b> (page {{$paginator->currentPage()}}) of <b>{{$paginator->total()}}</b> care months</div>
+                        {!! $paginator->onEachSide(2)->withQueryString()->links() !!}
+                        <select class="form-control form-control-sm min-width-unset width-100px px-2 ml-2" onchange="fastLoad('{{ route('practice-management.rpm-matrix-admin') }}?{{queryLineExcept(['per_page', 'page'])}}&per_page=' + this.value)">
+                            <option {{$perPage == 25 ? 'selected' : ''}} value="25">25/page</option>
+                            <option {{$perPage == 50 ? 'selected' : ''}} value="50">50/page</option>
+                            <option {{$perPage == 75 ? 'selected' : ''}} value="75">75/page</option>
+                            <option {{$perPage == 100 ? 'selected' : ''}} value="100">100/page</option>
+                        </select>
+                    </div>
                 </div>
                 <div class="cm-tab {{!request()->input('not-enrolled') ? '' : 'd-none'}}" tab-key="rpm">
                     @include('app.practice-management.rpm-matrix-for-admin-table')