Przeglądaj źródła

Merge branch 'dev' into dev-vj

Vijayakrishnan 3 lat temu
rodzic
commit
fb5bd84c6c

+ 11 - 0
app/Http/Controllers/AdminController.php

@@ -82,6 +82,17 @@ class AdminController extends Controller
                 break;
         }
 
+        $initiative = $request->input('initiative');
+        if($initiative){
+            $wildCardedInitiative = '%'.$initiative.'%';
+            $patients->where('initiative', 'ilike', $wildCardedInitiative);
+        }
+
+        $include_test_records = $request->input('include_test_records');
+        if(!$include_test_records){
+            $patients->where('client_engagement_status_category', '<>', 'DUMMY');
+        }
+
         $patients = $patients->orderBy('created_at', 'DESC')->paginate(20);
         return view('app.mcp.patients', compact('patients', 'filters'));
     }

+ 18 - 1
app/Http/Controllers/McpController.php

@@ -39,7 +39,13 @@ class McpController extends Controller
     public function patients(Request $request)
     {
         $filters = $request->all();
-        $patients = Client::whereNull('shadow_pro_id')->where('mcp_pro_id', $this->performer->pro->id);
+        $patients = Client::whereNull('shadow_pro_id');
+        
+        //TODO: implement in admin controller 
+        if($this->performer->pro->pro_type != 'ADMIN'){
+            $patients->where('mcp_pro_id', $this->performer->pro->id);
+        }
+        
 
         // filters
         /*
@@ -93,6 +99,17 @@ class McpController extends Controller
                 break;
         }
 
+        $initiative = $request->input('initiative');
+        if($initiative){
+            $wildCardedInitiative = '%'.$initiative.'%';
+            $patients->where('initiative', 'ilike', $wildCardedInitiative);
+        }
+
+        $include_test_records = $request->input('include_test_records');
+        if(!$include_test_records){
+            $patients->where('client_engagement_status_category', '<>', 'DUMMY');
+        }
+
         $patients = $patients->orderBy('created_at', 'DESC')->paginate(50);
         return view('app.mcp.patients', compact('patients', 'filters'));
     }

+ 50 - 5
app/Http/Controllers/PracticeManagementController.php

@@ -36,6 +36,7 @@ use App\Models\AccountInvite;
 use App\Models\ClientMeasurementDaysPerMonth;
 use App\Models\ClientBDTDevice;
 use App\Models\ClientMemo;
+use Carbon\Carbon;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Http;
 use PDF;
@@ -100,7 +101,7 @@ class PracticeManagementController extends Controller
                     return $clientQuery->where('client_engagement_status_category','<>' ,'DUMMY');
                 })->paginate(50);
             }else{
-                $rows = BillingReport::whereHas('note', function($noteQuery) use ($claimStatus){
+                $rows =  BillingReport::whereHas('note', function($noteQuery) use ($claimStatus){
                     return $noteQuery->whereHas('claims', function($claimQuery) use ($claimStatus) {
                         return $claimQuery->where('status', $claimStatus);
                     });
@@ -108,12 +109,12 @@ class PracticeManagementController extends Controller
                     return $clientQuery->where('client_engagement_status_category','<>' ,'DUMMY');
                 })->paginate(50);
             }
-            
+        }else {
+            $rows =  BillingReport::whereHas('client', function($clientQuery){
+                return $clientQuery->where('client_engagement_status_category','<>' ,'DUMMY');
+            })->paginate(50);    
         }
 
-       
-        
-
         $claimStatuses = DB::select('SELECT distinct status FROM claim ORDER BY status DESC');
 
         return view('app.practice-management.billing-report', compact('rows', 'claimStatuses'));
@@ -799,6 +800,50 @@ class PracticeManagementController extends Controller
         return view('app.practice-management.processing-bill-matrix', $viewData);
     }
 
+    public function hcpNoteActivity(Request $request)
+    {
+
+        $filters = $request->all();
+
+        $from_date = $request->get('from_date');
+        if(!$from_date) {
+            $from_date = '2010-01-01';
+        }
+        $to_date = $request->get('to_date');
+        if(!$to_date){
+            $to_date = '2900-12-31';
+        }
+        
+
+        //TODO sanitize inputs
+
+        $proUid =  $request->get('pro-uid');
+
+        $now = Carbon::now();
+        $startOfCurrentMonth = $now->startOfMonth('Y-m-d');
+        $endOfCurrentMonth = $now->endOfMonth()->format('Y-m-d');
+
+        $rows = DB::table('pro')
+        ->selectRaw(" *,
+            (SELECT id FROM note WHERE note.hcp_pro_id = pro.id AND is_cancelled = false ORDER BY created_at DESC LIMIT 1) as last_note_id, 
+            (SELECT note.created_at FROM note WHERE note.hcp_pro_id = pro.id AND note.is_cancelled = false ORDER BY note.created_at DESC LIMIT 1) as last_note_created_at,
+            (SELECT COUNT(*) FROM note WHERE note.hcp_pro_id = pro.id AND note.is_cancelled = false AND created_at >= '${startOfCurrentMonth}'::DATE AND created_at <= '${endOfCurrentMonth}'::DATE ) AS notes_this_month,
+            (SELECT COUNT(*) FROM note WHERE note.hcp_pro_id = pro.id AND note.is_cancelled = false AND created_at >= '${from_date}'::DATE AND created_at <= '${to_date}'::DATE  ) AS notes_this_period");
+
+        $prosIDs = $request->get('pros_ids');
+        if($prosIDs){
+            $pros = 
+            $rows = $rows->whereIn('pro.id', $prosIDs);
+        }
+
+        $rows = $rows->orderBy('name_first');
+        $rows = $rows->paginate(50);
+
+
+        return view('app.practice-management.hcp-note-activity', compact('rows', 'filters'));
+    }
+
+
     public function proFinancials(Request $request, $proUid = null)
     {
         $proUid = $proUid ? $proUid : $request->get('pro-uid');

+ 1 - 1
resources/views/app/dna/dashboard/supply_orders_pending_my_ack.blade.php

@@ -55,7 +55,7 @@ $supplyOrdersPendingMyAck = $performer->pro->supplyOrdersPendingMyAckRecordsAsDn
 
                     @if(count($supplyOrdersPendingMyAck) === 0)
                     <tr>
-                        <td colspan="6">No records found!</td>
+                        <td colspan="7">No records found!</td>
                     </tr>
                     @endif
                 </tbody>

+ 2 - 0
resources/views/app/mcp/patients-table.blade.php

@@ -29,6 +29,7 @@
 
 				@if($pro->pro_type == 'ADMIN')
 				<th class="border-0">MCP</th>
+				<th class="border-0">Initiative</th>
 				@endif
 			</tr>
 		</thead>
@@ -93,6 +94,7 @@
 				<td>{{$patient->getMcpAssignedOn()}}</td>
 				@if($pro->pro_type == 'ADMIN')
 				<td>{{$patient->mcp->display_name ?? '--'}}</td>
+				<td>{{$patient->initiative}}</td>
 				@endif
 			</tr>
 			@endforeach

+ 24 - 0
resources/views/app/mcp/patients_filters.blade.php

@@ -143,6 +143,28 @@
 		</div>
 	</div>
 
+	@if($performer->pro->pro_type == 'ADMIN')
+	<div class="sm-section">
+		<div class="form-group">
+			<label>Initiative:</label>
+			<input type="text" name="initiative" class="form-control input-sm" v-model="filters.initiative">
+		</div>
+	</div>
+	@endif
+
+	@if($performer->pro->pro_type == 'ADMIN')
+	<div class="sm-section">
+		<div class="form-group">
+			<div class="checkbox mt-4 pt-2">
+				<label>
+					<input type="checkbox" name="include_test_records"  v-model="filters.include_test_records">
+					Include Test Records
+				</label>
+			</div>
+		</div>
+	</div>
+	@endif
+
 	<!-- LAST WEIGHED-IN -->
 	<!-- <div class="col-md-2 d-none">
 		<div class="form-group">
@@ -222,6 +244,8 @@ $allFilterKeys = [
 	'next_appointment_value_1',
 	'sex',
 	'status',
+	'initiative',
+	'include_test_records',
 ];
 for ($i=0; $i < count($allFilterKeys); $i++) {
 	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {

+ 189 - 0
resources/views/app/practice-management/hcp-note-activity.blade.php

@@ -0,0 +1,189 @@
+@extends ('layouts/template')
+
+@section('content')
+<link href="/select2/select2.min.css" rel="stylesheet" />
+<script src="/select2/select2.min.js"></script>
+<style>
+    #hcp-note-activity-filters label {
+        font-weight: bold;
+    }
+
+    #hcp-note-activity-filters .mw-100px {
+        min-width: 100px;
+    }
+
+    .filter-container {
+        display: flex;
+        align-items: flex-start;
+        flex-wrap: wrap;
+    }
+
+    .filter-container>div {
+        width: 165px;
+    }
+
+    .filter-container>div:not(:last-child) {
+        margin-right: 15px;
+    }
+
+    .sm-section {
+        width: 125px !important;
+    }
+</style>
+
+<div id="hcp-note-activity" class="p-3 mcp-theme-1">
+    <div class="card">
+
+        <div class="card-header px-2 py-1 d-flex align-items-center">
+            <strong class="mr-4">
+                <i class="fas fa-user"></i>
+                HCP Note Activity
+            </strong>
+        </div>
+        <div class="card-body p-0 border-0 table-responsive">
+            <div class="m-2">
+            
+            <form id="hcp-note-activity-filters" method="GET" action="{{ route('practice-management.hcp-note-activity') }}" class="filter-container" v-cloak>                
+                <div class="sm-section" style="width: 250px !important;">
+                    <div class="form-group">
+                        <label>Pros:</label>
+                        <select id="searchForProInput" multiple name="pros_ids[]" class="form-control input-sm" v-model="filters.pros_ids">
+                            @if(@$filters['pros_ids'])
+                                @foreach($rows as $p)
+                                    <option value="{{ $p->id }}" selected>{{$p->name_first}} {{$p->name_last}}</option>
+                                @endforeach
+                            @endif
+                        </select>
+                    </div>
+                </div>
+               
+                <div class="sm-section">
+                    <div class="form-group">
+                        <label>From Date:</label>
+                        <input type="date" name="from_date" class="form-control input-sm" v-model="filters.from_date">
+                    </div>
+                </div>
+
+                <div class="sm-section">
+                    <div class="form-group">
+                        <label>To Date:</label>
+                        <input type="date" name="to_date" class="form-control input-sm" v-model="filters.to_date">
+                    </div>
+                </div>
+
+                <div>
+                    <div class="form-group">
+                        <label>&nbsp;</label>
+                        <div class=" d-flex">
+                            <button type="button" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+                            <a href="#" v-on:click.prevent="fastLoad('{{route('practice-management.hcp-note-activity')}}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+                        </div>
+                    </div>
+                </div>
+            </form>
+            </div>
+            <table class="table table-sm table-striped border-0 p-0 m-0 text-nowrap">
+                <thead class="bg-light">
+                    <tr>
+                        <th>First Name</th>
+                        <th>Last Name</th>
+                        <th>Last Note Created At</th>
+                        <th># Notes This Month</th>
+                        <th># Notes In the Period</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach ($rows as $row)
+                    <tr class="{{false ? 'bg-light' : ''}}">
+                        <td class="text-nowrap border-left-0">
+                           {{$row->name_first}}
+                        </td>
+                        <td>{{$row->name_last}}</td>
+                        <td>{{friendly_date_time($row->last_note_created_at)}}</td>
+                        <td>{{$row->notes_this_month}}</td>
+                        <td>{{$row->notes_this_period}}</td>
+                    </tr>
+                    @endforeach
+                </tbody>
+            </table>
+
+        </div>
+    </div>
+    <div class="mt-3">
+        {{$rows->appends(request()->input())->links()}}
+    </div>
+
+</div>
+
+<?php
+$loadedFilters = $filters;
+$allFilterKeys = [
+	'pros_ids',
+	'from_date',
+	'to_date'
+];
+for ($i = 0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+<script>
+	(function() {
+		function init() {
+			new Vue({
+				el: '#hcp-note-activity',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+                    initSelect2: function(){
+                        var select2 = $("#searchForProInput").select2({
+                            placeholder: "Search Pro(s) by Name",
+                            minimumInputLength: 2,
+                            ajax: {
+                                url: '/pro-suggest',
+                                dataType: 'json',
+                                type: "GET",
+                                quietMillis: 50,
+                                data: function (params) {
+                                    return {
+                                        term: params.term,
+                                        json: true
+                                    };
+                                },
+                                results: function (data) {
+                                    return {
+                                        results: $.map(data, function (item) {
+                                            return {
+                                                text: item.completeName,
+                                                slug: item.slug,
+                                                id: item.id
+                                            }
+                                        })
+                                    };
+                                }
+                            }
+                        });
+                    },
+					init: function() {
+                        this.initSelect2();
+					},
+					doSubmit: function() {
+						fastLoad('{{ route("practice-management.hcp-note-activity") }}?' + $('#hcp-note-activity-filters').serialize());
+						return false;
+					}
+				},
+				mounted: function() {
+					console.log(this.filters);
+					this.init();
+				},
+			});
+
+
+		}
+		addMCInitializer('hcp-note-activity', init, '#hcp-note-activity');
+	})();
+</script>
+@endsection

+ 2 - 0
resources/views/layouts/template.blade.php

@@ -164,6 +164,8 @@
                             <a class="dropdown-item" href="{{ route('practice-management.process-notes') }}">Process Notes</a>
                             <a class="dropdown-item" href="{{ route('practice-management.notes-processing-center') }}">Notes Processing Center</a>
                             <a class="dropdown-item" href="{{ route('practice-management.client-ccm-rm-status') }}">Client CCM/RM Status</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.hcp-note-activity') }}">HCP Note Activity</a>
+                            
                             @if($pro->id == '1' || $pro->id == '16')
                                 <a class="dropdown-item" href="{{ route('practice-management.treatmentServiceUtil') }}">Treatment Service Util.</a>
                             @endif

+ 2 - 0
routes/web.php

@@ -248,6 +248,8 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('memos', 'PracticeManagementController@memos')->name('memos');
         Route::get('client-ccm-rm-status', 'PracticeManagementController@clientCcmRmStatus')->name('client-ccm-rm-status');
 
+        Route::get('hcp-note-activity', 'PracticeManagementController@hcpNoteActivity')->name('hcp-note-activity');
+
         Route::middleware('pro.auth.admin')->group(function () {
 
             // BILLING REPORT