Vijayakrishnan преди 3 години
родител
ревизия
27ea7f73d8

+ 51 - 42
app/Http/Controllers/McpController.php

@@ -438,51 +438,60 @@ class McpController extends Controller
         $ym = ($request->input('y') ?: 'Y') . '-' . ($request->input('m') ?: 'm');
         $careMonthStart = date($ym . '-01');
 
-        $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
-";
-
         $patient = null;
         $careMonth = null;
-        $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();
+        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'));

+ 1 - 1
app/Http/Controllers/PracticeManagementController.php

@@ -1049,7 +1049,7 @@ SELECT client.name_first, client.name_last,
        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.has_mcp_interacted_with_client_about_rm,
        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,

+ 1 - 1
resources/views/app/patient/care-month/_matrix.blade.php

@@ -328,7 +328,7 @@ foreach ($days as $k => $day) {
                 <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</b>
+                            <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>

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

@@ -332,7 +332,7 @@ $days = $daysWithUnstamped;
                 <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</b>
+                            <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>

+ 82 - 17
resources/views/app/practice-management/remote-monitoring.blade.php

@@ -106,10 +106,11 @@
                                 <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.remote-monitoring"), 'label' => 'Latest BP', 'key' => 'most_recent_cellular_bp_measurement_at'])</th>
                                 <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.remote-monitoring"), 'label' => 'Latest Weight', 'key' => 'most_recent_cellular_weight_measurement_at'])</th>
                                 <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.remote-monitoring"), 'label' => 'Last Visit', 'key' => 'most_recent_completed_mcp_note_date'])</th>
-                                <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.remote-monitoring"), 'label' => 'Communicated?', 'key' => 'has_anyone_interacted_with_client_about_rm_outside_note'])</th>
+                                <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.remote-monitoring"), 'label' => 'Communicated?', 'key' => 'has_mcp_interacted_with_client_about_rm'])</th>
                                 <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.remote-monitoring"), 'label' => '#Meas. Days', 'key' => 'number_of_days_with_remote_measurements'])</th>
                                 <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.remote-monitoring"), 'label' => '#Unstamped', 'key' => 'rm_num_measurements_not_stamped_by_mcp'])</th>
-                                {{--<th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.remote-monitoring"), 'label' => '#RPM Mins.', 'key' => 'rm_total_time_in_seconds_by_mcp'])</th>--}}
+                                <th class="border-0">@include('app.practice-management._sort_header', ['route' => route("practice-management.remote-monitoring"), 'label' => '#RPM Mins.', 'key' => 'rm_total_time_in_seconds_by_mcp'])</th>
+                                <th class="border-0">Billable</th>
                             </tr>
                             </thead>
                             <tbody>
@@ -158,21 +159,65 @@
                                     </td>
                                     <td>
                                         <div class="d-flex align-items-baseline">
-                                            <i class="mr-1 text-sm fa {{$iPatient->has_anyone_interacted_with_client_about_rm_outside_note ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
-                                            <span>{{$iPatient->has_anyone_interacted_with_client_about_rm_outside_note ? 'Yes' : 'No'}}</span>
-                                            <div moe relative class="ml-2">
-                                                <a href="#" start show class="text-sm">Toggle</a>
-                                                <form url="/api/careMonth/setHasAnyoneInteractedWithClientAboutRmOutsideNoteToTrue" right>
-                                                    <input type="hidden" name="uid" value="{{$iPatient->care_month_uid}}">
-                                                    <p>Set to Yes?</p>
+                                            <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>
+                                                            </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>
+                                                    </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 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>
-                                        @if(!$iPatient->has_anyone_interacted_with_client_about_rm_outside_note)
+                                        @if(!$iPatient->has_mcp_interacted_with_client_about_rm)
                                             <div class="text-sm font-italic text-secondary">Not interacted this month!</div>
                                         @endif
                                     </td>
@@ -208,21 +253,41 @@
                                     <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.measurements_pending_stamping_in_care_month') }}?patientUid={{$iPatient->client_uid}}&careMonthUid={{$iPatient->care_month_uid}}"
+                                            @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="cm-matrix-{{$oPatient->id}}"
-                                                   title="{{$oPatient->displayName(true)}}: Measurements Pending Stamping">
-                                                    Stamp
+                                                   mc-initer="rpm-work-matrix"
+                                                   title="RPM Work Matrix">
+                                                    View
                                                 </a>
-                                            @endif--}}
+                                            @endif
                                         </div>
                                     </td>
-                                    {{--<td>{{floor($iPatient->rm_total_time_in_seconds_by_mcp / 60)}}</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>
+                                        @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>
+                                        @endif
+                                    </td>
                                 </tr>
                             @endforeach
                             </tbody>