Bläddra i källkod

RPM matrix - last-visit-date logic update

Vijayakrishnan 3 år sedan
förälder
incheckning
abb7879eaa

+ 24 - 2
app/Http/Controllers/PracticeManagementController.php

@@ -1046,7 +1046,9 @@ SELECT client.name_first, client.name_last,
        client.is_enrolled_in_rm,
        client.most_recent_completed_mcp_note_date,
        client.most_recent_completed_mcp_note_id,
-       mrnote.uid as most_recent_completed_mcp_note_uid,
+       mrmnote.effective_dateest::date as most_recent_completed_mcp_note_date_cm,
+       mrmnote.id as most_recent_completed_mcp_note_id_cm,
+       mrmnote.uid as most_recent_completed_mcp_note_uid_cm,
        client.cell_number,
        client.is_assigned_cellular_bp_device,
        client.is_assigned_cellular_weight_scale_device,
@@ -1074,6 +1076,15 @@ SELECT client.name_first, client.name_last,
        client.most_recent_cellular_weight_value,
        client.most_recent_cellular_weight_measurement_at
 FROM care_month join client on care_month.client_id = client.id join note mrnote on client.most_recent_completed_mcp_note_id = mrnote.id
+     left join note mrmnote on mrmnote.id = (
+        select max(n.id) from note n 
+        where 
+              n.client_id = client.id AND 
+              n.is_cancelled = FALSE AND
+              (n.is_signed_by_hcp IS NOT NULL AND n.is_signed_by_hcp = TRUE) AND
+              n.effective_dateest::date >= care_month.start_date::date AND 
+              n.effective_dateest::date < (care_month.start_date::date + INTERVAL '1 month')
+     )
 WHERE
       (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())') . "
@@ -1103,7 +1114,9 @@ SELECT client.name_first, client.name_last,
        client.is_enrolled_in_rm,
        client.most_recent_completed_mcp_note_date,
        client.most_recent_completed_mcp_note_id,
-       mrnote.uid as most_recent_completed_mcp_note_uid,
+       mrmnote.effective_dateest::date as most_recent_completed_mcp_note_date_cm,
+       mrmnote.id as most_recent_completed_mcp_note_id_cm,
+       mrmnote.uid as most_recent_completed_mcp_note_uid_cm,
        client.cell_number,
        client.is_assigned_cellular_bp_device,
        client.is_assigned_cellular_weight_scale_device,
@@ -1131,6 +1144,15 @@ SELECT client.name_first, client.name_last,
        client.most_recent_cellular_weight_value,
        client.most_recent_cellular_weight_measurement_at
 FROM care_month join client on care_month.client_id = client.id join note mrnote on client.most_recent_completed_mcp_note_id = mrnote.id
+     left join note mrmnote on mrmnote.id = (
+        select max(n.id) from note n 
+        where 
+              n.client_id = client.id AND 
+              n.is_cancelled = FALSE AND
+              (n.is_signed_by_hcp IS NOT NULL AND n.is_signed_by_hcp = TRUE) AND
+              n.effective_dateest::date >= care_month.start_date::date AND 
+              n.effective_dateest::date < (care_month.start_date::date + INTERVAL '1 month')
+     )
 WHERE care_month.uid = '{$careMonthUid}' AND client.uid = '{$clientUid}'
 ";
 

+ 1 - 1
config/app.php

@@ -65,7 +65,7 @@ return [
 
     'hrm2_url' => env('HRM2_URL'),
 
-    'asset_version' => 54,
+    'asset_version' => 55,
 
     'temp_dir' => env('TEMP_DIR'),
 

+ 2 - 3
public/css/style.css

@@ -3073,10 +3073,9 @@ body.forced-masking #mask {
     position: absolute;
     bottom: 100%;
     left: 0;
-    width: 100%;
     background: #f7f7f7;
-    border-top: 1px solid #d7d7d7;
-    border-bottom: 1px solid #d7d7d7;
+    border: 1px solid #d7d7d7;
+    border-left: 0;
     color: #888;
     text-align: center;
     font-size: 80%;

+ 223 - 0
resources/views/app/practice-management/remote-monitoring-row-markup.blade.php

@@ -0,0 +1,223 @@
+<tr data-client-uid="{{$iPatient->client_uid}}" data-care-month-uid="{{$iPatient->care_month_uid}}">
+    <td class="pl-2">
+        <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}" class="text-nowrap"
+           native target="_blank"
+           open-in-stag-popup
+           update-parent="refresh-rpm-row-{{$trIndex}}"
+           popup-style="tall overflow-visible"
+           mc-initer="care-month-dashboard-{{$iPatient->client_uid}}"
+           title="{{$iPatient->client_name}}"
+        ><span class="sort-data">{{ $iPatient->client_name }}</span></a>
+    </td>
+
+    <td>{{friendly_date($iPatient->dob)}}</td>
+    <td>{!! $iPatient->is_enrolled_in_rm === 'YES' ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
+    <td>{!! $iPatient->is_assigned_cellular_bp_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
+    <td>{!! $iPatient->is_assigned_cellular_weight_scale_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
+    <td>
+        <div class="text-nowrap">
+            <span class="sort-data">{{$iPatient->most_recent_cellular_bp_sbp_mm_hg ?: '-'}}</span>/{{$iPatient->most_recent_cellular_bp_dbp_mm_hg ?: '-'}}
+            @if($iPatient->most_recent_cellular_bp_measurement_at)
+                <span class="text-sm text-secondary text-nowrap ml-1"
+                      title="{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}">({{friendly_date($iPatient->most_recent_cellular_bp_measurement_at)}})</span>
+            @endif
+        </div>
+    </td>
+    <td>
+        <div class="text-nowrap">
+            <span class="sort-data">{{$iPatient->most_recent_cellular_weight_value ? round($iPatient->most_recent_cellular_weight_value, 1) : '-'}}</span>
+            @if($iPatient->most_recent_cellular_weight_measurement_at)
+                <span class="text-sm text-secondary text-nowrap ml-1"
+                      title="{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}">({{friendly_date($iPatient->most_recent_cellular_weight_measurement_at)}})</span>
+            @endif
+        </div>
+    </td>
+    <td>
+        <div class="d-flex align-items-baseline">
+            @if($iPatient->most_recent_completed_mcp_note_uid_cm)
+                <a href = "/patients/view/{{$iPatient->client_uid}}/notes/view/{{$iPatient->most_recent_completed_mcp_note_uid_cm}}">
+                    <span class="sort-data">{{$iPatient->most_recent_completed_mcp_note_date_cm ? friendly_date($iPatient->most_recent_completed_mcp_note_date_cm) : '-'}}</span>
+                </a>
+            @else
+                <span class="sort-data">-</span>
+            @endif
+        </div>
+    </td>
+    <td>
+        <div class="d-flex align-items-baseline">
+            <i class="mr-1 text-sm fa {{$lastVisitWithin90Days ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
+            <span class="sort-data">{{$daysDiff !== -1 ? $daysDiff : '-'}}</span>
+        </div>
+    </td>
+    <td>
+        <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>
+            @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 hook="refresh-rpm-row-{{$trIndex}}">
+                        <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 (secs.)" required>
+                                </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>.</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 class="mb-2">
+                            <label class="text-sm text-secondary mb-1">Memo</label>
+                            <textarea class="form-control form-control-sm w-100" name="contentText"
+                                      required>Interacted with the patient</textarea>
+                        </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">{{$performerRole === 'MCP' ? 'Not' : "MCP hasn't"}} interacted this month!</div>
+        @endif--}}
+    </td>
+    <td>
+        <div class="d-flex align-items-baseline">
+            <i class="mr-1 text-sm fa {{$iPatient->number_of_days_with_remote_measurements >= 16 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
+            <span class="sort-data">{{$iPatient->number_of_days_with_remote_measurements ?: 0}}</span>
+            @if($iPatient->number_of_days_with_remote_measurements < 16)
+                <div moe relative class="ml-2">
+                    <a href="#" start show class="text-sm">SMS</a>
+                    <form url="/api/clientSms/createOutgoing" right="" class="mcp-theme-1" noreload="" style="display: none;">
+                        <input type="hidden" name="uid" value="{{ $iPatient->client_uid }}">
+                        <div class="mb-2">
+                            <label for="" class="text-sm text-secondary mb-1">Cell Number</label>
+                            <input type="text" class="form-control form-control-sm" name="cellNumber" value="{{$iPatient->cell_number}}">
+                        </div>
+                        <div class="mb-2">
+                            <label for="" class="text-sm text-secondary mb-1">Message</label>
+                            <textarea rows="5" class="form-control form-control-sm" name="message">Hi! This is {{$pro->displayName(true)}}, from Cardio 1st. Please check your blood pressure.</textarea>
+                        </div>
+                        <div class="d-flex align-items-center">
+                            <button class="btn btn-sm btn-primary mr-2" submit="">Send</button>
+                            <button class="btn btn-sm btn-default mr-2 border" cancel="">Cancel</button>
+                        </div>
+                    </form>
+                </div>
+            @endif
+        </div>
+        {{--@if($iPatient->number_of_days_with_remote_measurements < 16)
+            <div class="text-sm font-italic text-secondary">Meas. days < 16</div>
+        @endif--}}
+    </td>
+    <td>
+        <div class="d-flex align-items-baseline">
+            @if($performerRole === 'MCP')
+                <span class="sort-data">{{$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="refresh-rpm-row-{{$trIndex}}"
+                       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 class="sort-data">{{$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="refresh-rpm-row-{{$trIndex}}"
+                       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>
+        @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>
+                <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_mcp}}</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>
+                <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_rmm_pro}}</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($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>

+ 1 - 221
resources/views/app/practice-management/remote-monitoring-row.blade.php

@@ -24,224 +24,4 @@ if ($pro->pro_type === 'ADMIN') {
 }
 
 ?>
-<tr data-client-uid="{{$iPatient->client_uid}}" data-care-month-uid="{{$iPatient->care_month_uid}}">
-    <td class="pl-2">
-        <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}" class="text-nowrap"
-           native target="_blank"
-           open-in-stag-popup
-           update-parent="refresh-rpm-row-{{$trIndex}}"
-           popup-style="tall overflow-visible"
-           mc-initer="care-month-dashboard-{{$iPatient->client_uid}}"
-           title="{{$iPatient->client_name}}"
-        ><span class="sort-data">{{ $iPatient->client_name }}</span></a>
-    </td>
-
-    <td>{{friendly_date($iPatient->dob)}}</td>
-    <td>{!! $iPatient->is_enrolled_in_rm === 'YES' ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
-    <td>{!! $iPatient->is_assigned_cellular_bp_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
-    <td>{!! $iPatient->is_assigned_cellular_weight_scale_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
-    <td>
-        <div class="text-nowrap">
-            <span class="sort-data">{{$iPatient->most_recent_cellular_bp_sbp_mm_hg ?: '-'}}</span>/{{$iPatient->most_recent_cellular_bp_dbp_mm_hg ?: '-'}}
-            @if($iPatient->most_recent_cellular_bp_measurement_at)
-                <span class="text-sm text-secondary text-nowrap ml-1"
-                      title="{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}">({{friendly_date($iPatient->most_recent_cellular_bp_measurement_at)}})</span>
-            @endif
-        </div>
-    </td>
-    <td>
-        <div class="text-nowrap">
-            <span class="sort-data">{{$iPatient->most_recent_cellular_weight_value ? round($iPatient->most_recent_cellular_weight_value, 1) : '-'}}</span>
-            @if($iPatient->most_recent_cellular_weight_measurement_at)
-                <span class="text-sm text-secondary text-nowrap ml-1"
-                      title="{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}">({{friendly_date($iPatient->most_recent_cellular_weight_measurement_at)}})</span>
-            @endif
-        </div>
-    </td>
-    <td>
-        <div class="d-flex align-items-baseline">
-            <i class="mr-1 text-sm fa {{$lastVisitWithin90Days ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
-            @if($iPatient->most_recent_completed_mcp_note_uid)
-                <a href = "/patients/view/{{$iPatient->client_uid}}/notes/view/{{$iPatient->most_recent_completed_mcp_note_uid}}">
-                    <span class="sort-data">{{$iPatient->most_recent_completed_mcp_note_date ? friendly_date($iPatient->most_recent_completed_mcp_note_date) : '-'}}</span>
-                </a>
-            @else
-                <span class="sort-data">-</span>
-            @endif
-        </div>
-        {{--@if(!$lastVisitWithin90Days)
-            <div class="text-sm font-italic text-secondary">No visit in over 90 days</div>
-        @endif--}}
-    </td>
-    <td>
-        <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>
-            @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 hook="refresh-rpm-row-{{$trIndex}}">
-                        <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 (secs.)" required>
-                                </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>.</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 class="mb-2">
-                            <label class="text-sm text-secondary mb-1">Memo</label>
-                            <textarea class="form-control form-control-sm w-100" name="contentText"
-                                      required>Interacted with the patient</textarea>
-                        </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">{{$performerRole === 'MCP' ? 'Not' : "MCP hasn't"}} interacted this month!</div>
-        @endif--}}
-    </td>
-    <td>
-        <div class="d-flex align-items-baseline">
-            <i class="mr-1 text-sm fa {{$iPatient->number_of_days_with_remote_measurements >= 16 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
-            <span class="sort-data">{{$iPatient->number_of_days_with_remote_measurements ?: 0}}</span>
-            @if($iPatient->number_of_days_with_remote_measurements < 16)
-                <div moe relative class="ml-2">
-                    <a href="#" start show class="text-sm">SMS</a>
-                    <form url="/api/clientSms/createOutgoing" right="" class="mcp-theme-1" noreload="" style="display: none;">
-                        <input type="hidden" name="uid" value="{{ $iPatient->client_uid }}">
-                        <div class="mb-2">
-                            <label for="" class="text-sm text-secondary mb-1">Cell Number</label>
-                            <input type="text" class="form-control form-control-sm" name="cellNumber" value="{{$iPatient->cell_number}}">
-                        </div>
-                        <div class="mb-2">
-                            <label for="" class="text-sm text-secondary mb-1">Message</label>
-                            <textarea rows="5" class="form-control form-control-sm" name="message">Hi! This is {{$pro->displayName(true)}}, from Cardio 1st. Please check your blood pressure.</textarea>
-                        </div>
-                        <div class="d-flex align-items-center">
-                            <button class="btn btn-sm btn-primary mr-2" submit="">Send</button>
-                            <button class="btn btn-sm btn-default mr-2 border" cancel="">Cancel</button>
-                        </div>
-                    </form>
-                </div>
-            @endif
-        </div>
-        {{--@if($iPatient->number_of_days_with_remote_measurements < 16)
-            <div class="text-sm font-italic text-secondary">Meas. days < 16</div>
-        @endif--}}
-    </td>
-    <td>
-        <div class="d-flex align-items-baseline">
-            @if($performerRole === 'MCP')
-                <span class="sort-data">{{$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="refresh-rpm-row-{{$trIndex}}"
-                       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 class="sort-data">{{$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="refresh-rpm-row-{{$trIndex}}"
-                       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>
-        @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>
-                <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_mcp}}</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>
-                <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_rmm_pro}}</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($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>
+@include('app.practice-management.remote-monitoring-row-markup')

+ 3 - 222
resources/views/app/practice-management/remote-monitoring.blade.php

@@ -102,6 +102,7 @@
                                 <th class="border-0">Last BP</th>
                                 <th class="border-0">Last Wt</th>
                                 <th class="border-0">Last Visit</th>
+                                <th class="border-0">Days Since Last Visit</th>
                                 <th class="border-0">Interacted?</th>
                                 <th class="border-0">#Meas. Days</th>
                                 <th class="border-0">#Unstamped</th>
@@ -132,227 +133,7 @@
                                 }
 
                                 ?>
-                                <tr data-client-uid="{{$iPatient->client_uid}}" data-care-month-uid="{{$iPatient->care_month_uid}}">
-                                    <td class="pl-2">
-                                        <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}" class="text-nowrap"
-                                           native target="_blank"
-                                           open-in-stag-popup
-                                           update-parent="refresh-rpm-row-{{$trIndex}}"
-                                           popup-style="tall overflow-visible"
-                                           mc-initer="care-month-dashboard-{{$iPatient->client_uid}}"
-                                           title="{{$iPatient->client_name}}"
-                                        ><span class="sort-data">{{ $iPatient->client_name }}</span></a>
-                                    </td>
-
-                                    <td>{{friendly_date($iPatient->dob)}}</td>
-                                    <td>{!! $iPatient->is_enrolled_in_rm === 'YES' ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
-                                    <td>{!! $iPatient->is_assigned_cellular_bp_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
-                                    <td>{!! $iPatient->is_assigned_cellular_weight_scale_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
-                                    <td>
-                                        <div class="text-nowrap">
-                                            <span class="sort-data">{{$iPatient->most_recent_cellular_bp_sbp_mm_hg ?: '-'}}</span>/{{$iPatient->most_recent_cellular_bp_dbp_mm_hg ?: '-'}}
-                                            @if($iPatient->most_recent_cellular_bp_measurement_at)
-                                                <span class="text-sm text-secondary text-nowrap ml-1"
-                                                      title="{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}">({{friendly_date($iPatient->most_recent_cellular_bp_measurement_at)}})</span>
-                                            @endif
-                                        </div>
-                                    </td>
-                                    <td>
-                                        <div class="text-nowrap">
-                                            <span class="sort-data">{{$iPatient->most_recent_cellular_weight_value ? round($iPatient->most_recent_cellular_weight_value, 1) : '-'}}</span>
-                                            @if($iPatient->most_recent_cellular_weight_measurement_at)
-                                                <span class="text-sm text-secondary text-nowrap ml-1"
-                                                      title="{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}">({{friendly_date($iPatient->most_recent_cellular_weight_measurement_at)}})</span>
-                                            @endif
-                                        </div>
-                                    </td>
-                                    <td>
-                                        <div class="d-flex align-items-baseline">
-                                            <i class="mr-1 text-sm fa {{$lastVisitWithin90Days ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
-                                            @if($iPatient->most_recent_completed_mcp_note_uid)
-                                                <a href = "/patients/view/{{$iPatient->client_uid}}/notes/view/{{$iPatient->most_recent_completed_mcp_note_uid}}">
-                                                    <span class="sort-data">{{$iPatient->most_recent_completed_mcp_note_date ? friendly_date($iPatient->most_recent_completed_mcp_note_date) : '-'}}</span>
-                                                </a>
-                                            @else
-                                                <span class="sort-data">-</span>
-                                            @endif
-                                        </div>
-                                        {{--@if(!$lastVisitWithin90Days)
-                                            <div class="text-sm font-italic text-secondary">No visit in over 90 days</div>
-                                        @endif--}}
-                                    </td>
-                                    <td>
-                                        <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>
-                                            @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 hook="refresh-rpm-row-{{$trIndex}}">
-                                                        <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 (secs.)" required>
-                                                                </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>.</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 class="mb-2">
-                                                            <label class="text-sm text-secondary mb-1">Memo</label>
-                                                            <textarea class="form-control form-control-sm w-100" name="contentText"
-                                                                   required>Interacted with the patient</textarea>
-                                                        </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">{{$performerRole === 'MCP' ? 'Not' : "MCP hasn't"}} interacted this month!</div>
-                                        @endif--}}
-                                    </td>
-                                    <td>
-                                        <div class="d-flex align-items-baseline">
-                                            <i class="mr-1 text-sm fa {{$iPatient->number_of_days_with_remote_measurements >= 16 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
-                                            <span class="sort-data">{{$iPatient->number_of_days_with_remote_measurements ?: 0}}</span>
-                                            @if($iPatient->number_of_days_with_remote_measurements < 16)
-                                                <div moe relative class="ml-2">
-                                                    <a href="#" start show class="text-sm">SMS</a>
-                                                    <form url="/api/clientSms/createOutgoing" right="" class="mcp-theme-1" noreload="" style="display: none;">
-                                                        <input type="hidden" name="uid" value="{{ $iPatient->client_uid }}">
-                                                        <div class="mb-2">
-                                                            <label for="" class="text-sm text-secondary mb-1">Cell Number</label>
-                                                            <input type="text" class="form-control form-control-sm" name="cellNumber" value="{{$iPatient->cell_number}}">
-                                                        </div>
-                                                        <div class="mb-2">
-                                                            <label for="" class="text-sm text-secondary mb-1">Message</label>
-                                                            <textarea rows="5" class="form-control form-control-sm" name="message">Hi! This is {{$pro->displayName(true)}}, from Cardio 1st. Please check your blood pressure.</textarea>
-                                                        </div>
-                                                        <div class="d-flex align-items-center">
-                                                            <button class="btn btn-sm btn-primary mr-2" submit="">Send</button>
-                                                            <button class="btn btn-sm btn-default mr-2 border" cancel="">Cancel</button>
-                                                        </div>
-                                                    </form>
-                                                </div>
-                                            @endif
-                                        </div>
-                                        {{--@if($iPatient->number_of_days_with_remote_measurements < 16)
-                                            <div class="text-sm font-italic text-secondary">Meas. days < 16</div>
-                                        @endif--}}
-                                    </td>
-                                    <td>
-                                        <div class="d-flex align-items-baseline">
-                                            @if($performerRole === 'MCP')
-                                                <span class="sort-data">{{$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="refresh-rpm-row-{{$trIndex}}"
-                                                       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 class="sort-data">{{$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="refresh-rpm-row-{{$trIndex}}"
-                                                       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>
-                                        @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>
-                                                <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_mcp}}</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>
-                                                <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_rmm_pro}}</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($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>
+                                @include('app.practice-management.remote-monitoring-row-markup')
                                 <?php $trIndex++; ?>
                             @endforeach
                             </tbody>
@@ -408,7 +189,7 @@
                             },
                         },
                         {
-                            targets: [5, 6, 9, 10, 11],
+                            targets: [5, 6, 8, 10, 11, 12],
                             type: 'num',
                             render: function (data, type, row, meta) {
                                 if(type === 'sort') {