Przeglądaj źródła

Merge remote-tracking branch 'origin/cleanup' into cleanup

= 1 rok temu
rodzic
commit
36f05798b0

+ 23 - 16
app/Http/Controllers/AdminController.php

@@ -806,9 +806,12 @@ class AdminController extends Controller
         }
 
 
+        //Query distinct clients who have points that contain specific substrings in the point.data
+
         $qry = "
         SELECT
-        DISTINCT p.client_id,
+        DISTINCT ON (p.client_id)
+        p.client_id,
         p.id,
         p.uid,
         c.uid as client_uid,
@@ -830,26 +833,30 @@ class AdminController extends Controller
         LEFT JOIN pro mcp on mcp.id = c.mcp_pro_id
         LEFT JOIN client_primary_coverage cover on cover.client_id = c.id
         ";
+        
 
         if($searchArrayStrings){
-            $qry = $qry . "WHERE lower(p.data) ILIKE any (array[".$searchArrayStrings."])";
+            $qry = $qry . " WHERE lower(p.data) ILIKE any (array[".$searchArrayStrings."])";
         }
+        $qry = $qry . " ORDER BY p.client_id DESC, p.created_at DESC";
 
+        $records = null;
 
-        $records = DB::select($qry);
-
-        $page = $request->get('page', 1);
-        $size = 20;
-        $collect = collect($records);
-
-        $records = new LengthAwarePaginator(
-            $collect->forPage($page, $size),
-            $collect->count(),
-            $size,
-            $page
-          );
-
-        $records->setPath(route('admin.patients-notes-points-filter'));
+        if($searchArrayStrings){
+            $records = DB::select($qry);
+            $page = $request->get('page', 1);
+            $size = 20;
+            $collect = collect($records);
+            $records = new LengthAwarePaginator(
+                $collect->forPage($page, $size),
+                $collect->count(),
+                $size,
+                $page
+            );
+            $records->setPath(route('admin.patients-notes-points-filter'));
+        }
+
+        
 
         return view('app.admin.patients-notes-points-filter', compact('records', 'filters'));
     }

+ 4 - 0
app/Http/Controllers/CareMonthController.php

@@ -36,4 +36,8 @@ class CareMonthController extends Controller
         return view('app.patient.care-month.dashboard', compact('patient', 'careMonth', 'pros', 'cmTemplates', 'rmTemplates'));
     }
 
+    public function print(Request $request, Client $patient, CareMonth $careMonth, $type = 'detailed' )
+    {
+        return view('app.patient.care-month.print', compact('patient', 'careMonth', 'type'));
+    }
 }

+ 1 - 1
resources/views/app/admin/patients-notes-points-filter-form.blade.php

@@ -38,7 +38,7 @@
 		<div class="">
 			<label>&nbsp;</label>
 			<div class=" d-flex">
-				<button type="button" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<button type="submit" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
 				<a href="#" v-on:click.prevent="fastLoad('{{route('admin.patients-notes-points-filter')}}')" class="btn btn-link btn-sm text-danger">Clear</a>
 			</div>
 		</div>

+ 53 - 47
resources/views/app/admin/patients-notes-points-filter.blade.php

@@ -13,56 +13,62 @@
 		<div class="p-3">
 			@include('app.admin.patients-notes-points-filter-form')
 		</div>
-		<table class="table table-striped p-0 m-0 table-sm border-top border-bottom ">
-			<thead class="bg-light">
-				<tr>
-					<th class="border-0">Chart #</th>
-					<th class="border-0">Patient</th>
-					<th class="border-0">Cell #</th>
-					<th class="border-0">Phone #</th>
-					<th class="border-0">Email Address</th>
-					<th class="border-0">DOB</th>
-					<th class="border-0">MCP</th>
-					<th class="border-0">Last Visit Date</th>
-					<th class="border-0">Cover</th>
-				</tr>
-			</thead>
-			<tbody>
-				@foreach($records as $record)
-				<tr>
-					<td>
-						<a href="{{route('patients.view.dashboard', $record->client_uid)}}">
-							{{$record->chart_number}}
-						</a>
-					</td>
-					<td>
-						<a href="{{route('patients.view.settings', $record->client_uid)}}">
-							{{$record->patient_name}}
-						</a>
-					</td>
-					<td>{{ $record->cell_number }}</td>
-					<td>{{ $record->phone_home ?? $record->phone_work ?? $record->phone_mobile }}</td>
-					<td>{{ $record->email_address }}</td>
-					<td>{{ friendly_date($record->dob) }}</td>
-					<td>{{ $record->mcp_name }}</td>
-					<td>{{ friendly_date($record->last_visit_date) }}</td>
-					<td>{{ $record->cover }}</td>
-				</tr>
-				@endforeach
+		@if($records)
+			<table class="table table-striped p-0 m-0 table-sm border-top border-bottom ">
+				<thead class="bg-light">
+					<tr>
+						<th class="border-0">Chart #</th>
+						<th class="border-0">Patient</th>
+						<th class="border-0">Cell #</th>
+						<th class="border-0">Phone #</th>
+						<th class="border-0">Email Address</th>
+						<th class="border-0">DOB</th>
+						<th class="border-0">MCP</th>
+						<th class="border-0">Last Visit Date</th>
+						<th class="border-0">Cover</th>
+					</tr>
+				</thead>
+				<tbody>
+					@foreach($records as $record)
+					<tr>
+						<td>
+							<a href="{{route('patients.view.dashboard', $record->client_uid)}}">
+								{{$record->chart_number}}
+							</a>
+						</td>
+						<td>
+							<a href="{{route('patients.view.settings', $record->client_uid)}}">
+								{{$record->patient_name}}
+							</a>
+						</td>
+						<td>{{ $record->cell_number }}</td>
+						<td>{{ $record->phone_home ?? $record->phone_work ?? $record->phone_mobile }}</td>
+						<td>{{ $record->email_address }}</td>
+						<td>{{ friendly_date($record->dob) }}</td>
+						<td>{{ $record->mcp_name }}</td>
+						<td>{{ friendly_date($record->last_visit_date) }}</td>
+						<td>{{ $record->cover }}</td>
+					</tr>
+					@endforeach
 
-				@if(count($records) === 0)
-				<tr>
-					<td colspan="8">No records found!</td>
-				</tr>
-				@endif
-			</tbody>
+					@if(count($records) === 0)
+					<tr>
+						<td colspan="8">No records found!</td>
+					</tr>
+					@endif
+				</tbody>
 
-		</table>
+			</table>
+		@endif
 	</div>
-	<div class="p-3">
-		{{$records->withQueryString()->links()}}
-	</div>
-
+	@if($records)
+		<div class="p-3">
+			{{$records->withQueryString()->links()}}
+		</div>
+	@endif
+	@if(!$records)
+		<small class="text-info">Enter search string(s) in the above input to start filtering!</small>
+	@endif
 </div>
 </div>
 </div>

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

@@ -85,8 +85,14 @@
                     <i class="fa fa-chevron-left"></i>
                 </a>
                 <div>
-                    <div>
+                    <div class="d-flex align-items-center">
                         <span class="text-dark font-weight-bold font-size-14">Care Month</span>&nbsp;for&nbsp;<span class="text-dark font-weight-bold">{{friendly_month($careMonth->start_date)}}</span>
+                        <div class="ml-3">
+                            <a href="{{ route('patients.view.care-months.view.print', ['patient' => $patient, 'careMonth' => $careMonth, 'type' => 'detailed']) }}" class="mr-2" target="_blank" native><i class="fas fa-print fa-fw"></i> Print Detailed</a>
+                            <a href="{{ route('patients.view.care-months.view.print', ['patient' => $patient, 'careMonth' => $careMonth, 'type' => 'measurements']) }}" class="mr-2" target="_blank" native><i class="fas fa-print fa-fw"></i> Print All Measurements Summary</a>
+                            <a href="{{ route('patients.view.care-months.view.print', ['patient' => $patient, 'careMonth' => $careMonth, 'type' => 'measurements-bp']) }}" class="mr-2" target="_blank" native><i class="fas fa-print fa-fw"></i> Print Measurements (BP)</a>
+                            <a href="{{ route('patients.view.care-months.view.print', ['patient' => $patient, 'careMonth' => $careMonth, 'type' => 'measurements-wt']) }}" class="mr-2" target="_blank" native><i class="fas fa-print fa-fw"></i> Print Measurements (Wt.)</a>
+                        </div>
                     </div>
                 </div>
             </h6>

+ 109 - 0
resources/views/app/patient/care-month/detailed-print.blade.php

@@ -0,0 +1,109 @@
+@extends('layouts.print')
+
+@section('content')
+    <style>
+        html,
+        body {
+            height: max-content
+        }
+    </style>
+    <div id="printableScreen" style="padding: 15px;">
+        <div style="text-align:center;margin-top:15px;margin-bottom: 30px;">
+            <h6 class="font-weight-bold text-uppercase">{{ $patient->displayName() }}</h6>
+            <div style="margin-bottom: 5px;font-weight:bold;">NP: {{ $careMonth->mcp ? $careMonth->mcp->displayName() : '---' }}</div>
+            <div>
+                <span class="text-dark font-weight-bold">Care Month</span>&nbsp;for&nbsp;<span
+                    class="text-dark font-weight-bold">{{ friendly_month($careMonth->start_date) }}</span>
+            </div>
+        </div>
+        
+        <div style="margin-bottom: 30px;">
+        <h6 class="font-weight-bold">RM Reasons</h6>
+        <table class="table table-striped table-sm table-bordered mt-2 mb-0">
+            <tr>
+                <td>
+                    @include('app.patient.partials.rm-reasons-print-display', ['recordType' => 'CARE_MONTH', 'record' => $careMonth])
+                </td>
+            </tr>
+        </table>
+        </div>
+
+        <h6 class="font-weight-bold">Measurements</h6>
+        <table class="table table-striped table-sm table-bordered mt-2 mb-0">
+            <thead>
+                <tr>
+                    <th class="px-2 text-secondary">Effective Date</th>
+                    <th class="px-2 text-secondary w-25">Category</th>
+                    <th class="px-2 text-secondary w-25">Value</th>
+                    <th class="px-2 text-secondary">Stamped</th>
+                </tr>
+            </thead>
+            <tbody>
+                @php
+                    $measurementsInCareMonth = $patient->measurementsInCareMonth($careMonth);
+                    $plottableMeasurements = [];
+                @endphp
+                @foreach ($measurementsInCareMonth as $measurement)
+                    @if (!empty($measurement->label) && !in_array($measurement->label, ['SBP', 'DBP']) && !$measurement->is_cellular_zero)
+                        <tr>
+                            <td class="px-2">
+                                @if ($measurement->ts)
+                                    <?php $timestampInSec = floor($measurement->ts / 1000); ?>
+                                    {{ friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN') }}
+                                @else
+                                    {{ friendly_date_time_short_with_tz($measurement->effective_date, true, 'EASTERN') }}
+                                @endif
+                                EST
+                            </td>
+                            <td class="px-2">{{ $measurement->label }}</td>
+                            <td class="px-2">
+                                @if ($measurement->is_cellular_zero)
+                                    <i class="font-size-11 fa fa-rss"></i>
+                                @elseif($measurement->label === 'BP')
+                                    {{ $measurement->sbp_mm_hg }}/{{ $measurement->dbp_mm_hg }} mmHg
+                                @elseif($measurement->label === 'Wt. (lbs.)')
+                                    {{ round(floatval($measurement->numeric_value), 2) }} lbs
+                                @else
+                                    {{ $measurement->value }}
+                                @endif
+                            </td>
+                            <td colspan="px-2">
+                                <?php
+                                $stamps = ['has_been_stamped_by_mcp', 'has_been_stamped_by_non_hcp', 'has_been_stamped_by_rme', 'has_been_stamped_by_rmm'];
+                                $isStamped = false;
+                                foreach ($stamps as $stamp) {
+                                    if ($measurement->{$stamp}) {
+                                        $isStamped = true;
+                                    }
+                                }
+                                ?>
+                                @if($isStamped)
+                                    ✓
+                                @endif
+                            </td>
+                        </tr>
+                    @endif
+                @endforeach
+                @if (!$patient->measurements || !count($patient->measurements) === 0)
+                    <tr>
+                        <td class="text-secondary p-0 border-0">
+                            No items to show
+                        </td>
+                    </tr>
+                @endif
+            </tbody>
+        </table>
+    </div>
+    <script>
+        function printDiv(divName) {
+            var printContents = document.getElementById(divName).innerHTML;
+            var originalContents = document.body.innerHTML;
+            document.body.innerHTML = printContents;
+            window.print();
+            document.body.innerHTML = originalContents;
+        }
+        document.addEventListener("DOMContentLoaded", function(event) {
+            printDiv('printableScreen');
+        });
+    </script>
+@endsection

+ 97 - 0
resources/views/app/patient/care-month/measurements-print.blade.php

@@ -0,0 +1,97 @@
+@extends('layouts.print')
+
+@section('content')
+    <style>
+        html,
+        body {
+            height: max-content
+        }
+    </style>
+    <div id="printableScreen" style="padding: 15px;">
+        <div style="text-align:center;margin-top:15px;margin-bottom: 30px;">
+            <h6 class="font-weight-bold text-uppercase">{{ $patient->displayName() }}</h6>
+            <div>
+                <span class="text-dark font-weight-bold">Care Month</span>&nbsp;for&nbsp;<span
+                    class="text-dark font-weight-bold">{{ friendly_month($careMonth->start_date) }}</span>
+            </div>
+        </div>
+
+        <h6 class="font-weight-bold">Measurements</h6>
+        <table class="table table-striped table-sm table-bordered mt-2 mb-0">
+            <thead>
+                <tr>
+                    <th class="px-2 text-secondary">Effective Date</th>
+                    <th class="px-2 text-secondary w-25">Category</th>
+                    <th class="px-2 text-secondary w-25">Value</th>
+                    <th class="px-2 text-secondary">Stamped</th>
+                </tr>
+            </thead>
+            <tbody>
+                @php
+                    $measurementsInCareMonth = $patient->measurementsInCareMonth($careMonth);
+                    $plottableMeasurements = [];
+                @endphp
+                @foreach ($measurementsInCareMonth as $measurement)
+                    @if (!empty($measurement->label) && !in_array($measurement->label, ['SBP', 'DBP']) && !$measurement->is_cellular_zero)
+                        <tr>
+                            <td class="px-2">
+                                @if ($measurement->ts)
+                                    <?php $timestampInSec = floor($measurement->ts / 1000); ?>
+                                    {{ friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN') }}
+                                @else
+                                    {{ friendly_date_time_short_with_tz($measurement->effective_date, true, 'EASTERN') }}
+                                @endif
+                                EST
+                            </td>
+                            <td class="px-2">{{ $measurement->label }}</td>
+                            <td class="px-2">
+                                @if ($measurement->is_cellular_zero)
+                                    <i class="font-size-11 fa fa-rss"></i>
+                                @elseif($measurement->label === 'BP')
+                                    {{ $measurement->sbp_mm_hg }}/{{ $measurement->dbp_mm_hg }} mmHg
+                                @elseif($measurement->label === 'Wt. (lbs.)')
+                                    {{ round(floatval($measurement->numeric_value), 2) }} lbs
+                                @else
+                                    {{ $measurement->value }}
+                                @endif
+                            </td>
+                            <td colspan="px-2">
+                                <?php
+                                $stamps = ['has_been_stamped_by_mcp', 'has_been_stamped_by_non_hcp', 'has_been_stamped_by_rme', 'has_been_stamped_by_rmm'];
+                                $isStamped = false;
+                                foreach ($stamps as $stamp) {
+                                    if ($measurement->{$stamp}) {
+                                        $isStamped = true;
+                                    }
+                                }
+                                ?>
+                                @if($isStamped)
+                                    ✓
+                                @endif
+                            </td>
+                        </tr>
+                    @endif
+                @endforeach
+                @if (!$patient->measurements || !count($patient->measurements) === 0)
+                    <tr>
+                        <td class="text-secondary p-0 border-0">
+                            No items to show
+                        </td>
+                    </tr>
+                @endif
+            </tbody>
+        </table>
+    </div>
+    <script>
+        function printDiv(divName) {
+            var printContents = document.getElementById(divName).innerHTML;
+            var originalContents = document.body.innerHTML;
+            document.body.innerHTML = printContents;
+            window.print();
+            document.body.innerHTML = originalContents;
+        }
+        document.addEventListener("DOMContentLoaded", function(event) {
+            printDiv('printableScreen');
+        });
+    </script>
+@endsection

+ 66 - 0
resources/views/app/patient/care-month/partials/print/measurements.blade.php

@@ -0,0 +1,66 @@
+<h6 class="font-weight-bold">Measurements</h6>
+<table class="table table-striped table-sm table-bordered mt-2 mb-0">
+    <thead>
+        <tr>
+            <th class="px-2 text-secondary">Effective Date</th>
+            <th class="px-2 text-secondary w-25">Category</th>
+            <th class="px-2 text-secondary w-25">Value</th>
+            <th class="px-2 text-secondary">Stamped</th>
+        </tr>
+    </thead>
+    <tbody>
+        @php
+            $measurementsInCareMonth = $patient->measurementsInCareMonth($careMonth);
+            $plottableMeasurements = [];
+        @endphp
+        @foreach ($measurementsInCareMonth as $measurement)
+            @if($measurementType && stripos($measurement->label, $measurementType) === false ) @continue @endif
+            @if (!empty($measurement->label) && !in_array($measurement->label, ['SBP', 'DBP']) && !$measurement->is_cellular_zero)
+                <tr>
+                    <td class="px-2">
+                        @if ($measurement->ts)
+                            <?php $timestampInSec = floor($measurement->ts / 1000); ?>
+                            {{ friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN') }}
+                        @else
+                            {{ friendly_date_time_short_with_tz($measurement->effective_date, true, 'EASTERN') }}
+                        @endif
+                        EST
+                    </td>
+                    <td class="px-2">{{ $measurement->label }}</td>
+                    <td class="px-2">
+                        @if ($measurement->is_cellular_zero)
+                            <i class="font-size-11 fa fa-rss"></i>
+                        @elseif($measurement->label === 'BP')
+                            {{ $measurement->sbp_mm_hg }}/{{ $measurement->dbp_mm_hg }} mmHg
+                        @elseif($measurement->label === 'Wt. (lbs.)')
+                            {{ round(floatval($measurement->numeric_value), 2) }} lbs
+                        @else
+                            {{ $measurement->value }}
+                        @endif
+                    </td>
+                    <td colspan="px-2">
+                        <?php
+                        $stamps = ['has_been_stamped_by_mcp', 'has_been_stamped_by_non_hcp', 'has_been_stamped_by_rme', 'has_been_stamped_by_rmm'];
+                        $isStamped = false;
+                        foreach ($stamps as $stamp) {
+                            if ($measurement->{$stamp}) {
+                                $isStamped = true;
+                            }
+                        }
+                        ?>
+                        @if ($isStamped)
+                            ✓
+                        @endif
+                    </td>
+                </tr>
+            @endif
+        @endforeach
+        @if (!$patient->measurements || !count($patient->measurements) === 0)
+            <tr>
+                <td class="text-secondary p-0 border-0">
+                    No items to show
+                </td>
+            </tr>
+        @endif
+    </tbody>
+</table>

+ 11 - 0
resources/views/app/patient/care-month/partials/print/rm-reasons.blade.php

@@ -0,0 +1,11 @@
+<h6 class="font-weight-bold">RM Reasons</h6>
+<table class="table table-striped table-sm table-bordered mt-2 mb-0">
+    <tr>
+        <td>
+            @include('app.patient.partials.rm-reasons-print-display', [
+                'recordType' => 'CARE_MONTH',
+                'record' => $careMonth,
+            ])
+        </td>
+    </tr>
+</table>

+ 65 - 0
resources/views/app/patient/care-month/print.blade.php

@@ -0,0 +1,65 @@
+@extends('layouts.print')
+
+@section('content')
+    <style>
+        html,
+        body {
+            height: max-content
+        }
+    </style>
+    <div id="printableScreen" style="padding: 15px;">
+        <div class="d-flex align-items-start justify-content-center" style="margin-top:15px;margin-bottom: 30px;">
+            <div class="">
+                <div class="border-bottom pb-2 mb-2 text-center">
+                    <h6 class="font-weight-bold text-uppercase">{{ $patient->displayName() }}</h6>
+                    <div style="margin-bottom: 5px;font-weight:bold;"><span style="color: #6c757d;">DOB</span>:  {{ $patient->dob ? friendly_date($patient->dob) : '---' }}</div>
+                    <div style="margin-bottom: 5px;font-weight:bold;"><span style="color: #6c757d;">NP</span>:  {{ $careMonth->mcp ? $careMonth->mcp->displayName() : '---' }}</div>
+                    <div>
+                        <span class="text-dark font-weight-bold">Care Month</span>&nbsp;for&nbsp;<span
+                            class="text-dark font-weight-bold">{{ friendly_month($careMonth->start_date) }}</span>
+                    </div>
+                </div>
+                <div>
+                    <div style="margin-bottom: 5px;font-weight:bold;"><span style="color: #6c757d;">Company</span>:  
+                        {{$careMonth->companyPro && $careMonth->companyPro->company ? $careMonth->companyPro->company->name : '-'}}
+                    </div>
+                    <div style="margin-bottom: 5px;font-weight:bold;"><span style="color: #6c757d;">Location</span>:  
+                        {{$careMonth->companyLocation ? $careMonth->companyLocation->line1 . ', ' . $careMonth->companyLocation->city : '-'}}
+                    </div>                    
+                </div>
+            </div>
+            
+        </div>
+
+        @if($type === 'detailed')
+            <div style="margin-bottom: 30px;">
+                @include('app.patient.care-month.partials.print.rm-reasons')
+            </div>
+        @endif
+
+        <div>
+            <?php
+                $measurementType = null;
+                if($type === 'measurements-bp'){
+                    $measurementType = 'BP';
+                }
+                if($type === 'measurements-wt'){
+                   $measurementType = 'Wt'; 
+                }
+            ?>
+            @include('app.patient.care-month.partials.print.measurements', ['measurementType' => $measurementType])
+        </div>
+    </div>
+    <script>
+        function printDiv(divName) {
+            var printContents = document.getElementById(divName).innerHTML;
+            var originalContents = document.body.innerHTML;
+            document.body.innerHTML = printContents;
+            window.print();
+            document.body.innerHTML = originalContents;
+        }
+        document.addEventListener("DOMContentLoaded", function(event) {
+            //printDiv('printableScreen');
+        });
+    </script>
+@endsection

+ 91 - 0
resources/views/app/patient/partials/rm-reasons-print-display.blade.php

@@ -0,0 +1,91 @@
+<?php
+$displayData = [
+	'icd_1' => [
+		'title' => 'ICD 1',
+		'reason' => $record->rm_reason_icd1,
+		'description' => $record->rm_reason_icd1description
+	],
+	'icd_2' => [
+		'title' => 'ICD 2',
+		'reason' => $record->rm_reason_icd2,
+		'description' => $record->rm_reason_icd2description
+	],
+	'icd_3' => [
+		'title' => 'ICD 3',
+		'reason' => $record->rm_reason_icd3,
+		'description' => $record->rm_reason_icd3description
+	],
+	'icd_4' => [
+		'title' => 'ICD 4',
+		'reason' => $record->rm_reason_icd4,
+		'description' => $record->rm_reason_icd4description
+	],
+];
+if($recordType === 'NOTE'){
+	$displayData['icd_1']['reason'] = $record->note_reason_icd1;
+	$displayData['icd_1']['description'] = $record->note_reason_icd1description;
+	$displayData['icd_2']['reason'] = $record->note_reason_icd2;
+	$displayData['icd_2']['description'] = $record->note_reason_icd2description;
+	$displayData['icd_3']['reason'] = $record->note_reason_icd3;
+	$displayData['icd_3']['description'] = $record->note_reason_icd3description;
+	$displayData['icd_4']['reason'] = $record->note_reason_icd4;
+	$displayData['icd_4']['description'] = $record->note_reason_icd4description;
+
+	$points = \App\Models\Point
+	    ::where('client_id', $patient->id)
+	    ->where('is_removed_due_to_entry_error', false)
+	    ->where(function ($query1) use ($note) {
+	        $query1
+	            ->where(function ($query2) use ($note) {
+	                $query2->where('is_removed', false)
+	                    ->where('addition_reason_category', 'DURING_VISIT')
+	                    ->where('added_in_note_id', $note->id);
+	            })
+	            ->orWhereRaw("(SELECT count(id) from note_point WHERE is_active IS TRUE AND note_id = {$note->id} AND point_id = point.id) > 0");
+	    })
+	    ->orderBy('created_at')
+	    ->get();
+
+	$problems = [];
+
+	foreach ($points as $point) {
+	    if ($point->data) {
+	        $point->data = json_decode($point->data);
+	    }
+	    if($point->category === 'PROBLEM' && @$point->data->name) $problems[] = $point->data->name . (@$point->data->icd ? ' (' . $point->data->icd . ')' : '');
+	}
+
+}
+?>
+<div>
+	<div class="d-flex">
+		<?php $emptyICDs = true; ?>
+		<ol class="pl-3 mb-2">
+			@foreach($displayData as $rmKey=>$rmData)
+				<?php
+				$emptyICD = true;
+				if (!empty($rmData['reason']) || !empty($rmData['description'])) {
+					$emptyICDs = false;
+					$emptyICD = false;
+				}
+				?>
+				@if(!$emptyICD)
+					<li  style="margin-bottom: 10px;">
+					{{$rmData['reason']}} 
+					@if(!empty($rmData['description']))({{ $rmData['description'] }})@endif
+					</li>
+				@endif
+			@endforeach
+		</ol>
+		@if($emptyICDs)
+			Relevant RM reason(s) not specified.
+		@endif
+	</div>
+
+	@if($record->rm_reason_memo)
+	<div>
+			<span class="text-secondary mr-2"><b>Memo:</b></span>
+			<small class="">{{ $record->rm_reason_memo }}</small>
+	</div>
+	@endif
+</div>

+ 1 - 0
resources/views/layouts/template.blade.php

@@ -276,6 +276,7 @@
                             <a class="dropdown-item" href="{{ route('management-stats') }}">Management Stats</a>
                             <a class="dropdown-item" href="{{ route('messages') }}">Messages</a>
                             <a class="dropdown-item" target="_blank"  native href="{{ route('admin.points') }}">Points</a>
+                            <a class="dropdown-item" target="_blank"  native href="{{ route('admin.patients-notes-points-filter') }}">Patients/Notes/Points Filter</a>
                         </div>
                     </li>
                     <li class="nav-item dropdown">

+ 2 - 1
routes/web.php

@@ -283,7 +283,7 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('patients-missing-defult-settings', 'AdminController@patientsMissingDefasultSettings')->name('patientsMissingDefasultSettings');
         Route::get('points', 'AdminController@points')->name('points');
         Route::get('/points/view/{uid}', 'AdminController@pointDetails')->name('points.view');
-//        Route::get('patients-notes-points-filter', 'AdminController@patientsNotesPointsFilter')->name('patients-notes-points-filter');
+       Route::get('patients-notes-points-filter', 'AdminController@patientsNotesPointsFilter')->name('patients-notes-points-filter');
     });
     Route::middleware('pro.auth.admin')->group(function () {
         Route::get('mgmt-stats', [ManagementStatsController::class, 'index'])->name('management-stats');
@@ -636,6 +636,7 @@ Route::middleware('pro.auth')->group(function () {
             Route::get('care-months', 'PatientController@careMonths')->name('care-months');
             Route::name('care-months.view.')->prefix('care-months/view/{careMonth}')->group(function () {
                 Route::get('', 'CareMonthController@dashboard')->name('dashboard');
+                Route::get('/print/{type?}', 'CareMonthController@print')->name('print');
             });
 
             // appointment calendar