Samson Mutunga преди 1 година
родител
ревизия
647d4d83ba

+ 6 - 0
app/Models/CareMonth.php

@@ -63,6 +63,12 @@ class CareMonth extends Model
             ->orderBy('effective_date', 'DESC');
     }
 
+    public function ccmEntries() {
+        return $this->hasMany(CareMonthEntry::class, 'care_month_id', 'id')
+            ->whereRaw("(cm_or_rm_or_rtm_msk_or_rtm_lung = 'CM')")
+            ->orderBy('effective_date', 'DESC');
+    }
+
     public function bills() {
         return $this->hasMany(Bill::class, 'care_month_id', 'id');
     }

+ 2 - 0
resources/views/app/patient/care-month/dashboard.blade.php

@@ -712,6 +712,8 @@
 
         @include('app.patient.rm-setup-form')
 
+        @include("app.patient.care-month.partials.ccm")
+
         {{-- rtm msk --}}
         @if($careMonth->is_enrolled_in_rtm_msk)
             <hr class="m-negator my-3">

+ 74 - 0
resources/views/app/patient/care-month/partials/ccm.blade.php

@@ -0,0 +1,74 @@
+{{-- ccm --}}
+<hr class="m-negator my-3">
+<p class="font-weight-bold text-secondary mb-2 font-size-14">Chronic Care Management (CCM)</p>
+<div class="d-flex align-items-center">
+    <span class="mr-2">Is enrolled to CCM? 
+        <b>
+            {{ $careMonth->is_client_enrolled_in_cm ? 'YES' : 'NO' }}
+        </b>
+    </span>
+    <div>
+        @if($careMonth->is_client_enrolled_in_cm)
+            @include("app.patient.care-month.partials.ccm.set-is-enrolled-to-ccm-to-false")
+        @else
+            @include("app.patient.care-month.partials.ccm.set-is-enrolled-to-ccm-to-true")
+        @endif
+    </div>
+</div>
+@if ($careMonth->is_client_enrolled_in_cm)
+    <div class="pl-3">
+        <div class="screen-only mt-3">
+            <div class="d-flex align-items-center">
+                <h6 class="font-weight-bold text-secondary m-0">Time Entries</h6>
+                <span class="mx-2 text-secondary">|</span>
+                @include('app.practice-management.care_month_add_ccm_entry_form', [
+                    'right' => false,
+                    'type' => 'CM',
+                    'label' => 'Add for CCM',
+                ])
+            </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 w-50">Comments</th>
+                        <th class="px-2 text-secondary border-bottom-0 delete-column">&nbsp;</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach ($careMonth->ccmEntries as $entry)
+                        @if (!$entry->is_removed && $entry->cm_or_rm_or_rtm_msk_or_rtm_lung == 'CM')
+                            <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">
+                                    <div class="text-secondary in-table-markup">{!! $entry->content_text !!}</div>
+                                </td>
+                                <td class="px-2">
+                                    @include('app.practice-management.care_month_add_ccm_entry_form', [
+                                        'right' => true,
+                                        'type' =>
+                                            $entry->cm_or_rm_or_rtm_msk_or_rtm_lung,
+                                        'entry' => $entry,
+                                    ])
+                                </td>
+                            </tr>
+                        @endif
+                    @endforeach
+                    @php $entry = null; @endphp
+                </tbody>
+            </table>
+        </div>
+    </div>
+
+@endif

+ 14 - 0
resources/views/app/patient/care-month/partials/ccm/set-is-enrolled-to-ccm-to-false.blade.php

@@ -0,0 +1,14 @@
+<div moe wide class="">
+    <a class="" href="" show start>Undo Enroll</a>
+    <form url="/api/careMonth/setIsClientEnrolledInCmToFalse">
+        <input type="hidden" name="uid" value="{{ $careMonth->uid }}">
+        <div class="mb-2">
+            <label>Are you sure?</label>
+        </div>
+
+        <div class="">
+            <button class="btn btn-danger btn-sm" submit>Undo Enroll to CCM</button>
+            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+        </div>
+    </form>
+</div>

+ 14 - 0
resources/views/app/patient/care-month/partials/ccm/set-is-enrolled-to-ccm-to-true.blade.php

@@ -0,0 +1,14 @@
+<div moe wide class="">
+    <a class="" href="" show start>Enroll</a>
+    <form url="/api/careMonth/setIsClientEnrolledInCmToTrue">
+        <input type="hidden" name="uid" value="{{ $careMonth->uid }}">
+        <div class="mb-2">
+            <label>Are you sure?</label>
+        </div>
+
+        <div class="">
+            <button class="btn btn-primary btn-sm" submit>Enroll to CCM</button>
+            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+        </div>
+    </form>
+</div>

+ 87 - 0
resources/views/app/practice-management/care_month_add_ccm_entry_form.blade.php

@@ -0,0 +1,87 @@
+<div moe large id="cm-entry-form{{@$entry ? '-' . $entry->uid : ''}}">
+    <a start show class="py-0 mb-3">{{@$entry ? 'Edit' : (@$label ?: 'Add')}}</a> 
+    <form url="/api/careMonthEntry/{{@$entry ? 'updateSimpleForCm' : 'createForCm'}}" {{@$right ? 'right' : ''}} {{@$hook ? 'hook=' . $hook : ''}}>
+        @if(@$entry)
+            <input type="hidden" name="uid" value="{{ $entry->uid }}">
+        @else
+            <input type="hidden" name="careMonthUid" value="{{ $careMonth->uid }}">
+        @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($careMonth->start_date);
+                    $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 ?: $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 : (@$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) : (@$defaultSeconds ? $defaultSeconds/60 : '')}}"
+                           required>
+                </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 patient feedback regarding ' . $type . ' instructions.') !!}</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>
+<script>
+    (function() {
+        function init() {
+            $(document)
+                .off('input change paste keyup', '[name="timeInMinutes"]')
+                .on('input change paste keyup', '[name="timeInMinutes"]', function() {
+                    let form = $(this).closest('form'), val = '' + $(this).val();
+                    if(!isNaN(val)) {
+                        form.find('[name="timeInSeconds"]').val(+val * 60);
+                    }
+                });
+        }
+        addMCInitializer('cm-entry-form{{@$entry ? '-' . $entry->uid : ''}}', init, '#cm-entry-form{{@$entry ? '-' . $entry->uid : ''}}');
+    }).call(window);
+</script>