Pārlūkot izejas kodu

Merge branch 'dev' of rav.triplestart.com:jmudaka/stagfe2 into dev

= 3 gadi atpakaļ
vecāks
revīzija
41e54dee8f

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

@@ -3638,15 +3638,15 @@ ORDER BY c.name_last, c.name_first
 	        n.visit_number,
             ROUND(b.number_of_units * 60) as minutes,
 
- n.note_reason_icd1 AS icd1,
- n.note_reason_icd1description AS icd1description,
- n.note_reason_icd2 AS icd2,
- n.note_reason_icd2description AS icd2description,
- n.note_reason_icd3 AS icd3,
- n.note_reason_icd3description AS icd3description,
- n.note_reason_icd4 AS icd4,
- n.note_reason_icd4description AS icd4description,
- n.note_reason_memo AS icd_memo
+ 		n.note_reason_icd1 AS icd1,
+ 		n.note_reason_icd1description AS icd1description,
+ 		n.note_reason_icd2 AS icd2,
+ 		n.note_reason_icd2description AS icd2description,
+ 		n.note_reason_icd3 AS icd3,
+ 		n.note_reason_icd3description AS icd3description,
+ 		n.note_reason_icd4 AS icd4,
+ 		n.note_reason_icd4description AS icd4description,
+ 		n.note_reason_memo AS icd_memo
 
             ";
         $from = "FROM note AS n
@@ -3669,9 +3669,9 @@ ORDER BY c.name_last, c.name_first
             c.name_last NOT ILIKE '%test%' AND
             n.id IN (SELECT note_id FROM bill WHERE code ILIKE '%treatment%' AND bill.is_cancelled IS NOT TRUE AND note_id IS NOT NULL) AND
             -- n.id NOT IN (SELECT note_id FROM claim WHERE note_id IS NOT NULL) AND
-            c.is_part_b_primary = 'YES' AND
-            c.latest_eligible_refresh_at::DATE >= '2022-01-01' AND
-            c.mpb_remaining = 0 -- AND
+            c.is_part_b_primary <> 'YES' -- AND
+            -- c.latest_eligible_refresh_at::DATE >= '2022-01-01' AND
+            -- c.mpb_remaining = 0 -- AND
             -- c.created_at::DATE >= '2022-01-01'::DATE
             ";
         $filters = [];
@@ -3721,10 +3721,10 @@ ORDER BY c.name_last, c.name_first
             c.sex,
             c.dob,
             c.age_in_years,
-            row_to_json(lcpc.*)::json as latest_client_primary_coverage,
+            row_to_json(lcpc.*) as latest_client_primary_coverage,
             row_to_json(lacpc.*) as latest_auto_client_primary_coverage,
             row_to_json(lmcpc.*) as latest_manual_client_primary_coverage,
-            row_to_json(lmcpc_payer) as latest_manual_client_primary_coverage_payer
+            row_to_json(lmcpc_payer.*) as latest_manual_client_primary_coverage_payer
             ";
         $from = "FROM client AS c
             LEFT JOIN client_primary_coverage lcpc on c.latest_client_primary_coverage_id = lcpc.id

+ 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;
     }
 

+ 1 - 1
config/app.php

@@ -65,7 +65,7 @@ return [
 
     'hrm2_url' => env('HRM2_URL'),
 
-    'asset_version' => 90,
+    'asset_version' => 91,
 
     'temp_dir' => env('TEMP_DIR'),
 

+ 1 - 1
public/css/style.css

@@ -3543,7 +3543,7 @@ table.v-top th {
     box-shadow: 0 0 0 0.2rem rgb(0 123 255 / 25%);
 }
 .coverage-payer-name {
-    width: 120px;
+    max-width: 120px;
     white-space: nowrap;
     overflow: hidden;
     text-overflow: ellipsis;

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

@@ -19,6 +19,9 @@
             @endif
             <th class="border-0">Mailing Address State</th>
             <th class="border-0">Insurance</th>
+            @if($performer->pro->pro_type == 'ADMIN')
+		<th class="border-0">Ded.</th>
+	    @endif
             <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("admin.patients"), 'label' => 'Last Visit', 'key' => 'most_recent_completed_mcp_note_date'])</th>
             <th class="border-0">Next Appt.</th>
             <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("admin.patients"), 'label' => 'BP/Pulse Timestamp', 'key' => 'most_recent_cellular_bp_measurement_at'])</th>
@@ -71,9 +74,9 @@
                     {{--<td>{{$patient->source}}</td>--}}
                 @endif
                 <td>{{$patient->mailing_address_state}}</td>
-                <td>
+                <td class="{{ $patient->latestClientPrimaryCoverage && $patient->latestClientPrimaryCoverage->auto_medicare_mpb_remaining === 0 ? 'deductible-zero' : '' }}">
                     @include('app.patient.coverage_column_renderer', ['patient'=>$patient])
-                    @if($performer->pro->pro_type == 'ADMIN')
+                    @if(false && $performer->pro->pro_type == 'ADMIN')
                         @if(@$patient->latestClientPrimaryCoverage->auto_medicare_mpb_remaining)
                         <small class="d-block text-sm text-muted ml-3">
                             Deductible: <span class="font-weight-bold">{{ format_number(@$patient->latestClientPrimaryCoverage->auto_medicare_mpb_remaining)}}</span>
@@ -81,6 +84,13 @@
                         @endif
                     @endif 
                 </td>
+		@if($performer->pro->pro_type == 'ADMIN')
+		<td>
+                        <small class="d-block text-sm text-muted">
+                            <span class="font-weight-bold">{{ format_number(@$patient->latestClientPrimaryCoverage->auto_medicare_mpb_remaining)}}</span>
+                        </small>
+		</td>
+		@endif
                 <td>
                     {{ friendly_date($patient->most_recent_completed_mcp_note_date) }}
                     {{-- {{$patient->lastMcpAppointment ? friendly_date_time($patient->lastMcpAppointment->raw_date.' '.$patient->lastMcpAppointment->raw_start_time) : '-'}}--}}

+ 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>

+ 17 - 4
resources/views/app/patient/note/partials/resolve-content.blade.php

@@ -138,15 +138,28 @@
     <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="d-inline-flex mr-4 align-items-baseline">
+            <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="d-inline-flex mr-4 align-items-baseline">
+                <div class="mr-3">
+                    <?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>
                     <div>{{$patient->dob}}</div>
                 </div>
-                <div class="d-inline-flex mr-4 align-items-baseline">
+                <div class="d-inline-flex mr-3 align-items-baseline">
                     <div class="mr-1 text-secondary">Visit Date:</div>
                     <div>{{friendly_date($note->effective_dateest)}}</div>
                 </div>