Samson Mutunga 1 年間 前
コミット
eb0dcda193

+ 1 - 1
app/Http/Controllers/ClientProAccessController.php

@@ -78,6 +78,6 @@ class ClientProAccessController extends Controller
         $performer = $this->performer();
         $pro = $performer->pro;
         $reviewRequests = ClientReviewRequest::where('pro_id', $pro->id)->where('is_active', true)->orderBy('created_at', 'DESC')->paginate(50);
-        return view('app.ps.review-requests.list', compact('reviewRequests', 'hideTitle'));
+        return view('app.ca.review-requests.list', compact('reviewRequests', 'hideTitle'));
     }
 }

+ 2 - 0
app/Http/Controllers/HomeController.php

@@ -1394,6 +1394,8 @@ WHERE cl.shadow_pro_id IS NULL
             return redirect()->route('ps.dashboard');
         }elseif($pro->is_considered_for_dna){
             return $this->dashboard_DNA($request);
+        }elseif($pro->is_considered_for_rd_assignment){
+            return redirect()->route('rd.dashboard'); 
         }else{
             return redirect()->route('ca.dashboard'); 
         }

+ 84 - 0
app/Http/Controllers/RdController.php

@@ -0,0 +1,84 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Models\Client;
+use App\Models\ClientProAccess;
+use App\Models\ClientReviewRequest;
+use Illuminate\Http\Request;
+class RdController extends Controller
+{
+
+    public function dashboard(Request $request){
+        $performer = $this->performer();
+        $pro = $performer->pro;
+        $performerProID = $performer->pro->id;
+
+        $milliseconds = strtotime(date('Y-m-d')) . '000'; //required by the calendar
+        return view('app.rd.dashboard', compact( 'milliseconds'));
+    }
+
+    public function patients(Request $request)
+    {
+        $filters = $request->all();
+        $pro = $this->performer->pro;
+        $patients = Client::where('rd_pro_id', $pro->id);
+
+        $proAccessClientIDs = ClientProAccess::where('pro_id', $pro->id)->pluck('client_id')->toArray();
+        $patients = $patients->orWhereIn('id', $proAccessClientIDs);
+
+
+        if ($request->input('name')) {
+            $name = trim($request->input('name'));
+            if ($name) {
+                $patients = $patients->where(function ($q) use ($name) {
+                    $q->where('name_first', 'ILIKE', '%' . $name . '%')
+                        ->orWhere('name_last', 'ILIKE', '%' . $name . '%');
+                });
+            }
+        }
+
+        if ($request->input('home_address_state')) {
+
+            if($request->input('home_address_state') == 'NONE'){
+                $patients = $patients->whereNull('mailing_address_state');
+            }else if($request->input('home_address_state') == 'NOT_MD'){
+                $patients = $patients->where('mailing_address_state', '<>' , 'MD');
+            }else{
+                $patients = $patients->where('mailing_address_state', '=' , $request->input('home_address_state'));
+            }
+        }
+
+        $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2', false);
+        $this->filterSimpleQuery($request, $patients, 'sex', 'sex');
+        $this->filterMultiQuery($request, $patients, 'usual_bmi_max', 'bmi_category', 'bmi_value_1', 'bmi_value_2', false);
+        $this->filterMultiQuery($request, $patients, 'most_recent_completed_mcp_note_date', 'last_visit_category', 'last_visit_value_1', 'last_visit_value_2'); 
+        $this->filterMultiQuery($request, $patients, 'next_mcp_appointment_date', 'next_appointment_category', 'next_appointment_value_1', 'next_appointment_value_2');
+
+        switch($request->input('status')) {
+            case 'ACTIVE':
+                $patients->where('is_active', true)->where('has_mcp_done_onboarding_visit', true);
+                break;
+            case 'AWAITING_VISIT':
+                $patients->where('is_active', true)->where('has_mcp_done_onboarding_visit', false);
+                break;
+            case 'INACTIVE':
+                $patients->where('is_active', '<>', true);
+                break;
+        }
+        $sortBy = $request->input('sort_by') ?: 'name_first';
+        $sortDir = $request->input('sort_dir') ?: 'ASC';
+
+        $patients = $patients->orderByRaw("$sortBy $sortDir NULLS LAST");
+        
+        $patients = $patients->orderBy('created_at', 'DESC')->paginate(20);
+        return view('app.rd.patients', compact('patients', 'filters'));
+    }
+    public function clientReviewRequests(Request $request){
+        $hideTitle = $request->get('hideTitle');
+        $performer = $this->performer();
+        $pro = $performer->pro;
+        $reviewRequests = ClientReviewRequest::where('pro_id', $pro->id)->where('is_active', true)->orderBy('created_at', 'DESC')->paginate(50);
+        return view('app.rd.review-requests.list', compact('reviewRequests', 'hideTitle'));
+    }
+}

+ 75 - 0
resources/views/app/ca/review-requests/list.blade.php

@@ -0,0 +1,75 @@
+@extends ('layouts.template')
+@section('content')
+<div class="p-3 mcp-theme-1">
+    <div class="">
+        @if(!@$hideTitle)
+        <div class="d-flex align-items-center pb-2">
+            <h4 class="font-weight-bold mb-0 mr-3">Review Requests</h4>
+        </div>
+        @endif
+        <table class="table table-striped table-sm table-bordered">
+            <thead class="bg-light">
+                <tr>
+                    <th class="border-0 text-secondary text-nowrap">Created At</th>
+                    <th class="border-0 text-secondary text-nowrap">Chart #</th>
+                    <th class="border-0 text-secondary text-nowrap">Patient</th>
+                    <th class="border-0 text-secondary">Scoped Month Start Date</th>
+                    <th class="border-0 text-secondary">Access Start Date</th>
+                    <th class="border-0 text-secondary">Access End Date</th>
+                    <th class="border-0 text-secondary">Pro</th>
+                    <th class="border-0 text-secondary">Created By</th>
+                    <th class="border-0 text-secondary">Is Active</th>
+                    <th class="border-0 text-secondary">Status</th>
+                </tr>
+            </thead>
+            <tbody>
+                @foreach($reviewRequests as $rr)
+                <tr>
+                    <td class="text-nowrap">{{ friendly_date_time($rr->created_at) }}</td>
+                    <td>
+                    <a native target="_blank" href="{{route('patients.view.dashboard', $rr->client)}}">
+						{{$rr->client->chart_number}}
+					</a>
+                    </td>
+                    <td>
+                    <a native target="_blank" href="{{route('patients.view.dashboard', $rr->client)}}">
+						{{$rr->client->displayName()}}
+					</a>
+                    </td>
+                    <td>{{ friendly_date($rr->scoped_month_start_date) }}</td>
+                    <td>{{ friendly_date($rr->access_start_date) }}</td>
+                    <td>{{ friendly_date($rr->access_end_date) }}</td>
+                    <td>{{ $rr->pro->displayName() }}</td>
+                    <td>{{ $rr->createdBySession->pro->displayName() }}</td>
+                    <td>
+                        @if($rr->is_active)
+                        <span class="text-success mr-2">YES
+                            @if($rr->reactivation_memo)
+                            <i class="fas fa-info-circle text-muted" title="{{ $rr->reactivation_memo }}"></i>
+                            @endif
+                        </span>
+                        @else
+                        <span class="text-secondary mr-2">NO
+                            @if($rr->deactivation_memo)
+                            <i class="fas fa-info-circle text-muted" title="{{ $rr->deactivation_memo }}"></i>
+                            @endif
+                        </span>
+                        @endif
+                    </td>
+                    <td>
+                        <span class="mr-2">{{ $rr->status ?? '--' }}
+                            @if($rr->status_memo )
+                            <i class="fas fa-info-circle text-muted" title="{{ $rr->status_memo }}"></i>
+                            @endif
+                        </span>
+                    </td>
+                </tr>
+                @endforeach
+            </tbody>
+        </table>
+        <div class="p-3">
+            {{$reviewRequests->withQueryString()->links()}}
+        </div>
+    </div>
+</div>
+@endsection

+ 38 - 1
resources/views/app/patient/settings.blade.php

@@ -465,7 +465,44 @@ $patientName = implode(', ', array_filter([$patient->name_last, $patient->name_f
                       MCP Pro: <b>{{ $patient->mcp->name_display ?? ''}}</b>
                     </div>
                     <div class="mb-1">
-                      RD Pro: <b>{{ $patient->rd->name_display ?? ''}}</b>
+                        RD Pro: <b>{{ $patient->rd ? $patient->rd->displayName() : '-'}}</b>
+                        @if($pro->pro_type === 'ADMIN')
+                        <div moe wide>
+                            <a start show><i class="fa fa-edit"></i></a>
+                            <form url="/api/client/putRdPro" class="mcp-theme-1">
+                                <input type="hidden" name="uid" value="{{$patient->uid}}">
+                                <div class="mb-2">
+                                    <label class="mb-1 text-secondary text-sm">RME Pro</label>
+                                    <select class="form-control form-control-sm" name="rdProUid" provider-search provider-type="rd">
+                                        <option value="">--select--</option>
+                                    </select>
+                                </div>
+                                <div>
+                                    <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+                                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                        @if($patient->rd)
+                            <div moe class="ml-2">
+                                <a start show><i class="fa fa-times"></i></a>
+                                <form url="/api/client/removeRdPro" class="mcp-theme-1">
+                                    <input type="hidden" name="uid" value="{{$patient->uid}}">
+                                    <div class="mb-2">
+                                        <label class="text-secondary text-sm">Remove RD</label>
+
+                                    </div>
+                                    <div>
+                                        <button submit class="btn btn-sm btn-primary mr-1">Submit
+                                        </button>
+                                        <button cancel class="btn btn-sm btn-default border">
+                                            Cancel
+                                        </button>
+                                    </div>
+                                </form>
+                            </div>
+                        @endif
+                        @endif
                     </div>
                     <div class="mb-1">
                       Physician Pro: <b>{{ $patient->pcp->rd->name_display ?? ''}}</b>

+ 302 - 0
resources/views/app/rd/dashboard.blade.php

@@ -0,0 +1,302 @@
+@extends ('layouts.template')
+
+@section('content')
+
+    <style>
+        #dashboard-mcp tr.thin th,
+        #dashboard-mcp tr.thin td,
+        #dashboard-mcp .dashboard-stats-table tr td,
+        #dashboard-mcp .dashboard-stats-table tr th {
+            padding: 0.25em;
+            font-weight: normal;
+        }
+
+        #dashboard-dna table.appointments tr td {
+            vertical-align: middle;
+        }
+    </style>
+
+    <div id="dashboard-dna">
+    <div class="p-3">
+        <div class="">
+            <div class="row mcp-theme-1" id="pro-dashboard-container">
+                <div class="col-md-3 mcp-theme-1">
+                    <div class="mb-4">
+                        <div class="pro-dashboard-inline-calendar"></div>
+                    </div>
+                    <div class="card mb-4" stag-collapsible-card="dna-key-numbers">
+                        <div class="card-header pl-2">
+                            <strong>
+                                Key Numbers
+                            </strong>
+                        </div>
+                        <div class="card-body p-0">
+                            <table class="table table-sm mb-0">
+                                <tbody>
+                                    <tr>
+                                        <th class="px-2 text-center">{{$pro->activeClientReviewRequests->count()}}<th>  
+                                        <th class="pl-2">
+                                            <a class="font-weight-normal" href="{{route('rd.client-review-requests', ['hideTitle' => true])}}" native target="_blank" open-in-stag-popup popup-style="tall" title="Charts Pending My Review">Charts Pending My Review </a>
+                                        </th>
+                                    </tr>
+                                    
+                                </tbody>
+                            </table>
+                        </div>
+                    </div>
+                    
+                    <div class="card mb-4" stag-collapsible-card="dna-practice-management" collapsed>
+                        <div class="card-header pl-2">
+                            <strong>
+                                Practice Management
+                            </strong>
+                        </div>
+                        <div class="card-body p-0">
+                            <table class="table table-sm mb-0">
+                                <tbody>
+                                <tr class="thin">
+                                    <th colspan="2" class="font-weight-normal px-2 pl-2">Billing & Reimbursement</th>
+                                </tr>
+                                <tr class="thin">
+                                    <th class="font-weight-normal px-2 pl-4">{{friendly_date_time($performer->pro->getNextPaymentDateAsDna(), false)}}</th>
+                                    <th class="font-weight-normal pl-2">Next Payment Date</th>
+                                </tr>
+                                <tr class="thin">
+                                    <th class="font-weight-normal px-2 pl-4">
+                                        ${{friendly_money($performer->pro->balance)}}</th>
+                                    <th class="font-weight-normal pl-2 w-100"><a
+                                            href="/practice-management/financial-transactions">Current balance</a></th>
+                                </tr>
+                                <tr class="thin">
+                                    <th class="font-weight-normal px-2 pl-4">
+                                        ${{friendly_money($performer->pro->getProcessingAmountAsDna())}}</th>
+                                    <th class="font-weight-normal pl-2"><a
+                                            href="/practice-management/bills-under-processing">Processing</a></th>
+                                </tr>
+
+                               
+                                </tbody>
+                            </table>
+                        </div>
+                    </div>
+                </div>
+                <div class="col-md-9">
+                    <div class="row mcp-theme-1">
+                        <div class="col-md-6 mcp-theme-1">
+                          
+
+                            <!-- ENCOUNTERS PENDING MY REVIEW -->
+                            <div class="card mb-4">
+                                <div class="card-header pl-2">
+                                    <strong>
+                                        Charts Pending My Review
+                                    </strong>
+                                </div>
+                                <div class="card-body p-0">
+                                    @include('app.rd.dashboard.client-charts-pending-my-review')
+                                </div>
+                            </div>
+
+                          
+
+                        </div>
+                        <div class="col-md-6 mcp-theme-1">
+                            <div class="card mb-4">
+                                <div class="card-header pl-2">
+                                    <strong>
+                                        Messages
+                                    </strong>
+                                </div>
+                                <div class="card-body p-0">
+                                    @include('app.dna.dashboard.messages')
+                                </div>
+                            </div>
+                            
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+    </div>
+
+    <div class="stag-popup stag-popup-md ticket-popup mcp-theme-1" stag-popup-key="ticket-popup"></div>
+
+    <script>
+        (function () {
+
+            let datesWithEvents = [],
+                selectedDate = '{{ date('Y-m-d') }}',
+                calendarElem = null,
+                currentMonth = null,
+                currentYear = null,
+                appointmentsLoaded = false;
+
+            function formatDate(date) {
+                let d = new Date(date),
+                    month = '' + (d.getMonth() + 1),
+                    day = '' + d.getDate(),
+                    year = d.getFullYear();
+
+                if (month.length < 2)
+                    month = '0' + month;
+                if (day.length < 2)
+                    day = '0' + day;
+
+                return [year, month, day].join('-');
+            }
+
+            function onDateChange(_newDate) {
+                // ajax load appts list as markup directly from server
+                selectedDate = _newDate;
+                $.get('/pro-dashboard-events-display/' + selectedDate + '/' + selectedDate, function (_data) {
+                    let apptscontainer = $('#dna-dashboard-appointments');
+                    apptscontainer.html(_data);
+                    initFastLoad(apptscontainer);
+                    initMoes();
+                });
+            }
+
+            function loadEventDates(_refDate = false) {
+                let today = new Date(_refDate ? _refDate : '{{date('Y-m-d')}}'),
+                    firstOfMonth = new Date(today.getFullYear(), today.getMonth(), 1),
+                    lastOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
+                selectedDate = null;
+                $('td.day.active').removeClass('active');
+                $.get('/pro-dashboard-event-dates/' +
+                    formatDate(firstOfMonth) + '/' +
+                    formatDate(lastOfMonth), (_data) => {
+                    datesWithEvents = _data;
+                    calendarElem.datepicker('refresh');
+                    currentMonth = firstOfMonth.getMonth();
+                    currentYear = firstOfMonth.getFullYear();
+                    if (!_refDate && $('td.day[data-date="{{$milliseconds}}"]:visible').length) {
+                        $('td.day[data-date="{{$milliseconds}}"]:visible').first().click();
+                    }
+                    appointmentsLoaded = true;
+                }, 'json');
+            }
+
+            function getFormattedCurrentDate() {
+                let date = new Date();
+                let day = date.getDate();
+                day = day < 10 ? '0' + day : day;
+                return date.getFullYear() + '-' + parseInt(date.getMonth() + 1) + '-' + day;
+            }
+
+            function init(_target = null) {
+
+                if(_target && _target !== '.stag-content') return;
+
+                calendarElem = $('.pro-dashboard-inline-calendar');
+                calendarElem.datepicker({
+                    dateFormat: 'yy-mm-dd',
+                    onSelect: function (_date) {
+                        onDateChange(_date);
+                    },
+                    onChangeMonthYear: function (_year, _month) {
+                        let date = _year + '-' + (_month < 10 ? '0' : '') + _month + '-05';
+                        loadEventDates(date);
+                    },
+                    beforeShowDay: function (d) {
+                        if (datesWithEvents && datesWithEvents.indexOf(formatDate(d)) !== -1) {
+                            return [true, 'has-events'];
+                        }
+                        return [true, 'no-events'];
+                    },
+                    defaultDate: 0
+                });
+
+                let date = new Date();
+                let day = date.getDate();
+                day = day < 10 ? '0' + day : day;
+                let mon = parseInt(date.getMonth() + 1);
+                mon = mon < 10 ? '0' + mon : mon;
+                let dateStr = date.getFullYear() + '-' + mon + '-' + day;
+                loadEventDates(dateStr);
+
+                onDateChange(getFormattedCurrentDate());
+                selectedDate = getFormattedCurrentDate();
+
+                $(document)
+                    .off('click', '.ack-client-pro-change')
+                    .on('click', '.ack-client-pro-change', function () {
+                        let trigger = $(this).text('…');
+                        $.post('/api/clientProChange/accept', {
+                            uid: $(this).attr('data-uid')
+                        }, _data => {
+                            if (!hasResponseError(_data)) {
+                                trigger.hide();
+                                let doneElem = $('<i class="text-success fa fa-check"></i>');
+                                doneElem.insertAfter(trigger);
+                                setTimeout(() => {
+                                    let ackContainer = trigger.closest('.ack-container');
+                                    trigger.closest('div').slideUp('fast', function () {
+                                        $(this).remove();
+                                        if (!ackContainer.find('>div').length) {
+                                            ackContainer.remove();
+                                        }
+                                    });
+                                }, 500);
+                            }
+                        }, 'json');
+                        return false;
+                    });
+
+                $(document)
+                    .off('click', '.ack-client-memo')
+                    .on('click', '.ack-client-memo', function () {
+                        let trigger = $(this).text('…');
+                        $.post('/api/clientMemo/stamp', {
+                            uid: $(this).attr('data-uid')
+                        }, _data => {
+                            if (!hasResponseError(_data)) {
+                                trigger.hide();
+                                let doneElem = $('<i class="text-success fa fa-check"></i>');
+                                doneElem.insertAfter(trigger);
+                                setTimeout(() => {
+                                    let tbody = trigger.closest('tbody');
+                                    trigger.closest('tr').remove();
+                                    if (!tbody.find('>tr').length) {
+                                        tbody.closest('.ack-container').remove();
+                                    }
+                                }, 500);
+                            }
+                        }, 'json');
+                        return false;
+                    });
+
+                $(document)
+                    .off('click', '.ack-pro-appt-update')
+                    .on('click', '.ack-pro-appt-update', function () {
+                        let trigger = $(this).text('…');
+                        $.post('/api/appointmentConfirmationDecision/acknowledgeAsAppointmentPro', {
+                            uid: $(this).attr('data-uid')
+                        }, _data => {
+                            if (!hasResponseError(_data)) {
+                                trigger.hide();
+                                let doneElem = $('<i class="text-success fa fa-check"></i>');
+                                doneElem.insertAfter(trigger);
+                                setTimeout(() => {
+                                    let ackContainer = trigger.closest('tbody');
+                                    trigger.closest('tr').slideUp('fast', function () {
+                                        $(this).remove();
+                                        if (!ackContainer.find('>tr').length) {
+                                            ackContainer.remove();
+                                        }
+                                    });
+                                }, 500);
+                            }
+                        }, 'json');
+                        return false;
+                    });
+
+                addMCHook('refreshDashboardAppointments', function() {
+                    onDateChange(selectedDate);
+                });
+            }
+
+            addMCInitializer('pro-dashboard', init, '#pro-dashboard-container');
+        })();
+    </script>
+@endsection

+ 62 - 0
resources/views/app/rd/dashboard/client-charts-pending-my-review.blade.php

@@ -0,0 +1,62 @@
+
+<?php 
+    $reviewRequests = $performer->pro->activeClientReviewRequests;
+?>
+@if(!count($reviewRequests))
+    <div class="mt-3 pl-2">
+        <p>No client review requests found.</p>
+    </div>
+@else
+<div class="table-responsive">
+    <table class="table table-striped table-sm table-bordered">
+        <thead class="bg-light">
+            <tr>
+                <th class="border-0 text-secondary text-nowrap">Created</th>
+                <th class="border-0 text-secondary">Patient</th>
+                <th class="border-0 text-secondary">Scoped Month Start</th>
+                <th class="border-0 text-secondary">Access Start</th>
+                <th class="border-0 text-secondary">Access End</th>                
+                <th class="border-0 text-secondary">Is Active</th>
+                <th class="border-0 text-secondary">Status</th>
+            </tr>
+        </thead>
+        <tbody>
+            @foreach($reviewRequests as $rr)
+            <tr>
+                <td class="text-nowrap">{{ friendlier_date($rr->created_at) }}</td>
+                <td>
+                <a native target="_blank" href="{{route('patients.view.dashboard', $rr->client)}}">
+						{{$rr->client->displayName()}}
+					</a>
+                </td>
+                <td>{{ friendlier_date($rr->scoped_month_start_date) }}</td>
+                <td>{{ friendlier_date($rr->access_start_date) }}</td>
+                <td>{{ friendlier_date($rr->access_end_date) }}</td>                
+                <td>
+                    @if($rr->is_active)
+                    <span class="text-success mr-2">YES
+                        @if($rr->reactivation_memo)
+                        <i class="fas fa-info-circle text-muted" title="{{ $rr->reactivation_memo }}"></i>
+                        @endif
+                    </span>
+                    @else
+                    <span class="text-secondary mr-2">NO
+                        @if($rr->deactivation_memo)
+                        <i class="fas fa-info-circle text-muted" title="{{ $rr->deactivation_memo }}"></i>
+                        @endif
+                    </span>
+                    @endif
+                </td>
+                <td>
+                    <span class="mr-2">{{ $rr->status ?? '--' }}
+                        @if($rr->status_memo )
+                        <i class="fas fa-info-circle text-muted" title="{{ $rr->status_memo }}"></i>
+                        @endif
+                    </span>
+                </td>
+            </tr>
+            @endforeach
+        </tbody>
+    </table>
+</div>
+@endif

+ 137 - 0
resources/views/app/rd/patients-table.blade.php

@@ -0,0 +1,137 @@
+<div class="table-responsive">
+<table class="table table-sm table-striped p-0 m-0">
+	<thead class="bg-light border-top">
+		<tr>
+			<th class="border-0">#</th>
+			<th class="border-0">@include('app.practice-management._sort_header', ['route' => route("rd.patients"), 'label' => 'Name', 'key' => 'name_first'])</th>
+			<th class="border-0">@include('app.practice-management._sort_header', ['route' => route("rd.patients"), 'label' => 'DOB', 'key' => 'dob'])</th>
+			<th class="border-0">@include('app.practice-management._sort_header', ['route' => route("rd.patients"), 'label' => 'Age', 'key' => 'age_in_years'])</th>
+			<th class="border-0">@include('app.practice-management._sort_header', ['route' => route("rd.patients"), 'label' => 'Sex', 'key' => 'sex'])</th>
+			<th class="border-0">@include('app.practice-management._sort_header', ['route' => route("rd.patients"), 'label' => 'BMI', 'key' => 'usual_bmi_min'])</th>
+			<th class="border-0">Insurance</th>
+			<th class="border-0">MCP</th>
+			<th class="border-0">RPM</th>
+		</tr>
+	</thead>
+	<tbody>
+		@foreach($patients as $patient)
+		<?php
+			$patient->most_recent_weight_measurement_id = 68434;
+		?>
+		<tr>
+			<td>
+				<a native target="_blank" href="{{route('patients.view.dashboard', $patient)}}">
+					{{$patient->chart_number}}
+				</a>
+			</td>
+			<td>
+				{{$patient->displayName()}}
+				@if($patient->rd_pro_id != $pro->id)
+					<span class="text-danger ml-1" title="This is not your patient but you have been granted access!"><i class="fas fa-user-clock fa-fw"></i></span>
+				@endif
+			</td>
+			<td class="text-nowrap">{{ friendly_date_time($patient->dob, false) }}</td>
+			<td>{{ $patient->age_in_years ?  $patient->age_in_years : '-' }}</td>
+			<td>{{ $patient->sex }}</td>
+			<td>
+				<div class="d-flex flex-column">
+					@if($patient->usual_bmi_min && $patient->usual_bmi_max)
+					<small class="text-muted">BMI (Usual): <b>{{ $patient->usual_bmi_min }}</b> {{ $patient->usual_bmi_min_category }} to <b>{{ $patient->usual_bmi_max }}</b> {{ $patient->usual_bmi_max_category }}</small>
+					@endif
+					@if($patient->ideal_bmi)
+					<small class="text-muted">BMI (Ideal) <b>{{ $patient->ideal_bmi }}</b> {{ $patient->ideal_bmi_category }}</small>
+					@endif
+				</div>
+			</td>
+			<td>
+				@include('app.patient.coverage_column_renderer', ['patient'=>$patient])
+			</td>
+			<td>
+				<div class="d-flex flex-column">
+					<span>{{ $patient->mcp ? $patient->mcp->displayName() :'' }}</span>	
+					<span>Status: 
+						@if($patient->has_mcp_done_onboarding_visit === 'YES')
+						<i class="fas fa-check-circle text-success" data-toggle="tooltip" data-placement="bottom" title="YES"></i>
+						@elseif($patient->has_mcp_done_onboarding_visit === 'NO')
+						<i class="fas fa-times-circle text-danger" data-toggle="tooltip" data-placement="bottom" title="NO"></i>
+						@elseif($patient->has_mcp_done_onboarding_visit === 'UNKNOWN')
+							<i class="fas fa-question-circle text-secondary" data-toggle="tooltip" data-placement="bottom" title="UNKNOWN"></i>
+						@endif
+					</span>				
+					@if($patient->mostRecentCompletedMcpNote)
+						<span>Last Encounter:  
+						<a href="/patients/view/{{ $patient->mostRecentCompletedMcpNote->client->uid }}/notes/view/{{ $patient->mostRecentCompletedMcpNote->uid }}" class="font-weight-bold">
+                                {{ friendly_date_time($patient->mostRecentCompletedMcpNote->effective_dateest, false) }}
+                            </a>
+						</span>
+					@endif
+					@if($patient->next_mcp_appointment_date)
+						<span class="text-muted">Next Appt. <b>{{ friendly_date_time($patient->next_mcp_appointment_date) }}</b></span>
+					@endif
+					<?php $recentNote = $patient->mostRecentCompletedMcpNote; ?>
+					@if($recentNote)
+					<div>
+						Note: <a href="/patients/view/{{ $patient->uid }}/notes/view/{{ $recentNote->uid }}" class="font-weight-bold">
+                        {{ friendly_date_time($recentNote->effective_dateest, false) }}
+                    </a>
+					</div>
+					@endif
+				</div>
+			</td>
+			<td>
+			   <div class="">
+				   <div class="on-hover-show d-inline-block">
+					   <span>Enrolled:
+						   @if($patient->is_enrolled_in_rm === 'YES') {{-- correct --}}
+							   <i class="fas fa-check-circle text-success" data-toggle="tooltip" data-placement="bottom" title="YES"></i>
+						   @elseif($patient->is_enrolled_in_rm === 'NO') {{-- correct --}}
+							   <i
+									   class="fas fa-times-circle text-danger"
+									   tabindex="0"
+									   data-toggle="popover"
+									   title="No"
+									   data-target="#enrollment-{{ $patient->uid }}"
+							   ></i>
+						   @elseif($patient->is_enrolled_in_rm === 'UNKNOWN') {{-- correct --}}
+							   <i
+									   tabindex="0"
+									   data-toggle="popover"
+									   title="Uknown"
+									   data-target="#enrollment-{{ $patient->uid }}"
+									   class="fas fa-question-circle text-secondary"
+									   popover
+							   ></i>
+						   @endif
+						</span>
+					   	<div id="enrollment-{{ $patient->uid }}" class="on-hover-content">
+						   	<h6 class="mt-2 font-weight-bold">{{ $patient->is_enrolled_in_rm }}</h6> {{-- correct --}}
+							<span>Is Eligible for RM: {{ $patient->is_eligible_for_rm }}</span><br>
+							<span>Why not eligible: {{ $patient->why_not_eligible_for_rm_category ?? '---' }}</span><br>
+							<span>{{ $patient->why_not_eligible_for_rm_memo }}</span>
+						</div>
+				   </div>
+				<?php $m = $patient->lastMeasurementOfType('Wt. (lbs.)');?>
+				@if($m)
+				<span class="d-block mt-1">Wt. (lbs.) {{$m && $m->value ? round($m->value, 2) : '-'}}</span>
+				@endif
+				<?php $bp = $patient->lastMeasurementOfType('BP'); ?>
+				@if($bp)
+				<span class="d-block mt-1">BP. {{$bp && $bp->value ? $bp->value : '-'}}</span>
+				@endif
+			   </div>
+			</td>
+		</tr>
+		@endforeach
+
+		@if(count($patients) === 0)
+		<tr>
+			<td colspan="9">No records found!</td>
+		</tr>
+		@endif
+	</tbody>
+
+</table>
+</div>
+<div class="p-3">
+	{{$patients->withQueryString()->links()}}
+</div>

+ 24 - 0
resources/views/app/rd/patients.blade.php

@@ -0,0 +1,24 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+    <div class="card">
+
+        <div class="card-header px-3 py-2 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-user"></i>
+                Patients
+            </strong>
+        </div>
+
+        <div class="card-body p-0">
+            <div class="p-3">
+                @include('app.rd.patients_filters')
+            </div>
+            @include('app.rd.patients-table')
+        </div>
+    </div>
+</div>
+
+@endsection
+

+ 275 - 0
resources/views/app/rd/patients_filters.blade.php

@@ -0,0 +1,275 @@
+<style>
+	#dna-patients-filters label {
+		font-weight: bold;
+	}
+
+	#dna-patients-filters .mw-100px {
+		min-width: 100px;
+	}
+
+	.filter-container {
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+
+	.filter-container>div {
+		width: 165px;
+	}
+
+	.filter-container>div:not(:last-child) {
+		margin-right: 15px;
+	}
+
+	.sm-section {
+		width: 125px !important;
+	}
+</style>
+<form id="dna-patients-filters" method="GET" action="{{ route('rd.patients') }}" class="filter-container" v-cloak>
+	<div class="sm-section">
+		<div class="form-group">
+			<label>Name:</label>
+			<input name="name" class="form-control input-sm" v-model="filters.name">
+		</div>
+	</div>
+	<!-- AGE	 -->
+	<div class="sm-section">
+		<div class="form-group">
+			<label>Age:</label>
+			<select name="age_category" class="form-control input-sm" v-model="filters.age_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.age_category" class="mt-2">
+				<div>
+					<input name="age_value_1" v-model="filters.age_value_1" type="number" class="form-control input-sm" :placeholder="(filters.age_category === 'BETWEEN' || filters.age_category === 'NOT_BETWEEN') ? 'From' : 'Age'" />
+				</div>
+				<div v-show="filters.age_category === 'BETWEEN' || filters.age_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="age_value_2" v-model="filters.age_value_2" type="number" class="form-control input-sm" placeholder="To" />
+				</div>
+			</div>
+		</div>
+	</div>
+	<!-- SEX -->
+	<div class="sm-section">
+		<div class="form-group">
+			<label>Sex:</label>
+			<select name="sex" class="form-control input-sm" v-model="filters.sex">
+				<option value="">All</option>
+				<option value="M">Male</option>
+				<option value="F">Female</option>
+			</select>
+		</div>
+	</div>
+	<!-- BMI -->
+	<div class="sm-section">
+		<div class="form-group">
+			<label>BMI:</label>
+			<select name="bmi_category" class="form-control input-sm" v-model="filters.bmi_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.bmi_category" class="mt-2">
+				<div>
+					<input name="bmi_value_1" v-model="filters.bmi_value_1" type="number" class="form-control input-sm" :placeholder="(filters.bmi_category === 'BETWEEN' || filters.bmi_category === 'NOT_BETWEEN') ? 'From' : 'BMI'" />
+				</div>
+				<div v-show="filters.bmi_category === 'BETWEEN' || filters.bmi_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="bmi_value_2" v-model="filters.bmi_value_2" type="number" class="form-control input-sm" placeholder="To" />
+				</div>
+			</div>
+		</div>
+	</div>
+
+	<!-- LAST VISIT -->
+	<!-- <div class="sm-section">
+		<div class="form-group">
+			<label>Last Visit:</label>
+			<select name="last_visit_category" class="form-control input-sm" v-model="filters.last_visit_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.last_visit_category" class="mt-2">
+				<div>
+					<input name="last_visit_value_1" v-model="filters.last_visit_value_1" type="date" class="form-control input-sm" :placeholder="(filters.last_visit_category === 'BETWEEN' || filters.last_visit_category === 'NOT_BETWEEN') ? 'From' : 'Last Visit'" />
+				</div>
+				<div v-show="filters.last_visit_category === 'BETWEEN' || filters.last_visit_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="last_visit_value_2" v-model="filters.last_visit_value_2" type="date" class="form-control input-sm" placeholder="To" />
+				</div>
+			</div>
+		</div>
+	</div> -->
+
+	<!-- NEXT APPOINTMENT -->
+	<div>
+		<div class="form-group">
+			<label>Next Appointment:</label>
+			<select name="next_appointment_category" class="form-control input-sm" v-model="filters.next_appointment_category">
+				<option value="">All</option>
+				<option value="EXACTLY">Exactly</option>
+				<option value="LESS_THAN">Less Than</option>
+				<option value="GREATER_THAN">Greater Than</option>
+				<option value="BETWEEN">Between</option>
+				<option value="NOT_BETWEEN">Not Between</option>
+			</select>
+			<div v-show="filters.next_appointment_category" class="mt-2">
+				<div>
+					<input name="next_appointment_value_1" v-model="filters.next_appointment_value_1" type="date" class="form-control input-sm" :placeholder="(filters.next_appointment_category === 'BETWEEN' || filters.next_appointment_category === 'NOT_BETWEEN') ? 'From' : 'Next Appt.'" />
+				</div>
+				<div v-show="filters.next_appointment_category === 'BETWEEN' || filters.next_appointment_category === 'NOT_BETWEEN'" class="mt-2">
+					<input name="next_appointment_value_2" v-model="filters.next_appointment_value_2" type="date" class="form-control input-sm" placeholder="To" />
+				</div>
+			</div>
+		</div>
+	</div>
+
+	<!-- STATUS -->
+	<div class="sm-section">
+		<div class="form-group">
+			<label>Status:</label>
+			<select name="status" class="form-control input-sm" v-model="filters.status">
+				<option value="">All</option>
+				<option value="ACTIVE">Active</option>
+				<option value="AWAITING_VISIT">Awaiting Visit</option>
+				<option value="INACTIVE">Inactive</option>
+			</select>
+		</div>
+	</div>
+
+	<div class="sm-section">
+		<div class="">
+			<label>Home State:</label>
+			<select name="home_address_state" class="form-control input-sm" v-model="filters.home_address_state">
+				<option value="">All</option>
+				<option value="NONE">Not Available</option>
+				<option value="NOT_MD">Not MD</option>
+				<option value="AL">Alabama</option>
+				<option value="AK">Alaska</option>
+				<option value="AZ">Arizona</option>
+				<option value="AR">Arkansas</option>
+				<option value="CA">California</option>
+				<option value="CO">Colorado</option>
+				<option value="CT">Connecticut</option>
+				<option value="DE">Delaware</option>
+				<option value="FL">Florida</option>
+				<option value="GA">Georgia</option>
+				<option value="HI">Hawaii</option>
+				<option value="ID">Idaho</option>
+				<option value="IL">Illinois</option>
+				<option value="IN">Indiana</option>
+				<option value="IA">Iowa</option>
+				<option value="KS">Kansas</option>
+				<option value="KY">Kentucky</option>
+				<option value="LA">Louisiana</option>
+				<option value="ME">Maine</option>
+				<option value="MD">Maryland</option>
+				<option value="MA">Massachusetts</option>
+				<option value="MI">Michigan</option>
+				<option value="MN">Minnesota</option>
+				<option value="MS">Mississippi</option>
+				<option value="MO">Missouri</option>
+				<option value="MT">Montana</option>
+				<option value="NE">Nebraska</option>
+				<option value="NV">Nevada</option>
+				<option value="NH">New Hampshire</option>
+				<option value="NJ">New Jersey</option>
+				<option value="NM">NewMexico</option>
+				<option value="NY">New York</option>
+				<option value="NC">North Carolina</option>
+				<option value="ND">North Dakota</option>
+				<option value="OH">Ohio</option>
+				<option value="OK">Oklahoma</option>
+				<option value="OR">Oregon</option>
+				<option value="PA">Pennsylvania</option>
+				<option value="RI">RhodeIsland</option>
+				<option value="SC">South Carolina</option>
+				<option value="SD">South Dakota</option>
+				<option value="TN">Tennessee</option>
+				<option value="TX">Texas</option>
+				<option value="UT">Utah</option>
+				<option value="VT">Vermont</option>
+				<option value="VA">Virginia</option>
+				<option value="WA">Washington</option>
+				<option value="WV">West Virginia</option>
+				<option value="WI">Wisconsin</option>
+				<option value="WY">Wyoming</option>
+			</select>
+		</div>
+	</div>
+
+	<div>
+		<div class="form-group">
+			<label>&nbsp;</label>
+			<div class=" d-flex">
+				<button type="button" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a href="#" v-on:click.prevent="fastLoad('{{route('rd.patients')}}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+			</div>
+		</div>
+	</div>
+</form>
+
+<?php
+$loadedFilters = $filters;
+$allFilterKeys = [
+	'name',
+	'age_category',
+	'age_value_1',
+	'age_value_2',
+	'bmi_category',
+	'bmi_value_1',
+	'bmi_value_2',	
+	'last_visit_category',
+	'last_visit_value_1',
+	'last_visit_value_2',
+	'next_appointment_category',
+	'next_appointment_value_1',
+	'next_appointment_value_2',
+	'sex',
+	'status',
+];
+for ($i = 0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+<script>
+	(function() {
+		function init() {
+			new Vue({
+				el: '#dna-patients-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					init: function() {
+
+					},
+					doSubmit: function() {
+						fastLoad('{{ route("rd.patients") }}?' + $('#dna-patients-filters').serialize());
+						return false;
+					}
+				},
+				mounted: function() {
+					console.log(this.filters);
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('dna-patients-filters', init, '#dna-patients-filters');
+	})();
+</script>

+ 75 - 0
resources/views/app/rd/review-requests/list.blade.php

@@ -0,0 +1,75 @@
+@extends ('layouts.template')
+@section('content')
+<div class="p-3 mcp-theme-1">
+    <div class="">
+        @if(!@$hideTitle)
+        <div class="d-flex align-items-center pb-2">
+            <h4 class="font-weight-bold mb-0 mr-3">Review Requests</h4>
+        </div>
+        @endif
+        <table class="table table-striped table-sm table-bordered">
+            <thead class="bg-light">
+                <tr>
+                    <th class="border-0 text-secondary text-nowrap">Created At</th>
+                    <th class="border-0 text-secondary text-nowrap">Chart #</th>
+                    <th class="border-0 text-secondary text-nowrap">Patient</th>
+                    <th class="border-0 text-secondary">Scoped Month Start Date</th>
+                    <th class="border-0 text-secondary">Access Start Date</th>
+                    <th class="border-0 text-secondary">Access End Date</th>
+                    <th class="border-0 text-secondary">Pro</th>
+                    <th class="border-0 text-secondary">Created By</th>
+                    <th class="border-0 text-secondary">Is Active</th>
+                    <th class="border-0 text-secondary">Status</th>
+                </tr>
+            </thead>
+            <tbody>
+                @foreach($reviewRequests as $rr)
+                <tr>
+                    <td class="text-nowrap">{{ friendly_date_time($rr->created_at) }}</td>
+                    <td>
+                    <a native target="_blank" href="{{route('patients.view.dashboard', $rr->client)}}">
+						{{$rr->client->chart_number}}
+					</a>
+                    </td>
+                    <td>
+                    <a native target="_blank" href="{{route('patients.view.dashboard', $rr->client)}}">
+						{{$rr->client->displayName()}}
+					</a>
+                    </td>
+                    <td>{{ friendly_date($rr->scoped_month_start_date) }}</td>
+                    <td>{{ friendly_date($rr->access_start_date) }}</td>
+                    <td>{{ friendly_date($rr->access_end_date) }}</td>
+                    <td>{{ $rr->pro->displayName() }}</td>
+                    <td>{{ $rr->createdBySession->pro->displayName() }}</td>
+                    <td>
+                        @if($rr->is_active)
+                        <span class="text-success mr-2">YES
+                            @if($rr->reactivation_memo)
+                            <i class="fas fa-info-circle text-muted" title="{{ $rr->reactivation_memo }}"></i>
+                            @endif
+                        </span>
+                        @else
+                        <span class="text-secondary mr-2">NO
+                            @if($rr->deactivation_memo)
+                            <i class="fas fa-info-circle text-muted" title="{{ $rr->deactivation_memo }}"></i>
+                            @endif
+                        </span>
+                        @endif
+                    </td>
+                    <td>
+                        <span class="mr-2">{{ $rr->status ?? '--' }}
+                            @if($rr->status_memo )
+                            <i class="fas fa-info-circle text-muted" title="{{ $rr->status_memo }}"></i>
+                            @endif
+                        </span>
+                    </td>
+                </tr>
+                @endforeach
+            </tbody>
+        </table>
+        <div class="p-3">
+            {{$reviewRequests->withQueryString()->links()}}
+        </div>
+    </div>
+</div>
+@endsection

+ 4 - 1
resources/views/layouts/template.blade.php

@@ -127,7 +127,10 @@
                 @elseif($pro->is_considered_for_dna)
                     <li class="nav-item"><a class="nav-link" href="{{ route('dna.dashboard') }}"><i class="mr-1 fas fa-home"></i> Home</a> </li>
                     <li class="nav-item"><a class="nav-link" href="{{ route('dna.patients') }}"><i class="mr-1 fas fa-user"></i> Patients</a> </li>
-                @else
+                 @elseif($pro->is_considered_for_rd_assignment)
+                    <li class="nav-item"><a class="nav-link" href="{{ route('rd.dashboard') }}"><i class="mr-1 fas fa-home"></i> Home</a> </li>
+                    <li class="nav-item"><a class="nav-link" href="{{ route('rd.patients') }}"><i class="mr-1 fas fa-user"></i> Patients</a> </li>
+                 @else
                     <li class="nav-item"><a class="nav-link" href="{{ route('ps.dashboard') }}"><i class="mr-1 fas fa-home"></i> Home</a> </li>
                     <li class="nav-item"><a class="nav-link" href="{{ route('ca.patients') }}"><i class="mr-1 fas fa-user"></i> Patients</a> </li>
                 @endif

+ 9 - 0
routes/web.php

@@ -9,6 +9,7 @@ use App\Http\Controllers\MessageController;
 use App\Http\Controllers\CompanyClientController;
 use App\Http\Controllers\CustomerController;
 use App\Http\Controllers\ClientProAccessController;
+use App\Http\Controllers\RdController;
 
 /*
 |--------------------------------------------------------------------------
@@ -213,6 +214,14 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('client-review-requests', [SupervisingPhysicianController::class, 'clientReviewRequests'])->name('client-review-requests');
 
 
+    });
+
+    Route::name('rd.')->prefix('rd')->group(function () {
+        Route::get('dashboard', [RdController::class, 'dashboard'])->name('dashboard');
+        Route::get('client-review-requests', [RdController::class, 'clientReviewRequests'])->name('client-review-requests');
+        Route::get('patients', [RdController::class, 'patients'])->name('patients');
+
+
     });
 
     Route::name('ca.')->prefix('ca')->group(function () {