فهرست منبع

Objective forms/data -> rpm data + add entry

Vijayakrishnan 3 سال پیش
والد
کامیت
19307c567e

+ 1 - 0
resources/views/app/patient/care-month/_matrix-v2.blade.php

@@ -40,6 +40,7 @@ foreach ($days as $k => $day) {
     @if($careMonth->is_client_enrolled_in_rm)
         <div class="d-flex align-items-center">
             <h6 class="my-0 text-secondary font-weight-bold text-dark lh-24px">Time Entries</h6>
+            <span class="mx-2 text-secondary">|</span>
             @include('app.practice-management.care_month_add_entry_form', ['right' => false])
         </div>
         <table class="table table-striped table-sm table-bordered mt-2 mb-0 table-hover">

+ 8 - 6
resources/views/app/patient/care-month/_vitals_graph_unified.blade.php

@@ -3,8 +3,8 @@
     <script src="/c3/d3.v5.min.js" charset="utf-8"></script>
     <script src="/c3/c3.min.js"></script>
 
-    <div id="vitalsGraphComponentUnified_{{$careMonth->id}}" class="stag-chart mb-4 pt-3">
-        <div id="unified-chart_{{$careMonth->id}}">Unified Graph</div>
+    <div id="vitalsGraphComponentUnified_{{$careMonth->id}}{{@$suffix ?: ''}}" class="stag-chart mb-4 pt-3">
+        <div id="unified-chart_{{$careMonth->id}}{{@$suffix ?: ''}}"></div>
     </div>
 
     <?php
@@ -91,9 +91,11 @@
                 unifiedChart();
             }
             function unifiedChart() {
-                if(typeof window['vgUnifiedChart_{{$careMonth->id}}'] !== 'undefined') return;
-                window['vgUnifiedChart_{{$careMonth->id}}'] = c3.generate({
-                    bindto: '#unified-chart_{{$careMonth->id}}',
+                $('#vitalsGraphComponentUnified_{{$careMonth->id}}{{@$suffix ?: ''}}')
+                    .empty()
+                    .append('<div id="unified-chart_{{$careMonth->id}}{{@$suffix ?: ''}}"></div>');
+                window['vgUnifiedChart_{{$careMonth->id}}{{@$suffix ?: ''}}'] = c3.generate({
+                    bindto: '#unified-chart_{{$careMonth->id}}{{@$suffix ?: ''}}',
                     data: {
                         xs: {
                             'Systolic BP' : 'x1',
@@ -148,6 +150,6 @@
                     ]
                 });
             }
-            addMCInitializer('vitalsGraphUnified_{{$careMonth->id}}', init, '#vitalsGraphComponentUnified_{{$careMonth->id}}');
+            addMCInitializer('vitalsGraphUnified_{{$careMonth->id}}{{@$suffix ?: ''}}', init, '#vitalsGraphComponentUnified_{{$careMonth->id}}{{@$suffix ?: ''}}');
         }).call(window);
     </script>

+ 3 - 0
resources/views/app/patient/note/dashboard_script.blade.php

@@ -337,6 +337,9 @@
                             visitTreeLink.closest('.note-tree-node').addClass('active');
                         }
 
+                        // to force graph redraw
+                        window.dispatchEvent(new Event('resize'));
+
                         return false;
                     });
 

+ 137 - 1
resources/views/app/patient/segment-templates/omega_objective_system/edit.blade.php

@@ -41,7 +41,7 @@ if (!!@$point->data) {
             $cmStartDate = date('Y-m-01', strtotime($note->effective_dateest));
             $careMonth = \App\Models\CareMonth::where('client_id', $note->client->id)->where('start_date', $cmStartDate)->first();
             ?>
-            @if($careMonth)
+            @if($careMonth && $careMonth->is_client_enrolled_in_rm)
                 <a href="/patients/view/{{ $note->client->uid }}/care-months/view/{{$careMonth->uid}}"
                    class="text-nowrap ml-3"
                    native target="_blank"
@@ -63,6 +63,12 @@ if (!!@$point->data) {
             <span>Remote monitoring data not available.</span>
         </label>
 
+        @if($careMonth && $careMonth->is_client_enrolled_in_rm)
+            <div class="w-75">
+                @include('app.patient.care-month._vitals_graph_unified', ['suffix' => $segment->uid])
+            </div>
+        @endif
+
         <div class="pt-2">
             <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <div class="d-inline-flex align-self-stretch align-items-center">
@@ -76,6 +82,87 @@ if (!!@$point->data) {
     </form>
 </div>
 
+@if($careMonth && $careMonth->is_client_enrolled_in_rm)
+    <div class="p-2">
+        <div class="d-flex align-items-center">
+            <h6 class="my-0 text-secondary font-weight-bold text-dark lh-24px"><span class="text-secondary">RPM time billed:</span> {{time_in_hrminsec($careMonth->rm_total_time_in_seconds_by_mcp)}}</h6>
+            <?php
+            $rmBills = $careMonth->getBillsOfType('RM');
+            $activeRMBill = false;
+            foreach ($rmBills as $rmBill) {
+                if(!$rmBill->is_cancelled && $careMonth->rm_bill_id === $rmBill->id) {
+                    $activeRMBill = $rmBill;
+                    break;
+                }
+            }
+            ?>
+            <span class="mx-2 text-secondary">|</span>
+            @include('app.practice-management.care_month_add_entry_form', [
+                'right' => false,
+                'hook' => 'updateRMSegment',
+                'defaultDate' => $note->effective_dateest,
+                'defaultSeconds' => 120,
+                'defaultInteracted' => true,
+                'defaultComment' => 'I have discussed remote monitoring data to date and encouraged patient to regularly measure and follow the care plan.'
+                ])
+        </div>
+{{--        <table class="table table-striped table-sm table-bordered mt-2 mb-0 table-hover">--}}
+{{--            <thead>--}}
+{{--            <tr>--}}
+{{--                <th class="px-2 text-secondary border-bottom-0">Effective Date</th>--}}
+{{--                <th class="px-2 text-secondary border-bottom-0">Time</th>--}}
+{{--                <th class="px-2 text-secondary border-bottom-0">Created</th>--}}
+{{--                <th class="px-2 text-secondary border-bottom-0">Communicated</th>--}}
+{{--                <th class="px-2 text-secondary border-bottom-0 w-50">Comments</th>--}}
+{{--                <th class="px-2 text-secondary border-bottom-0 delete-column">&nbsp;</th>--}}
+{{--            </tr>--}}
+{{--            </thead>--}}
+{{--            <tbody>--}}
+{{--            @foreach($careMonth->entries as $entry)--}}
+{{--                @if(!$entry->is_removed && $entry->cm_or_rm === "RM")--}}
+{{--                    <tr>--}}
+{{--                        <td class="px-2">--}}
+{{--                            <div class="font-weight-bold">{{friendly_date_time($entry->effective_date, false)}}</div>--}}
+{{--                        </td>--}}
+{{--                        <td class="px-2">--}}
+{{--                            {{time_in_hrminsec($entry->time_in_seconds)}}--}}
+{{--                        </td>--}}
+{{--                        <td class="px-2">--}}
+{{--                            {{friendly_date_time($entry->created_at)}}--}}
+{{--                        </td>--}}
+{{--                        <td class="px-2">--}}
+{{--                            {{$entry->did_pro_interact_with_client_about_rm ? 'Yes' : 'No'}}--}}
+{{--                        </td>--}}
+{{--                        <td class="px-2">--}}
+{{--                            <div class="text-secondary in-table-markup">{!! $entry->content_text !!}</div>--}}
+{{--                            <!--                                        <div class="text-secondary text-sm">{{$entry->content_detail}}</div>-->--}}
+{{--                        </td>--}}
+{{--                        <td class="px-2">--}}
+{{--                            @if(!$activeRMBill)--}}
+{{--                                @include('app.practice-management.care_month_add_entry_form', ['right' => true, 'entry' => $entry])--}}
+{{--                                <div moe relative>--}}
+{{--                                    <a start show class="text-danger">Delete</a>--}}
+{{--                                    <form url="/api/careMonthEntry/remove" right class="text-left">--}}
+{{--                                        <input type="hidden" name="uid" value="{{ $entry->uid }}">--}}
+{{--                                        <p class="small">Are you sure you want to delete this RM 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>--}}
+{{--                            @else--}}
+{{--                                <span class="text-sm text-secondary">Can't modify since a bill exists</span>--}}
+{{--                            @endif--}}
+{{--                        </td>--}}
+{{--                    </tr>--}}
+{{--                @endif--}}
+{{--            @endforeach--}}
+{{--            </tbody>--}}
+{{--        </table>--}}
+    </div>
+@endif
+
 <script>
     (function() {
         window.segmentInitializers.<?= !!@$segment ? $segment->segmentTemplate->internal_name : $segmentInternalName ?> = function () {
@@ -109,6 +196,55 @@ if (!!@$point->data) {
                         parentSegment.find('[if-reviewed-rpm]').removeClass('d-flex').addClass('d-none');
                     }
                 });
+
+            @if($careMonth && $careMonth->is_client_enrolled_in_rm)
+            runMCInitializer('vitalsGraphUnified_{{$careMonth->id}}{{$segment->uid}}');
+            addMCHook('updateRMSegment', function() {
+                refreshSegment('<?= $segment->segmentTemplate->internal_name ?>');
+                return false;
+            });
+            initMoes();
+            initProSuggest();
+            parentSegment.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);
+
+            });
+            @endif
         };
     }).call(window);
 </script>

+ 8 - 8
resources/views/app/practice-management/care_month_add_entry_form.blade.php

@@ -1,7 +1,7 @@
 @if(!$activeRMBill || @$entry)
     <div moe large class="mr-2" id="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' : ''}}>
+        <form url="/api/careMonthEntry/{{@$entry ? 'updateSimpleForRm' : 'createForRm'}}" {{@$right ? 'right' : ''}} {{@$hook ? 'hook=' . $hook : ''}}>
             @if(@$entry)
                 <input type="hidden" name="uid" value="{{ $entry->uid }}">
             @else
@@ -11,7 +11,7 @@
                 <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 : '' }}"
+                        <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>
@@ -32,15 +32,15 @@
                         ?>
                         <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 : $careMonth->end_date}}"
+                               value="{{@$entry ? $entry->effective_date : (@$defaultDate ?: $careMonth->end_date)}}"
                                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>
-                        <input type="hidden" name="timeInSeconds" value="{{@$entry ? $entry->time_in_seconds : ''}}">
+                        <input type="hidden" name="timeInSeconds" value="{{@$entry ? $entry->time_in_seconds : (@$defaultSeconds ?: '')}}">
                         <input type="number" min="1" max="20" name="timeInMinutes" class="form-control form-control-sm w-100 cm-time-value"
-                               value="{{@$entry ? round($entry->time_in_seconds / 60, 0) : ''}}"
+                               value="{{@$entry ? round($entry->time_in_seconds / 60, 0) : (@$defaultSeconds ? $defaultSeconds/60 : '')}}"
                                required>
                     </div>
                 </div>
@@ -49,11 +49,11 @@
                 <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 ? 'checked' : ''}} required>
+                        <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 ? '' : 'checked' }} required>
+                        <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>
@@ -61,7 +61,7 @@
             <div class="mb-2">
                 <div class="row">
                     <div class="col-12">
-                        <div cm-rte data-name="contentText">{!! @$entry ? $entry->content_text : 'Reviewed/managed patient measurements' !!}</div>
+                        <div cm-rte data-name="contentText">{!! @$entry ? $entry->content_text : (@$defaultComment ?: 'Reviewed/managed patient measurements') !!}</div>
                     </div>
                 </div>
             </div>