Prechádzať zdrojové kódy

Visit UI - PDF (wip)

Vijayakrishnan 3 rokov pred
rodič
commit
e6752778c1

+ 12 - 0
app/Http/Controllers/NoteController.php

@@ -287,6 +287,18 @@ class NoteController extends Controller
         return view('app.patient.note.plan-log', compact('point'));
     }
 
+    // print/pdf
+    public function downloadAsPdf(Request $request, Note $note) {
+        $patient = $note->client;
+        if($request->input('html')) {
+            return view('app.patient.note.pdf', compact('note', 'patient'));
+        }
+        else {
+            $pdf = \PDF::loadView('app.patient.note.pdf', compact('note', 'patient'));
+            return $pdf->download($note->created_at .'_' . 'note.pdf');
+        }
+    }
+
     // TODO move to utility
     private function callJava($request, $endPoint, $data, $guestAccessCode = null)
     {

+ 241 - 0
resources/views/app/patient/note/pdf.blade.php

@@ -0,0 +1,241 @@
+<!doctype html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport"
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>Note</title>
+</head>
+<body>
+<div style="margin: 0; padding: 1rem; font-family: serif">
+    <!-- header/smg info -->
+    <div style="text-align: right; margin-bottom: 1.5rem; font-family: sans-serif">
+        <div style="margin-bottom: 3px; font-weight:bold; font-size: 14px">Scholar Medical Group</div>
+        <div style="margin-bottom: 3px; font-size: 13px;">133 Rollins Ave, Suite 3</div>
+        <div style="margin-bottom: 3px; font-size: 13px;">Rockville, MD 20852</div>
+        <div style="margin-bottom: 3px; font-size: 13px;">Phone: 202-935-1033</div>
+        <div style="margin-bottom: 3px; font-size: 13px;">NPI# 1639796428</div>
+    </div>
+
+    <!-- header grey bar -->
+    <table style="background-color: #d9d9d9; border: 0; width: 100%; font-family: sans-serif" border="0">
+        <tr>
+            <td style="width: 50%; text-align: left; font-weight:bold; padding: 0.5rem 1rem;">Tele-Audio Visit</td>
+            <td style="width: 50%; text-align: right; font-weight:bold; padding: 0.5rem 1rem;">
+                @if($note->new_or_fu_or_na === "NEW")
+                    New
+                @elseif($note->new_or_fu_or_na === "FU")
+                    Follow-up
+                @else
+                    {{$note->new_or_fu_or_na}}
+                @endif
+                Televisit Note
+            </td>
+        </tr>
+    </table>
+
+    <!-- patient info -->
+    <div style="padding: 1rem; border-bottom: 1px solid #ddd;">
+        <table style="border: 0; width: 100%; border: 0" border="0" cellspacing="0" cellpadding="0">
+            <tr>
+                <td colspan="2" style="font-size: 18px; font-weight:bold; padding-bottom: 0.75rem; font-family: sans-serif">
+                    {{implode(', ', array_filter([$patient->name_last, $patient->name_first]))}}
+                </td>
+            </tr>
+            <tr>
+                <td style="width: 60%; text-align: left;">
+                    <table style="border: 0; width: 100%;" border="0" cellspacing="0" cellpadding="0">
+                        <tr>
+                            <td style="padding-bottom: 0.75rem; vertical-align: top" width="100px">Address:</td>
+                            <td style="padding-bottom: 0.75rem; vertical-align: top">{{@$patient->mailing_address_line1 ? $patient->mailing_address_line1 : ''}}</td>
+                        </tr>
+                        <tr>
+                            <td style="padding-bottom: 0.75rem; vertical-align: top" width="100px"></td>
+                            <td style="padding-bottom: 0.75rem; vertical-align: top">
+                                {{@$patient->mailing_address_city ? $patient->mailing_address_city : ''}}
+                                {{@$patient->mailing_address_state ? $patient->mailing_address_state : ''}}
+                                {{@$patient->mailing_address_zip ? $patient->mailing_address_zip : ''}}
+                            </td>
+                        </tr>
+                        <tr>
+                            <td style="padding-bottom: 0.75rem; vertical-align: top" width="100px">Gender:</td>
+                            <td style="padding-bottom: 0.75rem; vertical-align: top">{{$patient->sex}}</td>
+                        </tr>
+                        <tr>
+                            <td style="vertical-align: top" width="100px">Visited on:</td>
+                            <td style="vertical-align: top">{{friendly_date($note->effective_dateest)}}</td>
+                        </tr>
+                    </table>
+                </td>
+                <td style="width: 40%; text-align: left;">
+                    <table style="border: 0; width: 100%;" border="0" cellspacing="0" cellpadding="0">
+                        <tr>
+                            <td style="padding-bottom: 0.75rem; vertical-align: top" width="150px">Birth Date (Age):</td>
+                            <td style="padding-bottom: 0.75rem; vertical-align: top">{{friendly_date_time($patient->dob, false,null,true)}} ({{$patient->age_in_years}} Y)</td>
+                        </tr>
+                        <tr>
+                            <td style="padding-bottom: 0.75rem; vertical-align: top" width="150px">Home Phone:</td>
+                            <td style="padding-bottom: 0.75rem; vertical-align: top">{{$patient->phone_home}}</td>
+                        </tr>
+                        <tr>
+                            <td style="padding-bottom: 0.75rem; vertical-align: top" width="150px">Cell Phone:</td>
+                            <td style="padding-bottom: 0.75rem; vertical-align: top">{{$patient->cell_number}}</td>
+                        </tr>
+                        <tr>
+                            <td style="vertical-align: top" width="150px">Email:</td>
+                            <td style="vertical-align: top">{{$patient->email_address}}</td>
+                        </tr>
+                    </table>
+                </td>
+            </tr>
+        </table>
+    </div>
+
+    <?php
+    $allergiesSegment = null;
+    $vitalsSegment = null;
+    $medicationsSegment = null;
+    $ccSegment = null;
+    $problemsSegment = null;
+    $rosSegment = null;
+    $objectiveFreeTextSegment = null;
+    $objectiveImagingSegment = null;
+    $objectiveLabsSegment = null;
+    $objectiveMeasurementsSegment = null;
+    $objectiveOtherInvestigationsSegment = null;
+
+    // find and store handle to specific segments
+    foreach($note->segments as $segment) {
+        switch($segment->segmentTemplate->internal_name) {
+            case 'plan_allergies':
+                $allergiesSegment = $segment;
+                break;
+            case 'vitals':
+                $vitalsSegment = $segment;
+                break;
+            case 'plan_medications':
+                $medicationsSegment = $segment;
+                break;
+            case 'chief_complaint':
+                $ccSegment = $segment;
+                break;
+            case 'plan_problems':
+                $problemsSegment = $segment;
+                break;
+            case 'ros':
+                $rosSegment = $segment;
+                break;
+            case 'objective_free_text':
+                $objectiveFreeTextSegment = $segment;
+                break;
+            case 'objective_imaging':
+                $objectiveImagingSegment = $segment;
+                break;
+            case 'objective_labs':
+                $objectiveLabsSegment = $segment;
+                break;
+            case 'objective_measurements':
+                $objectiveMeasurementsSegment = $segment;
+                break;
+            case 'objective_other_investigations':
+                $objectiveOtherInvestigationsSegment = $segment;
+                break;
+        }
+    }
+    ?>
+
+    <!-- allergies -->
+    <div style="padding: 1rem; padding-bottom: 0;">
+        <p><b style="font-size: 18px">Allergies</b></p>
+        @if(!$allergiesSegment || empty(trim($allergiesSegment->summary_html)))
+            NKDA
+        @else
+            {!! $allergiesSegment->summary_html !!}
+        @endif
+    </div>
+
+    <!-- vitals -->
+    <div style="padding: 1rem; padding-bottom: 0;">
+        <p><b style="font-size: 18px">Vitals</b></p>
+        @if(!$vitalsSegment || empty(trim($vitalsSegment->summary_html)))
+            Unavailable
+        @else
+            {!! $vitalsSegment->summary_html !!}
+        @endif
+    </div>
+
+    <!-- medications -->
+    <div style="padding: 1rem; padding-bottom: 0;">
+        <p><b style="font-size: 18px">Medications</b></p>
+        <?php
+        $medications = \App\Models\Point::getPlanPointsOfCategory($patient, 'MEDICATION', $note);
+        ?>
+        <?php if (!count($medications)): ?>
+            <div class="text-secondary">No medications</div>
+        <?php else: ?>
+            <?php foreach ($medications as $medication): ?>
+                <div style="margin-bottom: 0.25rem;">
+                    <span style="<?= $medication->is_removed ? 'text-decoration: line-through;' : '' ?>">
+                        <b><?= !!@($medication->data->name) ? @($medication->data->name) : '-' ?></b>
+                        <?= !!@($medication->data->dose) ? '/&nbsp;' . @($medication->data->dose) : '' ?>
+                        <?= !!@($medication->data->frequency) ? '/&nbsp;' . @($medication->data->frequency) : '' ?>
+                    </span>
+                    <span style="padding-left: 1rem;">&nbsp;</span>
+                    <?php if ($medication->is_removed): ?>
+                        <span style="color: #666; font-size: 90%">Removed during visit</span>
+                    <?php elseif ($medication->added_in_note_id === $note->id): ?>
+                        <?php if ($medication->addition_reason_category === 'DURING_VISIT'): ?>
+                            <span style="color: #666; font-size: 90%">* Added during visit</span>
+                        <?php else: ?>
+                            <span style="color: #666; font-size: 90%">* Added on intake</span>
+                        <?php endif;?>
+                    <?php endif; ?>
+                </div>
+            <?php endforeach; ?>
+        <?php endif; ?>
+    </div>
+
+    <!-- cc -->
+    <div style="padding: 1rem; padding-bottom: 0;">
+        <p><b style="font-size: 18px">Chief Complaint</b></p>
+        @if(!$ccSegment || empty(trim($ccSegment->summary_html)))
+            Unavailable
+        @else
+            {!! $ccSegment->summary_html !!}
+        @endif
+    </div>
+
+    <!-- ros -->
+    <div style="padding: 1rem; padding-bottom: 0;">
+        <p><b style="font-size: 18px">Review of Systems</b></p>
+        @if(!$rosSegment || empty(trim($rosSegment->summary_html)))
+            Unavailable
+        @else
+            {!! $rosSegment->summary_html !!}
+        @endif
+    </div>
+
+    <!-- objective -->
+    <div style="padding: 1rem; padding-bottom: 0;">
+        <p><b style="font-size: 18px">Objective</b></p>
+        @if($objectiveFreeTextSegment && !empty(trim($objectiveFreeTextSegment->summary_html)))
+            {!! $objectiveFreeTextSegment->summary_html !!}
+        @endif
+        @if($objectiveImagingSegment && !empty(trim($objectiveImagingSegment->summary_html)))
+            {!! $objectiveImagingSegment->summary_html !!}
+        @endif
+        @if($objectiveLabsSegment && !empty(trim($objectiveLabsSegment->summary_html)))
+            {!! $objectiveLabsSegment->summary_html !!}
+        @endif
+        @if($objectiveMeasurementsSegment && !empty(trim($objectiveMeasurementsSegment->summary_html)))
+            {!! $objectiveMeasurementsSegment->summary_html !!}
+        @endif
+        @if($objectiveOtherInvestigationsSegment && !empty(trim($objectiveOtherInvestigationsSegment->summary_html)))
+            {!! $objectiveOtherInvestigationsSegment->summary_html !!}
+        @endif
+    </div>
+
+</div>
+</body>
+</html>

+ 1 - 0
routes/web.php

@@ -306,6 +306,7 @@ Route::middleware('pro.auth')->group(function () {
 
     Route::get('/point/review-log/{point}', 'NoteController@reviewLog')->name('point-review-log');
     Route::get('/point/plan-log/{point}', 'NoteController@planLog')->name('point-plan-log');
+    Route::get('/note/pdf/{note}', 'NoteController@downloadAsPdf')->name('note-pdf');
 
     //mb claim single view
     Route::get('mb-claims/view/{mbClaim}', 'PatientController@mbClaim')->name('mb-claim');