Pārlūkot izejas kodu

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

= 3 gadi atpakaļ
vecāks
revīzija
273a780e6b

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

@@ -318,7 +318,7 @@ class HomeController extends Controller
         $expectedForCm = DB::select(DB::raw("SELECT coalesce(SUM(cm_expected_payment_amount),0) as expected_pay  FROM bill WHERE cm_pro_id = :performerProID  AND has_cm_been_paid = false AND is_signed_by_cm IS TRUE AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
         $expectedForRme = DB::select(DB::raw("SELECT coalesce(SUM(rme_expected_payment_amount),0) as expected_pay  FROM bill WHERE rme_pro_id = :performerProID  AND has_rme_been_paid = false AND is_signed_by_rme IS TRUE AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
         $expectedForRmm = DB::select(DB::raw("SELECT coalesce(SUM(rmm_expected_payment_amount),0) as expected_pay  FROM bill WHERE rmm_pro_id = :performerProID  AND has_rmm_been_paid = false AND is_signed_by_rmm IS TRUE AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
-        $expectedForNa = DB::select(DB::raw("SELECT coalesce(SUM(na_expected_payment_amount),0) as expected_pay  FROM bill WHERE na_pro_id = :performerProID  AND has_na_been_paid = false AND is_signed_by_hcp IS TRUE AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
+        $expectedForNa = DB::select(DB::raw("SELECT coalesce(SUM(generic_pro_expected_payment_amount),0) as expected_pay  FROM bill WHERE generic_pro_id = :performerProID  AND has_generic_pro_been_paid = false AND is_signed_by_generic_pro IS TRUE AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
 
         $totalExpectedAmount =  $expectedForHcp + $expectedForCm + $expectedForRme + $expectedForRmm + $expectedForNa;
         $reimbursement['nextPaymentAmount'] =  $totalExpectedAmount;

+ 17 - 7
app/Http/Controllers/PracticeManagementController.php

@@ -519,13 +519,23 @@ class PracticeManagementController extends Controller
             $targetPro = $performerPro;
         }
 
-        $bills = Bill
-            ::where('has_hcp_been_paid', false)
-            ->where('is_cancelled', false)
-            ->where('is_signed_by_hcp', true);
-
-        if ($targetPro) {
-            $bills = $bills->where('hcp_pro_id', $targetPro->id);
+        $bills = Bill::where('is_cancelled', false);
+
+        if(!$request->input('t') || $request->input('t') === 'hcp') {
+            $bills = $bills
+                ->where('has_hcp_been_paid', false)
+                ->where('is_signed_by_hcp', true);
+            if ($targetPro) {
+                $bills = $bills->where('hcp_pro_id', $targetPro->id);
+            }
+        }
+        else if($request->input('t') === 'na') {
+            $bills = $bills
+                ->where('has_generic_pro_been_paid', false)
+                ->where('is_signed_by_generic_pro', true);
+            if ($targetPro) {
+                $bills = $bills->where('generic_pro_id', $targetPro->id);
+            }
         }
 
         $filter = $request->input('f');

+ 12 - 0
app/Models/Client.php

@@ -132,6 +132,18 @@ class Client extends Model
             ->orderByRaw('ts DESC NULLS LAST');
     }
 
+    public function recentMeasurements()
+    {
+        return $this->hasMany(Measurement::class, 'client_id', 'id')
+            ->where('is_removed', false)
+            ->whereNotNull('label')
+            ->where('label', '<>', 'SBP')
+            ->where('label', '<>', 'DBP')
+            ->where('is_cellular_zero', false)
+            ->orderByRaw('ts DESC NULLS LAST')
+            ->offset(0)->limit(20);
+    }
+
     public function nonZeroMeasurements()
     {
         return $this->hasMany(Measurement::class, 'client_id', 'id')

+ 2 - 0
resources/views/app/dashboard.blade.php

@@ -153,6 +153,7 @@
             <div class="col-md-9">
 
                 <!-- new associations -->
+                <?php /*
                 @if(count($newMCPAssociations))
                     <div class="mb-3 border rounded px-3 py-2 ack-container">
                         <p class="pt-1 mb-2"><b>New Patients</b></p>
@@ -174,6 +175,7 @@
                         @endforeach
                     </div>
                 @endif
+                */ ?>
 
                 <ul class="nav nav-tabs">
                     <li class="nav-item">

+ 4 - 2
resources/views/app/patient/note/dashboard.blade.php

@@ -1090,7 +1090,7 @@
                 @endif
 
                 {{-- bills --}}
-                @if($pro->pro_type === 'ADMIN' || ($note->hcpPro && $pro->id === $note->hcpPro->id) || ($note->allyPro && $pro->id === $note->allyPro->id))
+                @if($pro->pro_type === 'ADMIN' || ($note->hcpPro && $pro->id === $note->hcpPro->id))
                 @if($note->bills->count())
                     <div class="p-3 border-bottom">
                         <div class="d-flex align-items-center mb-2">
@@ -2003,7 +2003,9 @@
                 @endif
 
                 {{-- generic bills --}}
-                @include('app.generic-bills.inline', ['patient' => $patient, 'note' => $note, 'class' => 'p-3 border-top', 'label' => 'NA', 'entityType' => 'Note', 'entityUid' => $note->uid])
+                @if($pro->pro_type === 'ADMIN' || ($note->allyPro && $pro->id === $note->allyPro->id))
+                    @include('app.generic-bills.inline', ['patient' => $patient, 'note' => $note, 'class' => 'p-3 border-top', 'label' => 'NA', 'entityType' => 'Note', 'entityUid' => $note->uid])
+                @endif
 
                 <div class="border-top p-3 screen-only">
                     @if($note->addendums->count())

+ 1 - 1
resources/views/app/patient/partials/measurements.blade.php

@@ -53,7 +53,7 @@
     </div>
     <table class="table table-sm border-0 m-0">
         <tbody>
-        @foreach($patient->measurements as $measurement)
+        @foreach($patient->recentMeasurements as $measurement)
             @if(1 || !empty($measurement->label) && !in_array($measurement->label, $vitalLabels))
                 @if(!in_array($measurement->label, ["SBP", "DBP"]))
                     @if(!empty($measurement->client_bdt_measurement_id))

+ 43 - 7
resources/views/app/practice-management/processing-bill-matrix.blade.php

@@ -15,7 +15,7 @@
                 <div class="width-200px">
                     <select provider-search data-pro-uid="{{ @$targetPro->uid }}"
                             name="proUid" class="form-control form-control-sm mr-auto width-200px"
-                            onchange="fastLoad('/practice-management/processing-bill-matrix/' + this.value + '?f={{request()->input('f')}}')">
+                            onchange="fastLoad('/practice-management/processing-bill-matrix/' + this.value + '?f={{request()->input('f')}}&t={{request()->input('t')}}')">
                         <option value="" {{!@$targetPro ? 'selected' : ''}}>All Pros</option>
                     </select>
                 </div>
@@ -24,12 +24,19 @@
                 @endif
                 <div class="width-200px ml-2">
                     <select name="filter" class="form-control form-control-sm mr-auto width-200px"
-                            onchange="fastLoad('/practice-management/processing-bill-matrix/{{@$targetPro ? $targetPro->uid : ''}}?f=' + this.value)">
+                            onchange="fastLoad('/practice-management/processing-bill-matrix/{{@$targetPro ? $targetPro->uid : ''}}?f=' + this.value + '&t={{request()->input('t')}}')">
                         <option {{request()->input('f') === '' ? 'selected' : ''}} value="">All Bills</option>
                         <option {{request()->input('f') === 'verified' ? 'selected' : ''}} value="verified">Verified Only</option>
                         <option {{request()->input('f') === 'not-verified' ? 'selected' : ''}} value="not-verified">Not Verified Only</option>
                     </select>
                 </div>
+                <div class="width-200px ml-2">
+                    <select name="filter" class="form-control form-control-sm mr-auto width-200px"
+                            onchange="fastLoad('/practice-management/processing-bill-matrix/{{@$targetPro ? $targetPro->uid : ''}}?f={{request()->input('f')}}&t=' + this.value)">
+                        <option {{!request()->input('t') || request()->input('t') === 'hcp' ? 'selected' : ''}} value="hcp">HCP Bills</option>
+                        <option {{request()->input('t') === 'na' ? 'selected' : ''}} value="na">NA Bills</option>
+                    </select>
+                </div>
             </div>
             <div class="card-body p-0">
                 <table class="table table-sm table-condensed p-0 m-0">
@@ -39,12 +46,24 @@
                         <th>Note Link</th>
                         <td>Effective Date</td>
 			<td>Balance Post Date</td>
-                        <td>Pro</td>
+
+                        @if(!request()->input('t') || request()->input('t') === 'hcp')
+                            <td>HCP Pro</td>
+                        @elseif(request()->input('t') === 'na')
+                            <td>NA Pro</td>
+                        @endif
+
                         <td>Client</td>
                         <td>Code</td>
                         <td>Units</td>
 			<td>Verified?</td>
-                        <td>HCP Expected Amount</td>
+
+                        @if(!request()->input('t') || request()->input('t') === 'hcp')
+                            <td>HCP Expected Amount</td>
+                        @elseif(request()->input('t') === 'na')
+                            <td>NA Expected Amount</td>
+                        @endif
+
                         <td>HCP Signed?</td>
 {{--                        <td>HCP Signed At</td>--}}
                     </tr>
@@ -68,13 +87,30 @@
                             </td>
                             <td>{{friendly_date($row->effective_date)}}</td>
 			    <td>{{friendly_date($row->balance_post_date)}}</td>
-                            <td>{{$row->hcp->name_last}}, {{$row->hcp->name_first}}</td>
+
+                            @if(!request()->input('t') || request()->input('t') === 'hcp')
+                                <td>{{$row->hcp->name_last}}, {{$row->hcp->name_first}}</td>
+                            @elseif(request()->input('t') === 'na')
+                                <td>{{$row->genericPro->name_last}}, {{$row->genericPro->name_first}}</td>
+                            @endif
                             <td>{{$row->client->name_last}}, {{$row->client->name_first}}</td>
                             <td>{{$row->code}}</td>
                             <td>{{$row->number_of_units}}</td>
 			    <td>{{$row->is_verified ? 'Verified: ' . friendly_date($row->marked_verified_at, true) : 'Not Verified'}} </td>
-                            <td>{{$row->hcp_expected_payment_amount}}</td>
-                            <td>{{$row->is_signed_by_hcp}}</td>
+
+                            @if(!request()->input('t') || request()->input('t') === 'hcp')
+                                <td>{{$row->hcp_expected_payment_amount}}</td>
+                            @elseif(request()->input('t') === 'na')
+                                <td>{{$row->generic_pro_expected_payment_amount}}</td>
+                            @endif
+
+                            @if(!request()->input('t') || request()->input('t') === 'hcp')
+                                <td>{{$row->is_signed_by_hcp}}</td>
+                            @elseif(request()->input('t') === 'na')
+                                <td>{{$row->is_signed_by_generic_pro}}</td>
+                            @endif
+
+
 {{--                            <td>{{$row->signed_by_hcp_at}}</td>--}}
                         </tr>
                     @endforeach