浏览代码

Merge branch 'dev' into dev-vj

Vijayakrishnan 4 年之前
父节点
当前提交
9a9fc31e1d

+ 81 - 19
app/Http/Controllers/PracticeManagementController.php

@@ -18,6 +18,7 @@ use App\Models\ProSpecificUnavailability;
 use App\Models\ProTextShortcut;
 use App\Models\ProTransaction;
 use App\Models\Ticket;
+use Illuminate\Support\Facades\DB;
 use PDF;
 use DateTime;
 use DateTimeZone;
@@ -341,21 +342,21 @@ class PracticeManagementController extends Controller
         if ($requests && count($requests)) {
             foreach ($requests as $mcpRequest) {
                 $client = $mcpRequest->client;
-                if ($client->initiative) {
-                    if (strpos($this->performer->pro->initiative, $client->initiative) !== false) {
-                        $results[] = [
-                            "clientUid" => $client->uid,
-                            "name" => $client->displayName(),
-                            "initials" => substr($client->name_first, 0, 1) . substr($client->name_last, 0, 1)
-                        ];
-                    }
-                } else {
-                    $results[] = [
-                        "clientUid" => $client->uid,
-                        "name" => $client->displayName(),
-                        "initials" => substr($client->name_first, 0, 1) . substr($client->name_last, 0, 1)
-                    ];
-                }
+                // if ($client->initiative) {
+                //     if (strpos($this->performer->pro->initiative, $client->initiative) !== false) {
+                //         $results[] = [
+                //             "clientUid" => $client->uid,
+                //             "name" => $client->displayName(),
+                //             "initials" => substr($client->name_first, 0, 1) . substr($client->name_last, 0, 1)
+                //         ];
+                //     }
+                // } else {
+                $results[] = [
+                    "clientUid" => $client->uid,
+                    "name" => $client->displayName(),
+                    "initials" => substr($client->name_first, 0, 1) . substr($client->name_last, 0, 1)
+                ];
+                //}
             }
         }
         return json_encode($results);
@@ -381,10 +382,71 @@ class PracticeManagementController extends Controller
         return view('app.practice-management.calendar', compact('pros'));
     }
 
+    public function cellularDeviceManager(Request $request, $proUid = null){
+        $proUid = $proUid ? $proUid : $request->get('pro-uid');
+        $performerPro = $this->performer->pro;
+        $targetPro = null;
+        $allPros = [];
+        $expectedForHcp = null;
+        if($performerPro->pro_type == 'ADMIN'){
+            $allPros = Pro::all();
+            $targetPro = Pro::where('uid', $proUid)->first();
+        }else{
+            $targetPro = $performerPro;
+        }
+        $clients = [];
+        if($targetPro){
+            $clients = Client::where('mcp_pro_id', $targetPro->id)->orderBy('created_at', 'desc')->paginate(100);
+        }else{
+            $clients = Client::orderBy('created_at', 'desc')->paginate(100);
+        }
+        return view('app.practice-management.cellular-device-manager', compact('clients', 'allPros', 'targetPro'));
+    }
+
+    public function hcpBillMatrix(Request $request, $proUid = null)
+    {
+        $proUid = $proUid ? $proUid : $request->get('pro-uid');
+        $performerPro = $this->performer->pro;
+        $targetPro = null;
+        $allPros = [];
+        $expectedForHcp = null;
+        if($performerPro->pro_type == 'ADMIN'){
+            $allPros = Pro::all();
+            $targetPro = Pro::where('uid', $proUid)->first();
+        }else{
+            $targetPro = $performerPro;
+        }
+        $bills = [];
+        if($targetPro){
+            $expectedForHcp = DB::select(DB::raw("SELECT coalesce(SUM(hcp_expected_payment_amount),0) as expected_pay FROM bill WHERE hcp_pro_id = :targetProID  AND is_signed_by_hcp IS TRUE AND is_cancelled = false"), ['targetProID' => $targetPro->id])[0]->expected_pay;
+            $bills = Bill::where('hcp_pro_id', $targetPro->id)->orderBy('created_at', 'desc')->paginate(500);
+        }else{
+            $bills = Bill::orderBy('created_at', 'desc')->paginate(500);
+        }
+        return view('app.practice-management.hcp-bill-matrix', compact('bills', 'allPros', 'expectedForHcp', 'targetPro'));
+    }
+
     public function billingManager(Request $request, $proUid = null)
     {
-        $notes = Note::orderBy('created_at', 'desc')->paginate();
-        return view('app.practice-management.billing-manager', compact('notes'));
+        $proUid = $proUid ? $proUid : $request->get('pro-uid');
+        $performerPro = $this->performer->pro;
+        $targetPro = null;
+        $allPros = [];
+        $expectedForHcp = null;
+        if($performerPro->pro_type == 'ADMIN'){
+            $allPros = Pro::all();
+            $targetPro = Pro::where('uid', $proUid)->first();
+        }else{
+            $targetPro = $performerPro;
+        }
+        $notes = [];
+        if($targetPro){
+            $expectedForHcp = DB::select(DB::raw("SELECT coalesce(SUM(hcp_expected_payment_amount),0) as expected_pay FROM bill WHERE hcp_pro_id = :targetProID  AND is_signed_by_hcp IS TRUE AND is_cancelled = false"), ['targetProID' => $targetPro->id])[0]->expected_pay;
+            $notes = Note::where('hcp_pro_id', $targetPro->id)->orderBy('effective_dateest', 'desc')->paginate();
+        }else{
+            $notes = Note::orderBy('effective_dateest', 'desc')->paginate();
+        }
+        return view('app.practice-management.billing-manager', compact('notes', 'allPros', 'expectedForHcp', 'targetPro'));
     }
 
     public function claims(Request $request)
@@ -395,9 +457,9 @@ class PracticeManagementController extends Controller
 
     // Generate PDF
     public function downloadClaims() {
-        $claims = Claim::where('was_submitted', false)->orWhere('was_submitted', null)->orderBy('created_at', 'desc')->paginate();
+        $claims = Claim::where('was_submitted', false)->orWhere('was_submitted', null)->orderBy('created_at', 'desc')->limit(100)->get();
         view()->share('claims', $claims);
-    
+
         $pdf = PDF::loadView('app.practice-management.claims-pdf', $claims);
 
         return $pdf->download('pdf_file.pdf');

+ 127 - 43
app/Models/Client.php

@@ -11,66 +11,80 @@ class Client extends Model
 {
     protected $table = 'client';
 
-    public function displayName() {
-        return $this->name_last . ', '. $this->name_first;
+    public function displayName()
+    {
+        return $this->name_last . ', ' . $this->name_first;
     }
 
-    public function mcp() {
+    public function mcp()
+    {
         return $this->hasOne(Pro::class, 'id', 'mcp_pro_id');
     }
 
-    public function pcp() {
+    public function pcp()
+    {
         return $this->hasOne(Pro::class, 'id', 'physician_pro_id');
     }
 
-    public function cm() {
+    public function cm()
+    {
         return $this->hasOne(Pro::class, 'id', 'cm_pro_id');
     }
 
-    public function rmm() {
+    public function rmm()
+    {
         return $this->hasOne(Pro::class, 'id', 'rmm_pro_id');
     }
 
-    public function rme() {
+    public function rme()
+    {
         return $this->hasOne(Pro::class, 'id', 'rme_pro_id');
     }
 
-    public function rms() {
+    public function rms()
+    {
         return $this->hasOne(Pro::class, 'id', 'rms_pro_id');
     }
 
-    public function rmg() {
+    public function rmg()
+    {
         return $this->hasOne(Pro::class, 'id', 'rmg_pro_id');
     }
 
-    public function prosInMeetingWith() {
+    public function prosInMeetingWith()
+    {
         return Pro::where('in_meeting_with_client_id', $this->id)->get();
     }
 
-    public function notes() {
+    public function notes()
+    {
         return $this->hasMany(Note::class, 'client_id', 'id')
             ->orderBy('effective_dateest', 'desc');
     }
 
-    public function activeNotes() {
+    public function activeNotes()
+    {
         return $this->hasMany(Note::class, 'client_id', 'id')
             ->where('is_cancelled', false)
             ->orderBy('effective_dateest', 'desc');
     }
 
-    public function cancelledNotes() {
+    public function cancelledNotes()
+    {
         return $this->hasMany(Note::class, 'client_id', 'id')
             ->where('is_cancelled', true)
             ->orderBy('effective_dateest', 'desc');
     }
 
-    public function sections() {
+    public function sections()
+    {
         return $this->hasMany(Section::class, 'client_id', 'id')
             ->where('is_active', true)
             ->orderBy('created_at', 'asc');
     }
 
-    public function handouts() {
+    public function handouts()
+    {
         $mappings = HandoutClient::where('client_id', $this->id)->get();
         $handouts = new Collection();
         foreach ($mappings as $mapping) {
@@ -82,28 +96,33 @@ class Client extends Model
         return $handouts;
     }
 
-    public function duplicateOf() {
+    public function duplicateOf()
+    {
         return $this->hasOne(Client::class, 'id', 'duplicate_of_client_id');
     }
 
-    public function actionItems () {
+    public function actionItems()
+    {
         return $this->hasMany(ActionItem::class, 'client_id', 'id')
             ->orderBy('action_item_category', 'asc')
             ->orderBy('created_at', 'desc');
     }
 
-    public function infoLines() {
-	    return $this->hasMany(ClientInfoLine::class, 'client_id', 'id')->orderBy('created_at', 'desc');
+    public function infoLines()
+    {
+        return $this->hasMany(ClientInfoLine::class, 'client_id', 'id')->orderBy('created_at', 'desc');
     }
 
-    public function measurements() {
+    public function measurements()
+    {
         return $this->hasMany(Measurement::class, 'client_id', 'id')
             /*->distinct('label')*/
             ->where('is_removed', false)
             ->orderBy('effective_date', 'desc');
     }
 
-    public function currentCareMonth() {
+    public function currentCareMonth()
+    {
         $cmStartDate = strtotime(date('Y-m-d'));
         $month = date("n", $cmStartDate);
         $year = date("Y", $cmStartDate);
@@ -114,7 +133,8 @@ class Client extends Model
             ->first();
     }
 
-    public function measurementsInCareMonth(CareMonth $careMonth) {
+    public function measurementsInCareMonth(CareMonth $careMonth)
+    {
         $cmStartDate = strtotime($careMonth->start_date);
         $month = date("n", $cmStartDate);
         $year = date("Y", $cmStartDate);
@@ -128,7 +148,8 @@ class Client extends Model
         return $measurements;
     }
 
-    public function allMeasurements() {
+    public function allMeasurements()
+    {
         return $this->hasMany(Measurement::class, 'client_id', 'id')
             ->where('is_removed', false)
             ->whereNull('parent_measurement_id')
@@ -136,12 +157,14 @@ class Client extends Model
             ->orderBy('effective_date', 'desc');
     }
 
-    public function smses() {
+    public function smses()
+    {
         return $this->hasMany(ClientSMS::class, 'client_id', 'id')
             ->orderBy('created_at', 'desc');
     }
 
-    public function documents() {
+    public function documents()
+    {
         return $this->hasMany(ClientDocument::class, 'client_id', 'id')
             ->orderBy('created_at', 'desc');
     }
@@ -156,8 +179,9 @@ class Client extends Model
             ->orderBy('created_at', 'desc');
     }
 
-    public function nextMcpAppointment() {
-        if($this->mcp) {
+    public function nextMcpAppointment()
+    {
+        if ($this->mcp) {
             return Appointment::where('client_id', $this->id)
                 ->where('pro_id', $this->mcp->id)
                 ->where('start_time', '>=', date('Y-m-d'))
@@ -167,31 +191,36 @@ class Client extends Model
         return false;
     }
 
-    public function appointments() {
+    public function appointments()
+    {
         return $this->hasMany(Appointment::class, 'client_id', 'id')
             ->orderBy('start_time', 'desc');
     }
 
-    public function upcomingAppointments() {
+    public function upcomingAppointments()
+    {
         return $this->hasMany(Appointment::class, 'client_id', 'id')
-           // ->where('raw_start_time', '>', date('Y-m-d H:i:s'))
+            // ->where('raw_start_time', '>', date('Y-m-d H:i:s'))
             ->whereIn('status', ['CREATED', 'CONFIRMED'])
             ->orderBy('start_time', 'desc');
     }
 
-    public function memos() {
+    public function memos()
+    {
         return $this->hasMany(ClientMemo::class, 'client_id', 'id')
             ->where('is_cancelled', false)
             ->orderBy('created_at', 'desc');
     }
 
-    public function devices() {
+    public function devices()
+    {
         return $this->hasMany(ClientBDTDevice::class, 'client_id', 'id')
             ->where('is_active', true)
             ->orderBy('created_at', 'desc');
     }
 
-    public function hasDevice($_device) {
+    public function hasDevice($_device)
+    {
         $count = ClientBDTDevice::where('client_id', $this->id)
             ->where('device_id', $_device->id)
             ->where('is_active', true)
@@ -199,27 +228,82 @@ class Client extends Model
         return !!$count;
     }
 
-    public function deviceMeasurements() {
+    public function deviceMeasurements()
+    {
         return $this->hasMany(ClientBDTMeasurement::class, 'client_id', 'id')
             ->orderBy('created_at', 'desc');
     }
 
-    public function activeMcpRequest() {
+    public function activeMcpRequest()
+    {
         return $this->hasOne(McpRequest::class, 'id', 'active_mcp_request_id');
     }
 
-    public function clientPrograms() {
+    public function clientPrograms()
+    {
         return $this->hasMany(ClientProgram::class, 'client_id', 'id')
             ->where('is_active', true)
             ->orderBy('title', 'desc');
     }
 
-    public function tickets() {
+    public function tickets()
+    {
         return $this->hasMany(Ticket::class, 'client_id', 'id')
             ->orderBy('created_at', 'desc');
     }
 
-    public function prosWithAccess() {
+    public function mcpDisplayName()
+    {
+    }
+
+    public function rmeDisplayName()
+    {
+    }
+
+    public function firstCellularBPDevice()
+    {
+        $devices = $this->devices();
+        $x = null;
+        foreach($devices as $device){
+            if($device->device->category == 'BP'){
+                $x = $device;
+                continue;
+            }
+        }
+        return $x;
+    }
+
+    public function getFirstCellularBPMeasurementAt()
+    {
+    }
+
+    public function getLatestCellularBPMeasurementAt()
+    {
+    }
+
+    public function getTotalCellularBPMeasurements()
+    {
+    }
+
+    public function firstCellularWeightDevice()
+    {
+
+    }
+
+    public function getFirstCellularWeightMeasurementAt()
+    {
+    }
+
+    public function getLatestCellularWeightMeasurementAt()
+    {
+    }
+
+    public function getTotalCellularWeightMeasurements()
+    {
+    }
+
+    public function prosWithAccess()
+    {
 
         $pros = [];
 
@@ -238,28 +322,28 @@ class Client extends Model
         // via client pro access
         $cpAccesses = ClientProAccess::where('client_id', $this->id)->where('is_active', true)->get();
         foreach ($cpAccesses as $cpAccess) {
-            if(!$cpAccess->pro) continue;
+            if (!$cpAccess->pro) continue;
             $pros[] = ["pro" => $cpAccess->pro->displayName(), "association" => 'Via Client-Pro Access'];
         }
 
         // via appointments
         $appointments = Appointment::where('client_id', $this->id)->get();
         foreach ($appointments as $appointment) {
-            if(!$appointment->pro) continue;
+            if (!$appointment->pro) continue;
             $pros[] = ["pro" => $appointment->pro->displayName(), "association" => 'Via Appointment: ' . $appointment->raw_date];
         }
 
         // via client program
         $clientPrograms = ClientProgram::where('client_id', $this->id)->where('is_active', true)->get();
         foreach ($clientPrograms as $clientProgram) {
-            if($clientProgram->mcp)
+            if ($clientProgram->mcp)
                 $pros[] = ["pro" => $clientProgram->mcp->displayName(), "association" => 'Program MCP: ' . $clientProgram->title];
-            if($clientProgram->manager)
+            if ($clientProgram->manager)
                 $pros[] = ["pro" => $clientProgram->manager->displayName(), "association" => 'Program Manager: ' . $clientProgram->title];
         }
 
         // sort by pro name
-        $name  = array_column($pros, 'pro');
+        $name = array_column($pros, 'pro');
         array_multisort($name, SORT_ASC, $pros);
 
         return $pros;

+ 2 - 1
resources/views/app/patient/canvas-sections/pmhx/summary.php

@@ -85,7 +85,8 @@ else {
     endfor;
 
     // custom fields
-    if(count($contentData['customFields'])):
+    
+    if(isset($contentData['customFields']) && count($contentData['customFields'])):
         ?> <div class="mt-2"> <?php
         for ($i = 0; $i < count($contentData['customFields']); $i++):
             $item = $contentData['customFields'][$i];

+ 31 - 8
resources/views/app/patient/partials/mcp-queue.blade.php

@@ -68,17 +68,12 @@
         window.queueComponent = new Vue({
             el: '#queueComponent',
             data: {
-                items: []
-            },
-            mounted: function() {
-                let self = this;
-                this.refresh();
-                window.setInterval(function() {
-                    self.refresh();
-                }, 15000); // once in 15 seconds
+                items: [],
+                socketClient: null,
             },
             methods: {
                 refresh: function() {
+                    console.log("Refreshing");
                     let self = this;
                     $.get('/patients-in-queue', function(_data) {
                         self.items = _data;
@@ -101,6 +96,34 @@
                         }
                     }, 'json');
                 }
+            },
+            mounted:function(){
+                let self = this;
+                self.refresh();
+                window.setInterval(function(){
+                    self.refresh();
+                }, 5000)
+                let socket = new SockJS("{{ config('app.backend_ws_url') }}");
+                self.socketClient = Stomp.over(socket);
+                self.socketClient.connect({}, (frame) => {
+
+                    self.socketClient.send("/app/register", {},     // register self
+                        JSON.stringify({
+                            sessionKey: '{{$performer->session_key}}'
+                        })
+                    );
+
+                    self.socketClient.subscribe("/user/topic/newMcpRequest", function(message) {
+                        console.log("Received new mcp request: ", message);
+                        self.refresh();
+                    }); 
+
+                    self.socketClient.subscribe("/user/topic/removeMcpRequest", function(message) {
+                        console.log("An mcp request has been removed: ", message);
+                        self.refresh();
+                    });
+                    
+                });
             }
         });
     })();

+ 149 - 118
resources/views/app/practice-management/billing-manager.blade.php

@@ -3,135 +3,166 @@
 @section('content')
 
     <div class="p-3 mcp-theme-1">
-    <div class="card">
+        <div class="card">
+            <div class="card-body p-2">
 
-        <div class="card-header px-3 py-2 d-flex align-items-center">
-            <strong class="mr-4">
-                <i class="fas fa-user-injured"></i>
-                Notes
-            </strong>
-            
+                @foreach($allPros as $_pro)
+                    <div>
+                        <a href="{{ route('practice-management.billingManager', $_pro) }}">
+                            {{$_pro->name_last}}, {{$_pro->name_first}}
+                        </a>
+                    </div>
+                @endforeach
+
+            </div>
         </div>
-        <div class="card-body p-0">
-            <table class="table table-sm table-condensed p-0 m-0">
-                <thead class="bg-light">
-                <tr>
-                    <th class="border-0">Patient</th>
-                    <th class="border-0">Note Eff. Date</th>
-                    <th class="border-0">HCP</th>
-                    <th class="border-0">Signed?</th>
-                    <th class="border-0">Bills</th>
-                    <th class="border-0">Assessments</th>
-                    <th class="border-0">Claims</th>
-                    <th class="px-3 border-0">Created</th>
-                </tr>
-                </thead>
-                <tbody>
-                @foreach ($notes as $note)
-                    <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
-                        
-                        <td class="">
-                            <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}">{{ $note->client->displayName() }}</a>
-                        </td>
-                        <td class="">
-                            <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}" class="font-weight-bold">
-                                {{ friendly_date_time($note->effective_dateest, false) }}
-                            </a>
-                            <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
-                        </td>
-                        <td>{{$note->hcpPro->name_first}} {{$note->hcpPro->name_first}}</td>
-                        <td>{{$note->is_signed_by_hcp?'Yes':'No'}}</td>
-                        <td>
-                            <table class="table table-sm table-condensed table-stripe">
-                                <thead>
+        <div class="card">
+
+            <div class="card-header px-3 py-2 d-flex align-items-center">
+                <strong class="mr-4">
+                    <i class="fas fa-user-injured"></i>
+                    Notes
+                </strong>
+
+            </div>
+            <div class="card-body p-0">
+                <table class="table table-sm table-condensed p-0 m-0">
+                    <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0">Note Eff. Date</th>
+
+
+                        <th class="border-0">HCP</th>
+
+                        <th class="border-0">Signed?</th>
+                        <th class="border-0">Bills</th>
+
+                        @if($performer->pro->pro_type == 'ADMIN')
+                            <th class="border-0">Assessments</th>
+                        @endif
+
+                        @if($performer->pro->pro_type == 'ADMIN')
+                            <th class="border-0">Claims</th>
+                        @endif
+                        <th class="px-3 border-0">Created</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach ($notes as $note)
+                        <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
+
+                            <td class="">
+                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}">{{ $note->client->displayName() }}</a>
+                            </td>
+                            <td class="">
+                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}"
+                                   class="font-weight-bold">
+                                    {{ friendly_date_time($note->effective_dateest, false) }}
+                                </a>
+                                <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
+                            </td>
+                            <td>{{$note->hcpPro->name_first}} {{$note->hcpPro->name_first}}</td>
+                            <td>{{$note->is_signed_by_hcp?'Yes':'No'}}</td>
+                            <td>
+                                <table class="table table-sm table-condensed table-stripe">
+                                    <thead>
                                     <tr>
                                         <th>Service</th>
                                         <th># of units</th>
                                         <th>Signed?</th>
+                                        <th>Cancelled?</th>
+                                        <th>HCP ex. amount</th>
                                     </tr>
-                                </thead>
-                                <tbody>
+                                    </thead>
+                                    <tbody>
                                     @foreach($note->bills as $bill)
-                                    <tr>
-                                        <td>{{$bill->code}}</td>
-                                        @if($bill->code == 'Treatment Services')
-                                            <td>{{ceil($bill->number_of_units*60)}}m</td>
-                                        @else
-                                            <td>{{$bill->number_of_units}}</td>
-                                        @endif
-                                        <td>{{$bill->is_signed_by_hcp?'Yes':'No'}}</td>
-                                    </tr>
+                                        <tr>
+                                            <td>{{$bill->code}}</td>
+                                            @if($bill->code == 'Treatment Services')
+                                                <td>{{floor($bill->number_of_units*60)}}m</td>
+                                            @else
+                                                <td>{{$bill->number_of_units}}</td>
+                                            @endif
+                                            <td>{{$bill->is_signed_by_hcp?'Yes':'No'}}</td>
+                                            <td>{{ $bill->is_cancelled ?'Yes':'No'}}</td>
+                                            <td>{{ $bill->hcp_expected_payment_amount }}</td>
+                                        </tr>
                                     @endforeach
-                                </tbody>
-                            </table>
-                        </td>
-                        <td>
-                            <table class="table table-sm table-condensed table-stripe">
-                                <thead>
-                                    <tr>
-                                        <th>Code</th>
-                                        <th>Description</th>
-                                    </tr>
-                                </thead>
-                                <tbody>
-                                    @foreach($note->reasons as $reason)
-                                    <tr>
-                                        <td>{{$reason->code}}</td>
-                                        <td>{{$reason->description}}</td>
-                                    </tr>
-                                    @endforeach
-                                </tbody>
-                            </table>
-                        </td>
-                        <td>
-                            <table class="table table-sm table-condensed table-stripe">
-                                <thead>
-                                    <tr>
-                                        <th>Identifier</th>
-                                        <th>Submitted?</th>
-                                    </tr>
-                                </thead>
-                                <tbody>
-                                    @foreach($note->claims as $claim)
-                                    <tr>
-                                        <td>{{$claim->iid}}</td>
-                                        <td>{{$claim->was_submitted?'Yes':'No'}}</td>
-                                    </tr>
-                                    <tr>
-                                        <td colspan="2">
-                                            <strong>Claim Lines</strong>
-                                            <table class="table table-sm table-condensed table-striped">
-                                                <tr>
-                                                    <th>CPT</th>
-                                                    <th>ICDs</th>
-                                                    <th>Date of Service</th>
-                                                </tr>
-                                                @foreach($claim->lines as $claimLine)
-                                                <tr>
-                                                    <td>{{$claimLine->cpt}}</td>
-                                                    <td>{{$claimLine->icds()}}</td>
-                                                    <td>{{$claimLine->date_of_service}}</td>
-                                                </tr>
-                                                @endforeach
-                                            </table>
-                                        </td>
-                                    </tr>
-                                    @endforeach
-                                </tbody>
-                            </table>
-                        </td>
-                        <td class="px-3">
-                            {{ friendly_date_time($note->created_at, true) }}
-                        </td>
-                    </tr>
-                @endforeach
-                </tbody>
-            </table>
-            <div>
-                {{$notes->links()}}
+                                    </tbody>
+                                </table>
+                            </td>
+                            @if($performer->pro->pro_type == 'ADMIN')
+                                <td>
+                                    <table class="table table-sm table-condensed table-stripe">
+                                        <thead>
+                                        <tr>
+                                            <th>Code</th>
+                                            <th>Description</th>
+                                        </tr>
+                                        </thead>
+                                        <tbody>
+                                        @foreach($note->reasons as $reason)
+                                            <tr>
+                                                <td>{{$reason->code}}</td>
+                                                <td>{{$reason->description}}</td>
+                                            </tr>
+                                        @endforeach
+                                        </tbody>
+                                    </table>
+                                </td>
+                            @endif
+                            @if($performer->pro->pro_type == 'ADMIN')
+                                <td>
+                                    <table class="table table-sm table-condensed table-stripe">
+                                        <thead>
+                                        <tr>
+                                            <th>Identifier</th>
+                                            <th>Submitted?</th>
+                                        </tr>
+                                        </thead>
+                                        <tbody>
+                                        @foreach($note->claims as $claim)
+                                            <tr>
+                                                <td>{{$claim->iid}}</td>
+                                                <td>{{$claim->was_submitted?'Yes':'No'}}</td>
+                                            </tr>
+                                            <tr>
+                                                <td colspan="2">
+                                                    <strong>Claim Lines</strong>
+                                                    <table class="table table-sm table-condensed table-striped">
+                                                        <tr>
+                                                            <th>CPT</th>
+                                                            <th>ICDs</th>
+                                                            <th>Date of Service</th>
+                                                        </tr>
+                                                        @foreach($claim->lines as $claimLine)
+                                                            <tr>
+                                                                <td>{{$claimLine->cpt}}</td>
+                                                                <td>{{$claimLine->icds()}}</td>
+                                                                <td>{{$claimLine->date_of_service}}</td>
+                                                            </tr>
+                                                        @endforeach
+                                                    </table>
+                                                </td>
+                                            </tr>
+                                        @endforeach
+                                        </tbody>
+                                    </table>
+                                </td>
+                            @endif
+                            <td class="px-3">
+                                {{ friendly_date_time($note->created_at, true) }}
+                            </td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+                <div>
+                    {{$notes->links()}}
+                </div>
             </div>
         </div>
     </div>
-    </div>
 
 @endsection

+ 96 - 0
resources/views/app/practice-management/cellular-device-manager.blade.php

@@ -0,0 +1,96 @@
+@extends ('layouts/template')
+
+@section('content')
+
+    <div class="p-3 mcp-theme-1">
+        <div class="card">
+            <div class="card-body p-2">
+
+                @foreach($allPros as $_pro)
+                    <div>
+                        <a href="{{ route('practice-management.cellularDeviceManager', $_pro) }}">
+                            {{$_pro->name_last}}, {{$_pro->name_first}}
+                        </a>
+                    </div>
+                @endforeach
+
+            </div>
+        </div>
+        <div class="card">
+
+            <div class="card-header px-3 py-2 d-flex align-items-center">
+                <strong class="mr-4">
+                    <i class="fas fa-user-injured"></i>
+                    Clients
+                </strong>
+
+            </div>
+            <style>
+                .cellular-bp {
+                    background-color: #d7d9f2;
+                }
+                .cellular-weight {
+                    background-color: #ffe8d4;
+                }
+            </style>
+            <div class="card-body p-0">
+                <table class="table table-sm table-condensed p-0 m-0">
+                    <colgroup>
+                        <col span="4">
+                        <col span="4" class="cellular-bp">
+                        <col span="4" class="cellular-weight">
+                    </colgroup>
+                    <thead class="bg-light">
+                    <tr>
+                        <th colspan="4"></th>
+                        <th colspan="4">Cellular BP</th>
+                        <th colspan="4">Cellular Weight</th>
+                    </tr>
+                    <tr>
+                        <th class="px-3 border-0">Created</th>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0">MCP</th>
+                        <th class="border-0">RME</th>
+
+                        <th class="border-0">Sent?</th>
+                        <th class="border-0">First use</th>
+                        <th class="border-0">Last use</th>
+                        <th class="border-0">Total measurements</th>
+
+                        <th class="border-0">Sent?</th>
+                        <th class="border-0">First use</th>
+                        <th class="border-0">Last use</th>
+                        <th class="border-0">Total measurements</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach ($clients as $client)
+                        <tr>
+
+                            <td>{{ $client->created_at }}</td>
+                            <td>{{ $client->displayName() }}</td>
+                            <td>{{ $client->mcpDisplayName() }}</td>
+                            <td>{{ $client->rmeDisplayName() }}</td>
+
+                            <td>{{ $client->firstCellularBPDevice() ? 'Yes' : 'No' }}</td>
+                            <td>{{ $client->getFirstCellularBPMeasurementAt()  }}</td>
+                            <td>{{ $client->getLatestCellularBPMeasurementAt() }}</td>
+                            <td>{{ $client->getTotalCellularBPMeasurements() }}</td>
+
+                            <td>{{ $client->firstCellularWeightDevice() ? 'Yes' : 'No' }}</td>
+                            <td>{{ $client->getFirstCellularWeightMeasurementAt()  }}</td>
+                            <td>{{ $client->getLatestCellularWeightMeasurementAt() }}</td>
+                            <td>{{ $client->getTotalCellularWeightMeasurements() }}</td>
+
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+                <div>
+                    {{$clients->links()}}
+                </div>
+            </div>
+        </div>
+    </div>
+
+@endsection

+ 0 - 3
resources/views/app/practice-management/claims-pdf.blade.php

@@ -45,9 +45,6 @@
                     @endforeach
                 </tbody>
             </table>
-            <div>
-                {{$claims->links()}}
-            </div>
         </div>
     </div>
 </div>

+ 153 - 0
resources/views/app/practice-management/hcp-bill-matrix.blade.php

@@ -0,0 +1,153 @@
+@extends ('layouts/template')
+
+@section('content')
+
+    <div class="p-3 mcp-theme-1">
+        <div class="card">
+            <div class="card-body p-2">
+
+                @foreach($allPros as $_pro)
+                    <div>
+                        <a href="{{ route('practice-management.hcpBillMatrix', $_pro) }}">
+                            {{$_pro->name_last}}, {{$_pro->name_first}}
+                        </a>
+                    </div>
+                @endforeach
+
+            </div>
+        </div>
+        <div class="card">
+
+            <div class="card-header px-3 py-2 d-flex align-items-center">
+                <strong class="mr-4">
+                    <i class="fas fa-user-injured"></i>
+                    Notes
+                </strong>
+
+            </div>
+            <div class="card-body p-0">
+                <table class="table table-sm table-condensed p-0 m-0">
+                    <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0">Note Eff. Date</th>
+
+
+                        <th class="border-0">HCP</th>
+
+                        <th class="border-0">Note Signed?</th>
+
+                        <th>Service</th>
+                        <th># of units</th>
+                        <th>Bill Signed?</th>
+                        <th>Cancelled?</th>
+                        <th>HCP ex. amount</th>
+
+                        @if($performer->pro->pro_type == 'ADMIN' && false)
+                            <th class="border-0">Assessments</th>
+                        @endif
+
+                        @if($performer->pro->pro_type == 'ADMIN' && false)
+                            <th class="border-0">Claims</th>
+                        @endif
+                        <th class="px-3 border-0">Created</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach ($bills as $bill)
+                        <?php $note = $bill->note; ?>
+                        <?php if(!$note) { continue; } ?>
+                        <tr class="">
+
+                            <td class="">
+                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}">{{ $note->client->displayName() }}</a>
+                            </td>
+                            <td class="">
+                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}"
+                                   class="font-weight-bold">
+                                    {{ friendly_date_time($note->effective_dateest, false) }}
+                                </a>
+                                <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
+                            </td>
+                            <td>{{$note->hcpPro->name_first}} {{$note->hcpPro->name_first}}</td>
+                            <td>{{$note->is_signed_by_hcp?'Yes':'No'}}</td>
+
+
+                            <td>{{$bill->code}}</td>
+                            @if($bill->code == 'Treatment Services')
+                                <td>{{floor($bill->number_of_units*60)}}m</td>
+                            @else
+                                <td>{{$bill->number_of_units}}</td>
+                            @endif
+                            <td>{{$bill->is_signed_by_hcp?'Yes':'No'}}</td>
+                            <td>{{ $bill->is_cancelled ?'Yes':'No'}}</td>
+                            <td>{{ $bill->hcp_expected_payment_amount }}</td>
+
+                            @if($performer->pro->pro_type == 'ADMIN' && false)
+                                <td>
+                                    <table class="table table-sm table-condensed table-stripe">
+                                        <thead>
+                                        <tr>
+                                            <th>Code</th>
+                                            <th>Description</th>
+                                        </tr>
+                                        </thead>
+                                        <tbody>
+                                        @foreach($note->reasons as $reason)
+                                            <tr>
+                                                <td>{{$reason->code}}</td>
+                                                <td>{{$reason->description}}</td>
+                                            </tr>
+                                        @endforeach
+                                        </tbody>
+                                    </table>
+                                </td>
+                            @endif
+                            @if($performer->pro->pro_type == 'ADMIN' && false)
+                                <td>
+                                    <table class="table table-sm table-condensed table-stripe">
+                                        <tbody>
+                                        @foreach($note->claims as $claim)
+                                            <tr>
+                                                <td>{{$claim->iid}}</td>
+                                                <td>{{$claim->was_submitted?'Yes':'No'}}</td>
+                                            </tr>
+                                            <tr>
+                                                <td colspan="2">
+                                                    <strong>Claim Lines</strong>
+                                                    <table class="table table-sm table-condensed table-striped">
+                                                        <tr>
+                                                            <th>CPT</th>
+                                                            <th>ICDs</th>
+                                                            <th>Date of Service</th>
+                                                        </tr>
+                                                        @foreach($claim->lines as $claimLine)
+                                                            <tr>
+                                                                <td>{{$claimLine->cpt}}</td>
+                                                                <td>{{$claimLine->icds()}}</td>
+                                                                <td>{{$claimLine->date_of_service}}</td>
+                                                            </tr>
+                                                        @endforeach
+                                                    </table>
+                                                </td>
+                                            </tr>
+                                        @endforeach
+                                        </tbody>
+                                    </table>
+                                </td>
+                            @endif
+                            <td class="px-3">
+                                {{ friendly_date_time($note->created_at, true) }}
+                            </td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+                <div>
+                    {{$bills->links()}}
+                </div>
+            </div>
+        </div>
+    </div>
+
+@endsection

+ 18 - 12
resources/views/layouts/template.blade.php

@@ -112,9 +112,13 @@
                         <a class="dropdown-item" href="{{ route('practice-management.myFavorites') }}">My Favorites</a>
                         <a class="dropdown-item" href="{{ route('practice-management.proAvailability') }}">Pro Availability</a>
                         <a class="dropdown-item" href="{{ route('practice-management.proCalendar') }}">Pro Calendar</a>
+
+                        <a class="dropdown-item" href="{{ route('practice-management.billingManager') }}">Billing Manager</a>
+
                         @if($pro && $pro->pro_type == 'ADMIN')
-                            <a class="dropdown-item" href="{{ route('practice-management.billingManager') }}">Billing Manager</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.cellularDeviceManager') }}">Cellular Device Manager</a>
                             <a class="dropdown-item" href="{{ route('practice-management.claims') }}">Claims</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.hcpBillMatrix') }}">HCP Bill Matrix</a>
                             <a class="dropdown-item" href="/practice-management/tickets">Tickets</a>
                         @endif
                     </div>
@@ -307,24 +311,26 @@
                 })
             );
 
-            window.socketClient.subscribe("/user/topic/newMcpRequest", function(message) {
-                console.log("Received new mcp request: ", message);
-                //TODO: Update the mcp queue on the DOM
-            }); // once in 15 seconds
-
-            window.socketClient.subscribe("/user/topic/removeMcpRequest", function(message) {
-                console.log("An mcp request has been removed: ", message);
-                //TODO: Update the mcp queue on the DOM
-            });
-
             window.socketClient.subscribe("/user/topic/myCurrentProClientWork", function(message) {
                 console.log("You have a client pro work: ", message);
                 $.get('/current-work', function(_data) {
                     $('.current-work').html(_data);
-                    initFastLoad($('.current-work'));
+                    //initFastLoad($('.current-work'));
+                    fastReload();
                 });
             });
 
+            window.socketClient.subscribe("/user/topic/killMyCurrentProClientWork", function(message) {
+                console.log("You have killed your current pro client work: ", message);
+                $.get('/current-work', function(_data) {
+                    $('.current-work').html(_data);
+                    //initFastLoad($('.current-work'));
+                    fastReload();
+                });
+            });
+
+            
+
         });
     </script>
 </body>

+ 8 - 2
routes/web.php

@@ -15,7 +15,7 @@ use Illuminate\Support\Facades\Route;
 
 
 /*
- * if no pro performer, then redirect to /login
+ * if no pro performer, then redirect to /login2
  * [Cell Number] [Password] field -> proLogInWithPassword -> /pro/dashboard
  * -> they are authenticated in... see the home dashboard... logout button to -> /login
  */
@@ -82,8 +82,14 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('pro-availability/{proUid?}', 'PracticeManagementController@proAvailability')->name('proAvailability');
         Route::get('calendar/{proUid?}', 'PracticeManagementController@calendar')->name('proCalendar');
 
+        Route::get('billing-manager/{proUid?}', 'PracticeManagementController@billingManager')->name('billingManager');
+
+        Route::get('cellular-device-manager/{proUid?}', 'PracticeManagementController@cellularDeviceManager')->name('cellularDeviceManager');
+
         Route::middleware('pro.auth.admin')->group(function(){
-            Route::get('billing-manager/{proUid?}', 'PracticeManagementController@billingManager')->name('billingManager');
+
+            Route::get('hcp-bill-matrix/{proUid?}', 'PracticeManagementController@hcpBillMatrix')->name('hcpBillMatrix');
+
             Route::get('tickets', 'PracticeManagementController@tickets')->name('tickets');
             Route::get('claims', 'PracticeManagementController@claims')->name('claims');
             Route::get('claims-download', 'PracticeManagementController@downloadClaims')->name('download-claims');

+ 52 - 0
spec/measurment-spec-jan-13-2021.txt

@@ -0,0 +1,52 @@
+@Vijay
+----------------------------------------------------
+
+	SELECT * FROM measurement LEFT JOIN client_bdt_measurement LEFT JOIN bdt_measurement
+
+	SELECT * FROM measurement WHERE month = "MONTH_SELECTOR_VALUE":
+
+		Vital Graph
+
+										  Month Selector
+
+		BP Graph: (shows the thresholds min/max and values outside this range will be highlighted)
+
+			<....>
+
+		Weight Graph:
+
+			<....>
+
+----------------------------------------------------
+
+	Allow me to double click any of the numbers and popup modal to UPDATE this measurement entry::
+
+		* Stamp it (STATUS = "ACK") --> [Stamp] JS powered refresh of the data.
+
+		* Declare it to be wrong (STATUS = "INVALID_ACK")
+
+----------------------------------------------------
+
+	Measurements subpage in the client 
+
+----------------------------------------------------
+
+@Josh
+
+	ALTER TABLE measurement ADD COLUMN IF NOT EXISTS effective_time TIMESTAMP WITH TIME ZONE;
+
+	UPDATE measurement SET effective_time = (SELECT ts WHATEVER SINCE 1970)
+
+	BLOOD PRESSURE has this as its alert arch.
+	
+		sbp_value_alert_threshold_max		140
+		sbp_value_alert_threshold_max_memo	
+		dbp_value_alert_threshold_max		110
+		dbp_value_alert_threshold_max_memo	
+		sbp_value_alert_threshold_min		90
+		sbp_value_alert_threshold_min_memo	
+		dbp_value_alert_threshold_min		70
+		dbp_value_alert_threshold_min_memo
+
+----------------------------------------------------
+