Sfoglia il codice sorgente

added remote monitoring table

Josh 3 anni fa
parent
commit
41aeb85990

+ 12 - 10
app/Http/Controllers/PracticeManagementController.php

@@ -54,8 +54,10 @@ class PracticeManagementController extends Controller
 		$rows = null;
 		$proID = $this->performer()->pro->id;
 		$isAdmin = $this->performer()->pro->pro_type == 'ADMIN';
-		$rows = $isAdmin ? ClientMeasurementDaysPerMonth::all() : ClientMeasurementDaysPerMonth::where('mcp_pro_id', $proID)->orderBy('year_month', 'asc')->orderBy('num_of_days_with_measurement', 'asc')->get();
-		return view ('app.practice-management.remote-monitoring-report', compact('rows'));
+		//$rows = $isAdmin ? ClientMeasurementDaysPerMonth::all() : ClientMeasurementDaysPerMonth::where('mcp_pro_id', $proID)->orderBy('year_month', 'asc')->orderBy('num_of_days_with_measurement', 'asc')->get();
+        $rows = $isAdmin ? CareMonth::orderByRaw(DB::raw('number_of_days_with_remote_measurements DESC NULLS LAST'))->paginate(50) : CareMonth::where('mcp_pro_id', $proID)->orderBy(DB::raw('number_of_days_with_remote_measurements DESC NULLS LAST'))->paginate(50);
+
+        return view ('app.practice-management.remote-monitoring-report', compact('rows'));
 	}
 
     public function billingReport(Request $request)
@@ -202,10 +204,10 @@ class PracticeManagementController extends Controller
             ->where('is_cancelled', FALSE)
             ->whereRaw("
             (
-                SELECT count(bill.id) 
-                FROM bill WHERE 
-                      bill.is_cancelled = FALSE AND 
-                      bill.generic_pro_id = {$this->performer()->pro->id} AND 
+                SELECT count(bill.id)
+                FROM bill WHERE
+                      bill.is_cancelled = FALSE AND
+                      bill.generic_pro_id = {$this->performer()->pro->id} AND
                       bill.note_id = note.id
             ) = 0
             ");
@@ -955,7 +957,7 @@ SELECT measurement.label,
 FROM measurement RIGHT JOIN client on measurement.client_id = client.id
 WHERE
     client.id = {$careMonth->client_id}
-    AND measurement.label IS NOT NULL  
+    AND measurement.label IS NOT NULL
     AND measurement.label NOT IN ('SBP', 'DBP')
     AND (measurement.is_cellular_zero = FALSE or measurement.is_cellular_zero IS NULL)
     AND measurement.is_removed IS FALSE
@@ -1537,7 +1539,7 @@ ORDER BY claim.created_at DESC
 
         $mode = $request->input('mode') ? $request->input('mode') : '1';
         if(($mode < 1 || $mode > 5) && $mode != 8) $mode = 1;
-	
+
 	DB::enableQueryLog(); // Enable query log
 
 	$test = Note::where('is_cancelled', false)
@@ -1614,7 +1616,7 @@ ORDER BY claim.created_at DESC
                 // ->whereRaw("(((detail_json)::json->>'isGood')::text <> 'true')")
                 ->where('is_claim_closed', true)
                 ->whereRaw("((SELECT count(id) FROM claim WHERE note_id = note.id AND is_cancelled IS FALSE AND status != 'CANCELLED' AND status != 'SUBMITTED') > 0)")
-                
+
 		->count(),
  // has unsubmitted claims MARKED GOOD!
             "mode-8" => Note::where('is_cancelled', false)
@@ -1738,7 +1740,7 @@ ORDER BY claim.created_at DESC
                 break;
             case 4: // claiming not closed
 		DB::enableQueryLog(); // Enable query log
-                
+
 		$note = Note::where('is_cancelled', false)
                     ->where('is_signed_by_hcp', true)
                     ->whereRaw("((detail_json)::json->>'isBad' is null OR ((detail_json)::json->>'isBad')::text != 'true')")

+ 6 - 0
app/Models/CareMonth.php

@@ -103,4 +103,10 @@ class CareMonth extends Model
         return $this->hasOne(Claim::class, 'id', 'rm_setup_claim_id')
             ->where('status', '<>', 'CANCELLED');
     }
+
+    public function mostRecentMcpNote()
+    {
+        return $this->hasOne(Note::class, 'id', 'most_recent_mcp_note_id');
+    }
+
 }

+ 1 - 1
resources/views/app/patient/note/dashboard.blade.php

@@ -26,7 +26,7 @@
     $doesVisitTemplateUiConfigExist = $uiConfigsPath && file_exists($uiConfigsPath);
     $visitTemplateUiConfig = $doesVisitTemplateUiConfigExist ? json_decode(file_get_contents($uiConfigsPath), true) : null;
 
-    $visitLayoutPath = "app.patient.note.visit-template-ui-layouts.{$note->visitTemplate->internal_name}";
+    $visitLayoutPath = $note->visitTemplate ? "app.patient.note.visit-template-ui-layouts.{$note->visitTemplate->internal_name}" : null;
     $doesVisitTemplateLayoutExist = $isVisitTemplateBased && \Illuminate\Support\Facades\View::exists($visitLayoutPath);
 
     $segmentMap = [];

+ 90 - 9
resources/views/app/practice-management/remote-monitoring-report.blade.php

@@ -5,41 +5,122 @@
         <div class="card">
             <div class="card-header p-3 d-flex align-items-center">
                 <strong class="mr-4">
-                    <i class="fas fa-user"></i>
+                    <i class="fas fa-chart-bar"></i>
                     Remote Monitoring Report
                 </strong>
             </div>
+
             <div class="card-body p-0">
+                <div class="d-flex flex-row">
+                    <div class="ml-2 mt-2">
+                        <div>Patient</div>
+                        <input type="text"  class="form-control input-sm" name="patient">
+                    </div>
+                    <div class="ml-2 mt-2">
+                        <div>HCP</div>
+                        <input type="text"  class="form-control input-sm" name="hcp">
+                    </div>
+                    <div class="ml-2 mt-2">
+                        <div>Care Month Start Date</div>
+                        <select name="" id="" class="form-control input-sm mb-2">
+                            <option>all</option>
+                            <option>on</option>
+                            <option>on-or-before</option>
+                            <option>on-or-after</option>
+                            <option>between</option>
+                            <option>not-on</option>
+                            <option>not-in-between</option>
+                        </select>
+                        <input type="date1" class="form-control input-sm mb-2">
+                        <input type="date1" class="form-control input-sm mb-2">
+                    </div>
+                    <div class="ml-2 mt-2">
+                        <div>Number Of Days With Measurements</div>
+                        <select name="" id="" class="form-control input-sm mb-2">
+                            <option>all</option>
+                            <option>less-than</option>
+                            <option>greater-than</option>
+                            <option>equal-to</option>
+                            <option>between</option>
+                            <option>not-equal-to</option>
+                            <option>not-in-between</option>
+                        </select>
+                        <input type="date1" class="form-control form-control input-sm mb-2">
+                        <input type="date1" class="form-control form-control input-sm mb-2">
+                    </div>
+                    <div class="ml-2 mt-2">
+                        <div>Most Recent Mcp Note Date</div>
+                        <select name="" id="" class="form-control  form-control input-sm mb-2">
+                            <option>all</option>
+                            <option>on</option>
+                            <option>on-or-before</option>
+                            <option>on-or-after</option>
+                            <option>between</option>
+                            <option>not-on</option>
+                            <option>not-in-between</option>
+                        </select>
+                        <input type="date1" class="form-control input-sm mb-2">
+                        <input type="date1" class="form-control input-sm mb-2">
+                    </div>
+                    <div class="ml-2 mt-2">
+                        <div>Days Between Most Recent Mcp Note Date And End Of Care Month</div>
+                        <select name="" id="" class="form-control input-sm mb-2">
+                            <option>all</option>
+                            <option>less-than</option>
+                            <option>greater-than</option>
+                            <option>equal-to</option>
+                            <option>between</option>
+                            <option>not-equal-to</option>
+                            <option>not-in-between</option>
+                        </select>
+                        <input type="date1" class="form-control  input-sm mb-2">
+                        <input type="date1" class="form-control  input-sm mb-2">
+                    </div>
+                </div>
                 <table class="table table-sm table-condensed p-0 m-0" style="table-layout: fixed">
                     <thead class="bg-light">
                         <tr>
                             <th class="px-3 border-0">Patient</th>
                             <th class="border-0">Month/Year</th>
                             <th class="border-0"># Days with Measurements</th>
+                            <th>Most Recent Mcp Note Date</th>
+                            <th>Days Between Most Recent Mcp Note Date And End Of Care Month</th>
                             <th class="border-0">HCP</th>
                         </tr>
                     </thead>
+                    
                     <tbody>
                         @foreach($rows as $row)
                             <tr>
                                 <td>
-                                    <a href="/patients/view/{{ $row->uid }}">
-                                        <b>{{ implode(", ", [$row->name_last, $row->name_first]) }}</b>
+                                    <a href="/patients/view/{{ $row->patient->uid }}">
+                                        <b>{{ implode(", ", [$row->patient->name_last,$row->patient->name_first]) }}</b>
                                     </a>
                                 </td>
                                 <td>
-                                        {{ $row->year_month }}
+                                    {{ $row->start_date }}
+                                </td>
+                                <td>
+                                	{{ $row->number_of_days_with_remote_measurements }}
+				                </td>
+                                <td>
+                                    @if($row->mostRecentMcpNote)
+                                        <a href="{{route('patients.view.notes.view.dashboard',['patient'=>$row->patient, 'note'=>$row->mostRecentMcpNote])}}">{{$row->most_recent_mcp_note_date}}</a>
+                                    @else
+                                        --
+                                    @endif
                                 </td>
+                                <td>{{$row->days_between_most_recent_mcp_note_date_and_end_of_care_month}}</td>
                                 <td>
-                                	{{ $row->num_of_days_with_measurement }}
-				</td>
-				<td>
-                                        <b>{{ implode(", ", [$row->mcp_pro_lname, $row->mcp_pro_fname]) }}</b>
-				</td>
+                                    <b>{{ implode(", ", [$row->mcp->name_first, $row->mcp->name_last]) }}</b>
+				                </td>
                             </tr>
                         @endforeach
                     </tbody>
                 </table>
+                <div>
+                    {{$rows->links()}}
+                </div>
             </div>
         </div>
     </div>