Переглянути джерело

Merge branch 'dev' into dev-vj

Vijayakrishnan 3 роки тому
батько
коміт
c480c2c020

+ 18 - 18
app/Http/Controllers/StatTreeLineController.php

@@ -8,6 +8,7 @@ use App\Models\StatTree;
 use App\Models\StatTreeLine;
 use App\Models\Client;
 use App\Models\Pro;
+use Illuminate\Support\Facades\DB;
 
 class StatTreeLineController extends Controller
 {
@@ -43,7 +44,7 @@ class StatTreeLineController extends Controller
         foreach ($lines as $line) {
             $query = $this->applyStatTreeLineQueryClauses($line);
             if ($query) {
-                $line->last_refresh_count = $query->count();
+                $line->last_refresh_count = $query[0]->count;
                 $line->save();
             }
         }
@@ -58,10 +59,9 @@ class StatTreeLineController extends Controller
 
         $statTreeLine = StatTreeLine::where('id', $statTreeLineID)->first();
         if (!$statTreeLine) return $this->fail('Invalid stat tree line!');
-
-        $query = $this->applyStatTreeLineQueryClauses($statTreeLine);        
+        $query = $this->applyStatTreeLineQueryClauses($statTreeLine);  
         if ($query) {
-            $statTreeLine->last_refresh_count = $query->count();
+            $statTreeLine->last_refresh_count = $query[0]->count;
             $statTreeLine->save();
             return $this->pass($statTreeLine->last_refresh_count);
         }else{
@@ -73,14 +73,17 @@ class StatTreeLineController extends Controller
     {
 
         $model = $statTreeLine->statTree->model;
-        $query = null;
-        if (strcasecmp($model, 'client') == 0) {
-            $query = Client::query();
-        }
-        if (strcasecmp($model, 'pro') == 0) {
-            $query = Pro::query();
-        }
-        if (!$query) return null;
+        // $query = null;
+        // if (strcasecmp($model, 'client') == 0) {
+        //     $query = Client::query();
+        // }
+        // if (strcasecmp($model, 'pro') == 0) {
+        //     $query = Pro::query();
+        // }
+        // if (!$query) return null;
+
+
+
 
         $clauses = [];
         foreach ($statTreeLine->lineClauses as $lineClause) {
@@ -91,12 +94,9 @@ class StatTreeLineController extends Controller
             }
         }
 
-        foreach ($clauses as $clause) {
-            $clauseQuery = $clause;
-            $query = $query->whereRaw($clauseQuery);
-        }
-
-        return $query;
+        $query = 'SELECT COUNT(*) FROM '.$model.' WHERE '. implode(" AND ", $clauses);
+        
+        return DB::select($query);
     }
 
     protected function cleanupClause($clauseText)

+ 3 - 3
resources/views/app/dashboard-mcp.blade.php

@@ -202,7 +202,7 @@
                             </table>
                         </div>
                     </div>
-                    <div class="card mb-4" stag-collapsible-card="mcp-rm">
+                    <div class="card mb-4 d-none" stag-collapsible-card="mcp-rm">
                         <div class="card-header pl-2">
                             <strong>
                                 Remote Monitoring: {{friendly_month(date('Y-m-d'))}}
@@ -302,13 +302,13 @@
                             <div id="mcp-dashboard-appointments" class="mb-4">
 
                             </div>
-                            <div class="card mb-4">
+                            <div class="card mb-4 d-none">
                                 <div class="card-header pl-2">
                                     <strong>
                                         Remote Monitoring: {{friendly_month(date('Y-m-d'))}}
                                     </strong>
                                 </div>
-                                <div class="card-body p-1">
+                                <div class="card-body p-1 d-none">
                                     @include('app.practice-management.remote-monitoring-tree')
                                 </div>
                             </div>

+ 5 - 3
resources/views/app/patient/segment-templates/covid_intake/edit.blade.php

@@ -3,9 +3,9 @@
 use App\Models\Point;
 
 $category = 'COVID_INTAKE';
-$endPoint = 'upsertNoteSingleton';
+$endPoint = 'upsertGlobalSingleton';
 
-$point = Point::where('added_in_segment_id', $segment->id)->where('category', $category)->orderBy('id', 'DESC')->first();
+$point = Point::getGlobalSingletonOfCategory($patient, 'COVID_INTAKE', true);
 $contentData = [
     "ans_how_are_you" => '',
     "ans_is_address_correct" => null, // yes/no
@@ -127,9 +127,11 @@ $contentData = [
     "ans_edu_provided_cdc_guidelines" => null, // checkbox
 
 ];
+
 if (!!@$point->data) {
-    $contentData = json_decode($point->data, true);
+    $contentData = $point->data;
 }
+
 ?>
 <div visit-moe close-on-save close-on-cancel class="d-block p-3">
     <form show url="/api/visitPoint/<?= $endPoint ?>" class="mcp-theme-1">

+ 4 - 3
resources/views/app/patient/segment-templates/covid_intake/summary.blade.php

@@ -3,9 +3,10 @@
 use App\Models\Point;
 
 $category = 'COVID_INTAKE';
-$endPoint = 'upsertNoteSingleton';
+$endPoint = 'upsertGlobalSingleton';
+
+$point = Point::getGlobalSingletonOfCategory($patient, 'COVID_INTAKE', true);
 
-$point = Point::where('added_in_segment_id', $segment->id)->where('category', $category)->orderBy('id', 'DESC')->first();
 $contentData = [
     "ans_how_are_you" => '',
     "ans_is_address_correct" => null, // yes/no
@@ -114,7 +115,7 @@ $contentData = [
 
 ];
 if (!!@$point->data) {
-    $contentData = json_decode($point->data, true);
+    $contentData = $point->data;
 }
 ?>
 <div class="events-none form-read-mode">

+ 2 - 1
routes/web.php

@@ -206,7 +206,6 @@ Route::middleware('pro.auth')->group(function () {
 
         Route::get('rpm-matrix', 'PracticeManagementController@rpmMatrix')->name('rpmMatrix');
 
-        Route::get('remote-monitoring-report', 'PracticeManagementController@remoteMonitoringReport')->name('remoteMonitoringReport');
         Route::get('rates/{selectedProUid?}', 'PracticeManagementController@rates')->name('rates');
         Route::get('dashboard', 'PracticeManagementController@dashboard')->name('dashboard');
         Route::get('previous-bills', 'PracticeManagementController@previousBills')->name('previousBills');
@@ -252,6 +251,8 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('hcp-note-activity', 'PracticeManagementController@hcpNoteActivity')->name('hcp-note-activity');
 
         Route::middleware('pro.auth.admin')->group(function () {
+        	
+		Route::get('remote-monitoring-report', 'PracticeManagementController@remoteMonitoringReport')->name('remoteMonitoringReport');
 
             // BILLING REPORT
             Route::get('billing-report', 'PracticeManagementController@billingReport')->name('billing-report');

+ 75 - 0
spec/sample_rm_stat_tree.txt

@@ -0,0 +1,75 @@
+care_month join client on care_month.client_id = client.id	Start date? 2021-12-01	(care_month.start_date = '2021-12-01')
+care_month join client on care_month.client_id = client.id	Enrolled in RPM?	YES	(client.is_enrolled_in_rm = 'YES')
+care_month join client on care_month.client_id = client.id	Enrolled in RPM?	NO	(client.is_enrolled_in_rm = 'NO')
+care_month join client on care_month.client_id = client.id	Have cellular device?	YES	(SELECT COUNT(client_bdt_device.id) FROM client_bdt_device JOIN bdt_device bd on client_bdt_device.device_id = bd.id WHERE client_bdt_device.client_id = client.id) > 0		
+care_month join client on care_month.client_id = client.id	Have been seen w/in 90 days?	YES	(DATE_PART('day', client.most_recent_completed_mcp_note_date::timestamp - care_month.start_date::timestamp) <= 90)
+care_month join client on care_month.client_id = client.id	Have been seen w/in 90 days?	NO	(DATE_PART('day', client.most_recent_completed_mcp_note_date::timestamp - care_month.start_date::timestamp) > 90)
+care_month join client on care_month.client_id = client.id	Have been spoken to this month?	YES	(care_month.has_anyone_interacted_with_client_about_rm_outside_note = TRUE)
+care_month join client on care_month.client_id = client.id	Have been spoken to this month?	NO	(care_month.has_anyone_interacted_with_client_about_rm_outside_note IS NULL OR care_month.has_anyone_interacted_with_client_about_rm_outside_note = FALSE)
+care_month join client on care_month.client_id = client.id	Have no unstamped meas.?	YES	(care_month.rm_num_measurements_not_stamped_by_mcp = 0)
+care_month join client on care_month.client_id = client.id	Have no unstamped meas.?	NO	(care_month.rm_num_measurements_not_stamped_by_mcp > 0)
+care_month join client on care_month.client_id = client.id	Have 16 or more meas. days?	YES	(care_month.number_of_days_with_remote_measurements >= 16)
+care_month join client on care_month.client_id = client.id	Have 16 or more meas. days?	NO	(care_month.number_of_days_with_remote_measurements < 16)
+care_month join client on care_month.client_id = client.id	Have 20 or more billing mins.?	YES	(care_month.rm_total_time_in_seconds_by_mcp >= 1200)
+care_month join client on care_month.client_id = client.id	Have 20 or more billing mins.?	NO	(care_month.rm_total_time_in_seconds_by_mcp < 1200)
+care_month join client on care_month.client_id = client.id	Have subscribed to SMS?	YES	(client.send_sms_on_bdt_measurement = TRUE)
+care_month join client on care_month.client_id = client.id	Have used the device?	YES	(client.most_recent_cellular_bp_measurement_at IS NOT NULL OR most_recent_cellular_weight_measurement_at IS NOT NULL)
+
+
+
+ Enrolled in RPM? YES
+ Enrolled in RPM? NO
+ Have cellular device? YES
+ Have been seen w/in 90 days? YES
+ Have been seen w/in 90 days? NO
+ Have been spoken to this month? YES
+ Have been spoken to this month? NO
+ Have no unstamped meas.? YES
+ Have no unstamped meas.? NO
+ Have 16 or more meas. days? YES
+ Have 16 or more meas. days? NO
+ Have 20 or more billing mins.? YES
+ Have 20 or more billing mins.? NO
+ Have subscribed to SMS? YES
+ Have used the device? YES
+
+
+<<<<<<< HEAD
+Start date. 2021-12-01
+=======
+Start date? 2021-12-01
+>>>>>>> 9d1c97068d0d8befbe5b3deb4efabbbfcf325574
+    Enrolled in RPM? YES
+        Have cellular device? YES
+            Have been seen w/in 90 days? NO
+            Have been seen w/in 90 days? YES
+                Have been spoken to this month? YES
+                    Have 16 or more meas. days? YES
+                        Have 20 or more billing mins.? YES
+                        Have 20 or more billing mins.? NO
+                    Have 16 or more meas. days? NO
+            Have been spoken to this month? NO
+            Have no unstamped meas.? YES
+            Have no unstamped meas.? NO
+            Have subscribed to SMS? YES
+    Enrolled in RPM? NO
+
+<<<<<<< HEAD
+=======
+Enrolled in RPM? YES
+    Have cellular device? YES
+        Have been seen w/in 90 days? NO
+        Have been seen w/in 90 days? YES
+            Have been spoken to this month? YES
+                Have 16 or more meas. days? YES
+                    Have 20 or more billing mins.? YES
+                    Have 20 or more billing mins.? NO
+                Have 16 or more meas. days? NO
+        Have been spoken to this month? NO
+        Have no unstamped meas.? YES
+        Have no unstamped meas.? NO
+        Have subscribed to SMS? YES
+Enrolled in RPM? NO
+
+>>>>>>> 9d1c97068d0d8befbe5b3deb4efabbbfcf325574
+

+ 20 - 17
spec/stat-tree-report-builder-spec.txt

@@ -47,22 +47,8 @@ Pro	Is HCP?	NO	(is_hcp IS NOT TRUE)
 
 			EXAMPLE tsv_text_for_lines:
 			
-[QUESTION][SPACE][ANSWER]
-Active? YES
-	MCP assigned? YES
-		MCB Primary? NO
-			Has active RM device? YES
-	MCP assigned? NO
-		MCB Primary? YES
-Active? NO
-	MCB Primary? YES
-		Has active RM device? YES
-		Has active RM device? NO
-	MCB Primary? NO
-		Has active RM device? YES
-		Has active RM device? NO
-	Has active RM device? YES
-	Has active RM device? NO
+
+
 //Pros
 Active? YES
 	Is HCP? YES
@@ -258,4 +244,21 @@ Active? NO
 	Top level filters:
 		-(WHERE mcp_pro_id=2)
 
-	// render same thing as static stat-tree-line, but with this filter
+	// render same thing as static stat-tree-line, but with this filter
+
+
+
+client	Active?	YES	(is_active IS TRUE)
+client	Active?	NO	(is_active IS FALSE)
+client	MCP assigned?	YES	(mcp_pro_id IS NOT NULL)
+client	MCP assigned?	NO	(mcp_pro_id IS NULL)
+client	MCB Primary?	YES	(is_part_b_primary = 'YES')
+client	MCB Primary?	NO	(is_part_b_primary = 'NO')
+
+
+Active? YES
+	MCP assigned? YES
+		MCB Primary? YES
+		MCB Primary? NO
+	MCP assigned? NO
+Active? NO