浏览代码

RTM UI (wip)

Vijayakrishnan 2 年之前
父节点
当前提交
635b5fb7fc

+ 13 - 1
app/Models/CareMonth.php

@@ -36,7 +36,15 @@ class CareMonth extends Model
     }
 
     public function entries() {
-        return $this->hasMany(CareMonthEntry::class, 'care_month_id', 'id')->orderBy('effective_date', 'DESC');
+        return $this->hasMany(CareMonthEntry::class, 'care_month_id', 'id')
+            ->where('cm_or_rm_or_rtm_msk_or_rtm_lung', 'RM')
+            ->orderBy('effective_date', 'DESC');
+    }
+
+    public function rtmEntries() {
+        return $this->hasMany(CareMonthEntry::class, 'care_month_id', 'id')
+            ->whereRaw("(cm_or_rm_or_rtm_msk_or_rtm_lung = 'RTM_MSK' OR cm_or_rm_or_rtm_msk_or_rtm_lung = 'RTM_LUNG')")
+            ->orderBy('effective_date', 'DESC');
     }
 
     public function bills() {
@@ -288,4 +296,8 @@ class CareMonth extends Model
         }
 
     }
+
+    public function rtmTransmissions() {
+        return $this->hasMany(ClientRtmTransmission::class, 'care_month_id', 'id')->orderBy('effective_date', 'DESC');
+    }
 }

+ 13 - 0
app/Models/ClientRtmTransmission.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ClientRtmTransmission extends Model
+{
+
+    protected $table = "client_rtm_transmission";
+
+    //
+}

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

@@ -56,7 +56,7 @@ foreach ($days as $k => $day) {
             </thead>
             <tbody>
             @foreach($careMonth->entries as $entry)
-                @if(!$entry->is_removed && $entry->cm_or_rm === "RM")
+                @if(!$entry->is_removed && $entry->cm_or_rm_or_rtm_msk_or_rtm_lung === "RM")
                     <tr>
                         <td class="px-2">
                             <div class="font-weight-bold">{{friendly_date_time($entry->effective_date, false)}}</div>

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

@@ -685,6 +685,100 @@
 
         @include('app.patient.rm-setup-form')
 
+        {{-- rtm --}}
+        @if($careMonth->is_enrolled_in_rtm_msk || $careMonth->is_enrolled_in_rtm_lung)
+            <hr class="m-negator my-3">
+
+            <div class="screen-only">
+                <div class="d-flex align-items-center mb-2">
+                    <p class="font-weight-bold text-secondary m-0 font-size-14">RTM Transmissions</p>
+                </div>
+                <?php $transmissions = $careMonth->rtmTransmissions; ?>
+                <table class="table table-striped table-sm table-bordered mt-2 mb-0">
+                    <thead>
+                    <tr>
+                        <th class="text-secondary border-bottom-0">Effective Date</th>
+                        <th class="text-secondary border-bottom-0">Category</th>
+                        <th class="text-secondary border-bottom-0">Instructions</th>
+                        <th class="text-secondary border-bottom-0">Response</th>
+                        <th class="text-secondary border-bottom-0">Stamp</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @if(!$transmissions || !count($transmissions))
+                        <tr>
+                            <td class="text-secondary p-0 border-0">
+                                No items to show
+                            </td>
+                        </tr>
+                    @else
+                        @foreach($transmissions as $transmission)
+                            <tr>
+                                <td>{{friendly_date($transmission->effective_date)}}</td>
+                                <td>{{$transmission->msk_or_lung}}</td>
+                                <td>{{$transmission->protocol_detail_json}}</td>
+                                <td>{{$transmission->feedback_detail_json}}</td>
+                                <td></td>
+                            </tr>
+                        @endforeach
+                    @endif
+                    </tbody>
+                </table>
+            </div>
+
+            {{-- rtm time entries --}}
+            <hr class="m-negator my-3">
+
+            <div class="screen-only">
+                <div class="d-flex align-items-center">
+                    <h6 class="font-weight-bold text-secondary m-0 font-size-14">RTM Time Entries</h6>
+                    @if($careMonth->is_enrolled_in_rtm_msk)
+                        <span class="mx-2 text-secondary">|</span>
+                        @include('app.practice-management.care_month_add_rtm_entry_form', ['right' => false, 'type' => 'MSK', 'label' => 'Add for MSK'])
+                    @endif
+                    @if($careMonth->is_enrolled_in_rtm_lung)
+                        <span class="mx-2 text-secondary">|</span>
+                        @include('app.practice-management.care_month_add_rtm_entry_form', ['right' => false, 'type' => 'LUNG', 'label' => 'Add for Lung'])
+                    @endif
+                </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->rtmEntries as $entry)
+                        @if(!$entry->is_removed)
+                            <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_rtm_entry_form', ['right' => true, 'type' => ($entry->cm_or_rm_or_rtm_msk_or_rtm_lung === 'RTM_MSK' ? 'MSK' : 'LUNG'), 'entry' => $entry])
+                                </td>
+                            </tr>
+                        @endif
+                    @endforeach
+                    </tbody>
+                </table>
+            </div>
+
+        @endif
+
         @if($pro->pro_type === 'ADMIN')
 
             <hr class="m-negator my-3">

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

@@ -0,0 +1,87 @@
+<div moe large id="cm-rtm-entry-form{{@$entry ? '-' . $entry->uid : ''}}">
+    <a start show class="py-0 mb-3">{{@$entry ? 'Edit' : (@$label ?: 'Add')}}</a>
+    <form url="/api/careMonthEntry/{{@$entry ? 'updateSimpleFor' . ($type === 'MSK' ? 'Msk' : 'Lung') : 'createForRtm' . ($type === 'MSK' ? 'Msk' : 'Lung')}}" {{@$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 . ' RTM 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-rtm-entry-form{{@$entry ? '-' . $entry->uid : ''}}', init, '#cm-rtm-entry-form{{@$entry ? '-' . $entry->uid : ''}}');
+    }).call(window);
+</script>