Просмотр исходного кода

MCP RM interaction push from patient layout

Vijayakrishnan 3 лет назад
Родитель
Сommit
8a3f2dd722
2 измененных файлов с 28 добавлено и 7 удалено
  1. 12 7
      app/Models/Client.php
  2. 16 0
      resources/views/layouts/patient.blade.php

+ 12 - 7
app/Models/Client.php

@@ -298,16 +298,21 @@ class Client extends Model
 
     public function currentCareMonth()
     {
-        $cmStartDate = strtotime(date('Y-m-d'));
-        $month = date("n", $cmStartDate);
-        $year = date("Y", $cmStartDate);
-        return CareMonth
-            ::where('client_id', $this->id)
-            ->whereRaw('EXTRACT(MONTH FROM start_date) = ?', [$month])
-            ->whereRaw('EXTRACT(YEAR FROM start_date) = ?', [$year])
+        $cmStartDate = date('Y-m-01');
+        return CareMonth::where('client_id', $this->id)
+            ->whereRaw('start_date = ?', [$cmStartDate])
             ->first();
     }
 
+    // returns the current care-month, if in fact patient is awaiting mcp rm interaction
+    public function isAwaitingRMCommunicationFromMCP() {
+        // if patient is enrolled in rm AND has current care month AND $careMonth->has_mcp_interacted_with_client_about_rm IS FALSE
+        if($this->is_enrolled_in_rm !== 'YES') return false;
+        $careMonth = $this->currentCareMonth();
+        if(!$careMonth) return false;
+        return $careMonth->has_mcp_interacted_with_client_about_rm ? false : $careMonth;
+    }
+
     public function previousCareMonth()
     {
         $cmStartDate = date('Y-m-d', strtotime('first day of last month'));

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

@@ -305,6 +305,22 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 						@include('layouts.patient-header')
 					</div>
 				</div>
+				<?php $iCM = $patient->isAwaitingRMCommunicationFromMCP(); ?>
+				@if($iCM !== FALSE)
+					<div class="d-block my-0 mx-2 p-2 alert alert-warning mcp-theme-1 border border-warning text-dark">
+						<span class="font-size-13">
+							<i class="fa fa-exclamation-triangle mr-1"></i>
+							This patient has not had RPM-related interactive communication this month. Please document interactive time
+							@if(request()->route()->getName() === 'patients.view.care-months.view.dashboard' && @$careMonth && @$careMonth->id === $iCM->id)
+								here.
+							@else
+								<a href="{{route('patients.view.care-months.view.dashboard', ['patient' => $patient, 'careMonth' => $iCM])}}"
+								   class="font-weight-bold d-inline">here</a>.
+							@endif
+							This time may not be billed towards a note.
+						</span>
+					</div>
+				@endif
 				@if($pro->pro_type === 'ADMIN')
 				<div class="screen-only card-header py-2 d-flex align-items-start justify-content-between mcp-theme-1 bg-aliceblue hide-inside-popup">
 					<div class="d-flex align-items-center">