Peter Muturi 2 年之前
父节点
当前提交
e6f2ed3fc6
共有 2 个文件被更改,包括 64 次插入32 次删除
  1. 24 24
      app/Http/Controllers/AdminController.php
  2. 40 8
      resources/views/app/admin/patients-maps.blade.php

+ 24 - 24
app/Http/Controllers/AdminController.php

@@ -40,7 +40,7 @@ class AdminController extends Controller
         $filters = $request->all();
         $patients = Client::whereNull('shadow_pro_id');
 
-       
+
         if ($request->input('name')) {
             $name = trim($request->input('name'));
             if ($name) {
@@ -71,7 +71,7 @@ class AdminController extends Controller
                     $patients = $patients->where('default_na_pro_id', $na->id);
                 }
             }
-           
+
         }
 
         if ($request->input('ob')) {
@@ -224,7 +224,7 @@ class AdminController extends Controller
 
         $fVal = $request->input('imei');
         if($fVal) {
-            $patients = $patients->whereRaw("((SELECT count(cbd.id) FROM client_bdt_device cbd 
+            $patients = $patients->whereRaw("((SELECT count(cbd.id) FROM client_bdt_device cbd
             WHERE cbd.client_id = client.id AND cbd.device_id IN (SELECT bd.id FROM bdt_device bd WHERE bd.imei LIKE '%$fVal%' AND bd.is_active IS TRUE)) > 0)");
         }
 
@@ -248,14 +248,14 @@ class AdminController extends Controller
                     }
                     break;
                 case 'BETWEEN':
-                    if($request->input('number_of_measurements_value_1') && $request->input('number_of_measurements_value_2')) { 
+                    if($request->input('number_of_measurements_value_1') && $request->input('number_of_measurements_value_2')) {
                         $patients->whereRaw($measurementCountQuery.'>='.$request->input('number_of_measurements_value_1') .' AND '. $measurementCountQuery . '<='.$request->input('number_of_measurements_value_2'));
                     }
                     break;
                 case 'NOT_BETWEEN':
                     if($request->input('number_of_measurements_value_1') && $request->input('number_of_measurements_value_2')) {
                         $patients->where(function ($q) use ($request, $measurementCountQuery) {
-                                $q->whereRaw($measurementCountQuery . '<'.$request->input('number_of_measurements_value_1') .' OR '. $measurementCountQuery . '>'.$request->input('number_of_measurements_value_2'));                               
+                                $q->whereRaw($measurementCountQuery . '<'.$request->input('number_of_measurements_value_1') .' OR '. $measurementCountQuery . '>'.$request->input('number_of_measurements_value_2'));
                         });
                     }
                     break;
@@ -268,7 +268,7 @@ class AdminController extends Controller
                 $patients->where('is_active', true)->where(function($q) use ($status){
                     return $q->where('client_engagement_status_category', $status)
                     ->orWhereNull('client_engagement_status_category');
-                });    
+                });
             }elseif($status === 'NONE'){
                 $patients->whereNull('client_engagement_status_category');
             }else {
@@ -321,9 +321,9 @@ class AdminController extends Controller
         }
 
         if(@$filters['mapView'] == 1){
-            $patients = $patients->orderByRaw($sortBySQL)->get(['uid', 'name_first', 'name_last']);
+            $patients = $patients->orderByRaw($sortBySQL)->paginate(25);
         }else{
-          $patients = $patients->orderByRaw($sortBySQL)->paginate(25);  
+          $patients = $patients->orderByRaw($sortBySQL)->paginate(25);
         }
 
         $insurances = DB::select('SELECT DISTINCT commercial_payer_name, commercial_payer_id FROM client_primary_coverage WHERE commercial_payer_name IS NOT NULL ORDER BY commercial_payer_name ASC');
@@ -332,11 +332,11 @@ class AdminController extends Controller
     }
 
     public function partBPatients(Request $request){
-        
+
         $filters = $request->all();
         $patients = Client::whereNull('shadow_pro_id');
 
-      
+
         if ($request->input('name')) {
             $name = trim($request->input('name'));
             if ($name) {
@@ -367,7 +367,7 @@ class AdminController extends Controller
                     $patients = $patients->where('default_na_pro_id', $na->id);
                 }
             }
-           
+
         }
 
         if ($request->input('next_appointment_category')) {
@@ -466,7 +466,7 @@ class AdminController extends Controller
             });
         }
 
-        
+
         $with_claim_not_closed = $request->input('with_claim_not_closed');
         if($with_claim_not_closed){
             $patients = $patients->whereHas('notes', function ($q) {
@@ -545,13 +545,13 @@ class AdminController extends Controller
         if(!$template) return $this->fail('No script template');
 
         $path = resource_path() . '/views/app/patient/create-patient/scripts/' . $template . '.blade.php';
-        
+
         if(!File::exists($path)) return $this->fail('Invalid script template');
 
         $templateContent = file_get_contents($path);
         return $this->pass($templateContent);
     }
-    
+
     public function bdtDevices(Request $request)
     {
         $filters = $request->all();
@@ -571,7 +571,7 @@ class AdminController extends Controller
                         return $q->where('name_first', 'ilike', $client)
                         ->orWhere('name_last', 'ilike', $client)
                         ->orWhere('cell_number', 'ilike', $client)
-                        ->orWhereRaw("name_first||' '||name_last ILIKE "."'".$client."'"); 
+                        ->orWhereRaw("name_first||' '||name_last ILIKE "."'".$client."'");
                     });
                 });
             });
@@ -610,8 +610,8 @@ class AdminController extends Controller
         }
 
         $bdtDevices = $bdtDevices->paginate(20);
-        
-       
+
+
         return view('app.admin.bdt_devices', compact('bdtDevices', 'filters'));
     }
 
@@ -654,13 +654,13 @@ class AdminController extends Controller
                 $patients->where('is_active', true)->where(function($q) use ($status){
                     return $q->where('client_engagement_status_category', $status)
                     ->orWhereNull('client_engagement_status_category');
-                });    
+                });
             }else {
                 $patients->where('client_engagement_status_category', $status);
             }
 
         }
-        
+
         $insurance = $request->get('insurance');
         if($insurance){
             if($insurance === 'MEDICARE'){
@@ -686,7 +686,7 @@ class AdminController extends Controller
                 });
             }
         }
-        
+
         $missing_default_settings = $request->get('missing_default_settings');
         if($missing_default_settings){
             if($missing_default_settings === 'NO_MCP') $patients = $patients->whereNull('mcp_pro_id');
@@ -698,18 +698,18 @@ class AdminController extends Controller
         $care_plan = $request->get('care_plan');
         if($care_plan){
             if($care_plan === 'UNSIGNED_CARE_PLANS'){
-              $patients = $patients->whereHas('notes', function($noteQuery){ 
+              $patients = $patients->whereHas('notes', function($noteQuery){
                 return $noteQuery->where('cm_setup_manager_signature_status', '!=', 'SIGNED');
-                });  
+                });
             }
             if($care_plan === 'UNCLEARED_CARE_PLANS'){
                 $patients = $patients->where('has_care_plan_flag', true)->where('is_flag_cleared', false);
             }
-            
+
         }
 
         $patients = $patients->orderBy('created_at', 'DESC')->paginate(50);
         return view('app.admin.patients_missing_default_settings', compact('patients', 'filters'));
     }
 
-} 
+}

+ 40 - 8
resources/views/app/admin/patients-maps.blade.php

@@ -4,15 +4,43 @@
 <div>
   @include('app.admin.patients-results-view-options')
 </div>
-<div id="map-canvas" style="height:700px;width:100%;"></div>
-<div class="px-3 pt-3 d-flex align-items-center">
-    <div class="ml-4 mb-3">Showing <b>{{ count($patients) }}</b></div>
+<style media="screen">
+  .pt-content {
+    background-color: #ffffff;
+    position: absolute;
+    top:60px;
+    left: 10px;
+    width: 300px;
+    height:80%;
+    overflow-y: scroll;
+  }
+</style>
+<div class="bg-white position-relative w-100">
+  <div id="map-canvas" style="height:700px;width:100%;"></div>
+  <div class="pt-content shadow">
+    <div class="p-3">
+      <input type="text" class="form-control" name="search" value="">
+    </div>
+    @foreach($patients as $patient)
+      @if($patient->home_address_geo_lat && $patient->home_address_geo_long)
+        <div class="p-3 border-bottom">
+          <div class="d-flex justify-content-between align-items-center">
+            <p class="m-0">{{$patient->displayName()}}</p>
+            <p class="m-0"># <a native target="_blank" href="{{route('patients.view.dashboard', $patient)}}">{{$patient->chart_number}}</a></p>
+          </div>
+          @include('app.patient.coverage_column_renderer', ['patient'=>$patient])
+        </div>
+      @endif
+    @endforeach
+    <div class="p-3 shadow">
+      Showing <b>{{ count($patients) }}</b> patients
+    </div>
+  </div>
 </div>
 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/markerclustererplus/2.1.4/markerclusterer.min.js"></script>
 <script>
-  var patients = <?= json_encode($patients) ?>;
-  console.log({patients});
+    var patients = <?= json_encode($patients) ?>;
     (function () {
 
       function init() {
@@ -28,11 +56,15 @@
 
         var markers = [];
         var locations = [];
+          patients = patients.data;
         for (var x = 0; x < patients.length; x++) {
           var patient = patients[x];
-          var location = ['<center><a href="patients/view/'+ patient.uid +'"><strong>'+ patient.name_first + ' ' + patient.name_last +'</strong></a><br />', patient.lat, patient.long, 0]
-          locations.push(location);
-          addMarkers(locations);
+          if (patient.home_address_geo_lat && patient.home_address_geo_long) {
+            var location = ['<center><a href="patients/view/'+ patient.uid +'"><strong>'+ patient.name_first + ' ' + patient.name_last +'</strong></a><br />', patient.home_address_geo_lat, patient.home_address_geo_long, 0]
+            locations.push(location);
+            addMarkers(locations);
+
+          }
         };
 
         function addMarkers(_locations) {