Selaa lähdekoodia

added canvas migrate

Josh 3 vuotta sitten
vanhempi
commit
c3341626b6

+ 33 - 0
app/Http/Controllers/PatientController.php

@@ -79,6 +79,39 @@ class PatientController extends Controller
             compact('patient', 'facilities', 'devices', 'dxInfoLines'));
     }
 
+    public function canvasMigrate(Request $request, Client $patient )
+    {
+        $mcpPros = Pro::where('is_enrolled_as_mcp', true)->get();
+        $facilities = []; // Facility::where('is_active', true)->get();
+
+        // get assigned devices
+        $assignedDeviceIDs = DB::select(DB::raw("SELECT device_id from client_bdt_device where is_active = true"));
+        $assignedDeviceIDs = array_map(function($_x) {
+            return $_x->device_id;
+        }, $assignedDeviceIDs);
+
+        // get all except assigned ones
+        $devices = BDTDevice::where('is_active', true)
+            ->whereNotIn('id', $assignedDeviceIDs)
+            ->orderBy('imei', 'asc')
+            ->get();
+
+        $assignedDeviceIDs = null;
+        unset($assignedDeviceIDs);
+
+        $dxInfoLines = ClientInfoLine::where('client_id', $patient->id)
+            ->where('category', 'dx')
+            ->where('is_removed', false)
+            ->orderBy('content_text', 'asc')
+            ->get();
+        return view('app.patient.canvas-migrate',
+            compact('patient', 'facilities', 'devices', 'dxInfoLines'));
+    }
+
+    public function canvas(Request $request, Client $patient){
+        return view('app.patient.canvas_dump', compact('patient'));
+    }
+
     public function actionItems(Request $request, Client $patient )
     {
         $facilities = []; // Facility::where('is_active', true)->get();

+ 421 - 0
resources/views/app/patient/canvas-migrate.blade.php

@@ -0,0 +1,421 @@
+@extends ('layouts.patient')
+
+@section('inner-content')
+    <?php
+    $shortCutsObject = [];
+    foreach ($pro->allShortcuts() as $shortcut) {
+
+        // %replaceables%
+        $shortcut->text = str_replace("%AGE%", $patient->age_in_years, $shortcut->text);
+        $shortcut->text = str_replace("%GENDER%", $patient->sex, $shortcut->text);
+        $shortcut->text = str_replace("%NAME%", $patient->displayName(), $shortcut->text);
+
+        $shortCutsObject[] = [
+            "name" => $shortcut->shortcut,
+            "value" => $shortcut->text
+        ];
+    }
+    ?>
+    <script>window.userShortcuts = <?= json_encode($shortCutsObject); ?>;</script>
+    <link href="/select2/select2.min.css" rel="stylesheet" />
+    <script src="/select2/select2.min.js"></script>
+    <div>
+
+        {{-- CARE PLAN START --}}
+        <?php $infoLines = json_decode($patient->info_lines);?>
+        <?php $infoLines = !$infoLines ? [] : $infoLines; ?>
+        <?php $vitalLabels = ['Ht. (in.)','Wt. (lbs.)','Temp. (F)','Pulse','Resp.','Pulse Ox.','SBP','DBP','Smoking Status', 'BMI']; ?>
+        <?php $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_create($patient->created_at))->invert === 1); ?>
+
+	    <div class="row client-single-dashboard">
+            <div class="col-6">
+
+                {{-- canvas based allergies --}}
+                @if($isOldClient)
+                <div class="pt-2 mt-2 border-top">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Allergies</h6>
+                        <div class="px-2 font-weight-bold alert alert-warning text-sm my-0 ml-2 py-1">Deprecated</div>
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @include('app.patient.canvas-sections.allergies.summary')
+                    </div>
+                </div>
+                @endif
+
+                {{-- canvas based dx --}}
+                @if($isOldClient)
+                    <div class="pt-2 mt-2 border-top">
+                        <div class="d-flex align-items-center pb-2">
+                            <h6 class="my-0 font-weight-bold text-secondary">Current Problems / Focus Areas</h6>
+                            <div class="px-2 font-weight-bold alert alert-warning text-sm my-0 ml-2 py-1">Deprecated</div>
+                        </div>
+                        <div class="bg-light border p-2 mb-3">
+                            @include('app.patient.canvas-sections.dx.summary')
+                        </div>
+                    </div>
+                @endif
+
+
+
+                {{-- canvas based rx --}}
+                @if($isOldClient)
+                <div class="pt-2 mt-2 border-top">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Current Medications</h6>
+                        <div class="px-2 font-weight-bold alert alert-warning text-sm my-0 ml-2 py-1">Deprecated</div>
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @include('app.patient.canvas-sections.rx.summary')
+                    </div>
+                </div>
+                @endif
+
+                {{-- canvas based careteam --}}
+                @if($isOldClient)
+                    <div class="pt-2 mt-2 border-top">
+                        <div class="d-flex align-items-center pb-2">
+                            <h6 class="my-0 font-weight-bold text-secondary">Care Team</h6>
+                            <div class="px-2 font-weight-bold alert alert-warning text-sm my-0 ml-2 py-1">Deprecated</div>
+                        </div>
+                        <div class="bg-light border p-2 mb-3">
+                            @include('app.patient.canvas-sections.care-team.summary')
+                        </div>
+                    </div>
+                @endif
+
+                {{-- history_medical --}}
+                @if($isOldClient)
+                    <div class="pt-2 mt-2 border-top">
+                        <div class="d-flex align-items-center pb-2">
+                            <h6 class="my-0 font-weight-bold text-secondary">Medical History</h6>
+                            <div class="px-2 font-weight-bold alert alert-warning text-sm my-0 ml-2 py-1">Deprecated</div>
+                        </div>
+                        <div class="bg-light border p-2 mb-3">
+                            @include('app.patient.canvas-sections.pmhx.summary')
+                        </div>
+                    </div>
+                @endif
+
+                {{-- history_surgical --}}
+                @if($isOldClient)
+                    <div class="mt-2 border-top pt-2">
+                        <div class="d-flex align-items-center pb-2">
+                            <h6 class="my-0 font-weight-bold text-secondary">Surgical History</h6>
+                            <div class="px-2 font-weight-bold alert alert-warning text-sm my-0 ml-2 py-1">Deprecated</div>
+                        </div>
+                        <div class="bg-light border p-2 mb-3">
+                            @include('app.patient.canvas-sections.pshx.summary')
+                        </div>
+                    </div>
+                @endif
+
+                {{-- history_family --}}
+                @if($isOldClient)
+                    <div class="mt-2 border-top pt-2">
+                        <div class="d-flex align-items-center pb-2">
+                            <h6 class="my-0 font-weight-bold text-secondary">Family History</h6>
+                            <div class="px-2 font-weight-bold alert alert-warning text-sm my-0 ml-2 py-1">Deprecated</div>
+                        </div>
+                        <div class="bg-light border p-2 mb-3">
+                            @include('app.patient.canvas-sections.fhx.summary')
+                        </div>
+                    </div>
+                @endif
+
+                {{-- history_social --}}
+                @if($isOldClient)
+                    <div class="mt-2 border-top pt-2">
+                        <div class="d-flex align-items-center pb-2">
+                            <h6 class="my-0 font-weight-bold text-secondary">Social History</h6>
+                            <div class="px-2 font-weight-bold alert alert-warning text-sm my-0 ml-2 py-1">Deprecated</div>
+                        </div>
+                        <div class="bg-light border p-2 mb-3">
+                            @include('app.patient.canvas-sections.sochx.summary')
+                        </div>
+                    </div>
+                @endif
+
+
+                {{-- vitals --}}
+                {{--@include('app/patient/partials/vitals')--}}
+
+                {{-- canvas based vitals --}}
+                @if($isOldClient)
+                <div class="pt-2 border-top">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Vitals</h6>
+                        <div class="px-2 font-weight-bold alert alert-warning text-sm my-0 ml-2 py-1">Deprecated</div>
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @include('app.patient.canvas-sections.vitals.summary')
+                    </div>
+                </div>
+                @endif
+
+            </div>
+            <div class="col-6">
+
+                <!-- allergies - point -->
+                @include('app.patient.point-based-partials.allergies')
+
+
+                <!-- probs - point -->
+                @include('app.patient.point-based-partials.dx')
+
+                <!-- meds - point -->
+                @include('app.patient.point-based-partials.rx')
+
+
+                <!-- careteam - point -->
+                @include('app.patient.point-based-partials.care-team')
+
+
+                <!-- pmhx - point -->
+                @include('app.patient.point-based-partials.pmhx')
+
+                <!-- pshx - point -->
+                @include('app.patient.point-based-partials.shx')
+
+                <!-- fhx - point -->
+                @include('app.patient.point-based-partials.fhx')
+
+
+                <!-- sochx - point -->
+                @include('app.patient.point-based-partials.sochx')
+
+                <!-- vitals - point -->
+                <?php $latestVitals = \App\Models\Point::where('client_id', $patient->id)->where('category', 'VITALS')->orderBy('id', 'DESC')->first(); ?>
+                <div class="pt-2 mt-2">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Vitals
+                            @if(!!$latestVitals && $latestVitals->note && $latestVitals->note->effective_dateest)
+                                <span class="text-secondary font-weight-normal pl-1">(as on
+                                    <a href="{{route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $latestVitals->note])}}">{{friendlier_date($latestVitals->note->effective_dateest)}}</a>)
+                                </span>
+                            @endif
+                        </h6>
+                        @if($isOldClient)
+                            <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
+                        @endif
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @if(!!$latestVitals)
+                            @include('app.patient.partials.latest-vitals', ['patient' => $patient, 'point' => $latestVitals])
+                        @else
+                            <div class="text-secondary">Nothing here yet</div>
+                        @endif
+                    </div>
+                </div>
+
+
+            </div>
+        </div>
+        <?php /* <div class="row my-3">
+            <div class="col-12">
+                {{-- erx --}}
+                <div  class="mb-2 pt-3 pb-2 border-top">
+                    <style>
+                        td.fit {
+                            width:1%;
+                            white-space:nowrap;
+                        }
+                    </style>
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">ERx</h6>
+                        <span class="mx-2 text-secondary">|</span>
+                        <div moe>
+                            <a start show class="py-0 font-weight-normal">Add</a>
+                            <form url="/api/actionItem/create" wide>
+                                <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+                                <input type="hidden" name="prescriberProUid" value="{{ $pro->uid }}">
+                                <input type="hidden" name="category" value="DRUG">
+                                <div class="mb-2">
+                                    <label for="" class="control-label text-sm text-secondary mb-1">Pharmacy</label>
+                                    <select name="toFacilityUid"
+                                            class="form-control form-control-sm">
+                                        <option value="">-- Pharmacy --</option>
+                                        @foreach ($facilities as $facility)
+                                            <option value="{{$facility->uid}}">{{$facility->name}}</option>
+                                        @endforeach
+                                    </select>
+                                </div>
+                                <div class="mb-2">
+                                    <input type="text" class="form-control form-control-sm" name="contentText" value="" placeholder="Title *" required>
+                                </div>
+                                <div class="mb-2">
+                                    <input type="text" class="form-control form-control-sm" name="contentDetail" value="" placeholder="Directions">
+                                </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>
+                    </div>
+                    <table class="table table-sm table-bordered mb-0" style="table-layout: fixed">
+                        <thead>
+                        <tr>
+                            <th class="px-2 text-secondary border-bottom-0 w-25">Prescription</th>
+                            <th class="px-2 text-secondary border-bottom-0 fit">Created</th>
+                            <th class="px-2 text-secondary border-bottom-0 fit">Status</th>
+                            <th class="px-2 text-secondary border-bottom-0 fit">Pharmacy</th>
+                            <th class="px-2 text-secondary border-bottom-0">&nbsp;</th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <?php $prevItemType = false; ?>
+                        @foreach($patient->actionItems as $item)
+                            @if($item->action_item_category === 'DRUG')
+                                <tr>
+                                    <td class="px-2">
+                                        {{$item->content_text}}
+                                        <span moe>
+                                        <a start show class="on-hover-opaque"><i class="fa fa-edit"></i></a>
+                                        <form url="/api/actionItem/updateContent" wide>
+                                            <input type="hidden" name="uid" value="{{ $item->uid }}">
+                                            <div class="mb-2">
+                                                <input type="text" class="form-control form-control-sm" name="contentText" value="{{ $item->content_text }}" placeholder="Title *" required>
+                                            </div>
+                                            <div class="mb-2">
+                                                <input type="text" class="form-control form-control-sm" name="contentDetail" value="{{ $item->content_detail }}" placeholder="Details">
+                                            </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>
+                                    </span>
+                                        <div class="text-sm text-secondary">{{$item->content_detail}}</div>
+                                    </td>
+                                    <td class="px-2">{{friendly_date_time($item->created_at, false)}}</td>
+                                    <td class="px-2">
+                                        {{ucwords($item->status_category)}}
+                                        <span moe>
+                                        <a start show class="on-hover-opaque"><i class="fa fa-edit"></i></a>
+                                        <form url="/api/actionItem/updateStatus">
+                                            <input type="hidden" name="uid" value="{{ $item->uid }}">
+                                            <div class="mb-2">
+                                                <label for="" class="control-label text-sm text-secondary mb-1">Status *</label>
+                                                <select name="statusCategory" class="form-control form-control-sm" required>
+                                                    <option {{ $item->status_category === 'OPEN' ? 'selected' : '' }} value="OPEN">Open</option>
+                                                    <option {{ $item->status_category === 'CLOSED' ? 'selected' : '' }} value="CLOSED">Closed</option>
+                                                </select>
+                                            </div>
+                                            <div class="mb-2">
+                                                <input type="text" class="form-control form-control-sm" name="statusMemo" value="" placeholder="Memo">
+                                            </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>
+                                    </span>
+                                    </td>
+                                    <td class="px-2">
+                                        {{$item->facility ? $item->facility->name : ''}}
+                                        <span moe>
+                                        <a start show class="on-hover-opaque"><i class="fa fa-edit"></i></a>
+                                        <form url="/api/actionItem/updateToFacility">
+                                            <input type="hidden" name="uid" value="{{ $item->uid }}">
+                                            <div class="mb-2">
+                                                <label for="" class="control-label text-sm text-secondary mb-1">Pharmacy *</label>
+                                                <select name="toFacilityUid" class="form-control form-control-sm" required>
+                                                    <option value="">-- Pharmacy --</option>
+                                                    @foreach ($facilities as $facility)
+                                                        <option {{ $item->to_facility_id === $facility->id ? 'selected' : '' }} value="{{$facility->uid}}">{{$facility->name}}</option>
+                                                    @endforeach
+                                                </select>
+                                            </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>
+                                    </span>
+                                    </td>
+                                    <td class="px-2 text-center">
+                                        <div class="d-flex align-items-center justify-content-start">
+                                            @if($item->is_signed_by_prescriber)
+                                                <span class="text-secondary">
+                                            <i class="fa fa-check"></i>
+                                            Signed
+                                        </span>
+                                                <span class="mx-2 text-secondary">|</span>
+                                            @else
+                                                @if($pro->id === $item->prescriber_pro_id)
+                                                    <span moe relative>
+                                                <a start show>Sign</a>
+                                                <form url="/api/actionItem/signAsPrescriber" right>
+                                                    <input type="hidden" name="uid" value="{{ $item->uid }}">
+                                                    <p class="small min-width-200px text-left">Sign this action items as the prescriber?</p>
+                                                    <div class="d-flex align-items-center">
+                                                        <button class="btn btn-sm btn-success mr-2" submit>Yes</button>
+                                                        <button class="btn btn-sm btn-default mr-2 border" cancel>No</button>
+                                                    </div>
+                                                </form>
+                                            </span>
+                                                    <span class="mx-2 text-secondary">|</span>
+                                                @endif
+                                            @endif
+                                            <span moe relative>
+                                        <a start show>eFax</a>
+                                        <form url="/api/actionItem/efax" right>
+                                            <input type="hidden" name="uid" value="{{ $item->uid }}">
+                                            <div class="mb-2">
+                                                <input type="text" class="form-control form-control-sm" name="toFaxNumber" value="" placeholder="To Number *" required>
+                                            </div>
+                                            <div class="d-flex align-items-center">
+                                                <button class="btn btn-sm btn-primary mr-2" submit>Send</button>
+                                                <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                            </div>
+                                        </form>
+                                    </span>
+                                        </div>
+                                    </td>
+                                </tr>
+                            @endif
+                        @endforeach
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div> */ ?>
+
+    </div>
+    <script>
+        (function() {
+            function init() {
+                $('select[name="deviceUid"]').select2({
+                    width: '100%'
+                });
+
+                // refresh once ticket popup is closed
+                $('body').off('stag-popup-closed')
+                /*$('body').on('stag-popup-closed', function() {
+                    if($('#client-rx-container').length) {
+                        fastReload();
+                    }
+                });*/
+                // ticket-popup
+                $(document)
+                    .off('click', '.ticket-popup-trigger')
+                    .on('click', '.ticket-popup-trigger', function() {
+                        showMask();
+                        window.noMc = true;
+                        $.get(this.href, (_data) => {
+                            $('.ticket-popup').html(_data);
+                            showStagPopup('ticket-popup', true);
+                            // $('.ticket-popup .stag-popup.stag-slide').attr('close-all-with-self', 1);
+                            runMCInitializer('patient-tickets'); // run specific mc initer
+                            hideMask();
+                        });
+                        return false;
+                    });
+
+            }
+            addMCInitializer('patient-dashboard-devices', init, '#patient-dashboard-devices');
+
+        }).call(window);
+    </script>
+@endsection

+ 11 - 0
resources/views/app/patient/canvas_dump.blade.php

@@ -0,0 +1,11 @@
+@extends ('layouts.patient')
+@section('inner-content')
+<div>
+    @php
+        $canvasDataJson = $patient->canvas_data ?? '[]';
+        $canvasData = json_decode($canvasDataJson);
+        dump($canvasData);
+    @endphp
+    {{$patient->canvas_data}}
+</div>
+@endsection

+ 10 - 0
resources/views/layouts/patient.blade.php

@@ -22,6 +22,16 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 							<a class="nav-link {{ strpos($routeName, 'patients.view.dashboard') === 0 ? 'active' : '' }}"
 							   href="{{ route('patients.view.dashboard', ['patient' => $patient]) }}">Dashboard</a>
 						</li>
+                        @if($performer->pro->pro_type == 'ADMIN')
+                            <li class="nav-item">
+                                <a class="nav-link {{ strpos($routeName, 'patients.view.migrate-canvas') === 0 ? 'active' : '' }}"
+                                   href="{{ route('patients.view.migrate-canvas', ['patient' => $patient]) }}">Canvas Migrate</a>
+                            </li>
+                            <li class="nav-item">
+                                <a class="nav-link {{ strpos($routeName, 'patients.view.canvas') === 0 ? 'active' : '' }}"
+                                   href="{{ route('patients.view.canvas', ['patient' => $patient]) }}">Canvas</a>
+                            </li>
+                        @endif
 						<li class="nav-item">
 							<a class="nav-link {{ strpos($routeName, 'patients.view.calendar') === 0 ? 'active' : '' }}"
 							   href="{{ route('patients.view.calendar', ['patient' => $patient]) }}">Calendar</a>

+ 4 - 2
routes/web.php

@@ -20,7 +20,6 @@ use Illuminate\Support\Facades\Route;
  * -> they are authenticated in... see the home dashboard... logout button to -> /login
  */
 
-
 Route::get('login', 'LoginController@showLoginForm')->name('login');
 Route::post('login', 'LoginController@login');
 Route::get('logout', 'LoginController@logout');
@@ -287,8 +286,11 @@ Route::middleware('pro.auth')->group(function () {
 
         Route::middleware('pro.auth.can-access-patient')->group(function () {
 
-            Route::get('intake', 'PatientController@intake')->name('intake');
             Route::get('', 'PatientController@dashboard')->name('dashboard');
+            Route::get('canvas-migrate', 'PatientController@canvasMigrate')->name('migrate-canvas');
+            Route::get('intake', 'PatientController@intake')->name('intake');
+            Route::get('canvas', 'PatientController@canvas')->name('canvas');
+            Route::get('intake', 'PatientController@intake')->name('intake');
             Route::get('care-plan', 'PatientController@carePlan')->name('care-plan');
             Route::get('medications', 'PatientController@medications')->name('medications');
             Route::get('dx-and-focus-areas', 'PatientController@dxAndFocusAreas')->name('dx-and-focus-areas');