Просмотр исходного кода

added none medicare insurance info

= 4 лет назад
Родитель
Сommit
65835b1751

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

@@ -10,6 +10,7 @@ use App\Models\ClientBDTDevice;
 use App\Models\ClientInfoLine;
 use App\Models\Facility;
 use App\Models\Handout;
+use App\Models\MBPayer;
 use App\Models\NoteTemplate;
 use App\Models\Pro;
 use App\Models\ProProAccess;
@@ -372,4 +373,9 @@ class PatientController extends Controller
     public function eligibleRefreshes(Request $request, Client $patient) {
         return view('app.patient.eligible-refreshes', compact('patient'));
     }
+
+    public function insuranceCoverage(Request $request, Client $patient) {
+        $mbPayers = MBPayer::paginate(50);
+        return view('app.patient.insurance-coverage', compact('patient', 'mbPayers'));
+    }
 }

+ 6 - 0
app/Models/Client.php

@@ -404,4 +404,10 @@ class Client extends Model
             ->orderBy('created_at', 'desc');
     }
 
+    public function mbPayerValidationResults()
+    {
+        return $this->hasMany(ClientMBPayerValidationResult::class, 'client_id', 'id')
+            ->orderBy('created_at', 'desc');
+    }
+
 }

+ 19 - 0
app/Models/ClientMBPayerValidationResult.php

@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Models;
+
+use Carbon\Carbon;
+use DateTime;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class ClientMBPayerValidationResult extends Model
+{
+    protected $table = 'client_mb_payer_validation_result';
+
+    public function mbPayer()
+    {
+        return $this->hasOne(MBPayer::class, 'id', 'mb_payer_id');
+    }
+
+}

+ 20 - 0
app/Models/MBPayer.php

@@ -0,0 +1,20 @@
+<?php
+
+namespace App\Models;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class MBPayer extends Model
+{
+    protected $table = 'mb_payer';
+
+   
+    public function name()
+    {
+        $vendorData = json_decode($this->vendor_data_json, true);
+        if(isset($vendorData['names'])){
+            return $vendorData['names'][0];
+        }
+        return "no set";
+    }
+}

+ 111 - 0
resources/views/app/patient/insurance-coverage.blade.php

@@ -0,0 +1,111 @@
+@extends ('layouts.patient')
+
+@section('inner-content')
+    <?php
+    function toHumanReadable($name) {
+        return ucwords(preg_replace("/[^0-9a-z]/i", " ", $name));
+    }
+    function parseRender($_data) {
+        if($_data) {
+            $type = gettype($_data);
+            if(is_string($_data) || is_numeric($_data)) {
+                echo $_data;
+            }
+            else {
+                echo "<table class='table table-sm border w-100'>";
+                foreach($_data as $k => $v) {
+                    echo "<tr>";
+                    echo "<td><b class='text-secondary'>" . toHumanReadable($k) . "</b></td>";
+                    echo "<td>";
+                    if(is_object($v)) {
+                        parseRender($v);
+                    }
+                    elseif(is_array($v)) {
+                        foreach($v as $k2 => $v2) {
+                            parseRender($v2);
+                        }
+                    }
+                    else {
+                        echo $v;
+                    }
+                    echo "</td>";
+                    echo "</tr>";
+                }
+                echo "</table>";
+            }
+        }
+    }
+    ?>
+    <style>
+        .eligible-table td {
+            white-space: nowrap;
+        }
+    </style>
+<div>
+    <div class="d-flex align-items-center">
+        <h4 class="font-weight-bold m-0 font-size-16">Insurance Coverage</h4>
+        <div class="ml-3">
+            <div moe relative>
+                <a href="" start show class="btn btn-sm btn-primary text-white font-weight-bold small">Add</a>
+                <form url="/api/client/validateAgainstMBPayer" class="mcp-theme-1">
+                    <input type="hidden" name="uid" value="{{$patient->uid}}">
+                    <div class="form-group">
+                        <select name="mbPayerUid"  class="form-control">
+                            <option value=""></option>
+                            @foreach($mbPayers as $mbPayer)
+                            <option value="{{$mbPayer->uid}}">{{$mbPayer->name()}}</option>
+                            @endforeach
+                        </select>
+                    </div>
+                    <div class="form-group">
+                        <label class="control-label">Member Id</label>
+                        <input type="text" name="memberId" class="form-control">
+                    </div>
+                    <div class="form-group">
+                        <label class="control-label">Member First Name</label>
+                        <input type="text" name="memberFirstName" class="form-control">
+                    </div>
+                    <div class="form-group">
+                        <label class="control-label">Member Last Name</label>
+                        <input type="text" name="memberLastName" class="form-control">
+                    </div>
+                    <div class="form-group">
+                        <label class="control-label">Member Dob</label>
+                        <input type="date" name="memberDOB" class="form-control">
+                    </div>
+                    <div>
+                        <button submit class="btn btn-sm btn-primary mr-2">Yes</button>
+                        <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+
+    <table class="table table-sm table-bordered mt-3 mb-0">
+        <thead>
+        <tr>
+            <th>Created At</th>
+            <th class="border-bottom-0 w-25">Payer Name </th>
+            <th class="border-bottom-0 w-25">Eligible Payer ID</th>
+            <th class="border-bottom-0 w-25">Member Details</th>
+            <th class="border-bottom-0">Result</th>
+        </tr>
+        </thead>
+        <tbody>
+        @foreach($patient->mbPayerValidationResults as $mbpvResult)
+            <tr>
+                <td class="text-nowrap">{{friendly_date_time($mbpvResult->created_at)}}</td>
+                <td>{{$mbpvResult->mbPayer->vendor_identifier}}</td>
+                <td>{{$mbpvResult->mbPayer->name()}}</td>
+                <td># {{$mbpvResult->member_id}} | {{$mbpvResult->member_first_name}} | {{$mbpvResult->member_last_name}} | {{$mbpvResult->member_dob}}</td>
+                <td class="">
+                    <pre>
+                    {{json_encode(json_decode($mbpvResult->validation_result_json), JSON_PRETTY_PRINT)}}</td>
+                    </pre>
+            </tr>
+        @endforeach
+        </tbody>
+    </table>
+</div>
+@endsection

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

@@ -168,6 +168,10 @@
                             <a class="nav-link {{ strpos($routeName, 'patients.view.eligible-refreshes') === 0 ? 'active' : '' }}"
                                href="{{ route('patients.view.eligible-refreshes', $patient) }}">Eligible Refreshes</a>
                         </li>
+                        <li class="nav-item">
+                            <a class="nav-link {{ strpos($routeName, 'patients.view.insurance-coverage') === 0 ? 'active' : '' }}"
+                               href="{{ route('patients.view.insurance-coverage', $patient) }}">Insurance Coverage</a>
+                        </li>
                         @endif
                     </ul>
                     <div class="mt-3 mcp-theme-1">

+ 1 - 0
routes/web.php

@@ -112,6 +112,7 @@ Route::middleware('pro.auth')->group(function () {
     Route::middleware('pro.auth.admin')->group(function(){
         Route::get('patients/view/mcp-requests/{patient?}', 'PatientController@mcpRequests')->name('patients.view.mcp-requests');
         Route::get('patients/view/eligible-refreshes/{patient}', 'PatientController@eligibleRefreshes')->name('patients.view.eligible-refreshes');
+        Route::get('patients/view/insurance-coverage/{patient}', 'PatientController@insuranceCoverage')->name('patients.view.insurance-coverage');
     });
 
     Route::name('patients.view.')->prefix('patients/view/{patient}')->group(function () {