Browse Source

Problems report (complete)

Vijayakrishnan 3 years ago
parent
commit
f73c27767a

+ 48 - 7
app/Http/Controllers/PracticeManagementController.php

@@ -2280,14 +2280,55 @@ WHERE
         }
         }
 
 
         // filters from the UI
         // filters from the UI
-        /*if(trim($request->input('f_start'))) {
-            $v = trim($request->input('f_start'));
-            $conditions[] = "(cline.date_of_service >= '{$v}')";
+
+        if(trim($request->input('f_client'))) {
+            $v = trim($request->input('f_client'));
+            $v = Client::where('uid', $v)->first();
+            if($v) {
+                $conditions[] = "(c.id = {$v->id})";
+            }
+        }
+        if(trim($request->input('f_mcp'))) {
+            $v = trim($request->input('f_mcp'));
+            $v = Pro::where('uid', $v)->first();
+            if($v) {
+                $conditions[] = "(c.mcp_pro_id = {$v->id})";
+            }
+        }
+        if(trim($request->input('f_problem'))) {
+            $v = strtolower(trim($request->input('f_problem')));
+            if($v) {
+                $conditions[] = "(((p.data)::json->>'name')::text ILIKE '%{$v}%')";
+            }
+        }
+        if(trim($request->input('f_icd'))) {
+            $v = strtolower(trim($request->input('f_icd')));
+            if($v) {
+                $conditions[] = "(((p.data)::json->>'icd')::text ILIKE '{$v}%')";
+            }
+        }
+        if(trim($request->input('f_lr_date_op')) && trim($request->input('f_lr_date')) !== '') {
+            $o = trim($request->input('f_lr_date_op'));
+            $v = trim($request->input('f_lr_date'));
+            $conditions[] = "(p.last_child_review_effective_date {$o} '{$v}')";
+        }
+        if(trim($request->input('f_lr_by'))) {
+            $v = trim($request->input('f_lr_by'));
+            if($v) {
+                $conditions[] = "(p.last_child_review_creator_pro_uid = '{$v}')";
+            }
+        }
+        if(trim($request->input('f_lp_date_op')) && trim($request->input('f_lp_date')) !== '') {
+            $o = trim($request->input('f_lp_date_op'));
+            $v = trim($request->input('f_lp_date'));
+            $conditions[] = "(p.last_child_plan_effective_date {$o} '{$v}')";
+        }
+        if(trim($request->input('f_lp_by'))) {
+            $v = trim($request->input('f_lp_by'));
+            if($v) {
+                $conditions[] = "(p.last_child_plan_creator_pro_uid = '{$v}')";
+            }
         }
         }
-        if(trim($request->input('f_end'))) {
-            $v = trim($request->input('f_end'));
-            $conditions[] = "(cline.date_of_service <= '{$v}')";
-        }*/
 
 
         $defaultPageSize = 25;
         $defaultPageSize = 25;
 
 

+ 127 - 16
resources/views/app/practice-management/problems-report.blade.php

@@ -27,11 +27,11 @@
         border-bottom: none;
         border-bottom: none;
     }
     }
 </style>
 </style>
-<div id="rm-action-report" class="p-3 mcp-theme-1">
+<div id="problems-report" class="p-3 mcp-theme-1">
     <div class="card">
     <div class="card">
 
 
         <div class="card-header px-2 py-1 d-flex align-items-center">
         <div class="card-header px-2 py-1 d-flex align-items-center">
-            <strong class="mr-4">
+            <strong class="mr-4 py-1">
                 <i class="fas fa-user"></i>
                 <i class="fas fa-user"></i>
                 Problems Report
                 Problems Report
             </strong>
             </strong>
@@ -39,21 +39,101 @@
         <div class="card-body p-0 border-0 table-responsive">
         <div class="card-body p-0 border-0 table-responsive">
             <div class="m-2">
             <div class="m-2">
                 <form method="GET" action="{{ route('practice-management.problems-report') }}">
                 <form method="GET" action="{{ route('practice-management.problems-report') }}">
-                    <div class="d-flex align-items-baseline">
-                        <div class="my-0 mr-2">
-                            <!--<label class="font-weight-normal mb-1">DOS From</label>
-                            <input name="f_start" type="date" class="form-control form-control-sm" value="{{request()->input('f_start')}}">
+
+                    <div class="d-flex align-items-start mt-2">
+
+                        <div class="width-140px mr-2">
+                            <label class="mb-0 text-sm {{request()->input('f_client') ? 'font-weight-bold text-info' : 'text-secondary'}}">Patient</label>
+                            <input type="hidden" name="f_client" value="{{request()->input('f_client')}}">
+                            <input type="text"
+                                   name="f_client_name"
+                                   value="{{request()->input('f_client_name')}}"
+                                   target-key="uid"
+                                   target-field="f_client"
+                                   autocomplete="off"
+                                   class="form-control form-control-sm min-width-unset"
+                                   stag-suggest
+                                   stag-suggest-left
+                                   stag-suggest-ep="/client-suggest"
+                                   placeholder="Patient">
+                        </div>
+
+                        <div class="width-140px mr-2">
+                            <label class="mb-0 text-sm {{request()->input('f_mcp') ? 'font-weight-bold text-info' : 'text-secondary'}}">Pro</label>
+                            <select name="f_mcp"
+                                    class="mr-2 form-control form-control-sm min-width-unset pl-0"
+                                    provider-search
+                                    data-pro-uid="{{request()->input('f_mcp')}}">
+                            </select>
+                        </div>
+
+                        <div class="width-140px mr-2">
+                            <label class="mb-0 text-sm {{request()->input('f_problem') ? 'font-weight-bold text-info' : 'text-secondary'}}">Problem</label>
+                            <input type="text" name="f_problem" value="{{request()->input('f_problem')}}" class="form-control form-control-sm min-width-unset">
                         </div>
                         </div>
-                        <div class="form-group my-0 mr-2">
-                            <label class="font-weight-normal mb-1">DOS To</label>
-                            <input name="f_end" type="date" class="form-control form-control-sm" value="{{request()->input('f_end')}}">-->
-                            TODO
+
+                        <div class="width-100px mr-2">
+                            <label class="mb-0 text-sm {{request()->input('f_icd') ? 'font-weight-bold text-info' : 'text-secondary'}}">ICD</label>
+                            <input type="text" name="f_icd" value="{{request()->input('f_icd')}}" class="form-control form-control-sm min-width-unset">
                         </div>
                         </div>
-                        <div class="form-group m-0">
-                            <label class="font-weight-normal mb-1">&nbsp;</label>
-                            <div class=" d-flex">
-                                <button type="button" onclick="return fastLoad('{{  route('practice-management.problems-report') }}?' + $(this).closest('form').serialize())" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
-                                <a href="#" onclick="return fastLoad('{{  route('practice-management.problems-report') }}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+
+                        <div class="mr-2">
+                            <label class="mb-0 text-sm {{request()->input('f_lr_date') ? 'font-weight-bold text-info' : 'text-secondary'}}">Last Review Date</label>
+                            <div class="d-flex align-items-start">
+                                <select name="f_lr_date_op"
+                                        class="mr-1 form-control form-control-sm min-width-unset width-40px pl-0">
+                                    <option {{request()->input('f_lr_date_op') === '=' ? 'selected' : ''}} value="=">&equals;</option>
+                                    <option {{request()->input('f_lr_date_op') === '>' ? 'selected' : ''}} value=">">&gt;</option>
+                                    <option {{request()->input('f_lr_date_op') === '<' ? 'selected' : ''}} value="<">&lt;</option>
+                                    <option {{request()->input('f_lr_date_op') === '>=' ? 'selected' : ''}} value=">=">&ge;</option>
+                                    <option {{request()->input('f_lr_date_op') === '<=' ? 'selected' : ''}} value="<=">&le;</option>
+                                </select>
+                                <input type="date" name="f_lr_date"
+                                       value="{{request()->input('f_lr_date')}}"
+                                       class="form-control form-control-sm min-width-unset">
+                            </div>
+                        </div>
+
+                        <div class="width-140px mr-2">
+                            <label class="mb-0 text-sm {{request()->input('f_lr_by') ? 'font-weight-bold text-info' : 'text-secondary'}}">Last Review By</label>
+                            <select name="f_lr_by"
+                                    class="mr-2 form-control form-control-sm min-width-unset pl-0"
+                                    provider-search
+                                    data-pro-uid="{{request()->input('f_lr_by')}}">
+                            </select>
+                        </div>
+
+                        <div class="mr-2">
+                            <label class="mb-0 text-sm {{request()->input('f_lp_date') ? 'font-weight-bold text-info' : 'text-secondary'}}">Last Plan Date</label>
+                            <div class="d-flex align-items-start">
+                                <select name="f_lp_date_op"
+                                        class="mr-1 form-control form-control-sm min-width-unset width-40px pl-0">
+                                    <option {{request()->input('f_lp_date_op') === '=' ? 'selected' : ''}} value="=">&equals;</option>
+                                    <option {{request()->input('f_lp_date_op') === '>' ? 'selected' : ''}} value=">">&gt;</option>
+                                    <option {{request()->input('f_lp_date_op') === '<' ? 'selected' : ''}} value="<">&lt;</option>
+                                    <option {{request()->input('f_lp_date_op') === '>=' ? 'selected' : ''}} value=">=">&ge;</option>
+                                    <option {{request()->input('f_lp_date_op') === '<=' ? 'selected' : ''}} value="<=">&le;</option>
+                                </select>
+                                <input type="date" name="f_lp_date"
+                                       value="{{request()->input('f_lp_date')}}"
+                                       class="form-control form-control-sm min-width-unset">
+                            </div>
+                        </div>
+
+                        <div class="width-140px mr-2">
+                            <label class="mb-0 text-sm {{request()->input('f_lp_by') ? 'font-weight-bold text-info' : 'text-secondary'}}">Last Plan By</label>
+                            <select name="f_lp_by"
+                                    class="mr-2 form-control form-control-sm min-width-unset pl-0"
+                                    provider-search
+                                    data-pro-uid="{{request()->input('f_lp_by')}}">
+                            </select>
+                        </div>
+
+                        <div>
+                            <label class="mb-0 text-sm text-secondary">&nbsp;</label>
+                            <div class="d-flex align-items-start">
+                                <button class="btn-apply btn btn-sm btn-primary mr-2"><i class="fa fa-check"></i></button>
+                                <button class="btn-reset btn btn-sm btn-default bg-white text-secondary border"><i class="fa fa-times"></i></button>
                             </div>
                             </div>
                         </div>
                         </div>
                     </div>
                     </div>
@@ -74,7 +154,7 @@
                     <tr>
                     <tr>
                         <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.problems-report"), 'label' => 'Patient', 'key' => 'client_name'])</th>
                         <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.problems-report"), 'label' => 'Patient', 'key' => 'client_name'])</th>
                         <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.problems-report"), 'label' => 'DOB', 'key' => 'dob'])</th>
                         <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.problems-report"), 'label' => 'DOB', 'key' => 'dob'])</th>
-                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.problems-report"), 'label' => 'Provider', 'key' => 'mcp_name'])</th>
+                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.problems-report"), 'label' => 'MCP', 'key' => 'mcp_name'])</th>
                         <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.problems-report"), 'label' => 'Problem', 'key' => 'problem'])</th>
                         <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.problems-report"), 'label' => 'Problem', 'key' => 'problem'])</th>
                         <th class="text-nowrap">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.problems-report"), 'label' => 'ICD', 'key' => 'icd'])</th>
                         <th class="text-nowrap">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.problems-report"), 'label' => 'ICD', 'key' => 'icd'])</th>
                         <th class="col-divider"></th>
                         <th class="col-divider"></th>
@@ -166,4 +246,35 @@
 
 
 </div>
 </div>
 
 
+<script>
+    (function() {
+        function init() {
+
+            let parent = $('#problems-report');
+
+            parent.find('input[stag-suggest][target-key][target-field]')
+                .off('stag-suggest-selected')
+                .on('stag-suggest-selected', (_e, _input, _data) => {
+                    _input = $(_input);
+                    _input.closest('form').find('input[name="' + _input.attr('target-field') + '"]').val(_data[_input.attr('target-key')]);
+                });
+
+            parent.find('.btn-apply')
+                .off('click.filter')
+                .on('click.filter', function() {
+                    fastLoad('{{route('practice-management.problems-report')}}?sort_by={{urlencode(request()->input('sort_by'))}}&' + $(this).closest('form').serialize());
+                    return false;
+                });
+
+            parent.find('.btn-reset')
+                .off('click.reset')
+                .on('click.reset', function() {
+                    fastLoad('{{route("practice-management.problems-report")}}?sort_by={{urlencode(request()->input('sort_by'))}}');
+                    return false;
+                });
+        }
+        addMCInitializer('problems-report', init, '#problems-report');
+    }).call(window);
+</script>
+
 @endsection
 @endsection