ソースを参照

RPM work matrix - RMMs

Vijayakrishnan 3 年 前
コミット
48e411533e

+ 0 - 68
app/Http/Controllers/McpController.php

@@ -430,74 +430,6 @@ class McpController extends Controller
         return view('app.mcp.measurements_pending_stamping_in_care_month', compact('patient', 'careMonth'));
     }
 
-    public function rpm_work_matrix(Request $request) {
-
-        // get the patient having most recent unstamped measurement
-        $performer = $this->performer();
-
-        $ym = ($request->input('y') ?: 'Y') . '-' . ($request->input('m') ?: 'm');
-        $careMonthStart = date($ym . '-01');
-
-        $patient = null;
-        $careMonth = null;
-
-        if($request->input('patientUid') && $request->input('careMonthUid')) {
-            $patient = Client::where('uid', $request->input('patientUid'))->first();
-            $careMonth = CareMonth::where('uid', $request->input('careMonthUid'))->first();
-        }
-
-        if(!$patient && !$careMonth) {
-
-            $query = "
-    SELECT client.name_first, client.name_last,
-           (client.name_first || ' ' || client.name_last) as client_name,
-           client.uid as client_uid, 
-           client.dob,
-           client.is_enrolled_in_rm,
-           client.most_recent_completed_mcp_note_date,
-           care_month.uid as care_month_uid,
-           care_month.id as care_month_id,
-           care_month.start_date,
-           care_month.rm_total_time_in_seconds_by_mcp,
-           care_month.number_of_days_with_remote_measurements,
-           care_month.has_anyone_interacted_with_client_about_rm_outside_note,
-           care_month.rm_num_measurements_not_stamped_by_mcp,
-           care_month.rm_num_measurements_not_stamped_by_non_hcp,
-           care_month.rm_num_measurements_not_stamped_by_rmm,
-           care_month.rm_num_measurements_not_stamped_by_rme,
-           client.mcp_pro_id,
-           client.default_na_pro_id,
-           client.rmm_pro_id,
-           client.rme_pro_id,
-           client.cell_number,
-           client.most_recent_cellular_bp_dbp_mm_hg,
-           client.most_recent_cellular_bp_sbp_mm_hg,
-           client.most_recent_cellular_bp_measurement_at,      
-           client.most_recent_cellular_weight_value,
-           client.most_recent_cellular_weight_measurement_at,
-           GREATEST(client.most_recent_cellular_bp_measurement_at, client.most_recent_cellular_weight_measurement_at) as latest_measurement_at
-    FROM care_month join client on care_month.client_id = client.id
-    WHERE
-          client.mcp_pro_id = {$performer->pro->id}
-          AND EXTRACT(MONTH from care_month.start_date) = " . ($request->input('m') ?: 'EXTRACT(MONTH from now())') . "
-          AND EXTRACT(YEAR from care_month.start_date) = " . ($request->input('y') ?: 'EXTRACT(YEAR from now())') . "
-          AND care_month.rm_num_measurements_not_stamped_by_mcp > 0
-          ORDER BY latest_measurement_at DESC
-          LIMIT 1
-    ";
-
-            $patients = DB::select($query);
-
-            if (count($patients)) {
-                $patient = Client::where('uid', $patients[0]->client_uid)->first();
-                $careMonth = CareMonth::where('uid', $patients[0]->care_month_uid)->first();
-            }
-        }
-
-        return view('app.mcp.rpm_work_matrix', compact('patient', 'careMonth'));
-
-    }
-
     public function measurements_mass_stamping(Request $request){
         $careMonthsWithMeasurementsPendingStamping = CareMonth::select('id')
             ->where('mcp_pro_id', $this->performer->pro->id)

+ 71 - 3
app/Http/Controllers/PracticeManagementController.php

@@ -1023,7 +1023,7 @@ SELECT effective_date, count(*), sum(number_of_units) as units FROM bill WHERE c
 
         $performer = $this->performer();
 
-        abort_if($performer->pro->pro_type !== 'ADMIN' && !$performer->pro->can_view_rm_matrix, 403);
+        // abort_if($performer->pro->pro_type !== 'ADMIN' && !$performer->pro->can_view_rm_matrix, 403);
 
         $ym = ($request->input('y') ?: 'Y') . '-' . ($request->input('m') ?: 'm');
         $careMonthStart = date($ym . '-01');
@@ -1031,7 +1031,7 @@ SELECT effective_date, count(*), sum(number_of_units) as units FROM bill WHERE c
         $rc = $request->input('rc') ?: 1;
         $rc2 = $request->input('rc2') ?: 2;
 
-        $conditions = $this->rpmConditions($performer, $rc, $rc2);
+        $conditions = [];// $this->rpmConditions($performer, $rc, $rc2);
 
         $sortBy = $request->input('sort_by') ?: 'name_first';
         $sortDir = $request->input('sort_dir') ?: 'ASC';
@@ -1048,6 +1048,7 @@ SELECT client.name_first, client.name_last,
        care_month.id as care_month_id,
        care_month.start_date,
        care_month.rm_total_time_in_seconds_by_mcp,
+       care_month.rm_total_time_in_seconds_by_rmm_pro,
        care_month.number_of_days_with_remote_measurements,
        care_month.has_mcp_interacted_with_client_about_rm,
        care_month.rm_num_measurements_not_stamped_by_mcp,
@@ -1066,7 +1067,7 @@ SELECT client.name_first, client.name_last,
        client.most_recent_cellular_weight_measurement_at
 FROM care_month join client on care_month.client_id = client.id
 WHERE
-      client.mcp_pro_id = {$performer->pro->id}
+      (care_month.mcp_pro_id = {$performer->pro->id} OR care_month.rmm_pro_id = {$performer->pro->id})
       AND EXTRACT(MONTH from care_month.start_date) = " . ($request->input('m') ?: 'EXTRACT(MONTH from now())') . "
       AND EXTRACT(YEAR from care_month.start_date) = " . ($request->input('y') ?: 'EXTRACT(YEAR from now())') . "
       " . (count($conditions) > 0 ? 'AND ' . implode(" AND ", $conditions) : '') . "
@@ -1081,6 +1082,73 @@ WHERE
         return view('app.practice-management.remote-monitoring', compact('patients', 'daysRemaining', 'careMonthStart'));
     }
 
+    public function rpm_work_matrix(Request $request) {
+
+        // get the patient having most recent unstamped measurement
+        $performer = $this->performer();
+
+        $ym = ($request->input('y') ?: 'Y') . '-' . ($request->input('m') ?: 'm');
+        $careMonthStart = date($ym . '-01');
+
+        $patient = null;
+        $careMonth = null;
+
+        if($request->input('patientUid') && $request->input('careMonthUid')) {
+            $patient = Client::where('uid', $request->input('patientUid'))->first();
+            $careMonth = CareMonth::where('uid', $request->input('careMonthUid'))->first();
+        }
+
+        if(!$patient && !$careMonth) {
+
+            $query = "
+    SELECT client.name_first, client.name_last,
+           (client.name_first || ' ' || client.name_last) as client_name,
+           client.uid as client_uid, 
+           client.dob,
+           client.is_enrolled_in_rm,
+           client.most_recent_completed_mcp_note_date,
+           care_month.uid as care_month_uid,
+           care_month.id as care_month_id,
+           care_month.start_date,
+           care_month.rm_total_time_in_seconds_by_mcp,
+           care_month.number_of_days_with_remote_measurements,
+           care_month.rm_num_measurements_not_stamped_by_mcp,
+           care_month.rm_num_measurements_not_stamped_by_rmm,
+           client.mcp_pro_id,
+           client.default_na_pro_id,
+           client.rmm_pro_id,
+           client.rme_pro_id,
+           client.cell_number,
+           client.most_recent_cellular_bp_dbp_mm_hg,
+           client.most_recent_cellular_bp_sbp_mm_hg,
+           client.most_recent_cellular_bp_measurement_at,      
+           client.most_recent_cellular_weight_value,
+           client.most_recent_cellular_weight_measurement_at,
+           GREATEST(client.most_recent_cellular_bp_measurement_at, client.most_recent_cellular_weight_measurement_at) as latest_measurement_at
+    FROM care_month join client on care_month.client_id = client.id
+    WHERE
+          (
+              (care_month.mcp_pro_id = {$performer->pro->id} AND care_month.rm_num_measurements_not_stamped_by_mcp > 0) OR 
+              (care_month.rmm_pro_id = {$performer->pro->id} AND care_month.rm_num_measurements_not_stamped_by_rmm > 0)
+          )
+          AND EXTRACT(MONTH from care_month.start_date) = " . ($request->input('m') ?: 'EXTRACT(MONTH from now())') . "
+          AND EXTRACT(YEAR from care_month.start_date) = " . ($request->input('y') ?: 'EXTRACT(YEAR from now())') . "
+          ORDER BY latest_measurement_at DESC
+          LIMIT 1
+    ";
+
+            $patients = DB::select($query);
+
+            if (count($patients)) {
+                $patient = Client::where('uid', $patients[0]->client_uid)->first();
+                $careMonth = CareMonth::where('uid', $patients[0]->care_month_uid)->first();
+            }
+        }
+
+        return view('app.practice-management.rpm_work_matrix', compact('patient', 'careMonth'));
+
+    }
+
     public function remoteMonitoringCount(Request $request) {
 
         $performer = $this->performer();

+ 1 - 0
app/Models/Client.php

@@ -805,6 +805,7 @@ SELECT m.id   AS measurement_id,
        m.effective_date,
        m.ts,
        m.has_been_stamped_by_mcp,
+       m.has_been_stamped_by_rmm,
        m.has_been_stamped_by_non_hcp
 FROM measurement m
          JOIN care_month cm ON m.care_month_id = cm.id

+ 350 - 353
resources/views/app/patient/care-month/_work_matrix.blade.php

@@ -7,35 +7,44 @@ if ($pro->pro_type === 'ADMIN') {
     $performerRole = 'ADMIN';
 } else if ($careMonth->mcp_pro_id === $pro->id) {
     $performerRole = 'MCP';
-} else if ($careMonth->rme_pro_id === $pro->id || $careMonth->rmm_pro_id === $pro->id) {
-    $performerRole = 'NON-HCP';
+} else if ($careMonth->rmm_pro_id === $pro->id) {
+    $performerRole = 'RMM';
 }
 
 $unstampedMCP = [];
-$unstampedNonHCP = [];
+$unstampedRMM = [];
 foreach ($days as $k => $day) {
     $unstampedMCP[$k] = [];
-    $unstampedNonHCP[$k] = [];
+    $unstampedRMM[$k] = [];
     foreach ($days[$k] as $mIndex => $m) {
         if(!$m->has_been_stamped_by_mcp) {
             $unstampedMCP[$k][] = $m->measurement_uid;
         }
-        if(!$m->has_been_stamped_by_non_hcp) {
-            $unstampedNonHCP[$k][] = $m->measurement_uid;
+        if(!$m->has_been_stamped_by_rmm) {
+            $unstampedRMM[$k][] = $m->measurement_uid;
         }
     }
 }
 
-// skip days that dont have any unstamped
+// skip days that don't have any unstamped
 $daysWithUnstamped = [];
 foreach ($days as $k => $day) {
     foreach ($days[$k] as $mIndex => $m) {
-        if($performerRole === 'MCP') {
+        if($performerRole === 'ADMIN') {
+            $daysWithUnstamped[$k] = $days[$k]; // show ther admin everything
+        }
+        else if($performerRole === 'MCP') {
             if(!$m->has_been_stamped_by_mcp) {
                 $daysWithUnstamped[$k] = $days[$k];
                 break;
             }
         }
+        else if($performerRole === 'RMM') {
+            if(!$m->has_been_stamped_by_rmm) {
+                $daysWithUnstamped[$k] = $days[$k];
+                break;
+            }
+        }
     }
 }
 $days = $daysWithUnstamped;
@@ -51,371 +60,358 @@ $days = $daysWithUnstamped;
         <b class="ml-1">{{friendly_month($careMonth->start_date)}}</b>
     </div>
 
-@if(!@$onlyMatrix)
-<div class="d-flex align-items-baseline mb-3" tab-links>
-    <a class="tab-link-active" href="#" tab-link="matrix">Matrix</a>
-    <a class="" href="#" tab-link="measurements-graph">Graph</a>
-    <a class="" href="#" tab-link="bmi-summary">BMI/Weight Management Settings</a>
-    <a class="" href="#" tab-link="bp-summary">BP Management Settings</a>
-</div>
-@endif
-<table class="table table-condensed table-sm table-bordered mb-3 cm-tab" tab-key="matrix">
-    <thead class="bg-light">
-    <tr>
-        <th class="px-2 text-secondary align-bottom border-bottom-0" rowspan="2">Date</th>
-        <th class="px-2 text-secondary border-bottom-0" colspan="4">Measurements</th>
-        <th class="px-2 text-secondary align-bottom border-bottom-0" rowspan="2">{{$performerRole === 'ADMIN' ? 'Stamp Status' : 'Stamp + Entry'}}</th>
-        <th class="px-2 text-secondary border-bottom-0" rowspan="2">Entries</th>
-    </tr>
-    <tr>
-        <th class="text-secondary text-sm border-bottom-0">Time</th>
-        <th class="text-secondary text-sm border-bottom-0">Type</th>
-        <th class="text-secondary text-sm border-bottom-0">Value</th>
-        <th class="text-secondary text-sm border-bottom-0">Stamp</th>
-    </tr>
-    </thead>
-    <tbody>
-    @foreach($days as $k => $day)
-        @foreach($days[$k] as $mIndex => $m)
-        <tr data-day="{{$k}}">
-            @if($mIndex === 0)
-                <td rowspan="{{count($days[$k])}}">
-                    {{$k}}
-                </td>
+    @if(!@$onlyMatrix)
+        <div class="d-flex align-items-baseline mb-3" tab-links>
+            <a class="tab-link-active" href="#" tab-link="matrix">Matrix</a>
+            <a class="" href="#" tab-link="measurements-graph">Graph</a>
+            @if($performerRole === 'ADMIN' || $performerRole === 'MCP')
+                <a class="" href="#" tab-link="bmi-summary">BMI/Weight Management Settings</a>
+                <a class="" href="#" tab-link="bp-summary">BP Management Settings</a>
             @endif
-            <td>{{$m->time}}</td>
-            <td>
-                @if($m->label === 'BP')
-                    BP
-                @elseif($m->label === 'Wt. (lbs.)')
-                    Weight
-                @endif
-            </td>
-            <td>
-                @if($m->label === 'BP')
-                    {{ $m->sbp_mm_hg }}/{{ $m->dbp_mm_hg }}
-                @elseif($m->label === 'Wt. (lbs.)')
-                    {{ round(floatval($m->numeric_value), 2) }} lbs
+        </div>
+    @endif
+
+    <table class="table table-condensed table-sm table-bordered mb-3 cm-tab" tab-key="matrix">
+        <thead class="bg-light">
+        <tr>
+            <th class="px-2 text-secondary align-bottom border-bottom-0" rowspan="2">Date</th>
+            <th class="px-2 text-secondary border-bottom-0" colspan="4">Measurements</th>
+            <th class="px-2 text-secondary align-bottom border-bottom-0" rowspan="2">{{$performerRole === 'ADMIN' ? 'Stamp Status' : 'Stamp + Entry'}}</th>
+            <th class="px-2 text-secondary border-bottom-0" rowspan="2">Entries</th>
+        </tr>
+        <tr>
+            <th class="text-secondary text-sm border-bottom-0">Time</th>
+            <th class="text-secondary text-sm border-bottom-0">Type</th>
+            <th class="text-secondary text-sm border-bottom-0">Value</th>
+            <th class="text-secondary text-sm border-bottom-0">Stamp</th>
+        </tr>
+        </thead>
+        <tbody>
+        @foreach($days as $k => $day)
+            @foreach($days[$k] as $mIndex => $m)
+            <tr data-day="{{$k}}">
+                @if($mIndex === 0)
+                    <td rowspan="{{count($days[$k])}}">
+                        {{$k}}
+                    </td>
                 @endif
-            </td>
-            <td>
-                @if($performerRole === 'MCP')
-                    <div class="width-100px">
-                        @if($m->has_been_stamped_by_mcp)
-                            <span class="text-secondary text-sm">
-                                <i class="fa fa-check"></i>
-                                Stamped
-                            </span>
-                        @else
-                            <div moe relative>
-                                <a href="#" start show>Stamp</a>
-                                <form url="/api/measurement/stamp" right class="width-300px">
-                                    <input type="hidden" name="uid" value="{{$m->measurement_uid}}">
-                                    <p class="mb-1">Stamp this measurement?</p>
-                                    <div class="mt-2 bg-light border p-2">
-                                        <div class="mb-1 text-secondary">{{ $m->label }}</div>
-                                        <div class="font-weight-bold mb-1">
-                                            @if($m->label === 'BP')
-                                                {{ round($m->sbp_mm_hg, 2) }}/{{ round($m->dbp_mm_hg, 2) }} mmHg
-                                                <span class="font-weight-normal d-inline-block pl-2">Pulse:</span>
-                                                {{ $m->value_pulse }} {{ $m->value_irregular === 0?'Irregular':'' }} {{ $m->value_irregular === 1?'Regular':'' }}
-                                            @elseif($m->label === 'Wt. (lbs.)')
-                                                {{ round($m->numeric_value, 2) }} lbs
-                                            @else
-                                                {{ $m->value }}
-                                            @endif
-                                        </div>
-                                        <div class="text-sm">
-                                            {{ $m->date }} {{ $m->time }} EST
-                                        </div>
-                                    </div>
-                                    <!--<div class="mb-2 border border-info p-2 mt-2 bg-light">
-                                        <span>I have had interactive communication with <b>{{$patient->displayName()}}</b> during this care month.</span>
-                                        <div class="d-flex border-top mt-2">
-                                            <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
-                                                <input type="radio" class="mr-2" name="communicatedToPatient" value="true" required>
-                                                <span>Yes</span>
-                                            </label>
-                                            <label class="mt-2 mb-0 d-inline-flex align-items-center">
-                                                <input type="radio" class="mr-2" name="communicatedToPatient" value="false" checked required>
-                                                <span>No</span>
-                                            </label>
-                                        </div>
-                                    </div>-->
-                                    <div class="mb-2">
-                                        <label class="mb-1 text-secondary text-sm">Memo</label>
-                                        <textarea class="form-control form-control-sm" name="memo"></textarea>
-                                    </div>
-                                    <div class="form-group m-0">
-                                        <button submit class="btn btn-primary btn-sm mr-2">Submit</button>
-                                        <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
-                                    </div>
-                                </form>
-                            </div>
-                        @endif
-                    </div>
-                @elseif($performerRole === 'NON-HCP')
-                    <div class="width-100px">
-                        @if($m->has_been_stamped_by_non_hcp)
-                            <span class="text-secondary text-sm">
-                                <i class="fa fa-check"></i>
-                                Stamped
-                            </span>
-                        @else
-                            <div moe relative>
-                                <a href="#" start show>Stamp</a>
-                                <form url="/api/measurement/stamp" right class="width-300px">
-                                    <input type="hidden" name="uid" value="{{$m->measurement_uid}}">
-                                    <p class="mb-1">Stamp this measurement?</p>
-                                    <div class="mt-2 bg-light border p-2">
-                                        <div class="mb-1 text-secondary">{{ $m->label }}</div>
-                                        <div class="font-weight-bold mb-1">
-                                            @if($m->label === 'BP')
-                                                {{ round($m->sbp_mm_hg, 2) }}/{{ round($m->dbp_mm_hg, 2) }} mmHg
-                                                <span class="font-weight-normal d-inline-block pl-2">Pulse:</span>
-                                                {{ $m->value_pulse }} {{ $m->value_irregular === 0?'Irregular':'' }} {{ $m->value_irregular === 1?'Regular':'' }}
-                                            @elseif($m->label === 'Wt. (lbs.)')
-                                                {{ round($m->numeric_value, 2) }} lbs
-                                            @else
-                                                {{ $m->value }}
-                                            @endif
-                                        </div>
-                                        <div class="text-sm">
-                                            {{ $m->date }} {{ $m->time }} EST
+                <td>{{$m->time}}</td>
+                <td>
+                    @if($m->label === 'BP')
+                        BP
+                    @elseif($m->label === 'Wt. (lbs.)')
+                        Weight
+                    @endif
+                </td>
+                <td>
+                    @if($m->label === 'BP')
+                        {{ $m->sbp_mm_hg }}/{{ $m->dbp_mm_hg }}
+                    @elseif($m->label === 'Wt. (lbs.)')
+                        {{ round(floatval($m->numeric_value), 2) }} lbs
+                    @endif
+                </td>
+                <td>
+                    @if($performerRole === 'MCP')
+                        <div class="width-100px">
+                            @if($m->has_been_stamped_by_mcp)
+                                <span class="text-secondary text-sm">
+                                    <i class="fa fa-check"></i>
+                                    Stamped
+                                </span>
+                            @else
+                                <div moe relative>
+                                    <a href="#" start show>Stamp</a>
+                                    <form url="/api/measurement/stamp" right class="width-300px">
+                                        <input type="hidden" name="uid" value="{{$m->measurement_uid}}">
+                                        <p class="mb-1">Stamp this measurement?</p>
+                                        <div class="mt-2 bg-light border p-2">
+                                            <div class="mb-1 text-secondary">{{ $m->label }}</div>
+                                            <div class="font-weight-bold mb-1">
+                                                @if($m->label === 'BP')
+                                                    {{ round($m->sbp_mm_hg, 2) }}/{{ round($m->dbp_mm_hg, 2) }} mmHg
+                                                    <span class="font-weight-normal d-inline-block pl-2">Pulse:</span>
+                                                    {{ $m->value_pulse }} {{ $m->value_irregular === 0?'Irregular':'' }} {{ $m->value_irregular === 1?'Regular':'' }}
+                                                @elseif($m->label === 'Wt. (lbs.)')
+                                                    {{ round($m->numeric_value, 2) }} lbs
+                                                @else
+                                                    {{ $m->value }}
+                                                @endif
+                                            </div>
+                                            <div class="text-sm">
+                                                {{ $m->date }} {{ $m->time }} EST
+                                            </div>
                                         </div>
-                                    </div>
-                                    <div class="mb-2">
-                                        <label class="mb-1 text-secondary text-sm">Memo</label>
-                                        <textarea class="form-control form-control-sm" name="memo"></textarea>
-                                    </div>
-                                    <div class="form-group m-0">
-                                        <button submit class="btn btn-primary btn-sm mr-2">Submit</button>
-                                        <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
-                                    </div>
-                                </form>
-                            </div>
-                        @endif
-                    </div>
-                @endif
-            </td>
-            @if($mIndex === 0)
-                <td rowspan="{{count($days[$k])}}" class="px-2">
-                    @if($performerRole === 'ADMIN')
-                        <div class="my-1">
-                            <span class="text-secondary">MCP Unstamped:</span>
-                            <b class="{{count($unstampedMCP[$k]) ? '' : 'text-secondary font-weight-normal'}}">{{count($unstampedMCP[$k])}}</b>
-                        </div>
-                        <div class="">
-                            <span class="text-secondary">Non-HCP Unstamped:</span>
-                            <b class="{{count($unstampedNonHCP[$k]) ? '' : 'text-secondary font-weight-normal'}}">{{count($unstampedNonHCP[$k])}}</b>
-                        </div>
-                    @elseif($performerRole === 'MCP')
-                        @if(count($unstampedMCP[$k]))
-                            <div moe relative>
-                                <a href="#" start show class="mcp-stamp-all">
-                                    Stamp All
-                                </a>
-                                <form url="/api/measurement/bulkStamp" class="width-300px">
-                                    <input type="hidden" name="clientUid" value="{{$patient->uid}}">
-                                    <input type="hidden" class="measurements-uids" value="{{implode('|', $unstampedMCP[$k])}}">
-                                    <p class="mb-2 font-weight-bold">Stamp all measurements?</p>
-                                    <?php
-                                    $dayTotalMinutes = 0;
-                                    foreach($m->entries as $entry) {
-                                        $dayTotalMinutes += round($entry->time_in_seconds / 60);
-                                    }
-                                    $autoCheckEntry = false;
-                                    $autoCheckEntry = ($dayTotalMinutes < 2 && $patient->is_enrolled_in_rm);
-                                    ?>
-                                    <div class="p-2 border border-info bg-light mb-2">
                                         <div class="mb-2">
                                             <label class="mb-1 text-secondary text-sm">Memo</label>
-                                            <textarea class="form-control form-control-sm" name="entryMemo">measurements within range</textarea>
+                                            <textarea class="form-control form-control-sm" name="memo"></textarea>
                                         </div>
-                                        <div class="">
-                                            <label class="mb-0 d-flex align-items-center">
-                                                <input type="checkbox" class="shouldAddEntry mr-2 my-0" {{$autoCheckEntry ? 'checked' : ''}}>
-                                                <span>Add Time Entry</span>
-                                            </label>
+                                        <div class="form-group m-0">
+                                            <button submit class="btn btn-primary btn-sm mr-2">Submit</button>
+                                            <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
                                         </div>
-                                        <div class="if-adding-time-entry pt-2 d-none">
-                                            <div class="mb-2">
-                                                <label class="mb-1 text-secondary text-sm">Seconds</label>
-                                                <input type="number" min="75" max="300"
-                                                       class="form-control form-control-sm w-100" name="entryNumberOfSeconds"
-                                                       value="75" placeholder="Time (secs.)">
+                                    </form>
+                                </div>
+                            @endif
+                        </div>
+                    @elseif($performerRole === 'RMM')
+                        <div class="width-100px">
+                            @if($m->has_been_stamped_by_rmm)
+                                <span class="text-secondary text-sm">
+                                    <i class="fa fa-check"></i>
+                                    Stamped
+                                </span>
+                            @else
+                                <div moe relative>
+                                    <a href="#" start show>Stamp</a>
+                                    <form url="/api/measurement/stamp" right class="width-300px">
+                                        <input type="hidden" name="uid" value="{{$m->measurement_uid}}">
+                                        <p class="mb-1">Stamp this measurement?</p>
+                                        <div class="mt-2 bg-light border p-2">
+                                            <div class="mb-1 text-secondary">{{ $m->label }}</div>
+                                            <div class="font-weight-bold mb-1">
+                                                @if($m->label === 'BP')
+                                                    {{ round($m->sbp_mm_hg, 2) }}/{{ round($m->dbp_mm_hg, 2) }} mmHg
+                                                    <span class="font-weight-normal d-inline-block pl-2">Pulse:</span>
+                                                    {{ $m->value_pulse }} {{ $m->value_irregular === 0?'Irregular':'' }} {{ $m->value_irregular === 1?'Regular':'' }}
+                                                @elseif($m->label === 'Wt. (lbs.)')
+                                                    {{ round($m->numeric_value, 2) }} lbs
+                                                @else
+                                                    {{ $m->value }}
+                                                @endif
                                             </div>
-                                            <div class="mb-2">
-                                                <label class="mb-1 text-secondary text-sm">Date</label>
-                                                <input type="date" class="form-control form-control-sm w-100"
-                                                       name="entryDate"
-                                                       value="{{date('Y-m-d', strtotime($k))}}">
+                                            <div class="text-sm">
+                                                {{ $m->date }} {{ $m->time }} EST
                                             </div>
                                         </div>
-                                    </div>
-                                    <div class="form-group m-0">
-                                        <button type="button" class="btn btn-primary btn-sm mr-2 btn-bulk-stamp">Next</button>
-                                        <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
-                                    </div>
-                                </form>
-                            </div>
-                        @else
-                            <span class="text-secondary text-sm d-flex align-items-center">
-                                <i class="fa fa-check mr-2"></i>
-                                <span>All Stamped</span>
-                            </span>
-                        @endif
-                    @elseif($performerRole === 'NON-HCP')
-                        @if(count($unstampedNonHCP[$k]))
-                            <div moe relative>
-                                <a href="#" start show class="">
-                                    Stamp All
-                                </a>
-                                <form url="/api/measurement/bulkStamp" class="width-300px">
-                                    <input type="hidden" name="clientUid" value="{{$patient->uid}}">
-                                    <input type="hidden" class="measurements-uids" value="{{implode('|', $unstampedNonHCP[$k])}}">
-                                    <p class="mb-2 font-weight-bold">Stamp all measurements?</p>
-                                    <?php
-                                    $dayTotalMinutes = 0;
-                                    foreach($m->entries as $entry) {
-                                        $dayTotalMinutes += round($entry->time_in_seconds / 60);
-                                    }
-                                    $autoCheckEntry = false;
-                                    $autoCheckEntry = ($dayTotalMinutes < 2 && $patient->is_enrolled_in_rm);
-                                    ?>
-                                    <div class="p-2 border border-info bg-light mb-2">
                                         <div class="mb-2">
                                             <label class="mb-1 text-secondary text-sm">Memo</label>
-                                            <textarea class="form-control form-control-sm" name="entryMemo"></textarea>
+                                            <textarea class="form-control form-control-sm" name="memo"></textarea>
                                         </div>
-                                        <div class="">
-                                            <label class="mb-0 d-flex align-items-center">
-                                                <input type="checkbox" class="shouldAddEntry mr-2 my-0" {{$autoCheckEntry ? 'checked' : ''}}>
-                                                <span>Add Time Entry</span>
-                                            </label>
+                                        <div class="form-group m-0">
+                                            <button submit class="btn btn-primary btn-sm mr-2">Submit</button>
+                                            <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
                                         </div>
-                                        <div class="if-adding-time-entry pt-2 d-none">
+                                    </form>
+                                </div>
+                            @endif
+                        </div>
+                    @else
+                        <div class="text-sm text-secondary">Only the MCP or RMM can stamp!</div>
+                    @endif
+                </td>
+                @if($mIndex === 0)
+                    <td rowspan="{{count($days[$k])}}" class="px-2">
+                        @if($performerRole === 'ADMIN')
+                            <div class="my-1">
+                                <span class="text-secondary">MCP Unstamped:</span>
+                                <b class="{{count($unstampedMCP[$k]) ? '' : 'text-secondary font-weight-normal'}}">{{count($unstampedMCP[$k])}}</b>
+                            </div>
+                            <div class="">
+                                <span class="text-secondary">RMM Unstamped:</span>
+                                <b class="{{count($unstampedRMM[$k]) ? '' : 'text-secondary font-weight-normal'}}">{{count($unstampedRMM[$k])}}</b>
+                            </div>
+                            <div class="text-sm text-secondary">Only the MCP or RMM can stamp-all!</div>
+                        @elseif($performerRole === 'MCP')
+                            @if(count($unstampedMCP[$k]))
+                                <div moe relative>
+                                    <a href="#" start show class="pro-stamp-all">
+                                        Stamp All
+                                    </a>
+                                    <form url="/api/measurement/bulkStamp" class="width-300px">
+                                        <input type="hidden" name="clientUid" value="{{$patient->uid}}">
+                                        <input type="hidden" class="measurements-uids" value="{{implode('|', $unstampedMCP[$k])}}">
+                                        <p class="mb-2 font-weight-bold">Stamp all measurements?</p>
+                                        <?php
+                                        $dayTotalMinutes = 0;
+                                        foreach($m->entries as $entry) {
+                                            $dayTotalMinutes += round($entry->time_in_seconds / 60);
+                                        }
+                                        $autoCheckEntry = false;
+                                        $autoCheckEntry = ($dayTotalMinutes < 2 && $patient->is_enrolled_in_rm);
+                                        ?>
+                                        <div class="p-2 border border-info bg-light mb-2">
                                             <div class="mb-2">
-                                                <label class="mb-1 text-secondary text-sm">Seconds</label>
-                                                <input type="number" min="75" max="300"
-                                                       class="form-control form-control-sm w-100" name="entryNumberOfSeconds"
-                                                       value="75" placeholder="Time (secs.)">
+                                                <label class="mb-1 text-secondary text-sm">Memo</label>
+                                                <textarea class="form-control form-control-sm" name="entryMemo">measurements within range</textarea>
+                                            </div>
+                                            <div class="">
+                                                <label class="mb-0 d-flex align-items-center">
+                                                    <input type="checkbox" class="shouldAddEntry mr-2 my-0" {{$autoCheckEntry ? 'checked' : ''}}>
+                                                    <span>Add Time Entry</span>
+                                                </label>
                                             </div>
+                                            <div class="if-adding-time-entry pt-2 d-none">
+                                                <div class="mb-2">
+                                                    <label class="mb-1 text-secondary text-sm">Seconds</label>
+                                                    <input type="number" min="75" max="300"
+                                                           class="form-control form-control-sm w-100" name="entryNumberOfSeconds"
+                                                           value="75" placeholder="Time (secs.)">
+                                                </div>
+                                                <div class="mb-2">
+                                                    <label class="mb-1 text-secondary text-sm">Date</label>
+                                                    <input type="date" class="form-control form-control-sm w-100"
+                                                           name="entryDate"
+                                                           value="{{date('Y-m-d', strtotime($k))}}">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="form-group m-0">
+                                            <button type="button" class="btn btn-primary btn-sm mr-2 btn-bulk-stamp">Next</button>
+                                            <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                            @else
+                                <span class="text-secondary text-sm d-flex align-items-center">
+                                    <i class="fa fa-check mr-2"></i>
+                                    <span>All Stamped</span>
+                                </span>
+                            @endif
+                        @elseif($performerRole === 'RMM')
+                            @if(count($unstampedRMM[$k]))
+                                <div moe relative>
+                                    <a href="#" start show class="pro-stamp-all">
+                                        Stamp All
+                                    </a>
+                                    <form url="/api/measurement/bulkStamp" class="width-300px">
+                                        <input type="hidden" name="clientUid" value="{{$patient->uid}}">
+                                        <input type="hidden" class="measurements-uids" value="{{implode('|', $unstampedRMM[$k])}}">
+                                        <p class="mb-2 font-weight-bold">Stamp all measurements?</p>
+                                        <?php
+                                        $dayTotalMinutes = 0;
+                                        foreach($m->entries as $entry) {
+                                            $dayTotalMinutes += round($entry->time_in_seconds / 60);
+                                        }
+                                        $autoCheckEntry = false;
+                                        $autoCheckEntry = ($dayTotalMinutes < 2 && $patient->is_enrolled_in_rm);
+                                        ?>
+                                        <div class="p-2 border border-info bg-light mb-2">
                                             <div class="mb-2">
-                                                <label class="mb-1 text-secondary text-sm">Date</label>
-                                                <input type="date" class="form-control form-control-sm w-100"
-                                                       name="entryDate"
-                                                       value="{{date('Y-m-d', strtotime($k))}}">
+                                                <label class="mb-1 text-secondary text-sm">Memo</label>
+                                                <textarea class="form-control form-control-sm" name="entryMemo"></textarea>
                                             </div>
-                                            <!--<div class="">
-                                                <label class="mb-0 d-flex align-items-baseline">
-                                                    <input type="checkbox" class="hasAnyoneInteractedWithClientAboutRmOutsideNote mr-2 mt-1">
-                                                    <span>Has anyone interacted with client about rm outside note?</span>
+                                            <div class="">
+                                                <label class="mb-0 d-flex align-items-center">
+                                                    <input type="checkbox" class="shouldAddEntry mr-2 my-0" {{$autoCheckEntry ? 'checked' : ''}}>
+                                                    <span>Add Time Entry</span>
                                                 </label>
-                                            </div>-->
+                                            </div>
+                                            <div class="if-adding-time-entry pt-2 d-none">
+                                                <div class="mb-2">
+                                                    <label class="mb-1 text-secondary text-sm">Seconds</label>
+                                                    <input type="number" min="75" max="300"
+                                                           class="form-control form-control-sm w-100" name="entryNumberOfSeconds"
+                                                           value="75" placeholder="Time (secs.)">
+                                                </div>
+                                                <div class="mb-2">
+                                                    <label class="mb-1 text-secondary text-sm">Date</label>
+                                                    <input type="date" class="form-control form-control-sm w-100"
+                                                           name="entryDate"
+                                                           value="{{date('Y-m-d', strtotime($k))}}">
+                                                </div>
+                                            </div>
                                         </div>
-                                    </div>
-                                    <div class="form-group m-0">
-                                        <button type="button" class="btn btn-primary btn-sm mr-2 btn-bulk-stamp">Submit</button>
-                                        <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
-                                    </div>
-                                </form>
-                            </div>
-                        @else
-                            <span class="text-secondary text-sm d-flex align-items-center">
-                                <i class="fa fa-check mr-2"></i>
-                                <span>All Stamped</span>
-                            </span>
+                                        <div class="form-group m-0">
+                                            <button type="button" class="btn btn-primary btn-sm mr-2 btn-bulk-stamp">Submit</button>
+                                            <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                            @else
+                                <span class="text-secondary text-sm d-flex align-items-center">
+                                    <i class="fa fa-check mr-2"></i>
+                                    <span>All Stamped</span>
+                                </span>
+                            @endif
                         @endif
-                    @endif
-                </td>
-                <td rowspan="{{count($days[$k])}}" class="px-2">
-                    @foreach($m->entries as $entry)
-                        <div class="my-1 d-flex align-items-baseline flex-nowrap">
-                            <b class="mr-2">{{round($entry->time_in_seconds / 60)}}m {{round($entry->time_in_seconds % 60)}}s</b>
-                            <span class="text-secondary mr-2 text-nowrap text-sm">({{friendly_date_time($entry->created_at)}})</span>
-                            <span class="text-secondary inline-html-container flex-grow-1">{!! $entry->content_text !!}</span>
-                        </div>
-                        @if($pro->pro_type === 'ADMIN')
-                            <div class="mt-1">
-                                <span class="text-secondary">Pro: </span>
-                                {{$entry->pro ? $entry->pro->displayName() : '-'}}
+                    </td>
+                    <td rowspan="{{count($days[$k])}}" class="px-2">
+                        @foreach($m->entries as $entry)
+                            <div class="my-1 d-flex align-items-baseline flex-nowrap">
+                                <b class="mr-2">{{round($entry->time_in_seconds / 60)}}m {{round($entry->time_in_seconds % 60)}}s</b>
+                                <span class="text-secondary mr-2 text-nowrap text-sm">({{friendly_date_time($entry->created_at)}})</span>
+                                <span class="text-secondary inline-html-container flex-grow-1">{!! $entry->content_text !!}</span>
                             </div>
-                        @endif
-                    @endforeach
-                    @if($performerRole === 'MCP' || $performerRole === 'NON-HCP')
-                        <div moe large relative>
-                            <a start show class="py-0 mb-3 text-sm">+ Add</a>
-                            <form url="/api/careMonthEntry/createForRm" right>
-                                <input type="hidden" name="careMonthUid" value="{{ $careMonth->uid }}">
-                                <div class="mb-2">
-                                    <div class="row">
-                                        <div class="col-4 pr-0">
-                                            <select class="form-control form-control-sm w-100" name="proUid" provider-search data-pro-uid="{{ @$pro->uid }}"
-                                                    required>
-                                                <option value="">-- Select Pro --</option>
-                                            </select>
-                                        </div>
-                                        <div class="col-4 pr-0">
-                                            <?php
-                                            $sD = strtotime($careMonth->start_date);
-                                            $y = date('Y', $sD);
-                                            $m0 = date('m', $sD);
-                                            $d = date('t', $sD);
-                                            $yCurrent = date('Y');
-                                            $mCurrent = date('m');
-                                            ?>
-                                            <input autofocus type="date" min="{{ date($y . '-' . $m0 . '-01') }}" max="{{ date($y . '-' . $m0 . '-' . $d) }}"
-                                                   value="{{$m->dateYMD}}"
-                                                   class="form-control form-control-sm w-100" name="effectiveDate"
-                                                   placeholder="Effective Date" required>
-                                        </div>
-                                        <div class="col-4">
-                                            <input type="number" min="0" max="15" class="form-control form-control-sm w-100 cm-time-value" name="timeInSeconds"
-                                                   value="75" placeholder="Time (secs.)" required>
+                            @if($pro->pro_type === 'ADMIN')
+                                <div class="mt-1">
+                                    <span class="text-secondary">Pro: </span>
+                                    {{$entry->pro ? $entry->pro->displayName() : '-'}}
+                                </div>
+                            @endif
+                        @endforeach
+                        @if($performerRole === 'MCP' || $performerRole === 'RMM')
+                            <div moe large relative>
+                                <a start show class="py-0 mb-3 text-sm">+ Add</a>
+                                <form url="/api/careMonthEntry/createForRm" right>
+                                    <input type="hidden" name="careMonthUid" value="{{ $careMonth->uid }}">
+                                    <input type="hidden" name="proUid" value="{{ $pro->uid }}">
+                                    <div class="mb-2">
+                                        <div class="row">
+                                            <div class="col-6 pr-0">
+                                                <?php
+                                                $sD = strtotime($careMonth->start_date);
+                                                $y = date('Y', $sD);
+                                                $m0 = date('m', $sD);
+                                                $d = date('t', $sD);
+                                                $yCurrent = date('Y');
+                                                $mCurrent = date('m');
+                                                ?>
+                                                <input autofocus type="date" min="{{ date($y . '-' . $m0 . '-01') }}" max="{{ date($y . '-' . $m0 . '-' . $d) }}"
+                                                       value="{{$m->dateYMD}}"
+                                                       class="form-control form-control-sm w-100" name="effectiveDate"
+                                                       placeholder="Effective Date" required>
+                                            </div>
+                                            <div class="col-6">
+                                                <input type="number" min="0" max="15" class="form-control form-control-sm w-100 cm-time-value" name="timeInSeconds"
+                                                       value="75" placeholder="Time (secs.)" required>
+                                            </div>
                                         </div>
                                     </div>
-                                </div>
-                                <div class="mb-2">
-                                    <div class="row">
-                                        <div class="col-12">
-                                            <div cm-rte data-content="Reviewed/managed patient measurements" data-name="contentText"></div>
+                                    <div class="mb-2">
+                                        <div class="row">
+                                            <div class="col-12">
+                                                <div cm-rte data-content="Reviewed/managed patient measurements" data-name="contentText"></div>
+                                            </div>
                                         </div>
                                     </div>
-                                </div>
-                                <div class="d-flex align-items-center">
-                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                </div>
-                            </form>
-                        </div>
-                    @endif
-                </td>
-            @endif
-        </tr>
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                        @endif
+                    </td>
+                @endif
+            </tr>
+            @endforeach
         @endforeach
-    @endforeach
-    </tbody>
-</table>
-<div class="my-3 borde d-none cm-tab cm-tab" tab-key="measurements-graph">
-    @include('app.patient.care-month._vitals_graph')
-</div>
-<div class="my-3 border p-3 d-none cm-tab" tab-key="bmi-summary">
-    <div class="d-flex align-items-baseline mb-2">
-        <b>BMI/Weight Management</b>
-        <span class="mx-2 text-secondary">|</span>
-        @include('app.patient.vitals-settings.bmi-management-form')
-    </div>
-    @include('app.patient.vitals-settings.bmi-management-summary')
-</div>
-<div class="my-3 border p-3 d-none cm-tab" tab-key="bp-summary">
-    <div class="d-flex align-items-baseline mb-2">
-        <b>BP Management</b>
-        <span class="mx-2 text-secondary">|</span>
-        @include('app.patient.vitals-settings.bp-management-form')
+        </tbody>
+    </table>
+
+    <div class="my-3 borde d-none cm-tab cm-tab" tab-key="measurements-graph">
+        @include('app.patient.care-month._vitals_graph')
     </div>
-    @include('app.patient.vitals-settings.bp-management-summary')
-</div>
+
+    @if($performerRole === 'MCP' || $performerRole === 'ADMIN')
+        <div class="my-3 border p-3 d-none cm-tab" tab-key="bmi-summary">
+            <div class="d-flex align-items-baseline mb-2">
+                <b>BMI/Weight Management</b>
+                <span class="mx-2 text-secondary">|</span>
+                @include('app.patient.vitals-settings.bmi-management-form')
+            </div>
+            @include('app.patient.vitals-settings.bmi-management-summary')
+        </div>
+
+        <div class="my-3 border p-3 d-none cm-tab" tab-key="bp-summary">
+            <div class="d-flex align-items-baseline mb-2">
+                <b>BP Management</b>
+                <span class="mx-2 text-secondary">|</span>
+                @include('app.patient.vitals-settings.bp-management-form')
+            </div>
+            @include('app.patient.vitals-settings.bp-management-summary')
+        </div>
+    @endif
 </div>
 <script>
     (function() {
@@ -482,8 +478,7 @@ $days = $daysWithUnstamped;
                         shouldAddEntry: form.find('.shouldAddEntry').prop('checked') ? 1 : 0,
                         entryDate: form.find('[name="entryDate"]').val(),
                         entryMemo: form.find('[name="entryMemo"]').val(),
-                        entryNumberOfSeconds: form.find('[name="entryNumberOfSeconds"]').val() ? +(form.find('[name="entryNumberOfSeconds"]').val()) : 0,
-                        hasAnyoneInteractedWithClientAboutRmOutsideNote: form.find('.hasAnyoneInteractedWithClientAboutRmOutsideNote').prop('checked') ? 1 : 0,
+                        entryNumberOfSeconds: form.find('[name="entryNumberOfSeconds"]').val() ? +(form.find('[name="entryNumberOfSeconds"]').val()) : 0
                     }
 
                     $.ajax({
@@ -525,12 +520,14 @@ $days = $daysWithUnstamped;
             let currentStampAllRow = null;
 
             function autoClickNextFirstAll() {
-                let link = $('#rpm-work-matrix .mcp-stamp-all').first();
-                if(link.length) {
-                    currentStampAllRow = link.closest('tr');
-                    $('#rpm-work-matrix tr[data-day="' + currentStampAllRow.attr('data-day') + '"]').addClass('bg-warning-mellow');
-                    link.trigger('click');
-                }
+                @if($performerRole === 'MCP' || $performerRole === 'RMM')
+                    let link = $('#rpm-work-matrix .pro-stamp-all').first();
+                    if(link.length) {
+                        currentStampAllRow = link.closest('tr');
+                        $('#rpm-work-matrix tr[data-day="' + currentStampAllRow.attr('data-day') + '"]').addClass('bg-warning-mellow');
+                        link.trigger('click');
+                    }
+                @endif
             }
 
             runMCInitializer('vitalsGraph');

+ 129 - 113
resources/views/app/practice-management/remote-monitoring.blade.php

@@ -19,7 +19,7 @@
                 $m = +$mStr;
                 $y = +$yStr;
                 ?>
-                <a href="{{ route('mcp.rpm_work_matrix') }}?m={{$mStr}}&y={{$yStr}}"
+                <a href="{{ route('practice-management.rpm_work_matrix') }}?m={{$mStr}}&y={{$yStr}}"
                    native target="_blank"
                    open-in-stag-popup
                    update-parent
@@ -60,41 +60,7 @@
 
             <div class="card-body p-0">
                 <div class="d-flex align-items-start m-0">
-                    {{--<div class="p-0">
-                        @include('app.practice-management.remote-monitoring-tree')
-                    </div>--}}
                     <div class="flex-grow-1 p-0">
-                        @if($rc == 4)
-                            <?php $rc2 = request()->input('rc2') ? request()->input('rc2') : 2; ?>
-                            <div class="d-flex align-items-baseline p-2 border-bottom">
-                                <a href="{{route('practice-management.remote-monitoring')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=4&rc2=1" class="border p-2 mr-2 {{$rc2 == 1 ? 'bg-aliceblue font-weight-bold' : ''}}" >Patients I have not seen in over 90 days</a>
-                                <a href="{{route('practice-management.remote-monitoring')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=4&rc2=2" class="border p-2 mr-2 {{$rc2 == 2 ? 'bg-aliceblue font-weight-bold' : ''}}" >Patients I have seen w/in last 90 days</a>
-                            </div>
-                        @elseif($rc == 5)
-                            <?php $rc2 = request()->input('rc2') ? request()->input('rc2') : 2; ?>
-                            <div class="d-flex align-items-baseline p-2 border-bottom">
-                                <a href="{{route('practice-management.remote-monitoring')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=5&rc2=1" class="border p-2 mr-2 {{$rc2 == 1 ? 'bg-aliceblue font-weight-bold' : ''}}" >Patients I have not spoken to this month</a>
-                                <a href="{{route('practice-management.remote-monitoring')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=5&rc2=2" class="border p-2 mr-2 {{$rc2 == 2 ? 'bg-aliceblue font-weight-bold' : ''}}" >Patients I have spoken to this month</a>
-                            </div>
-                        @elseif($rc == 6)
-                            <?php $rc2 = request()->input('rc2') ? request()->input('rc2') : 2; ?>
-                            <div class="d-flex align-items-baseline p-2 border-bottom">
-                                <a href="{{route('practice-management.remote-monitoring')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=6&rc2=1" class="border p-2 mr-2 {{$rc2 == 1 ? 'bg-aliceblue font-weight-bold' : ''}}" >Unstamped Measurements > 0</a>
-                                <a href="{{route('practice-management.remote-monitoring')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=6&rc2=2" class="border p-2 mr-2 {{$rc2 == 2 ? 'bg-aliceblue font-weight-bold' : ''}}" >All Measurements Stamped</a>
-                            </div>
-                        @elseif($rc == 7)
-                            <?php $rc2 = request()->input('rc2') ? request()->input('rc2') : 2; ?>
-                            <div class="d-flex align-items-baseline p-2 border-bottom">
-                                <a href="{{route('practice-management.remote-monitoring')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=7&rc2=1" class="border p-2 mr-2 {{$rc2 == 1 ? 'bg-aliceblue font-weight-bold' : ''}}" >Measurement Days < 16</a>
-                                <a href="{{route('practice-management.remote-monitoring')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=7&rc2=2" class="border p-2 mr-2 {{$rc2 == 2 ? 'bg-aliceblue font-weight-bold' : ''}}" >Measurement Days >= 16</a>
-                            </div>
-                        @elseif($rc == 10)
-                            <?php $rc2 = request()->input('rc2') ? request()->input('rc2') : 2; ?>
-                            <div class="d-flex align-items-baseline p-2 border-bottom">
-                                <a href="{{route('practice-management.remote-monitoring')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=10&rc2=1" class="border p-2 mr-2 {{$rc2 == 1 ? 'bg-aliceblue font-weight-bold' : ''}}" >Billing Minutes < 20</a>
-                                <a href="{{route('practice-management.remote-monitoring')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=10&rc2=2" class="border p-2 mr-2 {{$rc2 == 2 ? 'bg-aliceblue font-weight-bold' : ''}}" >Billing Minutes >= 20</a>
-                            </div>
-                        @endif
                         <table class="table table-sm table-striped table-hover p-0 m-0">
                             <thead class="bg-light">
                             <tr>
@@ -126,6 +92,16 @@
                                 }
                                 $lastVisitWithin90Days = ($daysDiff !== -1 && $daysDiff <= 90);
 
+                                $careMonth = \App\Models\CareMonth::where('uid', $iPatient->care_month_uid)->first();
+                                $performerRole = false;
+                                if ($pro->pro_type === 'ADMIN') {
+                                    $performerRole = 'ADMIN';
+                                } else if ($careMonth->mcp_pro_id === $pro->id) {
+                                    $performerRole = 'MCP';
+                                } else if ($careMonth->rmm_pro_id === $pro->id) {
+                                    $performerRole = 'RMM';
+                                }
+
                                 ?>
                                 <tr>
                                     <td class="pl-2">
@@ -161,64 +137,65 @@
                                         <div class="d-flex align-items-baseline">
                                             <i class="mr-1 text-sm fa {{$iPatient->has_mcp_interacted_with_client_about_rm ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
                                             <span>{{$iPatient->has_mcp_interacted_with_client_about_rm ? 'Yes' : 'No'}}</span>
-                                            <div moe large relative class="ml-2">
-                                                <a start show class="py-0 mb-3 text-sm">Edit</a>
-                                                <form url="/api/careMonthEntry/createForRm" right>
-                                                    <input type="hidden" name="careMonthUid" value="{{ $iPatient->care_month_uid }}">
-                                                    <input type="hidden" name="proUid" value="{{ $pro->uid }}">
-                                                    <div class="mb-2">
-                                                        <div class="row">
-                                                            <div class="col-6 pr-0">
-                                                                <?php
-                                                                $sD = strtotime($rcmStartDate);
-                                                                $y = date('Y', $sD);
-                                                                $m0 = date('m', $sD);
-                                                                $d = date('t', $sD);
-                                                                $defaultED = $sD >= strtotime(date('Y-m-d')) ? date('Y-m-d') : $rcmStartDate;
-                                                                ?>
-                                                                <label class="text-sm text-secondary mb-1">Effective Date</label>
-                                                                <input autofocus type="date" min="{{ date($y . '-' . $m0 . '-01') }}" max="{{ date($y . '-' . $m0 . '-' . $d) }}"
-                                                                       value="{{$defaultED}}"
-                                                                       class="form-control form-control-sm w-100" name="effectiveDate"
-                                                                       placeholder="Effective Date" required>
-                                                            </div>
-                                                            <div class="col-6">
-                                                                <label class="text-sm text-secondary mb-1">Seconds</label>
-                                                                <input type="number" min="75" max="300" class="form-control form-control-sm w-100 cm-time-value" name="timeInSeconds"
-                                                                       value="75" placeholder="Time (seconds.)" required>
+                                            @if($performerRole === 'MCP')
+                                                <div moe large relative class="ml-2">
+                                                    <a start show class="py-0 mb-3 text-sm">Edit</a>
+                                                    <form url="/api/careMonthEntry/createForRm" right>
+                                                        <input type="hidden" name="careMonthUid" value="{{ $iPatient->care_month_uid }}">
+                                                        <input type="hidden" name="proUid" value="{{ $pro->uid }}">
+                                                        <div class="mb-2">
+                                                            <div class="row">
+                                                                <div class="col-6 pr-0">
+                                                                    <?php
+                                                                    $sD = strtotime($rcmStartDate);
+                                                                    $y = date('Y', $sD);
+                                                                    $m0 = date('m', $sD);
+                                                                    $d = date('t', $sD);
+                                                                    $defaultED = $sD >= strtotime(date('Y-m-d')) ? date('Y-m-d') : $rcmStartDate;
+                                                                    ?>
+                                                                    <label class="text-sm text-secondary mb-1">Effective Date</label>
+                                                                    <input autofocus type="date" min="{{ date($y . '-' . $m0 . '-01') }}" max="{{ date($y . '-' . $m0 . '-' . $d) }}"
+                                                                           value="{{$defaultED}}"
+                                                                           class="form-control form-control-sm w-100" name="effectiveDate"
+                                                                           placeholder="Effective Date" required>
+                                                                </div>
+                                                                <div class="col-6">
+                                                                    <label class="text-sm text-secondary mb-1">Seconds</label>
+                                                                    <input type="number" min="75" max="300" class="form-control form-control-sm w-100 cm-time-value" name="timeInSeconds"
+                                                                           value="75" placeholder="Time (seconds.)" required>
+                                                                </div>
                                                             </div>
                                                         </div>
-                                                    </div>
-                                                    <div class="mb-2 border border-info p-2 mt-2 bg-light">
-                                                        <span>I have had interactive communication with <b>{{$iPatient->client_name}}</b> during this care month.</span>
-                                                        <div class="d-flex border-top mt-2">
-                                                            <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
-                                                                <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="true" required>
-                                                                <span>Yes</span>
-                                                            </label>
-                                                            <label class="mt-2 mb-0 d-inline-flex align-items-center">
-                                                                <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="false" required>
-                                                                <span>No</span>
-                                                            </label>
+                                                        <div class="mb-2 border border-info p-2 mt-2 bg-light">
+                                                            <span>I have had interactive communication with <b>{{$iPatient->client_name}}</b> during this care month.</span>
+                                                            <div class="d-flex border-top mt-2">
+                                                                <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
+                                                                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="true" required>
+                                                                    <span>Yes</span>
+                                                                </label>
+                                                                <label class="mt-2 mb-0 d-inline-flex align-items-center">
+                                                                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="false" required>
+                                                                    <span>No</span>
+                                                                </label>
+                                                            </div>
                                                         </div>
-                                                    </div>
-                                                    <div class="mb-2">
-                                                        <div class="row">
-                                                            <div class="col-12">
-                                                                <div cm-rte data-content="Interacted with the patient" data-name="contentText"></div>
+                                                        <div class="mb-2">
+                                                            <div class="row">
+                                                                <div class="col-12">
+                                                                    <div cm-rte data-content="Interacted with the patient" data-name="contentText"></div>
+                                                                </div>
                                                             </div>
                                                         </div>
-                                                    </div>
-                                                    <div class="d-flex align-items-center">
-                                                        <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                                    </div>
-                                                </form>
-                                            </div>
-
+                                                        <div class="d-flex align-items-center">
+                                                            <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                                        </div>
+                                                    </form>
+                                                </div>
+                                            @endif
                                         </div>
                                         @if(!$iPatient->has_mcp_interacted_with_client_about_rm)
-                                            <div class="text-sm font-italic text-secondary">Not interacted this month!</div>
+                                            <div class="text-sm font-italic text-secondary">{{$performerRole === 'MCP' ? 'Not' : "MCP hasn't"}} interacted this month!</div>
                                         @endif
                                     </td>
                                     <td>
@@ -252,40 +229,79 @@
                                     </td>
                                     <td>
                                         <div class="d-flex align-items-baseline">
-                                            <span>{{$iPatient->rm_num_measurements_not_stamped_by_mcp}}</span>
-                                            @if($iPatient->rm_num_measurements_not_stamped_by_mcp)
-                                                <a href="{{ route('mcp.rpm_work_matrix') }}?patientUid={{$iPatient->client_uid}}&careMonthUid={{$iPatient->care_month_uid}}"
-                                                   native target="_blank"
-                                                   open-in-stag-popup
-                                                   update-parent
-                                                   popup-style="tall overflow-visible"
-                                                   class="ml-2 text-sm"
-                                                   mc-initer="rpm-work-matrix"
-                                                   title="RPM Work Matrix">
-                                                    View
-                                                </a>
+                                            @if($performerRole === 'MCP')
+                                                <span>{{$iPatient->rm_num_measurements_not_stamped_by_mcp}}</span>
+                                                @if($iPatient->rm_num_measurements_not_stamped_by_mcp)
+                                                    <a href="{{ route('practice-management.rpm_work_matrix') }}?patientUid={{$iPatient->client_uid}}&careMonthUid={{$iPatient->care_month_uid}}"
+                                                       native target="_blank"
+                                                       open-in-stag-popup
+                                                       update-parent
+                                                       popup-style="tall overflow-visible"
+                                                       class="ml-2 text-sm"
+                                                       mc-initer="rpm-work-matrix"
+                                                       title="RPM Work Matrix">
+                                                        View
+                                                    </a>
+                                                @endif
+                                            @elseif($performerRole === 'RMM')
+                                                <span>{{$iPatient->rm_num_measurements_not_stamped_by_rmm}}</span>
+                                                @if($iPatient->rm_num_measurements_not_stamped_by_rmm)
+                                                    <a href="{{ route('practice-management.rpm_work_matrix') }}?patientUid={{$iPatient->client_uid}}&careMonthUid={{$iPatient->care_month_uid}}"
+                                                       native target="_blank"
+                                                       open-in-stag-popup
+                                                       update-parent
+                                                       popup-style="tall overflow-visible"
+                                                       class="ml-2 text-sm"
+                                                       mc-initer="rpm-work-matrix"
+                                                       title="RPM Work Matrix">
+                                                        View
+                                                    </a>
+                                                @endif
                                             @endif
                                         </div>
                                     </td>
                                     <td>
-                                        <div class="d-flex align-items-baseline">
-                                            <i class="mr-1 text-sm fa {{$iPatient->rm_total_time_in_seconds_by_mcp >= 1200 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
-                                            <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_mcp / 60)}}m {{round($iPatient->rm_total_time_in_seconds_by_mcp % 60)}}s</span>
-                                        </div>
-                                        @if($iPatient->rm_total_time_in_seconds_by_mcp < 1200)
-                                            <div class="text-sm font-italic text-secondary">Entry mins. < 20</div>
+                                        @if($performerRole === 'MCP')
+                                            <div class="d-flex align-items-baseline">
+                                                <i class="mr-1 text-sm fa {{$iPatient->rm_total_time_in_seconds_by_mcp >= 1200 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
+                                                <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_mcp / 60)}}m {{round($iPatient->rm_total_time_in_seconds_by_mcp % 60)}}s</span>
+                                            </div>
+                                            @if($iPatient->rm_total_time_in_seconds_by_mcp < 1200)
+                                                <div class="text-sm font-italic text-secondary">Entry mins. < 20</div>
+                                            @endif
+                                        @elseif($performerRole === 'RMM')
+                                            <div class="d-flex align-items-baseline">
+                                                <i class="mr-1 text-sm fa {{$iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
+                                                <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_rmm_pro / 60)}}m {{round($iPatient->rm_total_time_in_seconds_by_rmm_pro % 60)}}s</span>
+                                            </div>
+                                            @if($iPatient->rm_total_time_in_seconds_by_rmm_pro < 1200)
+                                                <div class="text-sm font-italic text-secondary">Entry mins. < 20</div>
+                                            @endif
                                         @endif
                                     </td>
                                     <td>
-                                        @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_mcp >= 1200)
-                                            <span class="text-success font-weight-bold">
-                                                <i class="fa fa-check"></i>
-                                                Yes
-                                            </span>
-                                        @else
-                                            <span class="text-danger font-weight-normal">
-                                                Not yet
-                                            </span>
+                                        @if($performerRole === 'MCP')
+                                            @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_mcp >= 1200)
+                                                <span class="text-success font-weight-bold">
+                                                    <i class="fa fa-check"></i>
+                                                    Yes
+                                                </span>
+                                            @else
+                                                <span class="text-danger font-weight-normal">
+                                                    Not yet
+                                                </span>
+                                            @endif
+                                        @elseif($performerRole === 'RMM')
+                                            @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200)
+                                                <span class="text-success font-weight-bold">
+                                                    <i class="fa fa-check"></i>
+                                                    Yes
+                                                </span>
+                                            @else
+                                                <span class="text-danger font-weight-normal">
+                                                    Not yet
+                                                </span>
+                                            @endif
                                         @endif
                                     </td>
                                 </tr>

+ 0 - 0
resources/views/app/mcp/rpm_work_matrix.blade.php → resources/views/app/practice-management/rpm_work_matrix.blade.php


+ 3 - 3
routes/web.php

@@ -108,9 +108,6 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('measurements-pending-stamping', 'McpController@measurements_pending_stamping')->name('measurements_pending_stamping');
         Route::get('measurements-pending-stamping-in-care-month', 'McpController@measurements_pending_stamping_in_care_month')->name('measurements_pending_stamping_in_care_month');
 
-        // rpm work matrix - latest patient with unstamped measurements
-        Route::get('rpm-work-matrix', 'McpController@rpm_work_matrix')->name('rpm_work_matrix');
-
         Route::get('measurements-mass-stamping', 'McpController@measurements_mass_stamping')->name('measurements_mass_stamping');
 
     });
@@ -220,6 +217,9 @@ Route::middleware('pro.auth')->group(function () {
 
         Route::get('rpm-matrix', 'PracticeManagementController@rpmMatrix')->name('rpmMatrix');
 
+        // rpm work matrix - latest patient with unstamped measurements
+        Route::get('rpm-work-matrix', 'PracticeManagementController@rpm_work_matrix')->name('rpm_work_matrix');
+
         Route::get('rates/{selectedProUid?}', 'PracticeManagementController@rates')->name('rates');
         Route::get('dashboard', 'PracticeManagementController@dashboard')->name('dashboard');
         Route::get('previous-bills', 'PracticeManagementController@previousBills')->name('previousBills');