Pārlūkot izejas kodu

Patient header - coverage mismatch warning

Vijayakrishnan 4 gadi atpakaļ
vecāks
revīzija
785ef0b851
2 mainītis faili ar 48 papildinājumiem un 0 dzēšanām
  1. 34 0
      app/Models/Pro.php
  2. 14 0
      resources/views/layouts/patient.blade.php

+ 34 - 0
app/Models/Pro.php

@@ -392,4 +392,38 @@ class Pro extends Model
 
         return $measurements;
     }
+
+    public function companyProPayers()
+    {
+        return $this->hasMany(CompanyProPayer::class, 'pro_id', 'id');
+    }
+
+    public function isAssociatedWithMCPayer() {
+        $companyProPayers = $this->companyProPayers;
+        $foundMC = false;
+        if($companyProPayers) {
+            foreach ($companyProPayers as $companyProPayer) {
+                if($companyProPayer->payer && $companyProPayer->payer->is_medicare) {
+                    $foundMC = true;
+                    break;
+                }
+            }
+        }
+        return $foundMC;
+    }
+
+    public function isAssociatedWithNonMCPayer($_payerID) {
+        $companyProPayers = $this->companyProPayers;
+        $foundNonMC = false;
+        if($companyProPayers) {
+            foreach ($companyProPayers as $companyProPayer) {
+                if($companyProPayer->payer && !$companyProPayer->payer->is_medicare && $companyProPayer->payer->id === $_payerID) {
+                    $foundNonMC = true;
+                    break;
+                }
+            }
+        }
+        return $foundNonMC;
+    }
+
 }

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

@@ -190,6 +190,20 @@
             </nav>
             @endif
             <main role="main" class="w-100">
+
+                @if(!count($pro->companyProPayers) ||
+                    ($patient->is_part_b_primary !== 'YES' && !$patient->non_mc_primary_payer_id) ||
+                    ($patient->is_part_b_primary === 'YES' && !$pro->isAssociatedWithMCPayer()) ||
+                    ($patient->is_part_b_primary !== 'YES' && $patient->non_mc_primary_payer_id && $pro->isAssociatedWithNonMCPayer($patient->non_mc_primary_payer_id))
+                )
+                    <div class="alert alert-warning mt-3 mcp-theme-1 p-3 hide-inside-ticket-popup">
+                        <div class="font-size-14 font-weight-bold">
+                            <i class="fa fa-exclamation-triangle text-warning-mellow"></i>
+                            This patient may not be covered for this visit. Please check with practice administrator.
+                        </div>
+                    </div>
+                @endif
+
                 @if($pro->is_enrolled_as_mcp && !$patient->mcp)
                     <div class="alert alert-info bg-white mt-3 mcp-theme-1 p-3 hide-inside-ticket-popup">
                         <div class="font-size-16">