Эх сурвалжийг харах

Merge branch 'dev' of rav.triplestart.com:jmudaka/stagfe2 into dev

= 3 жил өмнө
parent
commit
365f13d49b

+ 19 - 0
app/Helpers/helpers.php

@@ -149,6 +149,25 @@ if(!function_exists('get_current_date')) {
 }
 
 
+if(!function_exists('friendly_date_est')) {
+    function friendly_date_est($value, $default = '-') {
+
+        if(!$value || empty($value)) return $default;
+        try {
+
+            $realTimezone = resolve_timezone('EASTERN');
+            $date = new DateTime($value);
+            $date->setTimezone(new DateTimeZone($realTimezone));
+
+            return $date->format("m/d/y");
+
+        }
+        catch (Exception $e) {
+            return $e->getMessage();
+        }
+    }
+}
+
 
 if(!function_exists('friendly_date_time')) {
     function friendly_date_time($value, $includeTime = true, $default = '-', $long_year=false) {

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

@@ -1894,6 +1894,12 @@ WHERE measurement.label NOT IN ('SBP', 'DBP')
                 case 'non-admin':
                     $pros->where('pro_type', '!=', 'ADMIN');
                     break;
+                case 'rmm':
+                    $pros->where('is_considered_for_rmm', TRUE);
+                    break;
+                case 'rme':
+                    $pros->where('is_considered_for_rme', TRUE);
+                    break;
             }
         }
 

+ 41 - 7
app/Http/Controllers/PracticeManagementController.php

@@ -517,7 +517,7 @@ SELECT effective_date, count(*), sum(number_of_units) as units FROM bill WHERE c
                 ->orWhere('manager_pro_id', $performer->pro_id)
                 ->orWhere('ordering_pro_id', $performer->pro_id)
                 ->orWhere('initiating_pro_id', $performer->pro_id);
-        });
+        })->where('category', 'other');
         if ($filter === 'open') {
             $myTickets = $myTickets->where('is_open', true);
         } else if ($filter === 'closed') {
@@ -1335,6 +1335,16 @@ WHERE care_month.uid = '{$careMonthUid}' AND client.uid = '{$clientUid}'
         $sortDir = $request->input('sort_dir') ?: 'ASC';
         $orderBy = "ORDER BY $sortBy $sortDir NULLS LAST";
 
+        // special case of if-bill-exists
+        if($sortBy === 'mcp_rm_generic_bill_id' || $sortBy === 'rmm_rm_generic_bill_id') {
+            if($sortDir === 'ASC') {
+                $orderBy = "ORDER BY $sortBy $sortDir NULLS FIRST";
+            }
+            else {
+                $orderBy = "ORDER BY $sortBy $sortDir NULLS LAST";
+            }
+        }
+
         // filters from the UI
         if(trim($request->input('f_name'))) {
             $v = trim($request->input('f_name'));
@@ -1382,6 +1392,18 @@ WHERE care_month.uid = '{$careMonthUid}' AND client.uid = '{$clientUid}'
             }
         }
 
+        if($mode === 'mcp' || $mode === 'rmm') {
+            if(trim($request->input('f_billable'))) {
+                $v = trim($request->input('f_billable'));
+                if($v === 'yes') {
+                    $conditions[] = "(care_month.{$mode}_rm_generic_bill_id IS NOT NULL)";
+                }
+                elseif($v === 'no') {
+                    $conditions[] = "(care_month.{$mode}_rm_generic_bill_id IS NULL)";
+                }
+            }
+        }
+
         if(trim($request->input('f_md_op')) && trim($request->input('f_md')) !== '') {
             $o = trim($request->input('f_md_op'));
             $v = trim($request->input('f_md'));
@@ -1409,14 +1431,29 @@ WHERE care_month.uid = '{$careMonthUid}' AND client.uid = '{$clientUid}'
         }
 
         $proTypeCondition = '';
+        $genericBillIdColumns = '';
+        $genericBillJoinClause = '';
         switch($mode) {
             case 'mcp':
                 $proTypeCondition = "care_month.mcp_pro_id = {$performer->pro->id}";
+                $genericBillIdColumns = "care_month.mcp_rm_generic_bill_id,
+                   bill.uid as mcp_rm_generic_bill_uid,
+                   bill.generic_pro_id as mcp_rm_generic_bill_generic_pro_id,
+                   bill.generic_pro_expected_payment_amount as mcp_rm_generic_bill_expected_payment_amount,
+                   bill.is_signed_by_generic_pro as mcp_rm_generic_bill_signed";
+                $genericBillJoinClause = 'left join bill on care_month.mcp_rm_generic_bill_id = bill.id';
                 break;
             case 'rmm':
                 $proTypeCondition = "care_month.rmm_pro_id = {$performer->pro->id}";
+                $genericBillIdColumns = "care_month.rmm_rm_generic_bill_id,
+                   bill.uid as rmm_rm_generic_bill_uid,
+                   bill.generic_pro_id as rmm_rm_generic_bill_generic_pro_id,
+                   bill.generic_pro_expected_payment_amount as rmm_rm_generic_bill_expected_payment_amount,
+                   bill.is_signed_by_generic_pro as rmm_rm_generic_bill_signed";
+                $genericBillJoinClause = 'left join bill on care_month.rmm_rm_generic_bill_id = bill.id';
+                break;
             case 'rme':
-                $proTypeCondition = "care_month.rme_pro_id = {$performer->pro->id}";
+                $proTypeCondition = "left join bill on care_month.rme_pro_id = {$performer->pro->id}";
                 break;
         }
 
@@ -1457,12 +1494,9 @@ SELECT client.name_first, client.name_last,
        care_month.most_recent_cellular_bp_measurement_at,      
        care_month.most_recent_cellular_weight_value,
        care_month.most_recent_cellular_weight_measurement_at,
-       care_month.mcp_rm_generic_bill_id,
-       bill.uid as mcp_rm_generic_bill_uid,
-       bill.generic_pro_id as mcp_rm_generic_bill_generic_pro_id,
-       bill.generic_pro_expected_payment_amount as mcp_rm_generic_bill_expected_payment_amount 
+       {$genericBillIdColumns}
 FROM care_month join client on care_month.client_id = client.id join note mrnote on client.most_recent_completed_mcp_note_id = mrnote.id
-    left join bill  on care_month.mcp_rm_generic_bill_id = bill.id
+    {$genericBillJoinClause}
     left join note mrmnote on mrmnote.id = (
         select max(n.id) from note n 
         where 

+ 9 - 0
app/Models/ClientPrimaryCoverage.php

@@ -48,6 +48,15 @@ class ClientPrimaryCoverage extends Model
         return null;
 
     }
+    public function insuranceDisplayPayerName(){
+        if($this->plan_type === 'MEDICAID'){
+            if($this->mcdPayer) return $this->mcdPayer->name;
+        } 
+        if($this->plan_type === 'COMMERCIAL'){
+            if($this->payer) return $this->payer->name;
+        } 
+        return $this->insuranceDisplayName();
+    }
 
     public function toString() {
         $parts = [];

+ 10 - 0
app/Models/Note.php

@@ -187,4 +187,14 @@ class Note extends Model
         return !!$bills;
     }
 
+    public function segmentsWithPendingSummarySuggestion() {
+        return $this->hasMany(Segment::class, 'note_id', 'id')
+            ->where('id', '!=', $this->core_segment_id) // dont include core-segment
+            ->where('is_active', true)
+            ->whereHas('proposedSegmentSummarySuggestion', function($sugQuery) {
+                return $sugQuery->where('status', '=', 'PENDING');
+            })
+            ->orderBy('position_index', 'asc');
+    }
+
 }

+ 116 - 0
app/Models/Pro.php

@@ -371,6 +371,15 @@ class Pro extends Model
         return $favorites;
     }
 
+    function get_patients_count_as_admin() {
+        $query = Client::whereNull('shadow_pro_id');
+        return $query->where('is_active', true)
+            ->where(function ($q) {
+                $q->whereNull('client_engagement_status_category')
+                    ->orWhere('client_engagement_status_category', '<>', 'DUMMY');
+            })->count();
+    }
+
     function get_patients_count_as_mcp() {
         $query = Client::whereNull('shadow_pro_id');
         return $query->where('mcp_pro_id', $this->id)
@@ -387,6 +396,12 @@ class Pro extends Model
             ->count();
     }
 
+    function get_new_patients_awaiting_visit_count_as_admin() {
+        $query = Client::whereNull('shadow_pro_id');
+        return $query->where('has_mcp_done_onboarding_visit', '!=', 'YES')
+            ->count();
+    }
+
     function get_notes_pending_signature_count_as_mcp() {
         return Note::where('hcp_pro_id', $this->id)
             ->where('is_cancelled', '<>', true)
@@ -395,6 +410,13 @@ class Pro extends Model
             ->count();
     }
 
+    function get_notes_pending_signature_count_as_admin() {
+        return Note::where('is_cancelled', '<>', true)
+            ->where('is_core_note', '<>', true)
+            ->where('is_signed_by_hcp', '<>', true)
+            ->count();
+    }
+
     function get_notes_pending_summary_suggestion_as_mcp_query(){
         $segmentsWithProposedSummarySuggestion = Segment::whereHas('proposedSegmentSummarySuggestion', function($sugQuery){
             return $sugQuery->where('status', '=', 'PENDING');
@@ -493,6 +515,12 @@ class Pro extends Model
             ->count();
     }
 
+    function get_notes_pending_billing_count_as_admin() {
+        return Note::where('is_cancelled', '<>', true)
+            ->where('is_signed_by_hcp', true)
+            ->where('is_billing_marked_done', '<>', true)
+            ->count();
+    }
 
     function get_measurements_awaiting_review_count_as_mcp() {
         $result = DB::select(DB::raw("
@@ -529,6 +557,12 @@ WHERE mcp_pro_id = :pro_id
             ->count();
     }
 
+    function get_incoming_reports_pending_signature_count_as_admin() {
+        return IncomingReport::where('has_hcp_pro_signed', '<>', true)
+            ->where('is_entry_error', '<>', true)
+            ->count();
+    }
+
     function get_patients_without_appointment_query() {
         return Client::where('mcp_pro_id', $this->id)
                     ->whereNull('today_mcp_appointment_date')
@@ -551,6 +585,15 @@ WHERE mcp_pro_id = :pro_id
         return $this->get_patients_without_appointment_query()->count();
     }
 
+    function get_patients_without_appointment_count_as_admin() {
+        return Client::whereNull('shadow_pro_id')
+            ->whereNull('today_mcp_appointment_date')
+            ->where(function($q){
+                $q->whereNull('next_mcp_appointment_id')
+                    ->orWhere('next_mcp_appointment_date', '<=', DB::raw('NOW()::DATE'));
+            })->count();
+    }
+
     function get_patients_overdue_for_visit_query() {
         return Client::where('mcp_pro_id', $this->id)
                     ->where(function($q){
@@ -633,6 +676,66 @@ WHERE mcp_pro_id = :pro_id
             ->count();
     }
 
+    function get_unsigned_rpm_bills_count_as_mcp() {
+
+        $query = "
+SELECT count(distinct(care_month.id))
+FROM care_month join client on care_month.client_id = client.id join note mrnote on client.most_recent_completed_mcp_note_id = mrnote.id
+    left join bill on care_month.mcp_rm_generic_bill_id = bill.id
+    left join note mrmnote on mrmnote.id = (
+        select max(n.id) from note n 
+        where 
+              n.client_id = client.id AND 
+              n.is_cancelled = FALSE AND
+              (n.is_signed_by_hcp IS NOT NULL AND n.is_signed_by_hcp = TRUE) AND
+              n.effective_dateest::date >= care_month.start_date::date AND 
+              n.effective_dateest::date < (care_month.start_date::date + INTERVAL '1 month')
+     )
+WHERE
+      care_month.mcp_pro_id = {$this->id}
+      AND EXTRACT(MONTH from care_month.start_date) = EXTRACT(MONTH from now())
+      AND EXTRACT(YEAR from care_month.start_date) = EXTRACT(YEAR from now())
+      AND care_month.mcp_rm_generic_bill_id IS NOT NULL
+      AND bill.is_signed_by_generic_pro = TRUE
+";
+
+        // dd($query);
+
+        $count = DB::select($query);
+
+        return $count[0]->count;
+    }
+
+    function get_unsigned_rpm_bills_count_as_rmm() {
+
+        $query = "
+SELECT count(distinct(care_month.id))
+FROM care_month join client on care_month.client_id = client.id join note mrnote on client.most_recent_completed_mcp_note_id = mrnote.id
+    left join bill on care_month.rmm_rm_generic_bill_id = bill.id
+    left join note mrmnote on mrmnote.id = (
+        select max(n.id) from note n 
+        where 
+              n.client_id = client.id AND 
+              n.is_cancelled = FALSE AND
+              (n.is_signed_by_hcp IS NOT NULL AND n.is_signed_by_hcp = TRUE) AND
+              n.effective_dateest::date >= care_month.start_date::date AND 
+              n.effective_dateest::date < (care_month.start_date::date + INTERVAL '1 month')
+     )
+WHERE
+      care_month.rmm_pro_id = {$this->id}
+      AND EXTRACT(MONTH from care_month.start_date) = EXTRACT(MONTH from now())
+      AND EXTRACT(YEAR from care_month.start_date) = EXTRACT(YEAR from now())
+      AND care_month.rmm_rm_generic_bill_id IS NOT NULL
+      AND bill.is_signed_by_generic_pro = TRUE
+";
+
+        // dd($query);
+
+        $count = DB::select($query);
+
+        return $count[0]->count;
+    }
+
     function get_birthdays_today_as_mcp(){
         return;
         $queryClients = $this->performer()->pro->getAccessibleClientsQuery();
@@ -954,6 +1057,19 @@ WHERE mcp_pro_id = :pro_id
         return 0;
     }
 
+    public function get_open_tickets_count_as_mcp(){
+        $self = $this;
+        return Ticket::where(function ($q) use ($self) {
+                $q->where('assigned_pro_id', $self->id)
+                    ->orWhere('manager_pro_id', $self->id)
+                    ->orWhere('ordering_pro_id', $self->id)
+                    ->orWhere('initiating_pro_id', $self->id);
+            })
+            ->where('category', 'other')
+            ->where('is_open', true)
+            ->count();
+    }
+
     //DNA_DASHBOARD
     
     //queries

+ 4 - 1
app/Models/SegmentSummarySuggestion.php

@@ -8,6 +8,9 @@ class SegmentSummarySuggestion extends Model
 {
     protected $table = 'segment_summary_suggestion';
 
-   
+    public function creator()
+    {
+        return $this->hasOne(Pro::class, 'id', 'created_by_pro_id');
+    }
 
 }

+ 5 - 1
public/v-splitter-px/v-splitter.js

@@ -1,4 +1,4 @@
-function initVSplitter(_name, _left, _right, _alignTo = null) {
+function initVSplitter(_name, _left, _right, _alignTo = null, _style = null) {
 
     var minSplitWidth = 300;
 
@@ -17,6 +17,10 @@ function initVSplitter(_name, _left, _right, _alignTo = null) {
     _right.addClass('v-split-panel').css({maxWidth: 'unset', minWidth: 'unset'});
     const vSplit = $('<div/>').addClass('v-split').attr('data-name', _name).insertAfter(_left);
 
+    if(_style) {
+        vSplit.css(_style);
+    }
+
     function _setSplitterHeight() {
         if(!_alignTo) return;
         vSplit.css({marginTop: (_alignTo.position().top + 'px'), height: (_alignTo.outerHeight())});

+ 34 - 0
resources/views/app/admin/notes_pending_summary_suggestion.blade.php

@@ -16,6 +16,7 @@
                     <th class="border-0">Patient</th>
                     <th class="border-0">ICD</th>
                     <th class="border-0">Status</th>
+                    <th class="border-0">Suggestions</th>
                 </tr>
                 </thead>
                 <tbody>
@@ -38,6 +39,39 @@
                         <td>
                             {{$row->overallStatus()}}
                         </td>
+                        <td class="p-0">
+                            @php $segments = $row->segmentsWithPendingSummarySuggestion; @endphp
+                            <table class="table table-sm m-0">
+                                @foreach($segments as $segment)
+                                    <tr>
+                                        <td class="width-100px">
+                                            <div class="d-flex align-items-baseline grow-till-300px">
+                                                <span>{{$segment->display_title}}</span>
+                                                <div class="on-hover-show left on-hover-opaque">
+                                                    <i class="fa fa-info-circle ml-1"></i>
+                                                    <div class="on-hover-content p-2 text-sm">
+                                                        <div class="d-flex align-items-start border p-1 mb-2">
+                                                            <span class="mr-1 width-70px">Original:</span>
+                                                            <div class="bg-light inline-html-container max-height-100px max-width-300px overflow-hidden">
+                                                                {!! $segment->summary_html !!}
+                                                            </div>
+                                                        </div>
+                                                        <div class="d-flex align-items-start border p-1">
+                                                            <span class="mr-1 width-70px">Suggested:</span>
+                                                            <div class="bg-light inline-html-container max-height-100px max-width-300px overflow-hidden">
+                                                                {!! $segment->proposedSegmentSummarySuggestion->summary_html !!}
+                                                            </div>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        </td>
+                                        <td>{{$segment->proposedSegmentSummarySuggestion->creator->displayName()}}</td>
+                                        <td>{{friendlier_date($segment->proposedSegmentSummarySuggestion->created_at)}}</td>
+                                    </tr>
+                                @endforeach
+                            </table>
+                        </td>
                     </tr>
                 @endforeach
                 </tbody>

+ 16 - 7
resources/views/app/dashboard-admin.blade.php

@@ -25,15 +25,15 @@
                             <table class="table mb-0 dashboard-stats-table">
                                 <tbody>
                                 <tr>
-                                    <th class="px-2 text-center">{{$pro->get_patients_count_as_mcp()}}</th>
+                                    <th class="px-2 text-center">{{$pro->get_patients_count_as_admin()}}</th>
                                     <th class="pl-2">Patients</th>
                                 </tr>
                                 <tr>
-                                    <th class="px-2 text-center">{{$pro->get_new_patients_awaiting_visit_count_as_mcp()}}</th>
+                                    <th class="px-2 text-center">{{$pro->get_new_patients_awaiting_visit_count_as_admin()}}</th>
                                     <th class="pl-2">New Patients Awaiting Visit</th>
                                 </tr>
                                 <tr>
-                                    <th class="px-2 text-center">{{$pro->get_notes_pending_signature_count_as_mcp()}}</th>
+                                    <th class="px-2 text-center">{{$pro->get_notes_pending_signature_count_as_admin()}}</th>
                                     <th class="pl-2">Notes Pending Signature</th>
                                 </tr>
                                 <tr>
@@ -42,7 +42,7 @@
                                         <a href="{{ route('admin.notes_pending_summary_suggestion') }}"
                                            native target="_blank"
                                            open-in-stag-popup
-                                           popup-style="tall"
+                                           popup-style="tall stag-popup-md"
                                            title="Notes With Pending Summary Suggestion">
                                             Notes With Pending Summary Suggestion
                                         </a>
@@ -61,16 +61,16 @@
                                     </th>
                                 </tr>
                                 <tr>
-                                    <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_mcp()}}</th>
+                                    <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_admin()}}</th>
                                     <th class="pl-2">Notes Pending Billing</th>
                                 </tr>
                                 <tr>
-                                    <th class="px-2 text-center">{{$pro->get_incoming_reports_pending_signature_count_as_mcp()}}</th>
+                                    <th class="px-2 text-center">{{$pro->get_incoming_reports_pending_signature_count_as_admin()}}</th>
                                     <th class="pl-2">Reports Pending Signature</th>
                                 </tr>
 
                                 <tr>
-                                    <th class="px-2 text-center">{{$pro->get_patients_without_appointment_count_as_mcp()}}</th>
+                                    <th class="px-2 text-center">{{$pro->get_patients_without_appointment_count_as_admin()}}</th>
                                     <th class="pl-2">Patients w/o Appointments</th>
                                 </tr>
                                 <tr>
@@ -98,6 +98,15 @@
                                     <th class="px-2 text-center">{{$pro->get_supply_orders_awaiting_signature_count_as_mcp()}}</th>
                                     <th class="pl-2">Supply Orders Pending Signature</th>
                                 </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_open_tickets_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('practice-management.myTickets') }}">
+                                            Open Tickets
+                                        </a>
+                                    </th>
+                                </tr>
+
                                 </tbody>
                             </table>
                         </div>

+ 21 - 1
resources/views/app/dashboard-mcp.blade.php

@@ -70,7 +70,7 @@
                                         <a href="{{ route('mcp.notes_pending_summary_suggestion') }}"
                                            native target="_blank"
                                            open-in-stag-popup
-                                           popup-style="tall"
+                                           popup-style="tall stag-popup-md"
                                            title="Notes With Pending Summary Suggestion">
                                             Notes With Pending Summary Suggestion
                                         </a>
@@ -235,6 +235,26 @@
                                         </a>
                                     </th>
                                 </tr>
+                                @if($pro->is_enrolled_as_mcp)
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_unsigned_rpm_bills_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('practice-management.rpm-matrix-mcp') }}?f_billable=yes">
+                                            Unsigned RPM Bills (MCP)
+                                        </a>
+                                    </th>
+                                </tr>
+                                @endif
+                                @if($pro->is_considered_for_rmm)
+                                    <tr>
+                                        <th class="px-2 text-center">{{$pro->get_unsigned_rpm_bills_count_as_rmm()}}</th>
+                                        <th class="pl-2">
+                                            <a href="{{ route('practice-management.rpm-matrix-rmm') }}?f_billable=yes">
+                                                Unsigned RPM Bills (RMM)
+                                            </a>
+                                        </th>
+                                    </tr>
+                                @endif
                                 </tbody>
                             </table>
                         </div>

+ 1 - 1
resources/views/app/patient/note/dashboard.blade.php

@@ -770,7 +770,7 @@ use App\Models\Handout;
                             <div class="min-width-300px stag-scrollbar">
                                 <?php $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_create($patient->created_at))->invert === 1); ?>
                                 @if($isOldClient)
-                                    <div class="p-2 bg-light border-bottom">
+                                    <div class="p-2 bg-light border-bottom screen-only">
                                         <div class="d-flex align-items-baseline">
                                             <div class="font-weight-bold font-size-14 text-warning-dark">
                                                 <i class="fa fa-clock text-secondary text-sm"></i>

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

@@ -5,6 +5,15 @@
 
             function init() {
 
+                $(document)
+                    .off('keydown.capture-print')
+                    .on('keydown.capture-print', function(_e) {
+                        if(_e.which === 80 && _e.ctrlKey) {
+                            window.print(); // use "lhs" frame for printing, not "top"
+                            return false;
+                        }
+                    });
+
                 $(document)
                     .off('change.check-book-fu-appt', '.fu-appt-container [name="is_follow_up_needed"]')
                     .on('change.check-book-fu-appt', '.fu-appt-container [name="is_follow_up_needed"]', function() {

+ 1 - 1
resources/views/app/patient/note/lhs-tree.blade.php

@@ -1,4 +1,4 @@
-<div class="note-lhs-tree pb-4" id="note-lhs-tree">
+<div class="note-lhs-tree pb-4 screen-only" id="note-lhs-tree">
     <?php
     $previousHeading = null;
     $previousSubHeading = null;

+ 1 - 1
resources/views/app/patient/note/rhs-sidebar.blade.php

@@ -1,4 +1,4 @@
-<div class="note-rhs-sidebar" id="note-rhs-sidebar">
+<div class="note-rhs-sidebar screen-only" id="note-rhs-sidebar">
 
     <?php
     $cmStartDate = date('Y-m-01', strtotime($note->effective_dateest));

+ 2 - 2
resources/views/app/patient/note/segment/suggestions_and_updates.blade.php

@@ -56,7 +56,7 @@
         <div class="alert alert-info">Your suggestion has been rejected.</div>
         @endif
         <div class="d-flex">
-            @if(($note->hcp_pro_id == $performer->pro_id ) && $segment->proposedSegmentSummarySuggestion->status == 'PENDING')
+            @if(($note->hcp_pro_id == $performer->pro_id || $performer->pro->pro_type === 'ADMIN') && $segment->proposedSegmentSummarySuggestion->status == 'PENDING')
             <div class="d-block mt-1 mr-2" moe>
                 <form url="/api/segment/acceptProposedSegmentSummarySuggestion" show>
                     <input type="hidden" name="uid" value="{{$segment->uid}}">
@@ -123,4 +123,4 @@
             </form>
         </div>
     </div>
-@endif
+@endif

+ 4 - 10
resources/views/app/patient/settings.blade.php

@@ -358,7 +358,7 @@
                 <div class="pl-3">
 
                     <div class="mb-1">
-                        RMM: <b>{{ $patient->rmm->name_display ?? ''}}</b>
+                        RMM: <b>{{ $patient->rmm ? $patient->rmm->displayName() : '-'}}</b>
                         @if($pro->pro_type === 'ADMIN')
                         <div moe wide>
                             <a start show><i class="fa fa-edit"></i></a>
@@ -367,11 +367,8 @@
                                 <div class="mb-2">
                                     <label class="mb-1 text-secondary text-sm">RMM Pro</label>
 
-                                    <select class="form-control form-control-sm" name="rmmProUid">
+                                    <select class="form-control form-control-sm" name="rmmProUid" provider-search provider-type="rmm">
                                         <option value="">--select--</option>
-                                        @foreach($pros as $rmmPro)
-                                        <option value="{{$rmmPro->uid}}">{{$rmmPro->name_display}}</option>
-                                        @endforeach
                                     </select>
                                 </div>
                                 <div>
@@ -383,7 +380,7 @@
                         @endif
                     </div>
                     <div class="mb-1">
-                        RME: <b>{{ $patient->rme->name_display ?? '' }}</b>
+                        RME: <b>{{ $patient->rme ? $patient->rme->displayName() : '-'}}</b>
                         @if($pro->pro_type === 'ADMIN')
                         <div moe wide>
                             <a start show><i class="fa fa-edit"></i></a>
@@ -391,11 +388,8 @@
                                 <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="rmeProUid">
+                                    <select class="form-control form-control-sm" name="rmeProUid" provider-search provider-type="rme">
                                         <option value="">--select--</option>
-                                        @foreach($pros as $rmePro)
-                                        <option value="{{$rmePro->uid}}">{{$rmePro->name_display}}</option>
-                                        @endforeach
                                     </select>
                                 </div>
                                 <div>

+ 6 - 3
resources/views/app/practice-management/my-tickets.blade.php

@@ -21,8 +21,8 @@
             <table class="table table-sm table-striped p-0 m-0">
                 <thead class="bg-light">
                 <tr>
+                    <th class="border-0">Created</th>
                     <th class="border-0">Patient</th>
-                    <th class="border-0">Type</th>
                     <th class="border-0 w-50">Details</th>
                     <th class="border-0">Role</th>
                     <th class="border-0"></th>
@@ -31,10 +31,10 @@
                 <tbody>
                 @foreach($myTickets as $ticket)
                     <tr>
+                        <td>{{friendlier_date($ticket->created_at)}}</td>
                         <td class="text-nowrap">
                             <a href="/patients/view/{{ $ticket->patient->uid }}">{{ $ticket->patient->displayName() }}</a>
                         </td>
-                        <td>{{ strtoupper($ticket->category) }}</td>
                         <td>
                             <?php
                             $display = '-';
@@ -62,6 +62,9 @@
                                         }
                                     }
                                     break;
+                                case 'other':
+                                    $display = @$parsed->title;
+                                    break;
                             }
                             ?>
                             {!! $display !!}
@@ -78,7 +81,7 @@
                             {{ $roles }}
                         </td>
                         <td>
-                            <a href="/patients/view/{{ $ticket->patient->uid }}/action-items-{{ $ticket->category }}/view/{{ $ticket->uid }}">Open</a>
+                            <a href="/patients/view/{{ $ticket->patient->uid }}/tickets/other/{{ $ticket->uid }}">Open</a>
                         </td>
                     </tr>
                 @endforeach

+ 41 - 22
resources/views/app/practice-management/remote-monitoring-row-markup-by-pro-type.blade.php

@@ -19,7 +19,7 @@
             <span class="sort-data">{{$iPatient->most_recent_cellular_bp_sbp_mm_hg ?: '-'}}</span>/{{$iPatient->most_recent_cellular_bp_dbp_mm_hg ?: '-'}}
             @if($iPatient->most_recent_cellular_bp_measurement_at)
                 <span class="text-sm text-secondary text-nowrap ml-1"
-                      title="{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}">({{$iPatient->most_recent_cellular_bp_measurement_at}})</span>
+                      title="{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}">({{friendly_date_est($iPatient->most_recent_cellular_bp_measurement_at)}})</span>
             @endif
         </div>
     </td>
@@ -28,7 +28,7 @@
             <span class="sort-data">{{$iPatient->most_recent_cellular_weight_value ? round($iPatient->most_recent_cellular_weight_value, 1) : '-'}}</span>
             @if($iPatient->most_recent_cellular_weight_measurement_at)
                 <span class="text-sm text-secondary text-nowrap ml-1"
-                      title="{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}">({{friendly_date($iPatient->most_recent_cellular_weight_measurement_at)}})</span>
+                      title="{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}">({{friendly_date_est($iPatient->most_recent_cellular_weight_measurement_at)}})</span>
             @endif
         </div>
     </td>
@@ -215,39 +215,58 @@
     </td>
     <td>
         @if($mode === 'mcp')
-            @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_mcp >= 1200)
+            @if($iPatient->mcp_rm_generic_bill_id)
                 <span class="text-success font-weight-bold">
                     <i class="fa fa-check"></i>
-                    Yes 
-                    @if($iPatient->mcp_rm_generic_bill_id)
-                        (Billable: ${{friendly_money($iPatient->mcp_rm_generic_bill_expected_payment_amount)}})
-                        
-                        <div moe
-                                class="d-inline-block {{ $iPatient->mcp_rm_generic_bill_generic_pro_id !== $pro->id ? 'moe-disabled' : '' }}"
-                                title="{{ $iPatient->mcp_rm_generic_bill_generic_pro_id !== $pro->id ? 'Only the bill\'s pro can sign' : '' }}">
-                            <a class="text-nowrap" href="" show start>Sign</a>
-                            <form url="/api/bill/signAsGenericPro">
-                                <input type="hidden" name="uid" value="{{$iPatient->mcp_rm_generic_bill_uid}}">
-                                <p>Sign this bill?</p>
-                                <div class="mb-0">
-                                    <button class="btn btn-success btn-sm" submit>Sign</button>
-                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
-                                </div>
-                            </form>
-                        </div>
-                    @endif
+                    Yes
                 </span>
+                (${{friendly_money($iPatient->mcp_rm_generic_bill_expected_payment_amount)}})
+                @if($iPatient->mcp_rm_generic_bill_signed)
+                    <div moe relative
+                         class="d-inline-block {{ $iPatient->mcp_rm_generic_bill_generic_pro_id !== $pro->id ? 'moe-disabled' : '' }}"
+                         title="{{ $iPatient->mcp_rm_generic_bill_generic_pro_id !== $pro->id ? 'Only the bill\'s pro can sign' : '' }}">
+                        <a class="font-weight-bold" href="" show start>Sign</a>
+                        <form url="/api/bill/signAsGenericPro" right>
+                            <input type="hidden" name="uid" value="{{$iPatient->mcp_rm_generic_bill_uid}}">
+                            <p>Sign this bill?</p>
+                            <div class="mb-0">
+                                <button class="btn btn-success btn-sm" submit>Sign</button>
+                                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                            </div>
+                        </form>
+                    </div>
+                @else
+                    <span class="text-success">Signed</span>
+                @endif
             @else
                 <span class="text-danger font-weight-normal">
                     Not yet
                 </span>
             @endif
         @elseif($mode === 'rmm')
-            @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200)
+            @if($iPatient->rmm_rm_generic_bill_id)
                 <span class="text-success font-weight-bold">
                     <i class="fa fa-check"></i>
                     Yes
                 </span>
+                (${{friendly_money($iPatient->rmm_rm_generic_bill_expected_payment_amount)}})
+                @if($iPatient->rmm_rm_generic_bill_signed)
+                    <div moe relative
+                         class="d-inline-block {{ $iPatient->rmm_rm_generic_bill_generic_pro_id !== $pro->id ? 'moe-disabled' : '' }}"
+                         title="{{ $iPatient->rmm_rm_generic_bill_generic_pro_id !== $pro->id ? 'Only the bill\'s pro can sign' : '' }}">
+                        <a class="font-weight-bold" href="" show start>Sign</a>
+                        <form url="/api/bill/signAsGenericPro" right>
+                            <input type="hidden" name="uid" value="{{$iPatient->rmm_rm_generic_bill_uid}}">
+                            <p>Sign this bill?</p>
+                            <div class="mb-0">
+                                <button class="btn btn-success btn-sm" submit>Sign</button>
+                                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                            </div>
+                        </form>
+                    </div>
+                @else
+                    <span class="text-success">Signed</span>
+                @endif
             @else
                 <span class="text-danger font-weight-normal">
                     Not yet

+ 27 - 4
resources/views/app/practice-management/rpm-matrix-by-pro-type.blade.php

@@ -229,6 +229,18 @@
                             </div>
                         </div>
 
+                        @if($mode === 'mcp' || $mode === 'rmm')
+                        <div>
+                            <label class="mb-0 text-sm {{request()->input('f_billable') && request()->input('f_billable') !== 'any' ? 'text-info' : 'text-secondary'}}">Billable</label>
+                            <select name="f_billable"
+                                    class="mr-2 form-control form-control-sm min-width-unset width-70px pl-0">
+                                <option {{request()->input('f_billable') === 'all' ? 'selected' : ''}} value="any">All</option>
+                                <option {{request()->input('f_billable') === 'yes' ? 'selected' : ''}} value="yes">Yes</option>
+                                <option {{request()->input('f_billable') === 'no' ? 'selected' : ''}} value="no">No</option>
+                            </select>
+                        </div>
+                        @endif
+
                         <div>
                             <label class="mb-0 text-sm text-secondary">&nbsp;</label>
                             <div class="d-flex align-items-start">
@@ -245,10 +257,10 @@
 
             <div class="card-body p-0">
                 <div class="d-flex align-items-stretch m-0 h-100">
-                    <div class="overflow-auto border-right h-100">
+                    <div class="overflow-auto border-right h-100 rpm-matrix-left-column">
                         @include('app.stat-tree.summary', ['slug' => 'rm-tree-' . $mode, 'showForPro' => $pro, 'noDropVisualize' => true, 'stParams' => ['start_date' => $rcmStartDate]])
                     </div>
-                    <div class="flex-grow-1 px-0 overflow-auto h-100">
+                    <div class="flex-grow-1 px-0 overflow-auto h-100 rpm-matrix-right-column">
                         <?php $trIndex = 0; ?>
                         @foreach ($patients as $iPatient)
                             <script>
@@ -303,8 +315,15 @@
                                     <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => '#Meas. Days', 'key' => 'number_of_days_with_remote_measurements'])</th>
                                     <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => '#RME Mins.', 'key' => 'rm_total_time_in_seconds_by_rme_pro'])</th>
                                 @endif
-                                <th class="border-0 text-secondary"
-                                ">Billable</th>
+                                @if(!request()->input('f_billable') || request()->input('f_billable') === 'all')
+                                    @if($mode === 'mcp')
+                                        <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'Billable', 'key' => 'mcp_rm_generic_bill_id'])</th>
+                                    @elseif($mode === 'rmm')
+                                        <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.rpm-matrix-" . $mode), 'label' => 'Billable', 'key' => 'rmm_rm_generic_bill_id'])</th>
+                                    @endif
+                                @else
+                                    <th class="border-0 text-secondary">Billable</th>
+                                @endif
                             </tr>
                             </thead>
                             <tbody>
@@ -415,6 +434,10 @@
                     });
 
                 initMoes();
+
+                // hack - init split at 22%
+                localStorage['v-split-rounded-rpm-matrix-split'] = 22;
+                initVSplitter('rpm-matrix-split', $('.rpm-matrix-left-column'), $('.rpm-matrix-right-column'), null, {marginLeft: '-3px', width: '5px', height: '100%', marginTop: 0, borderRadius: 0});
             }
 
             addMCInitializer('practice-remote-monitoring', init, '#practice-remote-monitoring');

+ 2 - 2
resources/views/layouts/patient-header.blade.php

@@ -346,7 +346,7 @@ $addressParts .= implode(", ", $addressPart2);
           <div>DOB: {{friendly_date($patient->dob, false,null, true)}} </div>
           @if($patient->getPrimaryCoverage() && $patient->getPrimaryCoverageStatus() === 'YES')
             <div class="text-nowrap screen-only ml-2 pl-2 border-left">
-              {{$patient->getPrimaryCoverage()->insuranceDisplayName()}}
+              {{$patient->getPrimaryCoverage()->insuranceDisplayPayerName()}}
               <span class="on-hover-show d-inline-block on-hover-opaque">
                 <i class="fa fa-check-circle text-success"></i>
                 <div class="on-hover-content py-2 pl-3 text-nowrap">
@@ -355,7 +355,7 @@ $addressParts .= implode(", ", $addressPart2);
               </span> 
             </div>
             @if($performer->pro->pro_type == 'ADMIN')
-              <div class="ml-2">Deductible: {{@$patient->latestClientPrimaryCoverage->auto_medicare_mpb_remaining}} </div>
+              <div class="ml-2">Deductible: {{@$patient->latestClientPrimaryCoverage->auto_medicare_mpb_remaining ?? '--'}} </div>
             @endif 
           @endif
         </div>

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

@@ -139,6 +139,10 @@
                         @endif
                         <a class="dropdown-item" href="{{ route('practice-management.client-ccm-rm-status') }}">Client RM Status</a>
 
+                        <a class="dropdown-item" href="{{ route('practice-management.myTickets') }}">My Tickets</a>
+                        <a class="dropdown-item" href="{{ route('practice-management.myTextShortcuts') }}">My Text Shortcuts</a>
+                        <a class="dropdown-item" href="{{ route('practice-management.myFavorites') }}">My Favorites</a>
+
                         @if($pro->is_enrolled_as_mcp && $pro->is_considered_for_mcp_assignment)
 
                             <a class="dropdown-item" href="{{ route('practice-management.financialTransactions') }}">Financial Transactions</a>
@@ -193,9 +197,6 @@
                             <a class="dropdown-item" href="{{ route('pro-care-month-report') }}">Care Month Report</a>
                             <a class="dropdown-item" href="{{ route('practice-management.rm-bills-to-sign') }}">RM Bills to Sign</a>
                             <a class="dropdown-item" href="{{ route('unmapped-sms') }}">Unmapped SMS</a>
-                            <a class="dropdown-item" href="{{ route('practice-management.myTickets') }}">My Tickets</a>
-                            <a class="dropdown-item" href="{{ route('practice-management.myTextShortcuts') }}">My Text Shortcuts</a>
-                            <a class="dropdown-item" href="{{ route('practice-management.myFavorites') }}">My Favorites</a>
                             <a class="dropdown-item" href="{{ route('practice-management.proAvailability') }}">Pro Availability</a>
                             <a class="dropdown-item" href="{{ route('practice-management.proCalendar') }}">Pro Calendar</a>
                             <a class="dropdown-item" href="{{ route('practice-management.remoteMonitoringReport') }}">Remote Monitoring Report</a>