Browse Source

Updates - cpt codes

Samson Mutunga 1 year ago
parent
commit
8664bd35ed

+ 24 - 0
app/Http/Controllers/PatientController.php

@@ -753,4 +753,28 @@ class PatientController extends Controller
     public function protocolBuilder(Request $request, Client $patient) {
         return view('app.patient.rtm.protocol-builder', compact('patient'));
     }
+
+    public function checkIfCptCodeIsSubmitted(Request $request){
+        $clientUid = $request->get('clientUid');
+        $cptCode = $request->get('code');
+        if(!$clientUid || !$cptCode) return $this->fail('Error');
+        $client = Client::where('uid', $clientUid)->first();
+        $notes = $client->notes;
+        $isCptSubmitted = false;
+        foreach($notes as $note){
+            $noteClaims = $note->claims;
+            foreach($noteClaims as $noteClaim){
+                foreach($noteClaim->lines as $claimLine){
+                    if($claimLine->cpt == $cptCode){
+                        if($noteClaim->status == 'SUBMITTED'){
+                            $isCptSubmitted = true;
+                        }
+                    }
+                }
+            }
+            
+        }
+        if($isCptSubmitted) return $this->pass('SUBMITTED');
+        return $this->pass('NOT_SUBMITTED');
+    }
 }

+ 8 - 1
resources/views/app/patient/notes.blade.php

@@ -367,7 +367,14 @@
                     ?>
                     @foreach ($noteClaims as $noteClaim)
                         @foreach($noteClaim->lines as $claimLine)
-                            <div>{{ $claimLine->cpt }}</div>
+                            <div>
+                            {{ $claimLine->cpt }}
+                            @if($noteClaim->status == 'SUBMITTED')
+                                <span class="ml-1" title="submitted"><i class="far fa-check-circle fa-fw text-success"></i></span>
+                            @else
+                            <span class="ml-1" title="Not submitted"><i class="fas fa-exclamation-triangle fa-fw text-danger"></i></span>
+                            @endif
+                            </div>
                         @endforeach
                     @endforeach
                 </td>

+ 43 - 0
resources/views/app/patient/partials/cpt-alert.blade.php

@@ -0,0 +1,43 @@
+<div id="cptAlertComponent" v-cloak>
+    <div v-if="errorCodes.length" class="alert alert-danger p-0 rounded-0 text-center">
+        <div style="font-size: 14px;">
+        <i class="fas fa-exclamation-triangle fa-fw"></i>
+        <b>@{{ errorCodes.join(', ') }}</b> @{{ errorCodes.length > 1 ? 'codes have ':'code has ' }} never been submitted for this patient!</div>
+    </div>
+</div>
+<script>
+    (function() {
+        function init() {
+            var cptAlertComponent = new Vue({
+                el: '#cptAlertComponent',
+                data: {
+                    codesToCheck: ['G0506'],
+                    errorCodes:[]
+                },
+                methods:{
+                    checkForUnbilledCodes: function(){
+                        var self = this;
+                        for(var i in self.codesToCheck){
+                            code = self.codesToCheck[i];
+                            $.get('{{ route("check-if-cpt-code-is-submitted") }}', {clientUid: "{{ $patient->uid }}", code: code}, function(response){
+                                if(response.success){
+                                    if(response.data === 'NOT_SUBMITTED'){
+                                        self.errorCodes.push(code);
+                                    }
+                                }
+                            }, 'json');
+                        }
+
+                    },
+                    init: function(){
+                        this.checkForUnbilledCodes();
+                    }
+                },
+                mounted: function(){
+                    this.init();
+                }
+            });
+        }
+        addMCInitializer('cptAlertComponent', init, '#cptAlertComponent');
+    })();
+</script>

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

@@ -280,6 +280,7 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 		</nav>
 		@endif
 		<main role="main" class="w-100 {{$trimLayout || $leanLeftNav ? 'p-0' : ''}}">
+			@include('app.patient.partials.cpt-alert')
 			@if($pro->is_enrolled_as_mcp && !$patient->mcp)
 			<div class="d-flex align-items-center alert alert-info bg-white mcp-theme-1 p-3 hide-inside-ticket-popup m-1">
 				<div class="font-size-16 mr-3">

+ 2 - 0
routes/web.php

@@ -803,6 +803,8 @@ Route::middleware('pro.auth')->group(function () {
     Route::get('print-note-v3/{patient}/{note}', 'NoteController@printV3')->name('print-note-v3');
     Route::get('resolve-note/{patient}/{note}', 'NoteController@resolve')->name('resolve-note');
 
+    Route::get('check-if-cpt-code-is-submitted', 'PatientController@checkIfCptCodeIsSubmitted')->name('check-if-cpt-code-is-submitted');
+
 });
 
 Route::post("/process_form_submit", 'NoteController@processFormSubmit')->name('process_form_submit');