Преглед на файлове

CareMonth Detailed print

Samson Mutunga преди 1 година
родител
ревизия
d9ec4a9049

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

@@ -40,4 +40,8 @@ class CareMonthController extends Controller
     {
         return view('app.patient.care-month.measurements-print', compact('patient', 'careMonth'));
     }
+    public function detailedPrint(Request $request, Client $patient, CareMonth $careMonth )
+    {
+        return view('app.patient.care-month.detailed-print', compact('patient', 'careMonth'));
+    }
 }

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

@@ -88,7 +88,7 @@
                     <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="" 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.detailed-print', ['patient' => $patient, 'careMonth' => $careMonth]) }}" 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.measurements-print', ['patient' => $patient, 'careMonth' => $careMonth]) }}" class="" target="_blank" native><i class="fas fa-print fa-fw"></i> Print Summary</a>
                         </div>
                     </div>

+ 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

+ 3 - 2
resources/views/app/patient/care-month/measurements-print.blade.php

@@ -7,8 +7,8 @@
             height: max-content
         }
     </style>
-    <div id="printableScreen">
-        <div style="text-align:center;margin-top:15px;">
+    <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
@@ -16,6 +16,7 @@
             </div>
         </div>
 
+        <h6 class="font-weight-bold">Measurements</h6>
         <table class="table table-striped table-sm table-bordered mt-2 mb-0">
             <thead>
                 <tr>

+ 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
routes/web.php

@@ -637,6 +637,7 @@ Route::middleware('pro.auth')->group(function () {
             Route::name('care-months.view.')->prefix('care-months/view/{careMonth}')->group(function () {
                 Route::get('', 'CareMonthController@dashboard')->name('dashboard');
                 Route::get('/measurements-print', 'CareMonthController@measurementsPrint')->name('measurements-print');
+                Route::get('/detailed-print', 'CareMonthController@detailedPrint')->name('detailed-print');
             });
 
             // appointment calendar