Browse Source

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

= 3 years ago
parent
commit
27b6d5c03d

+ 62 - 0
app/Models/CareMonth.php

@@ -142,4 +142,66 @@ class CareMonth extends Model
         return  date('t') - date('j');
 
     }
+
+    public function calculateBillabilityForMcp(){
+
+
+        $strategy = $this->mcp->mcp_rpm_payment_strategy; 
+        if(!$strategy){
+            return [
+                'billable' => false, 
+                'reason' => 'MCP RPM strategy has not been set.'
+            ];
+        }
+        
+        $mcpRpmPaymentAmount =  $this->mcp->mcp_rpm_payment_amount;
+        $has16PlusDays = $this->number_of_days_with_remote_measurements >= 16;
+        $hasMcpBilled20Minutes = $this->rm_total_time_in_seconds_by_mcp >= 1200;
+        $hasMcpInteracted = $this->has_mcp_interacted_with_client_about_rm;
+        if($strategy == 'X16_DAYS'){
+            //only check for 16 days
+            if($has16PlusDays){
+                return [
+                    'billable' => true, 
+                    'amount' => $mcpRpmPaymentAmount
+                ];
+            } else {
+                //not billable
+                return [
+                    'billable' => false, 
+                    'reason' => "This care month does not have 16 or more measurement days."
+                ];
+            }
+        }
+    
+        if($strategy == 'X16_DAYS_20_MINS_ON_OWN_MCP_COM_DURING_CM'){
+            if ($has16PlusDays && $hasMcpBilled20Minutes && $hasMcpInteracted) {
+                return [
+                    'billable' => true, 
+                    'amount' => $mcpRpmPaymentAmount
+                ];
+            } else {
+                if(!$has16PlusDays){
+                    return [
+                        'billable' => false, 
+                        'reason' => 'Care month does not have 16 or more measurement days.'
+                    ];
+                }
+                if(!$hasMcpBilled20Minutes){
+                    return [
+                        'billable' => false, 
+                        'reason' => 'Care month does not have 20 minutes billed time.'
+                    ];
+                }
+                if(!$hasMcpInteracted){
+                    return [
+                        'billable' => false, 
+                        'reason' => 'Care month does MCP interaction.'
+                    ];
+                }
+                
+            }
+        }
+    
+    }
 }

+ 3 - 1
app/Models/Pro.php

@@ -1376,11 +1376,13 @@ SELECT crfu.id AS crfu_id,
        crfu.next_follow_up_reason,
        crfu.next_follow_up_memo,
        c.uid as client_uid,
-       (c.name_first || ' ' || c.name_last) as client_name
+       (c.name_first || ' ' || c.name_last) as client_name,
+       crfu.status AS status
 FROM client_rep_follow_up crfu join client c on crfu.id = c.client_rep_follow_up_id
 WHERE crfu.client_rep_pro_id = :pro_id
   AND crfu.next_follow_up_date = :date
   ORDER BY crfu.created_at DESC;
         "), ["pro_id" => $this->id, 'date' => date('Y-m-d')]);
     }
+
 }

+ 1 - 1
config/app.php

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

+ 4 - 4
public/css/style.css

@@ -3601,10 +3601,10 @@ table.v-top th {
     border: 1px dashed #333;
     padding: 5px;
 }
-.note-container .segments-list p>br:first-child:last-child,
-.note-container .segments-list p:empty {
-    display: none;
-}
+/*.note-container .segments-list p>br:first-child:last-child,*/
+/*.note-container .segments-list p:empty {*/
+/*    display: none;*/
+/*}*/
 .no-column-wrap th:first-child,
 .no-column-wrap td:first-child {
     white-space: nowrap;

BIN
public/img/p-phone.png


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

@@ -440,7 +440,7 @@
                                         <tr>
                                             <th>Client</th>
                                             <th>Reason</th>
-                                            <th>Memo</th>
+                                            <th>Status</th>
                                         </tr>
                                         </thead>
                                         <tbody>
@@ -448,7 +448,7 @@
                                             <tr>
                                                 <td><a href="/patients/view/{{$fu->client_uid}}">{{$fu->client_name}}</a></td>
                                                 <td>{{$fu->next_follow_up_reason}}</td>
-                                                <td>{{$fu->next_follow_up_memo}}</td>
+                                                <td>{{$fu->status}}</td>
                                             </tr>
                                         @endforeach
                                         </tbody>

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

@@ -395,7 +395,7 @@
                                             <tr>
                                                 <th>Client</th>
                                                 <th>Reason</th>
-                                                <th>Memo</th>
+                                                <th>Status</th>
                                             </tr>
                                             </thead>
                                             <tbody>
@@ -403,7 +403,7 @@
                                                 <tr>
                                                     <td><a href="/patients/view/{{$fu->client_uid}}">{{$fu->client_name}}</a></td>
                                                     <td>{{$fu->next_follow_up_reason}}</td>
-                                                    <td>{{$fu->next_follow_up_memo}}</td>
+                                                    <td>{{$fu->status}}</td>
                                                 </tr>
                                             @endforeach
                                             </tbody>

+ 40 - 17
resources/views/app/patient/care-month/dashboard.blade.php

@@ -342,14 +342,6 @@
                                 </div>
                                 @endif
 
-                                {{--@if(($daysDiff !== -1 && $daysDiff <= 90) &&
-                                    $careMonth->number_of_days_with_remote_measurements >= 16 &&
-                                    $careMonth->has_mcp_interacted_with_client_about_rm)
-                                    <div class="mt-2 border border-info p-2">
-                                        @include('app.rm-bills.inline', ['patient' => $patient, 'entityType' => 'CareMonth', 'entityUid' => $careMonth->uid, 'label' => 'RM'])
-                                    </div>
-                                @endif--}}
-
                                 <div class="mt-2">
                                     {{-- rm reasons --}}
                                     <div class="mb-2">
@@ -357,16 +349,47 @@
                                     </div>
                                 </div>
 
-                                <div class="mb-2">
-                                    @if($careMonth->rmBill && $careMonth->rmBill->code != 'RMB')
-                                        @if(true && 'TODO Check if MCP and echo as needed for rme/rmm')
-
-                                        @endif
-                                        @if($performer->pro->id == $careMonth->mcp_pro_id)
-                                            Reimbursement: {{ $careMonth->rmBill->hcp_payment_amount }}
-                                        @endif
+                                @if($careMonth->mcpRmGenericBill == null )
+                                    
+                                    @php 
+                                        $rpmBillability = $careMonth->calculateBillabilityForMcp();
+                                    @endphp 
+
+                                    @if(!$rpmBillability['billable'])
+                                        <div class="alert alert-info">{{$rpmBillability['reason']}}</div>
+                                    @else 
+                                        <div moe relative class="d-inline-block">
+                                            <a class="font-weight-bold" href="" show start>Bill for {{$rpmBillability['amount']}}</a>
+                                            <form url="/api/careMonth/generateRmGenericBillForMcpAndAutoSign" right>
+                                                <input type="hidden" name="uid" value="{{$careMonth->uid}}">
+                                                <p>Bill ${{$rpmBillability['amount']}} for this care month?</p>
+                                                <div class="mb-0">
+                                                    <button class="btn btn-success btn-sm" submit>Bill &amp; Sign</button>
+                                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                </div>
+                                            </form>
+                                        </div>   
                                     @endif
-                                </div>
+                                @else 
+                                    <div class="font-weight-bold">
+                                        Billed: ${{$careMonth->mcpRmGenericBill->generic_pro_expected_payment_amount}} 
+                                        @if($careMonth->mcpRmGenericBill->is_signed_by_generic_pro)
+                                            <span class="text-success"><i class="fa fa-check"></i> Signed </span>
+                                        @else 
+                                            <div moe relative class="d-inline-block">
+                                                <a class="font-weight-bold" href="" show start>Sign</a>
+                                                <form url="/api/bill/signAsGenericPro" right>
+                                                    <input type="hidden" name="uid" value="{{$careMonth->mcpRmGenericBill->uid}}">
+                                                    <p>Sign this bill?</p>
+                                                    <div class="mb-0">
+                                                        <button class="btn btn-success btn-sm" submit>Sign</button>
+                                                        <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                    </div>
+                                                </form>
+                                            </div>
+                                        @endif 
+                                    </div>
+                                @endif
                             </div>
                         </div>
                     </div>

+ 79 - 49
resources/views/app/patient/partials/fu-form.blade.php

@@ -1,22 +1,51 @@
+<?php
+    $nextFUReasons = [
+        "Appointment Confirmation",
+        "New Appointment",
+        "Missed Appointment",
+        "Appointment Reschedule",
+        "Appointment Cancellation",
+        "Response to Pt's Voicemail",
+        "Regarding ERx/Lab/Image Orders",
+        "Regarding Supply Orders",
+        "Regarding RPM",
+        "Pt Profile Related Matters",
+        "Pt Insurance Related Matters",
+        "Incoming Referrals",
+        "Outgoing Referrals",
+        "Insurance Verification",
+        "Questions Related to Past Visit",
+        "Provider Recommended follow-up",
+        "Care Coordination",
+        "Patient Consent",
+        "Patient Feedback",
+        "Goals Follow Up",
+        "Other-- (check recent memo)",
+    ];
+    $nextFUStatus = [
+        "SCHEDULED",
+        "CANCELLED",
+        "COMPLETED",
+    ];
+?>
 <div moe wide>
-    <a href="#" start show class="d-flex align-items-baseline" title="Next FU">Next FU</a>
+    <a href="#" start show class="d-flex align-items-baseline" title="Next FU"><img src="{{ asset('img/p-phone.png') }}" alt="" style="width:24px"></a>
     <form url="/api/client/putClientRepFollowUp" class="mcp-theme-1">
-        <div id="viewNextFuData" class="{{ $patient->clientRepFollowUp ? '':'d-none' }}">
+        <div id="viewNextFuData" class="{{ $patient->clientRepFollowUp ? '':'d-none' }}" fu-screen>
             @if($patient->clientRepFollowUp)
-            <a id="updateNextFu" class="c-pointer">Update</a>
+            <div class="d-flex align-items-center">
+            <a id="updateNextFu" class="c-pointer" data-show="#updateNextFuData" next-fu-screen>Update</a>
+            <a id="updateFuStatus" class="c-pointer ml-3" data-show="#updateStatus" next-fu-screen >Update Status</a>
+            </div>
             <table class="table table-sm table-striped table-bordered">
-                <tr>
-                    <td><b>Created At</b></td>
-                    <td>{{ friendly_date_time($patient->clientRepFollowUp->created_at) }}</td>
-                </tr>
-                <tr>
-                    <td><b>Updated At</b></td>
-                    <td>{{ friendly_date_time($patient->clientRepFollowUp->updated_at) }}</td>
-                </tr>
                 <tr>
                     <td><b>Client Rep</b></td>
                     <td>{{ $patient->clientRepFollowUp->pro->displayName() }}</td>
                 </tr>
+                <tr>
+                    <td><b>Status</b></td>
+                    <td>{{ $patient->clientRepFollowUp->status }}</td>
+                </tr>
                 <tr>
                     <td><b>Next Followup Date</b></td>
                     <td>{{ friendly_date_time($patient->clientRepFollowUp->next_follow_up_date) }}</td>
@@ -25,56 +54,50 @@
                     <td><b>Next Followup Reason</b></td>
                     <td>{{ $patient->clientRepFollowUp->next_follow_up_reason }}</td>
                 </tr>
-                <tr>
-                    <td><b>Next Followup Memo</b></td>
-                    <td>{{ $patient->clientRepFollowUp->next_follow_up_memo }}</td>
-                </tr>
             </table>
             @endif
         </div>
-        <div id="updateNextFuData" class="{{ $patient->clientRepFollowUp ? 'd-none':'' }}">
-            <a id="showNextFu" class="c-pointer">Show FU</a>
+        @if($patient->clientRepFollowUp)
+            <div id="updateStatus" class="{{ $patient->clientRepFollowUp ? 'd-none':'' }}" fu-screen>
+            <a class="c-pointer mb-2" data-show="#updateNextFuData" next-fu-screen>View FU</a>
+                <div class="mb-2">
+                    <label for="" class="text-secondary mb-1">Update Status</label>
+                    <select class="form-control input-sm" data-uid="{{ $patient->clientRepFollowUp->uid }}"  submit-status>
+                        <option value=""></option>
+                        @foreach($nextFUStatus as $fuStatus)
+                            <option {{ $patient->clientRepFollowUp->status == $fuStatus ? 'selected':'' }}>{{ $fuStatus }}</option>
+                        @endforeach
+                    </select>
+                </div>
+            </div>
+        @endif
+        <div id="updateNextFuData" class="{{ $patient->clientRepFollowUp ? 'd-none':'' }}" fu-screen>
+            <a id="showNextFu" class="c-pointer" data-show="#viewNextFuData" next-fu-screen>Show FU</a>
             <input type="hidden" name="uid" value="{{ $patient->uid }}">
             <div class="mb-2">
                 <label for="" class="text-sm text-secondary mb-1">Next Calling Date</label>
-                <input type="date" class="form-control input-sm" name="nextFollowUpDate" value="{{ $patient->next_follow_up_date }}" />
+                <input type="date" class="form-control input-sm" name="nextFollowUpDate" value="{{ $patient->clientRepFollowUp ? $patient->clientRepFollowUp->next_follow_up_date : '' }}" />
             </div>
             <div class="mb-2">
                 <label for="" class="text-sm text-secondary mb-1">Call Assigned To</label>
                 <select provider-search name="clientRepProUid" class="form-control input-sm">
+                    @if($patient->clientRepFollowUp)
+                    <option value="{{ $patient->clientRepFollowUp->pro->uid }}">{{ $patient->clientRepFollowUp->pro->displayName() }}</option>
+                    @endif
                 </select>
+                @if($patient->clientRepFollowUp)
+                    <small class="text-muted">Current: <b>{{ $patient->clientRepFollowUp->pro->displayName() }}</b></small>
+                @endif
             </div>
             <div class="mb-2">
                 <label for="" class="text-sm text-secondary mb-1">Call Reason</label>
                 <select name="nextFollowUpReason" class="form-control input-sm">
                     <option value=""></option>
-                    <option>Appointment Confirmation</option>
-                    <option>New Appointment</option>
-                    <option>Missed Appointment</option>
-                    <option>Appointment Reschedule</option>
-                    <option>Appointment Cancellation</option>
-                    <option>Response to Pt's Voicemail</option>
-                    <option>Regarding ERx/Lab/Image Orders</option>
-                    <option>Regarding Supply Orders</option>
-                    <option>Regarding RPM</option>
-                    <option>Pt Profile Related Matters</option>
-                    <option>Pt Insurance Related Matters</option>
-                    <option>Incoming Referrals</option>
-                    <option>Outgoing Referrals</option>
-                    <option>Insurance Verification</option>
-                    <option>Questions Related to Past Visit</option>
-                    <option>Provider Recommended follow-up</option>
-                    <option>Care Coordination</option>
-                    <option>Patient Consent</option>
-                    <option>Patient Feedback</option>
-                    <option>Goals Follow Up</option>
-                    <option>Other-- (check recent memo)</option>
+                    @foreach($nextFUReasons as $fuReason)
+                        <option @if($patient->clientRepFollowUp){{ $patient->clientRepFollowUp->next_follow_up_reason == $fuReason ? 'selected':'' }} @endif>{{ $fuReason }}</option>
+                    @endforeach
                 </select>
             </div>
-            <div class="mb-2">
-                <label for="" class="text-sm text-secondary mb-1">Memo</label>
-                <textarea class="form-control input-sm" name="nextFollowUpMemo"></textarea>
-            </div>
             <div class="d-flex align-items-center">
                 <button class="btn btn-sm btn-primary mr-2" submit>Submit</button>
                 <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
@@ -85,13 +108,20 @@
 
 <script>
     $(document).ready(function() {
-        $('#updateNextFu').click(function(){
-            $('#viewNextFuData').addClass('d-none');
-            $('#updateNextFuData').removeClass('d-none');
+        $('[next-fu-screen]').click(function(){
+            var showRef = $(this).data('show');
+            $('[fu-screen]').addClass('d-none');
+            $(showRef).removeClass('d-none');
         });
-        $('#showNextFu').click(function(){
-            $('#viewNextFuData').removeClass('d-none');
-            $('#updateNextFuData').addClass('d-none');
+
+        $('[submit-status]').change(function(){
+            var value = $(this).val();
+            var uid = $(this).data('uid');
+            $.post('/api/clientRepFollowUp/update-status', {uid: uid, status: value}, function(response){
+                if(response.success){
+                    fastReload();
+                }
+            }, 'json')
         });
     });
 </script>

+ 1 - 1
resources/views/app/patient/partials/quick-actions-buttons.blade.php

@@ -1,4 +1,4 @@
-<div class="d-flex justify-content-around">
+<div class="d-flex justify-content-around align-items-center">
 	<div>
 		<div moe relative>
 			<a href="#" start show class="ml-3 d-flex align-items-baseline"><i class="fa fa-comment mr-1"></i></a>

+ 17 - 1
spec/rpt-queries.sql

@@ -105,4 +105,20 @@ COPY (
     client_engagement_status_category as status
   FROM client 
   WHERE shadow_pro_id IS NULL
-) TO '/tmp/client_appts.csv' CSV HEADER;
+) TO '/tmp/client_appts.csv' CSV HEADER;
+
+
+COPY (
+  SELECT 
+    cl.name_first,
+    cl.name_last,
+    appt.raw_date, 
+    appt.status,
+    mcp.name_first, 
+    mcp.name_last
+  FROM appointment  appt 
+  LEFT JOIN pro mcp ON appt.pro_id = mcp.id 
+  LEFT JOIN client cl ON appt.client_id = cl.id 
+  WHERE appt.raw_date >= '01-05-2022'::DATE
+  AND cl.shadow_pro_id IS NOT NULL
+) TO '/tmp/appts.csv' CSV HEADER;