Peter Muturi 1 年之前
父節點
當前提交
aeeb4d26f4

+ 28 - 28
app/Models/Pro.php

@@ -62,7 +62,7 @@ class Pro extends Model
     {
         return $this->hasMany(ProTeam::class, 'mcp_pro_id', 'id');
     }
-    
+
     public function teamsWhereAssistant()
     {
         return $this->hasMany(ProTeam::class, 'assistant_pro_id', 'id');
@@ -165,7 +165,7 @@ class Pro extends Model
         $accesses = VisitTemplateAccess::where('pro_id', $this->id)->where('is_active', true)->pluck('visit_template_id')->toArray();
 
         $allAllowedVisitTemplatesIDs = array_unique(array_merge($allAccessibleVisitTemplatesIDs, $accesses));
-        
+
         return VisitTemplate::whereIn('id', $allAllowedVisitTemplatesIDs)->get();
     }
 
@@ -628,7 +628,7 @@ WHERE mcp_pro_id = :pro_id
     }
 
     function get_patients_without_remote_measurement_in_48_hours_count_as_mcp() {
-        return DB::select("SELECT COUNT(*) as count FROM client WHERE ((most_recent_cellular_measurement_at+ interval '48 hour')::timestamp < NOW() OR most_recent_cellular_measurement_id IS NULL) AND client.mcp_pro_id = :mcp_pro_id AND is_active IS TRUE", ['mcp_pro_id'=>$this->id])[0]->count; 
+        return DB::select("SELECT COUNT(*) as count FROM client WHERE ((most_recent_cellular_measurement_at+ interval '48 hour')::timestamp < NOW() OR most_recent_cellular_measurement_id IS NULL) AND client.mcp_pro_id = :mcp_pro_id AND is_active IS TRUE", ['mcp_pro_id'=>$this->id])[0]->count;
     }
 
     function get_cancelled_appointments_pending_acknowledgement_count_as_mcp_query() {
@@ -696,12 +696,12 @@ 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 
+        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 AND
               n.effective_dateest::date < (care_month.start_date::date + INTERVAL '1 month')
      )
 WHERE
@@ -725,12 +725,12 @@ 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 
+        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 AND
               n.effective_dateest::date < (care_month.start_date::date + INTERVAL '1 month')
      )
 WHERE
@@ -794,14 +794,14 @@ WHERE
             ->where('is_status_acknowledgement_from_appointment_pro_pending', true)
             //->where('raw_date', '>=', DB::raw('NOW()'))
             ->orderBy('raw_date', 'asc')
-            ->get();
+            ->paginate(20);
     }
     public function getAppointmentsPendingDecisionAck() {
         return Appointment::where('pro_id', $this->id)
             ->where('is_decision_acknowledgement_from_appointment_pro_pending', true)
             //->where('raw_date', '>=', DB::raw('NOW()'))
             ->orderBy('raw_date', 'asc')
-            ->get();
+            ->paginate(20);
     }
     public function getAppointmentsPendingTimeChangeAck() {
         return Appointment::where('pro_id', $this->id)
@@ -1084,7 +1084,7 @@ WHERE
     }
 
     //DNA_DASHBOARD
-    
+
     //queries
     private function patientsQueryAsDna(){
         // WHERE na_pro_id = :me.id
@@ -1118,7 +1118,7 @@ WHERE
                         ->whereNull('today_mcp_appointment_date')
                         ->whereNull('next_mcp_appointment_date');
     }
-    
+
     private function encountersPendingMyReviewQueryAsDna(){
         // WHERE ally_pro_id = me.id AND is_cancelled IS NOT TRUE AND is_signed_by_hcp IS TRUE AND is_signed_by_ally IS NOT TRUE;
         return Note::where('ally_pro_id', $this->id)
@@ -1164,7 +1164,7 @@ WHERE
             return $clientQuery->where('rd_pro_id', $myId);
         })->where('status', 'PENDING');
     }
-    
+
     private function cancelledAppointmentsPendingAckQueryAsDna(){
         // WHERE client_id IN (SELECT id FROM client WHERE default_na_pro_id = :me.id) AND status = 'CANCELLED' AND is_status_acknowledgement_from_default_na_pending IS TRUE;
         $myId = $this->id;
@@ -1182,7 +1182,7 @@ WHERE
         })->where('status', 'CANCELLED')
             ->where('is_status_acknowledgement_from_default_na_pending', true);
     }
-    
+
     private function reportsPendingAckQueryAsDna(){
         // WHERE client_id IN (SELECT id FROM client WHERE default_na_pro_id = :me.id) AND has_na_pro_signed IS FALSE AND is_entry_error
         $myId = $this->id;
@@ -1200,7 +1200,7 @@ WHERE
         })->where('has_na_pro_signed', '<>', true)
             ->where('is_entry_error','<>', true);
     }
-    
+
     private function supplyOrdersPendingMyAckQueryAsDna(){
         // WHERE client_id IN (SELECT id FROM client WHERE default_na_pro_id = :me.id) AND has_na_pro_signed IS FALSE AND is_signed_by_pro IS TRUE AND is_cancelled IS NOT TRUE;
         $myId = $this->id;
@@ -1373,8 +1373,8 @@ WHERE
     }
 
     public function measurementsPendingReviewAsDna(){
-        //Measurements Pending Review 
-        // SELECT * FROM measurement WHERE client_id IN (SELECT id FROM client WHERE rmm_pro_id = :me.id) 
+        //Measurements Pending Review
+        // SELECT * FROM measurement WHERE client_id IN (SELECT id FROM client WHERE rmm_pro_id = :me.id)
         // AND has_been_stamped_by_rmm IS FALSE AND is_cellular IS TRUE AND is_cellular_zero IS NOT TRUE AND is_active IS TRUE ORDER BY ts DESC;
         $myId = $this->id;
         return Measurement::whereHas('client',function($clientQuery) use ($myId) {
@@ -1417,7 +1417,7 @@ WHERE
         $todayMonth =  date('m', $today);
         $todayYear = date('Y', $today);
         if ($todayDate < 15) {
-            $nextPaymentDate = new DateTime(); 
+            $nextPaymentDate = new DateTime();
             $nextPaymentDate->setDate($todayYear, $todayMonth, 15);
             $nextPaymentDate = $nextPaymentDate->format('m/d/Y');
         } else {
@@ -1429,7 +1429,7 @@ WHERE
 
         return $nextPaymentDate;
     }
-    
+
     public function getNextPaymentDateAsRd(){
         $nextPaymentDate = '--';
         //if today is < 15th, next payment is 15th, else nextPayment is
@@ -1439,7 +1439,7 @@ WHERE
         $todayMonth =  date('m', $today);
         $todayYear = date('Y', $today);
         if ($todayDate < 15) {
-            $nextPaymentDate = new DateTime(); 
+            $nextPaymentDate = new DateTime();
             $nextPaymentDate->setDate($todayYear, $todayMonth, 15);
             $nextPaymentDate = $nextPaymentDate->format('m/d/Y');
         } else {
@@ -1544,8 +1544,8 @@ ORDER BY cm.created_at DESC
         return Bill::where('bill_service_type', 'GENERIC')
             ->where('generic_pro_id', $this->id)
             ->orderBy('created_at', 'DESC')->get();
-    }   
-    
+    }
+
     public function myNotesPendingSupervisorPhysicianStamping(){
         $pro = $this;
         return Note::where('is_stamped_by_supervising_physician', false)->where('is_flagged_for_supervising_physician_review', true)->whereHas('hcpCompanyPro', function($qry) use($pro){
@@ -1573,15 +1573,15 @@ ORDER BY cm.created_at DESC
                    crfu.uid,
                 crfu.next_follow_up_reason,
                 crfu.next_follow_up_memo,
-                pro.name_first as pro_first_name, 
+                pro.name_first as pro_first_name,
                 pro.name_last AS pro_last_name,
                 c.uid as client_uid,
                 (c.name_first || ' ' || c.name_last) as client_name,
                 crfu.status AS status
-            FROM client_rep_follow_up crfu 
+            FROM client_rep_follow_up crfu
             join client c on crfu.id = c.client_rep_follow_up_id
             join pro pro on pro.id = crfu.client_rep_pro_id
-            WHERE crfu.status = 'SCHEDULED' 
+            WHERE crfu.status = 'SCHEDULED'
             AND crfu.next_follow_up_date = :date
             ORDER BY crfu.created_at DESC;
         "), ['date' => date('Y-m-d')]);

File diff suppressed because it is too large
+ 403 - 183
package-lock.json


+ 2 - 2
resources/views/app/mcp/dashboard/caremonth-tiers-filter.blade.php

@@ -1,4 +1,4 @@
-<?php 
+<?php
     $filters = request()->all();
     $cmFilterUrl = "/";
 ?>
@@ -29,7 +29,7 @@
 <form id="care-month-tiers-filters" method="GET" action="{{ $cmFilterUrl }}" class="filter-container" v-cloak>
 	<div class="sm-section">
 		<div class="">
-			<label>Care Month Date:</label>
+			<label>Month:</label>
 			<input type="month" name="cm_start_date" class="form-control input-sm" v-model="filters.cm_start_date">
 		</div>
 	</div>

+ 25 - 10
resources/views/app/mcp/dashboard/caremonth-tiers-list.blade.php

@@ -1,11 +1,13 @@
 <div class="card mb-4" stag-collapsible-card="mcp-rm">
     <div class="card-header pl-2">
         <strong>
-            Caremonth Tiers
+            Care Months <sup class="text-danger" style="font-size:11px">NEW</sup>
         </strong>
     </div>
     <div class="card-body p-0">
-        @include('app.mcp.dashboard.caremonth-tiers-filter')
+        <div class="p-1">
+          @include('app.mcp.dashboard.caremonth-tiers-filter')
+        </div>
         <table class="table table-sm table-striped">
             <thead>
                 <tr>
@@ -21,31 +23,44 @@
                 <?php
                     $lastVisitWithinDays = ($cm->days_between_most_recent_mcp_note_date_and_end_of_care_month  <= config('app.maxDaysSinceLastVisit'));
                 ?>
-                <tr discardable-container="">
+                <tr class="{{$cm->tier() ? 'bg-warning-mellow' : ''}}" discardable-container="">
                     <td>
                         <a class="d-block" href="{{ route('patients.view.care-months.view.dashboard', ['patient' => $cm->client, 'careMonth' => $cm]) }}">{{ $cm->client->displayName() }}</a>
                     </td>
                     <td>
-                        {{ $cm->number_of_days_with_remote_measurements ?? 0 }}
+                        {{ $cm->number_of_days_with_remote_measurements ?? 0 }} days
                     </td>
                     <td>
-                        {{round($cm->rm_total_time_in_seconds_by_mcp / 60)}}m {{round($cm->rm_total_time_in_seconds_by_mcp % 60)}}s
+                        {{floor($cm->rm_total_time_in_seconds_by_mcp / 60)}}m
                     </td>
                     <td>
                         @if($lastVisitWithinDays && $cm->has_mcp_interacted_with_client_about_rm)
-                            <span class="text-success font-weight-bold"><i class="fa fa-check"></i> YES</span>
+                            <span class="text-success font-weight-bold">Yes</span>
                         @else
-                            <span class="text-danger font-weight-normal">NO</span>
+                            <span class="text-warning-mellow">No</span>
                         @endif
                     </td>
                     <td>
                         @if($cm->tier() === 'TIER_1')
-                            <span class="text-success font-weight-bold"><i class="fa fa-check"></i> YES <small class="text-muted">Tier 1</small></span>
+                            <span class="text-success">Yes</span> <span class="ml-1 text-secondary text-sm font-weight-bold">(Tier 1)</span>
                         @elseif($cm->tier() === 'TIER_2')
-                            <span class="text-success font-weight-bold"><i class="fa fa-check"></i> YES <small class="text-muted">Tier 2</small></span>
+                          <span class="text-success">Yes</span> <span class="ml-1 text-secondary text-sm font-weight-bold">(Tier 2)</span>
                         @else
-                            <span class="text-danger font-weight-normal">NO</span>
+                            <span class="text-danger">No</span>
                         @endif
+
+                        <div class="on-hover-show d-inline-block on-hover-opaque">
+                            <i class="fa fa-info-circle ml-1"></i>
+                            <div class="on-hover-content p-2 text-dark width-200px">
+                              @if(!$cm->tier())
+                              <h5 class="mb-2 font-weight-bold">Tier 1 Qualification:</h5>
+                              <p class="m-0 text-muted">Minimum of <b>7 days</b>, <b>10 mins</b> and <b>interaction</b> is required.</p>
+                              @elseif($cm->tier() === 'TIER_1')
+                              <h5 class="mb-2 font-weight-bold">Tier 2 Qualification:</h5>
+                              <p class="m-0 text-muted">Minimum of <b>16 days</b>, <b>20 mins</b> and <b>interaction</b> is required.</p>
+                              @endif
+                            </div>
+                        </div>
                     </td>
                 </tr>
                 @endforeach

+ 6 - 0
resources/views/app/mcp/dashboard/notifications.blade.php

@@ -67,6 +67,9 @@ $apptsPending = [
                     @endforeach
                     </tbody>
                 </table>
+                <div class="m-2">
+                    {{ $apptsPending['status']->withQueryString()->links() }}
+                </div>
             @endif
         </div>
     </div>
@@ -112,6 +115,9 @@ $apptsPending = [
                     @endforeach
                     </tbody>
                 </table>
+                <div class="m-2">
+                    {{ $apptsPending['decision']->withQueryString()->links() }}
+                </div>
             @endif
         </div>
     </div>

+ 1 - 1
resources/views/app/patient/care-months.blade.php

@@ -89,7 +89,7 @@
                     <div class="mb-2">
                         <label class="text-secondary text-sm mb-1">Year *</label>
                         <select name="startYear" class="form-control form-control-sm" required>
-                            <option value="2023" {{ date('Y') === '2023' ? 'selected' : '' }}>2023</option>
+                            <option value="{{date('Y')}}" selected>{{date('Y')}}</option>
                         </select>
                     </div>
                     <div class="d-flex align-items-center">

Some files were not shown because too many files changed in this diff