Selaa lähdekoodia

Patient list and single: new ins. blade

Vijayakrishnan Krishnan 2 viikkoa sitten
vanhempi
commit
b254d1dca4

+ 21 - 0
app/Models/Client.php

@@ -1081,4 +1081,25 @@ ORDER BY m.ts DESC
     {
         return $this->hasMany(Survey::class, 'entity_uid', 'uid');
     }
+
+    public function insuranceCards() {
+        $sql = "
+select ic.*,
+       (SELECT jsonb_build_object(
+                      'id', ec.id,
+                      'uid', ec.uid,
+                      'source', ec.source,
+                      'is_valid', ec.is_valid,
+                      'effective_date', ec.effective_date,
+                      'termination_date', ec.termination_date
+              )
+       FROM eligibility_check ec
+       WHERE ec.insurance_card_id = ic.id
+       ORDER BY ec.created_at DESC
+       LIMIT 1) as effective_eligibility_check
+from insurance_card ic
+where ic.client_id = " . $this->id . "
+order by ic.coverage_order asc";
+        return DB::select($sql);
+    }
 }

+ 1 - 1
resources/views/app/admin/patients-table-extended.blade.php

@@ -111,7 +111,7 @@ $patientEngagementColorCodes = @Config::get('constants.client_engagement_status_
                     @endif
                     <td>{{ $patient->mailing_address_state }}</td>
                     <td class="{{ $patient->mpb_remaining === 0 ? 'deductible-zero' : '' }}">
-                        @include('app.patient.coverage_column_fast_renderer', ['patient' => $patient])
+                        @include('app.patient.insurance_card_renderer', ['insurance_cards' => $patient->insurance_cards])
 
                     </td>
                     @if ($performer->pro->pro_type == 'ADMIN')

+ 1 - 1
resources/views/app/mcp/patients-table.blade.php

@@ -42,7 +42,7 @@
 				<td>{{ $patient->age_in_years ?  $patient->age_in_years : '-' }}</td>
 				<td>{{ $patient->sex }}</td>
 				<td>
-					@include('app.patient.coverage_column_fast_renderer', ['patient'=>$patient])
+                    @include('app.patient.insurance_card_renderer', ['insurance_cards' => $patient->insurance_cards])
 				</td>
 				<td>
 					{{ friendly_date($patient->most_recent_completed_mcp_note_date) }}

+ 56 - 0
resources/views/app/patient/insurance_card_renderer.blade.php

@@ -0,0 +1,56 @@
+<div class="d-flex align-items-baseline">
+    <?php
+    $cards = $insurance_cards;
+    $cardsArray = $cards;
+    if (!is_null($cards)) {
+        if(is_string($cards)) {
+            $cardsArray = json_decode($cards);
+            usort($cardsArray, function ($a, $b) {
+                return strcmp($a->coverage_order, $b->coverage_order); // Ascending
+            });
+        }
+    }
+    ?>
+
+    @if($cardsArray == null)
+        <small class="text-muted">-</small>
+    @else
+        <div>
+            @foreach($cardsArray as $card)
+                <div class="w-100 d-flex justify-content-start">
+
+                    <?php
+                        if(property_exists($card, 'effective_eligibility_check')) {
+                            if(is_string($card->effective_eligibility_check)) {
+                                $card->effective_eligibility_check = json_decode($card->effective_eligibility_check);
+                            }
+                        }
+                    ?>
+
+                    <span style="min-width: 14px">
+                    @if(property_exists($card, 'effective_eligibility_check') && $card->effective_eligibility_check)
+                        @if($card->effective_eligibility_check->is_valid)
+                            <i class="fa fa-check-circle text-success"></i>
+                        @else
+                            <i class="fa fa-times text-danger"></i>
+                        @endif
+                    @else
+                        <i class="fas fa-hourglass-half text-warning" title="Pending Validation"></i>
+                    @endif
+                    </span>
+
+                    @if($card->carrier_category == 'MEDICARE')
+                        <span class="ml-1">Medicare</span>
+                    @elseif($card->carrier_category == 'MEDICAID')
+                        <span class="ml-1">Medicaid</span>
+                    @elseif($card->carrier_category == 'COMMERCIAL')
+                        <span class="ml-1">{{$card->carrier_name}}</span>
+                    @endif
+
+                    <span class="ml-1 text-muted">({{substr(strtolower($card->coverage_order), 0, 3)}})</span>
+                </div>
+            @endforeach
+        </div>
+    @endif
+
+</div>

+ 1 - 1
resources/views/layouts/patient-header.blade.php

@@ -438,7 +438,7 @@ $addressParts .= implode(", ", $addressPart2);
 
         @if($hasCoverageColumn)
             <div class="d-flex bg-light p-2 border header-coverage-status" style="max-width: 305px;">
-                @include('app.patient.coverage-status')
+                @include('app.patient.insurance_card_renderer', ['insurance_cards' => $patient->insuranceCards()])
             </div>
         @else
             <div class="d-flex bg-light p-2 border header-coverage-status" style="max-width: 350px;">