Forráskód Böngészése

NRC - show full insurance info at the top if not covered

Vijayakrishnan 3 éve
szülő
commit
ed8d866bd3

+ 11 - 3
app/Models/Client.php

@@ -16,6 +16,7 @@ class Client extends Model
     public function primaryCoverages()
     {
         return $this->hasMany(ClientPrimaryCoverage::class, 'client_id', 'id')
+            ->whereRaw('(is_cancelled IS NULL OR is_cancelled IS FALSE)')
             ->orderBy('created_at', 'desc');
     }
 
@@ -26,10 +27,12 @@ class Client extends Model
         return $this->hasOne(ClientPrimaryCoverage::class, 'id', 'latest_new_client_primary_coverage_id');
     }
 	public function latestAutoRefreshClientPrimaryCoverage(){
-        return $this->hasOne(ClientPrimaryCoverage::class, 'id', 'latest_auto_refresh_client_primary_coverage_id');
+        return $this->hasOne(ClientPrimaryCoverage::class, 'id', 'latest_auto_refresh_client_primary_coverage_id')
+            ->whereRaw('(is_cancelled IS NULL OR is_cancelled IS FALSE)');
     }
 	public function latestManualClientPrimaryCoverage(){
-        return $this->hasOne(ClientPrimaryCoverage::class, 'id', 'latest_manual_client_primary_coverage_id');
+        return $this->hasOne(ClientPrimaryCoverage::class, 'id', 'latest_manual_client_primary_coverage_id')
+            ->whereRaw('(is_cancelled IS NULL OR is_cancelled IS FALSE)');
     }
 	public function temporaryOutsiderNewClientPrimaryCoverage(){
         return $this->hasOne(ClientPrimaryCoverage::class, 'id', 'temporary_outsider_new_client_primary_coverage_id');
@@ -886,7 +889,12 @@ ORDER BY m.ts DESC
 
     public function getPrimaryCoverage()
     {
-        $coverage = $this->latestClientPrimaryCoverage;
+        // try the latest manual coverage
+        $coverage = $this->latestManualClientPrimaryCoverage;
+        if (!$coverage) {
+            // try the latest auto coverage
+            $coverage = $this->latestAutoRefreshClientPrimaryCoverage;
+        }
         return $coverage;
     }
 

+ 7 - 7
resources/views/app/patient/coverage-status.blade.php

@@ -4,7 +4,7 @@
         $mcnDetails = json_decode($patient->mcn_response_detail ?? null);
     @endphp
     @if(!$coverage)
-        <table class="table table-sm table-bordered">
+        <table class="table table-sm table-bordered mb-0">
           <tr>
             <td>
               <b>No coverage info!</b>
@@ -13,7 +13,7 @@
         </table>
     @elseif($coverage->plan_type === 'MEDICARE')
       @if($coverage->creation_strategy == 'NEW' || $coverage->creation_strategy == 'AUTO_REFRESH')
-      <table class="table table-sm table-bordered">
+      <table class="table table-sm table-bordered mb-0">
         <tr>
           <td class="font-weight-bold">Medicare Part B<br>(Primary)</td>
           <td>
@@ -58,7 +58,7 @@
       </table>
       @else
       <!-- Manual determination -->
-      <table class="table table-sm table-bordered">
+      <table class="table table-sm table-bordered mb-0">
         <tr>
           <td class="font-weight-bold">Medicare Part B<br>(Primary)</td>
           <td>
@@ -108,7 +108,7 @@
 
     @elseif($coverage->plan_type === 'MEDICAID')
       @if($coverage->creation_strategy == 'NEW' || $coverage->creation_strategy == 'AUTO_REFRESH')
-      <table class="table table-sm table-bordered">
+      <table class="table table-sm table-bordered mb-0">
         <tr>
           <td class="font-weight-bold">Medicaid<br>(Primary):</td>
           <td>
@@ -128,7 +128,7 @@
         @endif
       </table>
       @else
-        <table class="table table-sm table-bordered">
+        <table class="table table-sm table-bordered mb-0">
           <tr>
             <td class="font-weight-bold">Medicaid<br>(Primary):</td>
             <td>
@@ -156,7 +156,7 @@
 
     @elseif($coverage->plan_type === 'COMMERCIAL')
       @if($coverage->creation_strategy == 'NEW' || $coverage->creation_strategy == 'AUTO_REFRESH')
-      <table class="table table-sm table-bordered">
+      <table class="table table-sm table-bordered mb-0">
         <tr>
           <td class="font-weight-bold">Commercial<br>(Primary):</td>
           <td>
@@ -176,7 +176,7 @@
         @endif
       </table>
       @else
-        <table class="table table-sm table-bordered">
+        <table class="table table-sm table-bordered mb-0">
           <tr>
             <td class="font-weight-bold">Commercial<br>(Primary):</td>
             <td>

+ 12 - 2
resources/views/app/patient/note/partials/resolve-content.blade.php

@@ -138,12 +138,22 @@
     <div class="mx-3 border">
         <div id="note-single-header" class="d-flex border-bottom align-items-start note_template_{{$note->visitTemplate ? $note->visitTemplate->internal_name : ''}}">
 
-            <div class="p-2 d-inline-flex align-items-baseline w-100">
+            <div class="p-2 d-inline-flex align-items-start w-100">
                 <div class="d-inline-flex mr-3 align-items-baseline">
                     <div class="font-weight-bold font-size-14">{{$patient->displayName()}}</div>
                 </div>
                 <div class="mr-3">
-                    @include('app.patient.coverage_column_renderer', ['patient'=>$patient, 'truncateName' => true])
+                    <?php
+                    $coverage = $patient->getPrimaryCoverage();
+                    $coverageStatus = $patient->getPrimaryCoverageStatus();
+                    ?>
+                    @if(!$patient->getPrimaryCoverage() || $patient->getPrimaryCoverageStatus() !== 'YES')
+                        <div class="max-width-300px">
+                            @include('app.patient.coverage-status')
+                        </div>
+                    @else
+                        @include('app.patient.coverage_column_renderer', ['patient'=>$patient, 'truncateName' => true])
+                    @endif
                 </div>
                 <div class="d-inline-flex mr-3 align-items-baseline">
                     <div class="mr-1 text-secondary">DOB:</div>