Browse Source

RPM manager - DOM <-> mins billed checks + add-entry ui

Vijayakrishnan 2 years ago
parent
commit
38fa2a456c

+ 3 - 1
app/Http/Controllers/PracticeManagementController.php

@@ -2582,6 +2582,7 @@ SELECT
        care_month.measurements_bp_json,
        care_month.measurements_weight_json,
        care_month.start_date as care_month_start_date,
+       care_month.end_date as care_month_end_date,
        mcpBill.has_generic_pro_been_paid as mcp_paid,
        rmmBill.has_generic_pro_been_paid as rmm_paid,
        rmeBill.has_generic_pro_been_paid as rme_paid
@@ -2680,6 +2681,7 @@ SELECT
        care_month.measurements_bp_json,
        care_month.measurements_weight_json,
        care_month.start_date as care_month_start_date,
+       care_month.end_date as care_month_end_date,
        mcpBill.has_generic_pro_been_paid as mcp_paid,
        rmmBill.has_generic_pro_been_paid as rmm_paid,
        rmeBill.has_generic_pro_been_paid as rme_paid
@@ -2712,7 +2714,7 @@ WHERE
 
         $updateModel = true;
 
-        return view('app.practice-management.rpm-manager.row', compact('iPatient', 'index', 'month', 'year', 'viewingAs', 'updateModel'));
+        return view('app.practice-management.rpm-manager.row', compact('iPatient', 'index', 'month', 'year', 'viewingAs', 'updateModel', 'daysRemaining'));
     }
 
     public function claimsReport(Request $request) {

+ 41 - 1
resources/views/app/practice-management/rpm-manager/index.blade.php

@@ -227,7 +227,7 @@
                         $index = $paginator->firstItem();
                         ?>
                         @foreach ($patients as $iPatient)
-                            @include('app.practice-management.rpm-manager.row', compact('iPatient', 'index', 'month', 'year', 'viewingAs'))
+                            @include('app.practice-management.rpm-manager.row', compact('iPatient', 'index', 'month', 'year', 'viewingAs', 'daysRemaining'))
                             <?php
                             $index++;
                             ?>
@@ -312,6 +312,46 @@
             function init() {
                 let parent = $('#practice-rpm-manager');
 
+                parent.find('[cm-rte]').each(function() {
+
+                    $(this).wrap(
+                        $('<div class="border-left border-right rte-holder"/>')
+                            .attr('data-shortcuts', '')
+                    );
+
+                    // give a unique id to this editor instance
+                    var editorID = Math.ceil(Math.random() * 99999), fieldName = $(this).attr('data-name');
+
+                    var el = this;
+                    var existingContent = $(el).attr('data-content') ? $(el).attr('data-content') : $(el).html();
+                    var quill = new Quill(el, {
+                        theme: 'snow',
+                        modules: stagQuillConfig
+                    });
+
+                    var toolbar = $(quill.container).prev('.ql-toolbar');
+
+                    // add button for new shortcut
+                    var newSCButton = $('<button class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +
+                        'text-sm add-shortcut" data-editor-id="' + editorID + '">+ Shortcut</button>');
+                    toolbar.append(newSCButton);
+
+                    quill.root.innerHTML = existingContent;
+
+                    $('<input type="hidden" name="' + fieldName + '">').val(existingContent).insertAfter(el);
+
+                    quill.on('text-change', function(delta, oldDelta, source) {
+                        $(el).next('[name="' + fieldName + '"]').val(quill.root.innerHTML);
+                    });
+
+                    $(quill.container)
+                        .find('.ql-editor[contenteditable]')
+                        .attr('data-field', fieldName)
+                        .attr('data-editor-id', editorID)
+                        .attr('with-shortcuts', 1);
+
+                });
+
                 parent
                     .off('mouseenter', '.rpm-manager-weight-popover-trigger')
                     .on('mouseenter', '.rpm-manager-weight-popover-trigger', function() {

+ 95 - 6
resources/views/app/practice-management/rpm-manager/row.blade.php

@@ -269,30 +269,119 @@
 
     <!--Time-->
     @if($viewingAs !== 'RME')
+        <?php $dayOfTheMonth = date('j'); ?>
         @if($viewingAs === 'ADMIN' || $viewingAs === 'MCP')
+            <?php $minsBilled = round($iPatient->rm_total_time_in_seconds_by_mcp / 60); ?>
             <td>
-                <div class="d-flex align-items-baseline">
+                <div class="d-flex align-items-baseline flex-nowrap">
                     <i class="mr-1 text-sm fa fa-circle opacity-35 {{$iPatient->rm_total_time_in_seconds_by_mcp >= 1200 ? 'text-success' : 'text-danger'}}"></i>
                     <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>
+                    @if(date('m') == $month && date('Y') == $year && $viewingAs === 'MCP')
+                        <?php
+                        $showAddEntry = 0;
+                        $expectation = 0;
+                        ?>
+                        @if($dayOfTheMonth >= 7 && $minsBilled < 5)
+                            <?php
+                            $showAddEntry = 5 - $minsBilled;
+                            $expectation = 5;
+                            ?>
+                        @elseif($dayOfTheMonth >= 14 && $minsBilled < 10)
+                            <?php
+                            $showAddEntry = 10 - $minsBilled;
+                            $expectation = 10;
+                            ?>
+                        @elseif($dayOfTheMonth >= 21 && $minsBilled < 15)
+                            <?php
+                            $showAddEntry = 15 - $minsBilled;
+                            $expectation = 15;
+                            ?>
+                        @elseif($dayOfTheMonth >= 28 && $minsBilled < 20)
+                            <?php
+                            $showAddEntry = 20 - $minsBilled;
+                            $expectation = 20;
+                            ?>
+                        @endif
+                        @if($showAddEntry > 0)
+                            <i class="ml-1 fa fa-hourglass text-danger opacity-60 text-sm"></i>
+                            <div class="ml-1" title="Total expected billing by end of today: {{$expectation}}">
+                                @include('app.practice-management.rpm-manager.rpm_manager_care_month_add_entry_form', [
+                                    'right' => true,
+                                    'defaultDate' => date('Y-m-d'),
+                                    'cmUid' => $iPatient->care_month_uid,
+                                    'cmStartDate' => $iPatient->care_month_start_date,
+                                    'cmEndDate' => $iPatient->care_month_end_date,
+                                    'defaultMins' => $showAddEntry,
+                                    'hook' => 'refresh-' . $iPatient->care_month_uid])
+                            </div>
+                        @endif
+                    @endif
                 </div>
             </td>
         @endif
         @if($viewingAs === 'ADMIN' || $viewingAs === 'RMM')
+            <?php $minsBilled = round($iPatient->rm_total_time_in_seconds_by_rmm_pro / 60); ?>
             <td>
-                <div class="d-flex align-items-baseline">
+                <div class="d-flex align-items-baseline flex-nowrap">
                     <i class="mr-1 text-sm fa fa-circle opacity-35 {{$iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200 ? 'text-success' : 'text-danger'}}"></i>
                     <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>
+                    @if(date('m') == $month && date('Y') == $year && $viewingAs === 'RMM')
+                        <?php
+                        $showAddEntry = 0;
+                        $expectation = 0;
+                        ?>
+                        @if($dayOfTheMonth >= 7 && $minsBilled < 5)
+                            <?php
+                            $showAddEntry = 5 - $minsBilled;
+                            $expectation = 5;
+                            ?>
+                        @elseif($dayOfTheMonth >= 14 && $minsBilled < 10)
+                            <?php
+                            $showAddEntry = 10 - $minsBilled;
+                            $expectation = 10;
+                            ?>
+                        @elseif($dayOfTheMonth >= 21 && $minsBilled < 15)
+                            <?php
+                            $showAddEntry = 15 - $minsBilled;
+                            $expectation = 15;
+                            ?>
+                        @elseif($dayOfTheMonth >= 28 && $minsBilled < 20)
+                            <?php
+                            $showAddEntry = 20 - $minsBilled;
+                            $expectation = 20;
+                            ?>
+                        @endif
+                        @if($showAddEntry > 0)
+                            <i class="ml-1 fa fa-hourglass text-danger opacity-60 text-sm"></i>
+                            <div class="ml-1" title="Total expected billing by end of today: {{$expectation}}">
+                                @include('app.practice-management.rpm-manager.rpm_manager_care_month_add_entry_form', [
+                                    'right' => true,
+                                    'defaultDate' => date('Y-m-d'),
+                                    'cmUid' => $iPatient->care_month_uid,
+                                    'cmStartDate' => $iPatient->care_month_start_date,
+                                    'cmEndDate' => $iPatient->care_month_end_date,
+                                    'defaultMins' => $showAddEntry,
+                                    'hook' => 'refresh-' . $iPatient->care_month_uid])
+                            </div>
+                        @endif
+                    @endif
                 </div>
             </td>
         @endif
         @if($viewingAs === 'ADMIN')
             <td>
-                <div class="d-flex align-items-baseline">
+                <div class="d-flex align-items-baseline flex-nowrap">
                     <i class="mr-1 text-sm fa fa-circle opacity-35 {{$iPatient->rm_total_time_in_seconds >= 1200 ? 'text-success' : 'text-danger'}}"></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 class="ml-1" title="Add Entry">
+                        @include('app.practice-management.rpm-manager.rpm_manager_care_month_add_entry_form', [
+                            'right' => true,
+                            'defaultDate' => date('Y-m-d'),
+                            'cmUid' => $iPatient->care_month_uid,
+                            'cmStartDate' => $iPatient->care_month_start_date,
+                            'cmEndDate' => $iPatient->care_month_end_date,
+                            'hook' => 'refresh-' . $iPatient->care_month_uid])
+                    </div>
                 </div>
             </td>
         @endif

+ 74 - 0
resources/views/app/practice-management/rpm-manager/rpm_manager_care_month_add_entry_form.blade.php

@@ -0,0 +1,74 @@
+<div moe large class="mr-2" id="rpm_manager-cm-entry-form{{@$entry ? '-' . $entry->uid : ''}}">
+    <a start show class="py-0 mb-3">{{@$entry ? 'Edit' : 'Add'}}</a>
+    <form url="/api/careMonthEntry/{{@$entry ? 'updateSimpleForRm' : 'createForRm'}}" {{@$right ? 'right' : ''}} {{@$hook ? 'hook=' . $hook : ''}}>
+        @if(@$entry)
+            <input type="hidden" name="uid" value="{{ $entry->uid }}">
+        @else
+            <input type="hidden" name="careMonthUid" value="{{ $cmUid }}">
+        @endif
+        <div class="mb-2">
+            <div class="row">
+                <div class="col-4 pr-0">
+                    <label class="mb-1 text-sm text-secondary text-left">Pro</label>
+                    <select class="form-control form-control-sm w-100" name="proUid" provider-search data-pro-uid="{{ @$entry ? $entry->pro->uid : ($pro ? $pro->uid : '') }}"
+                            required>
+                        <option value="">-- Select Pro --</option>
+                    </select>
+                </div>
+                <div class="col-4 pr-0">
+                    <?php
+                    $sD = strtotime($cmStartDate);
+                    $y = date('Y', $sD);
+                    $m = date('m', $sD);
+                    $d = date('t', $sD);
+                    $yCurrent = date('Y');
+                    $mCurrent = date('m');
+                    $isToday = false;
+                    if($y === $yCurrent && $m === $mCurrent) {
+                        $d = date('d');
+                        $isToday = true;
+                    }
+                    ?>
+                    <label class="mb-1 text-sm text-secondary text-left">Date</label>
+                    <input autofocus type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}"
+                           value="{{@$entry ? $entry->effective_date : (@$defaultDate ?: $cmEndDate)}}"
+                           class="form-control form-control-sm w-100" name="effectiveDate"
+                           placeholder="Effective Date" required>
+                </div>
+                <div class="col-4">
+                    <label class="mb-1 text-sm text-secondary text-left">Minutes</label>
+                    <select name="timeInSeconds" class="form-control form-control-sm min-width-unset" required>
+                        <option value="">-- select --</option>
+                        @for($i = 0; $i <= 20; $i++)
+                            <option value="{{$i * 60}}" {{@$defaultMins && $defaultMins == $i ? 'selected' : ''}}>{{$i}} min{{$i !== 1 ? 's' : ''}}</option>
+                        @endfor
+                    </select>
+                </div>
+            </div>
+        </div>
+        <div class="mb-2 border border-info p-2 mt-2 bg-light text-left">
+            <span><i class="fa fa-phone rotateh text-dark mr-1"></i>This time entry involved interactive communication (audio, video, or in-person) with the patient and/or caretaker.</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="didProInteractWithClientAboutRm" value="true" {{((@$entry && $entry->did_pro_interact_with_client_about_rm) || @$defaultInteracted) ? 'checked' : ''}} required>
+                    <span>Yes</span>
+                </label>
+                <label class="mt-2 mb-0 d-inline-flex align-items-center">
+                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="false" {{((@$entry && $entry->did_pro_interact_with_client_about_rm) || @$defaultInteracted) ? '' : 'checked' }} required>
+                    <span>No</span>
+                </label>
+            </div>
+        </div>
+        <div class="mb-2">
+            <div class="row">
+                <div class="col-12">
+                    <div cm-rte data-name="contentText">{!! @$entry ? $entry->content_text : (@$defaultComment ?: 'Reviewed/managed patient measurements') !!}</div>
+                </div>
+            </div>
+        </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>