Răsfoiți Sursa

RPM admin matrix - month/year now just another filter + month column

Vijayakrishnan 3 ani în urmă
părinte
comite
fb8002eda1

+ 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 "-";

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

@@ -1844,7 +1844,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';
@@ -1862,7 +1862,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'));
@@ -1883,6 +1883,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') {
@@ -2194,9 +2203,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);
@@ -2286,9 +2293,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}
       
 ";

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

@@ -1,6 +1,7 @@
 <?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>{{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"

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

@@ -25,6 +25,7 @@
             <thead class="bg-light">
             <tr>
                 <th class="border-0 pr-0">@include('app.practice-management._sort_header_multi_v2', ['route' => route("practice-management.rpm-matrix-admin"), 'label' => '<span class="text-sm font-weight-normal text-secondary">Sort</span>'])</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>

+ 30 - 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">
@@ -470,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');
 
@@ -552,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');