Prechádzať zdrojové kódy

Coverage - old to new (wip)

Vijayakrishnan 3 rokov pred
rodič
commit
488a7944a5

+ 1 - 1
app/Http/Controllers/PracticeManagementController.php

@@ -971,7 +971,7 @@ ORDER BY ts DESC
         //Only medicare claims
         $claims = [];
         foreach ($allClaims as $claim) {
-            if ($claim->client != null && $claim->client->is_part_b_primary == 'YES' && !$claim->edi) {
+            if ($claim->client != null && $claim->client->getPrimaryCoverageStatus() == 'YES' && !$claim->edi) {
                 $claims[] = $claim;
             }
         }

+ 18 - 0
app/Models/Client.php

@@ -758,4 +758,22 @@ ORDER BY m.ts DESC
         return $days;
 
     }
+
+    public function getPrimaryCoverage()
+    {
+        // try the latest manual coverage
+        $coverage = $this->latestManualClientPrimaryCoverage;
+        if (!$coverage) {
+            // try the latest coverage
+            $coverage = $this->latestClientPrimaryCoverage;
+        }
+        return $coverage;
+    }
+
+    // return value will be YES, NO or UNKNOWN
+    public function getPrimaryCoverageStatus() {
+        $coverage = $this->getPrimaryCoverage();
+        if(!$coverage) return 'NO';
+        return $coverage->getStatus();
+    }
 }

+ 46 - 0
app/Models/ClientPrimaryCoverage.php

@@ -9,4 +9,50 @@ class ClientPrimaryCoverage extends Model
 {    
     protected $table = 'client_primary_coverage';
 
+    public function getStatus() {
+        $status = 'NO';
+
+        // if medicare, check is_partbprimary
+        if($this->plan_type === 'MEDICARE') {
+            $status = $this->is_partbprimary;
+        }
+        else {
+            if(!$this->is_manually_determined) {
+                // AUTO determination of non-medicare not yet supported
+                $status = 'NO';
+            }
+            else {
+                switch($this->manual_determination_category) {
+                    case 'COVERED':
+                        $status = 'YES';
+                        break;
+                    case 'NOT_COVERED':
+                    case 'INVALID':
+                        $status = 'NO';
+                        break;
+                    default:
+                        $status = $this->manual_determination_category;
+                        break;
+                }
+            }
+        }
+
+        return $status;
+    }
+
+    public function toString() {
+        $parts = [];
+        $parts[] = $this->plan_type;
+        if($this->plan_type === 'MEDICARE') {
+            if($this->is_partbprimary === 'YES') {
+                $parts[] = 'Part B';
+            }
+        }
+        else {
+            if(@$this->plan_name) $parts[] = ' / ' . $this->plan_name;
+            if(@$this->plan_identifier) $parts[] = ' / ' . $this->plan_identifier;
+        }
+        return implode(" ", $parts);
+    }
+
 }

+ 0 - 16
resources/views/app/patient/note/dashboard-univ.blade.php

@@ -20,22 +20,6 @@
     }
     ?>
 
-    {{--
-    @if(!count($pro->companyProPayers) ||  /* pro has no assoc with any payer */
-                    ($patient->is_part_b_primary !== 'YES' && !$patient->non_mc_primary_payer_id) ||    /* patient is not part_b and has no primary non-mc payer */
-                    ($patient->is_part_b_primary === 'YES' && !$pro->isAssociatedWithMCPayer()) ||      /* patient is part_b but pro has no mc payer assoc */
-                    ($patient->is_part_b_primary !== 'YES' && $patient->non_mc_primary_payer_id &&      /* patient is not part_b and has non-mc-primary, but pro has no assoc with that payer */
-                        !$pro->isAssociatedWithNonMCPayer($patient->non_mc_primary_payer_id))
-                )
-        <div class="alert alert-warning 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
-    --}}
-
     <div id="note-single-header" class="pb-3 d-flex align-items-start screen-only">
         <h6 class="my-0 text-secondary d-flex align-items-center w-100">
             <a href="/patients/view/{{ $patient->uid }}/notes" class="small text-decoration-none mr-3">

+ 0 - 16
resources/views/app/patient/note/dashboard.blade.php

@@ -23,22 +23,6 @@
     $isVisitTemplateBased = !!$note->visitTemplate;
     ?>
 
-    {{--
-    @if(!count($pro->companyProPayers) ||  /* pro has no assoc with any payer */
-                    ($patient->is_part_b_primary !== 'YES' && !$patient->non_mc_primary_payer_id) ||    /* patient is not part_b and has no primary non-mc payer */
-                    ($patient->is_part_b_primary === 'YES' && !$pro->isAssociatedWithMCPayer()) ||      /* patient is part_b but pro has no mc payer assoc */
-                    ($patient->is_part_b_primary !== 'YES' && $patient->non_mc_primary_payer_id &&      /* patient is not part_b and has non-mc-primary, but pro has no assoc with that payer */
-                        !$pro->isAssociatedWithNonMCPayer($patient->non_mc_primary_payer_id))
-                )
-        <div class="alert alert-warning 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
-    --}}
-
     <div id="note-single-header" class="pb-3 d-flex align-items-start screen-only">
         <h6 class="my-0 text-secondary d-flex align-items-center w-100">
             <a href="/patients/view/{{ $patient->uid }}/notes" class="small text-decoration-none mr-3">

+ 1 - 1
resources/views/app/patient/supply-orders.blade.php

@@ -7,7 +7,7 @@
                 <span class="mx-2 text-secondary">|</span>
                 <div moe large>
                     <a start show href="#">Add</a>
-                    @if(($patient->is_eligible_for_cm === 'YES' || ($patient->was_medicare_validation_successful && $patient->is_part_b_primary == 'YES')) && $patient->is_enrolled_in_cm !== 'YES')
+                    @if(($patient->is_eligible_for_cm === 'YES' || $patient->getPrimaryCoverageStatus() == 'YES') && $patient->is_enrolled_in_cm !== 'YES')
                         <form url="/api/client/setIsEnrolledInCmToTrue">
                             <p class="font-weight-bold">You need to enroll this patient into CM before adding supply orders.</p>
                             <input type="hidden" name="uid" value="{{ $patient->uid }}">

+ 13 - 19
resources/views/app/patients.blade.php

@@ -127,7 +127,7 @@
                             </span>
                         </td>
                         <td>
-                            @if($patient->has_cm_setup_been_performed)
+                            @if($patient->has_cm_setup_been_performed && $patient->cmSetupNote)
                                 <i class="fa fa-check text-secondary on-hover-opaque"></i>
                                 <br>
                                 <a href="{{route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $patient->cmSetupNote])}}">Note</a>
@@ -179,25 +179,19 @@
                         </td>
                         @endif
                         <td>
-                            @if($patient->was_medicare_validation_successful && $patient->is_part_b_primary == 'YES')
-                            Covered <span style="color:green"><i class="fa fa-check-circle"></i></span>
-                            @elseif($patient->was_medicare_validation_successful)
-                                <div>Valid Medicare Number</div>
-                                    <div class="text-secondary">Not Medicare Part B</div>
-                                    @if($patient->is_medicare_advantage == 'YES')
-                                        <div class="text-secondary">Medicare Advantage: <b>{{$patient->medicare_advantage_plan}}</b></div>
-                                    @endif
+                            <?php $coverageStatus = $patient->getPrimaryCoverageStatus(); ?>
+                            @if($coverageStatus === 'YES')
+                                <div class="text-nowrap">Covered <i class="fa fa-check-circle text-success"></i>
+                                </div>
+                            @elseif($coverageStatus === 'NO')
+                                <div class="text-nowrap">Not Covered <i class="fa fa-times text-danger"></i></div>
                             @else
-                                @if($patient->mcn)
-                                    <div>Invalid MCN</div>
-                                @else
-                                    @if($patient->is_coverage_manually_verified)
-                                        {{$patient->coverage_manual_verification_memo}} <span style="color:green"><i class="fa fa-check-circle">
-                                    @else
-                                        <div>No Info Provided</div>
-                                    @endif
-
-                                @endif
+                                <div class="text-nowrap">Unknown <i
+                                            class="fa fa-exclamation-triangle text-warning-mellow"></i></div>
+                            @endif
+                            <?php $coverage = $patient->getPrimaryCoverage(); ?>
+                            @if($coverage)
+                                {{$coverage->toString()}}
                             @endif
                         </td>
                         <td>

+ 17 - 4
resources/views/app/practice-management/cellular-device-manager.blade.php

@@ -41,8 +41,7 @@
                         <th class="border-0">MCP</th>
                         <th class="border-0">RME</th>
                         <th class="border-0">RMM</th>
-                        <th class="border-0">MC</th>
-                        <th class="border-0">MC Part-B</th>
+                        <th class="border-0">Coverage</th>
                         <th class="border-0">SMS Notifs</th>
 
                         <th class="border-0" colspan="4">Cellular BP</th>
@@ -62,8 +61,22 @@
                             <td>{{ $client->rme ? $client->rme->displayName() : '' }}</td>
                             <td>{{ $client->rmm ? $client->rmm->displayName() : '' }}</td>
 
-                            <td>{{ $client->was_medicare_validation_successful ? 'Yes' : '' }}</td>
-                            <td>{{ $client->was_medicare_validation_successful && $client->is_part_b_primary == 'YES' ? 'Yes' : '' }}</td>
+                            <td>
+                                <?php $coverageStatus = $client->getPrimaryCoverageStatus(); ?>
+                                @if($coverageStatus === 'YES')
+                                    <div class="text-nowrap">Covered <i class="fa fa-check-circle text-success"></i>
+                                    </div>
+                                @elseif($coverageStatus === 'NO')
+                                    <div class="text-nowrap">Not Covered <i class="fa fa-times text-danger"></i></div>
+                                @else
+                                    <div class="text-nowrap">Unknown <i
+                                                class="fa fa-exclamation-triangle text-warning-mellow"></i></div>
+                                @endif
+                                <?php $coverage = $client->getPrimaryCoverage(); ?>
+                                @if($coverage)
+                                    {{$coverage->toString()}}
+                                @endif
+                            </td>
 
                             <td>{{$client->send_sms_on_bdt_measurement ? 'Yes' : ''}}</td>
 

+ 17 - 2
resources/views/app/practice-management/patient-claim-summary.blade.php

@@ -137,7 +137,7 @@
                     <tr>
                         <th>Patient</th>
                         <th>MCP</th>
-                        <th>Payer</th>
+                        <th>Coverage</th>
                         <th>#Notes without Billing Closed</th>
                         <th>#Notes without Claiming Closed</th>
                         <th>#Notes Total</th>
@@ -157,7 +157,22 @@
                                 </a>
                             </td>
                             <td>{{$patient->mcp}}</td>
-                            <td>{{$patient->is_part_b_primary == 'YES'?'Medicare Part B':($patient->medicare_advantage_plan?$patient->medicare_advantage_plan:'Manual: '.$patient->payer_name)}}</td>
+                            <td>
+                                <?php $coverageStatus = $patient->getPrimaryCoverageStatus(); ?>
+                                @if($coverageStatus === 'YES')
+                                    <div class="text-nowrap">Covered <i class="fa fa-check-circle text-success"></i>
+                                    </div>
+                                @elseif($coverageStatus === 'NO')
+                                    <div class="text-nowrap">Not Covered <i class="fa fa-times text-danger"></i></div>
+                                @else
+                                    <div class="text-nowrap">Unknown <i
+                                                class="fa fa-exclamation-triangle text-warning-mellow"></i></div>
+                                @endif
+                                <?php $coverage = $patient->getPrimaryCoverage(); ?>
+                                @if($coverage)
+                                    {{$coverage->toString()}}
+                                @endif
+                            </td>
                             <td>{{$patient->notes_without_billing_closed}}</td>
                             <td>{{$patient->notes_without_claiming_closed}}</td>
                             <td>{{$patient->notes_total}}</td>

+ 17 - 92
resources/views/layouts/patient.blade.php

@@ -356,100 +356,25 @@
                                                 y.o {{$patient->sex}})
                                             </div>
                                             <div>
-                                                @if($patient->is_coverage_manually_verified || ($patient->was_medicare_validation_successful && $patient->is_part_b_primary == 'YES'))
-                                                    Covered <span style="color:green"><i class="fa fa-check-circle"></i> </span>
-                                                @elseif($patient->was_medicare_validation_successful)
-                                                    <span>
-                                                    @if($patient->is_part_b_primary == 'YES')
-                                                        Medicare Part B
-                                                    @else
-                                                        Not Medicare Part B <i class="fa fa-times"></i>
-                                                        @if($patient->is_medicare_advantage == 'YES')
-                                                            , Medicare Advantage,
-                                                            {{$patient->medicare_advantage_plan}}
-                                                        @endif
-                                                    @endif
-                                                </span>
-                                                @elseif($patient->payer_name && $patient->payer_member_id)
-                                                    <b class="text-secondary">{{$patient->payer_name}}</b> {{--[{{$patient->payer_member_id}}]--}}
+                                                <?php
+                                                $coverageStatus = $patient->getPrimaryCoverageStatus();
+                                                $coverage = $patient->getPrimaryCoverage();
+                                                ?>
+                                                @if($coverageStatus === 'YES')
+                                                    Covered <i class="fa fa-check-circle text-success"></i>
+                                                @elseif($coverageStatus === 'NO')
+                                                    Not Covered <i class="fa fa-times text-danger"></i>
                                                 @else
-                                                    <div moe>
-                                                        <a href="" start show>
-                                                            @if($patient->mcn)
-                                                                {{$patient->mcn}} Invalid MCN <i
-                                                                    class="fa fa-times"></i>
-                                                            @elseif($patient->is_coverage_manually_verified)
-                                                                {{$patient->coverage_manual_verification_memo}} <span style="color:green"><i class="fa fa-check-circle"></i>
-                                                            @else
-                                                                No Info Provided
-                                                            @endif
-                                                        </a>
-                                                        <form url="/api/client/putMedicareInfo" class="mcp-theme-1">
-                                                            <input type="hidden" name="uid" value="{{$patient->uid}}">
-                                                            <div class="mb-2">
-                                                                <input type="text" class="form-control form-control-sm"
-                                                                       name="nameFirst"
-                                                                       value="{{$patient->name_first}}"
-                                                                       placeholder="First Name">
-                                                            </div>
-                                                            <div class="mb-2">
-                                                                <input type="text" class="form-control form-control-sm"
-                                                                       name="nameLast"
-                                                                       value="{{$patient->name_last}}"
-                                                                       placeholder="Last Name">
-                                                            </div>
-                                                            <div class="mb-2">
-                                                                <input type="date" class="form-control form-control-sm"
-                                                                       name="dob"
-                                                                       value="{{$patient->dob}}"
-                                                                       placeholder="Date of Birth">
-                                                            </div>
-                                                            <div class="mb-2">
-                                                                <input type="text" class="form-control form-control-sm"
-                                                                       name="mcn"
-                                                                       value="{{$patient->mcn}}"
-                                                                       placeholder="Medicare Number">
-                                                            </div>
-                                                            <div>
-                                                                <button submit class="btn btn-sm btn-primary mr-2">
-                                                                    Submit
-                                                                </button>
-                                                                <button cancel class="btn btn-sm btn-default border">
-                                                                    Cancel
-                                                                </button>
-                                                            </div>
-                                                        </form>
-                                                    </div>
+                                                    Unknown <i
+                                                            class="fa fa-exclamation-triangle text-warning-mellow"></i>
                                                 @endif
-                                                @if(!$patient->was_medicare_validation_successful)
-                                                    @if(!$patient->is_coverage_manually_verified)
-                                                    <div moe relative class="ml-2 hide-inside-popup">
-                                                        <a start show class="font-weight-bold">Manually verify coverage</a>
-                                                        <form url="/api/client/markCoverageAsManuallyVerified" class="mcp-theme-1" right>
-                                                            <input type="hidden" name="uid" value="{{$patient->uid}}">
-                                                            <div class="form-group">
-                                                                <textarea name="memo"  class="fom-control"></textarea>
-                                                            </div>
-                                                            <div>
-                                                                <button submit class="btn btn-sm btn-success mr-1">Yes</button>
-                                                                <button cancel class="btn btn-sm btn-default border">No</button>
-                                                            </div>
-                                                        </form>
-                                                    </div>
-                                                    @endif
-                                                    {{--@if($patient->is_coverage_manually_verified)
-                                                        <div moe relative class="ml-2">
-                                                            <a start show class="font-weight-bold">Undo manual verification</a>
-                                                            <form url="/api/client/undoMarkCoverageAsManuallyVerified" class="mcp-theme-1" right>
-                                                                <input type="hidden" name="uid" value="{{$patient->uid}}">
-                                                                <p>Undo coverage verification</p>
-                                                                <div>
-                                                                    <button submit class="btn btn-sm btn-success mr-1">Yes</button>
-                                                                    <button cancel class="btn btn-sm btn-default border">No</button>
-                                                                </div>
-                                                            </form>
-                                                        </div>
-                                                    @endif--}}
+                                                @if($coverage)
+                                                    &nbsp;
+                                                    {{$coverage->toString()}}
+                                                @endif
+                                                @if($pro->pro_type === 'ADMIN')
+                                                    &nbsp;
+                                                    <a href="{{route('patients.view.client-primary-coverages', ['patient' => $patient])}}">View</a>
                                                 @endif
                                             </div>
                                         </div>