Samson Mutunga 3 years ago
parent
commit
addf4cd2ca
2 changed files with 22 additions and 12 deletions
  1. 4 0
      app/Models/Client.php
  2. 18 12
      resources/views/app/dna/patients-table.blade.php

+ 4 - 0
app/Models/Client.php

@@ -853,4 +853,8 @@ ORDER BY m.ts DESC
             ->whereNotNull('visit_template_id')
             ->orderBy('created_at', 'desc');
     }
+
+    public function mostRecentWeightMeasurement(){        
+        return $this->hasOne(Measurement::class, 'id', 'most_recent_weight_measurement_id');
+    }
 }

+ 18 - 12
resources/views/app/dna/patients-table.blade.php

@@ -12,15 +12,15 @@
 			<th class="px-3 border-0">Last Visit</th>
 			<th class="px-3 border-0">Next Appt.</th>
 			<th class="px-3 border-0">Status</th>
-			<th class="px-3 border-0">CCM</th>
 			<th class="px-3 border-0">RPM</th>
-			<th class="px-3 border-0 d-none">Last Weight-In</th>
-			<th class="px-3 border-0 d-none">Last BP</th>
 			<th class="px-3 border-0">Assigned On</th>
 		</tr>
 	</thead>
 	<tbody>
 		@foreach($patients as $patient)
+		<?php
+			$patient->most_recent_weight_measurement_id = 68434;
+		?>
 		<tr>
 			<td class="px-3">
 				<a native target="_blank" href="{{route('patients.view.dashboard', $patient)}}">
@@ -59,7 +59,14 @@
 			</td>
 			<td>
 				<div class="d-flex flex-column">
-					<span>{{ $patient->mcp->displayName() }}</span>
+					<span>{{ $patient->mcp->displayName() }}</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>Next Appt. {{ friendly_date_time($patient->next_mcp_appointment_date) }}</span>
 					@endif
@@ -76,15 +83,14 @@
 			<td>{{$patient->lastMcpAppointment ? friendly_date_time($patient->lastMcpAppointment->raw_date.' '.$patient->lastMcpAppointment->raw_start_time) : '-'}}</td>
 			<td>{{$patient->nextMcpAppointment ? friendly_date_time($patient->nextMcpAppointment->raw_date.' '.$patient->nextMcpAppointment->raw_start_time) : '-'}}</td>
 			<td>{{$patient->nextMcpAppointment ? $patient->nextMcpAppointment->status : '-'}}</td>
-			<td>{{$patient->is_enrolled_in_cm ? 'Yes' : 'No'}}</td>
-			<td>{{$patient->is_enrolled_in_rm ? 'Yes' : 'No'}}</td>
-			<td class="d-none">
+			<td>
+			   <div class="d-flex flex-column">
+			   		<span>Enrolled: {{$patient->is_enrolled_in_rm ? 'Yes' : 'No'}}</span>
 				<?php $m = $patient->lastMeasurementOfType('Wt. (lbs.)'); ?>
-				{{$m && $m->value ? round($m->value, 2) : '-'}}
-			</td>
-			<td class="d-none">
-				<?php $m = $patient->lastMeasurementOfType('BP'); ?>
-				{{$m && $m->value ? $m->value : '-'}}
+				<span>Wt. (lbs.) {{$m && $m->value ? round($m->value, 2) : '-'}}</span>
+				<?php $bp = $patient->lastMeasurementOfType('BP'); ?>
+				<span>BP. {{$bp && $bp->value ? $bp->value : '-'}}</span>
+			   </div>
 			</td>
 			<td>{{$patient->getMcpAssignedOn()}}</td>
 		</tr>