|
@@ -10,9 +10,11 @@
|
|
|
<tr>
|
|
|
<th>HCP</th>
|
|
|
<th>Date</th>
|
|
|
- <th>Day in Program</th>
|
|
|
- <th>Day in MCP Program</th>
|
|
|
+ <th>Days in Program</th>
|
|
|
+ <th>Days in MCP Program</th>
|
|
|
+ <th>Days with HCP</th>
|
|
|
<th>Days Since Last Note by HCP</th>
|
|
|
+ <th>Days Since Last MCP Type Visit</th>
|
|
|
<th>Signed By HCP?</th>
|
|
|
<th>Content</th>
|
|
|
<th></th>
|
|
@@ -22,32 +24,30 @@
|
|
|
<?php
|
|
|
$firstDateEverSeenByAnyone = null;
|
|
|
$firstDateEverSeenByMcpTypePro = null;
|
|
|
- $firstDateEverSeenByCurrentMcp = null;
|
|
|
- $loopLastDateSeenByMcpTypePro = null;
|
|
|
+ $firstDateSeenByHcpMap = [];
|
|
|
$loopLastDateSeenByHcpMap = [];
|
|
|
+ $loopLastDateSeenByMcpTypePro = null;
|
|
|
foreach($patient->notesAscending as $note){
|
|
|
+
|
|
|
$d = $note->effective_dateest;
|
|
|
+ $firstDateSeenByHcpMap[$note->hcp_pro_id] = isset($firstDateSeenByHcpMap[$note->hcp_pro_id]) ? $firstDateSeenByHcpMap[$note->hcp_pro_id] : $d;
|
|
|
+
|
|
|
+ $firstDateSeenByThisHcp = $firstDateSeenByHcpMap[$note->hcp_pro_id];
|
|
|
+
|
|
|
$firstDateEverSeenByAnyone = $firstDateEverSeenByAnyone ? $firstDateEverSeenByAnyone : $d;
|
|
|
if($note->hcpPro->is_mcp){
|
|
|
$firstDateEverSeenByMcpTypePro = $firstDateEverSeenByMcpTypePro ? $firstDateEverSeenByMcpTypePro : $d;
|
|
|
- if($note->hcpPro->id == $patient->mcp_pro_id){
|
|
|
- $firstDateEverSeenByCurrentMcp = $firstDateEverSeenByCurrentMcp;
|
|
|
- }
|
|
|
- }
|
|
|
- $dayInProgram = (strtotime($d) - strtotime($firstDateEverSeenByAnyone)) / (60 * 60 * 24);
|
|
|
- $dayInMcpProgram = null;
|
|
|
- if($firstDateEverSeenByMcpTypePro){
|
|
|
- $dayInMcpProgram = (strtotime($d) - strtotime($firstDateEverSeenByMcpTypePro)) / (60 * 60 * 24);
|
|
|
- }
|
|
|
- $daysSinceLastMcpTypeVisit = null;
|
|
|
- if($note->hcpPro->is_mcp){
|
|
|
- $daysSinceLastMcpTypeVisit = (strtotime($d) - strtotime($loopLastDateSeenByMcpTypePro)) / (60 * 60 * 24);
|
|
|
}
|
|
|
+
|
|
|
+ $daysInProgram = (strtotime($d) - strtotime($firstDateEverSeenByAnyone)) / (60 * 60 * 24);
|
|
|
+ $daysInMcpProgram = $firstDateEverSeenByMcpTypePro ? (strtotime($d) - strtotime($firstDateEverSeenByMcpTypePro)) / (60 * 60 * 24) : null;
|
|
|
+
|
|
|
+ $daysWithHcp = (strtotime($d) - strtotime($firstDateSeenByThisHcp)) / (60 * 60 * 24);
|
|
|
+
|
|
|
$lastVisitWithHcp = isset($loopLastDateSeenByHcpMap[$note->hcp_pro_id]) ? $loopLastDateSeenByHcpMap[$note->hcp_pro_id] : null;
|
|
|
- $daysSinceLastHcpVisit = null;
|
|
|
- if($lastVisitWithHcp){
|
|
|
- $daysSinceLastHcpVisit = (strtotime($d) - strtotime($lastVisitWithHcp)) / (60 * 60 * 24);
|
|
|
- }
|
|
|
+ $daysSinceLastNoteByThisHcp = $lastVisitWithHcp ? (strtotime($d) - strtotime($lastVisitWithHcp)) / (60 * 60 * 24) : null;
|
|
|
+
|
|
|
+ $daysSinceLastMcpTypeVisit = $note->hcpPro->is_mcp && $loopLastDateSeenByMcpTypePro ? (strtotime($d) - strtotime($loopLastDateSeenByMcpTypePro)) / (60 * 60 * 24) : null;
|
|
|
?>
|
|
|
<tr>
|
|
|
<td>
|
|
@@ -57,13 +57,22 @@
|
|
|
{{ $d }}
|
|
|
</td>
|
|
|
<td>
|
|
|
- {{ $dayInProgram }}
|
|
|
+ {{ $daysInProgram }}
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ {{ $daysInMcpProgram }}
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ {{ $daysWithHcp }}
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ {{$daysSinceLastNoteByThisHcp}}
|
|
|
</td>
|
|
|
<td>
|
|
|
- {{ $dayInMcpProgram }}
|
|
|
+ {{$daysSinceLastNoteByThisHcp}}
|
|
|
</td>
|
|
|
<td>
|
|
|
- {{$daysSinceLastHcpVisit}}
|
|
|
+ {{ $daysSinceLastMcpTypeVisit }}
|
|
|
</td>
|
|
|
<td>
|
|
|
{{ $note->is_signed_by_hcp }}
|