Samson Mutunga 3 лет назад
Родитель
Сommit
98f6bb25f3
1 измененных файлов с 14 добавлено и 20 удалено
  1. 14 20
      resources/views/app/patient/claims-resolver.blade.php

+ 14 - 20
resources/views/app/patient/claims-resolver.blade.php

@@ -22,18 +22,15 @@
     $totalNotesWithBillingClosed = 0;
     $totalNotesWithClaimingClosed = 0;
     foreach($patient->notesAscending as $note){
-        if($note->is_cancelled) continue;
-        if($note->hcpPro){
-            $hcpIdToProMap[$note->hcp_pro_id] = $note->hcpPro;    
-        }
-        
+        if($note->is_cancelled || !$note->hcpPro) continue;
+        $hcpIdToProMap[$note->hcp_pro_id] = $note->hcpPro;
         $d = $note->effective_dateest;
         $firstDateSeenByHcpMap[$note->hcp_pro_id] = isset($firstDateSeenByHcpMap[$note->hcp_pro_id]) ? $firstDateSeenByHcpMap[$note->hcp_pro_id] : $d;
         $lastDateSeenByHcpMap[$note->hcp_pro_id] = $d;
         $noteCount = $hcpNoteCountMap[$note->hcp_pro_id] = isset($hcpNoteCountMap[$note->hcp_pro_id]) ? $hcpNoteCountMap[$note->hcp_pro_id]  + 1 : 1;
         $firstDateSeenByThisHcp = $firstDateSeenByHcpMap[$note->hcp_pro_id];
         $firstDateEverSeenByAnyone = $firstDateEverSeenByAnyone ? $firstDateEverSeenByAnyone : $d;
-        if($note->hcpPro && $note->hcpPro->is_enrolled_as_mcp){
+        if($note->hcpPro->is_enrolled_as_mcp){
             $firstDateEverSeenByMcpTypePro = $firstDateEverSeenByMcpTypePro ? $firstDateEverSeenByMcpTypePro : $d;
             if($note->client->mcp && $note->hcpPro->id == $note->client->mcp->id){
                 $firstDateEverSeenByCurrentMcp = $firstDateEverSeenByMcpTypePro;
@@ -44,11 +41,9 @@
         $daysWithHcp = (strtotime($d) - strtotime($firstDateSeenByThisHcp)) / (60 * 60 * 24);
         $lastVisitWithHcp = isset($loopLastDateSeenByHcpMap[$note->hcp_pro_id]) ? $loopLastDateSeenByHcpMap[$note->hcp_pro_id] : null;
         $daysSinceLastNoteByThisHcp = $lastVisitWithHcp ? (strtotime($d) - strtotime($lastVisitWithHcp)) / (60 * 60 * 24) : null;
-        $daysSinceLastMcpTypeVisit = $note->hcpPro && $note->hcpPro->is_enrolled_as_mcp && $loopLastDateSeenByMcpTypePro ? (strtotime($d) - strtotime($loopLastDateSeenByMcpTypePro)) / (60 * 60 * 24) : null;
-        if($note->hcpPro){
-          $loopLastDateSeenByHcpMap[$note->hcpPro->id] = $d;  
-        }        
-        if($note->hcpPro && $note->hcpPro->is_enrolled_as_mcp){
+        $daysSinceLastMcpTypeVisit = $note->hcpPro->is_enrolled_as_mcp && $loopLastDateSeenByMcpTypePro ? (strtotime($d) - strtotime($loopLastDateSeenByMcpTypePro)) / (60 * 60 * 24) : null;
+        $loopLastDateSeenByHcpMap[$note->hcpPro->id] = $d;
+        if($note->hcpPro->is_enrolled_as_mcp){
             $loopLastDateSeenByMcpTypePro = $d;
         }
         $daysInMcpProgramTotal = (strtotime(date('Y-m-d')) - strtotime($firstDateSeenByThisHcp)) / (60 * 60 * 24);
@@ -245,7 +240,7 @@
             $loopLastContentByHcp = [];
             $rowIndex = 0;
             foreach($patient->notesAscending as $note){
-                if($note->is_cancelled) continue;
+                if($note->is_cancelled || !$note->hcpPro) continue;
                 $rowIndex++;
 
                 $d = $note->effective_dateest;
@@ -255,7 +250,7 @@
                 $firstDateSeenByThisHcp = $firstDateSeenByHcpMap[$note->hcp_pro_id];
 
                 $firstDateEverSeenByAnyone = $firstDateEverSeenByAnyone ? $firstDateEverSeenByAnyone : $d;
-                if($note->hcpPro && $note->hcpPro->is_enrolled_as_mcp){
+                if($note->hcpPro->is_enrolled_as_mcp){
                     $firstDateEverSeenByMcpTypePro = $firstDateEverSeenByMcpTypePro ? $firstDateEverSeenByMcpTypePro : $d;
                 }
 
@@ -267,7 +262,7 @@
                 $lastVisitWithHcp = isset($loopLastDateSeenByHcpMap[$note->hcp_pro_id]) ? $loopLastDateSeenByHcpMap[$note->hcp_pro_id] : null;
                 $daysSinceLastNoteByThisHcp = $lastVisitWithHcp ? (strtotime($d) - strtotime($lastVisitWithHcp)) / (60 * 60 * 24) : null;
 
-                $daysSinceLastMcpTypeVisit = $note->hcpPro && $note->hcpPro->is_enrolled_as_mcp && $loopLastDateSeenByMcpTypePro ? (strtotime($d) - strtotime($loopLastDateSeenByMcpTypePro)) / (60 * 60 * 24) : null;
+                $daysSinceLastMcpTypeVisit = $note->hcpPro->is_enrolled_as_mcp && $loopLastDateSeenByMcpTypePro ? (strtotime($d) - strtotime($loopLastDateSeenByMcpTypePro)) / (60 * 60 * 24) : null;
 
                 // content
 
@@ -278,7 +273,7 @@
                     echo '<hr>';
                 }
                 $content = ob_get_clean();
-                $lastContent = isset($loopLastContentByHcp[@$note->hcpPro->id]) ? $loopLastContentByHcp[@$note->hcpPro->id] : "-";
+                $lastContent = isset($loopLastContentByHcp[$note->hcpPro->id]) ? $loopLastContentByHcp[$note->hcpPro->id] : "-";
 
                 $contentText = Html2Text::convert($content);
                 $lastContentText = Html2Text::convert($lastContent);
@@ -287,7 +282,7 @@
         <tr>
             <td>{{$rowIndex}}</td>
             <td>
-                <strong>{{ $note->hcpPro ?$note->hcpPro->displayName() : '' }}</strong>
+                <strong>{{ $note->hcpPro->displayName() }}</strong>
             </td>
             <td>
                 <a native target="_blank"
@@ -409,12 +404,11 @@
             </td>
         </tr>
         <?php
-                if($note->hcpPro) $loopLastDateSeenByHcpMap[$note->hcpPro->id] = $d;
-                
-                if($note->hcpPro && $note->hcpPro->is_enrolled_as_mcp){
+                $loopLastDateSeenByHcpMap[$note->hcpPro->id] = $d;
+                if($note->hcpPro->is_enrolled_as_mcp){
                     $loopLastDateSeenByMcpTypePro = $d;
                 }
-                if($note->hcpPro) $loopLastContentByHcp[$note->hcpPro->id] = $content;
+                $loopLastContentByHcp[$note->hcpPro->id] = $content;
             }
         ?>