소스 검색

ERx PDF template & generation

Vijayakrishnan 4 년 전
부모
커밋
b0eb2edf7d
3개의 변경된 파일127개의 추가작업 그리고 5개의 파일을 삭제
  1. 7 3
      app/Http/Controllers/TicketController.php
  2. 117 0
      resources/views/app/ticket/erx.blade.php
  3. 3 2
      resources/views/app/ticket/pdf-preview.blade.php

+ 7 - 3
app/Http/Controllers/TicketController.php

@@ -11,9 +11,13 @@ class TicketController extends Controller
 {
 
     public function downloadAsPdf(Request $request, Ticket $ticket){
-        $pdf = PDF::loadView('app.ticket.pdf-preview', compact('ticket'));
-        return $pdf->download('invoice.pdf');
-//        return view('app.ticket.pdf-preview', compact('ticket'));
+        if($request->input('html')) {
+            return view('app.ticket.pdf-preview', compact('ticket'));
+        }
+        else {
+            $pdf = PDF::loadView('app.ticket.pdf-preview', compact('ticket'));
+            return $pdf->download('invoice.pdf');
+        }
     }
 
     public function getTicketFaxes(Request $request, Ticket $ticket) {

+ 117 - 0
resources/views/app/ticket/erx.blade.php

@@ -0,0 +1,117 @@
+<?php
+/** @var Ticket $ticket */
+use App\Models\Ticket;
+$patient = $ticket->patient;
+?>
+<section style="padding-top: 0.1rem;">
+
+    <table cellpadding="0" cellspacing="0" border="0" style="width: 100%">
+        <tr>
+            <td style="width: 70%">
+                <b>Patient Information</b>
+            </td>
+            <td style="">
+                <div style="text-align: right">Date: <b>{{date('Y-m-d')}}</b></div>
+            </td>
+        </tr>
+    </table>
+
+    <div style="font-size: 14px; margin-top: 0.6rem; line-height: 1.4; opacity: 0.6">
+        <span>{{ $patient->displayName() }}, {{$patient->sex}}, {{$patient->age_in_years}} years old</span><br>
+        <?php
+        $addressParts = [];
+        if (!!$patient->mailing_address_line1) $addressParts[] = $patient->mailing_address_line1;
+        if (!!$patient->mailing_address_line2) $addressParts[] = $patient->mailing_address_line2;
+        $addressParts = implode(", ", $addressParts) . ", ";
+        $addressPart2 = [];
+        if (!!$patient->mailing_address_city) $addressPart2[] = $patient->mailing_address_city;
+        if (!!$patient->mailing_address_state) $addressPart2[] = $patient->mailing_address_state;
+        $addressParts .= implode(", ", $addressPart2);
+        ?>
+        <span>{!! $addressParts !!}</span>
+    </div>
+</section>
+<?php $rxData = json_decode($ticket->data); ?>
+<div style="margin: 1.5rem 0 1rem; font-weight: bold; opacity: 0.5"><span style="font-size: 24px">R</span><span style="font-size: 16px">x</span></div>
+<section style="font-size: 15px;">
+    <table cellpadding="0" cellspacing="0" border="0" style="width: 100%">
+        <tr>
+            <td style="width: 20px; vertical-align: top; opacity: 0.75; font-size: 14px">
+                <span>1. </span>
+            </td>
+            <td style="vertical-align: top">
+                <div>
+                    <p style="margin: 0 0 0.5rem;">
+                        <b>{{ $rxData->medication }} {{ $rxData->strength }}
+                            @if($rxData->route)
+                                - {{ $rxData->route }}
+                            @endif
+                        </b>
+                    </p>
+                    <div style="">
+                        @if($rxData->frequency)
+                            <p style="margin: 0.5rem 0;">Frequency: {{ $rxData->frequency }}</p>
+                        @endif
+                        @if($rxData->dispense)
+                            <p style="margin: 0.5rem 0;">Dispense: {{ $rxData->dispense }}</p>
+                        @endif
+                        @if($rxData->refills)
+                            <p style="margin: 0.5rem 0;">Refills: {{ $rxData->refills }}</p>
+                        @endif
+                        @if($rxData->purpose)
+                            <p style="margin: 0.5rem 0;">Purpose: <b>{{ $rxData->purpose }}</b></p>
+                        @endif
+                    </div>
+                </div>
+            </td>
+        </tr>
+    </table>
+</section>
+<?php
+$additionalItems = @$rxData->items && count($rxData->items) ? $rxData->items : [];
+$itemNum = 2;
+?>
+@foreach($additionalItems as $item)
+    <hr style="margin: 0.5rem 0 1rem; border-top-width: 0; border-bottom-width: 1px; border-color: #bbb">
+    <section style="font-size: 15px;">
+        <table cellpadding="0" cellspacing="0" border="0" style="width: 100%">
+            <tr>
+                <td style="width: 20px; vertical-align: top; opacity: 0.75; font-size: 14px">
+                    <span>{{$itemNum++}}. </span>
+                </td>
+                <td style="vertical-align: top">
+                    <div>
+                        <p style="margin: 0 0 0.5rem;">
+                            <b>{{ $item->medication }} {{ $item->strength }}
+                                @if($item->route)
+                                    - {{ $item->route }}
+                                @endif
+                            </b>
+                        </p>
+                        <div>
+                            @if($item->frequency)
+                                <p style="margin: 0.5rem 0;">Frequency: {{ $item->frequency }}</p>
+                            @endif
+                            @if($item->dispense)
+                                <p style="margin: 0.5rem 0;">Dispense: {{ $item->dispense }}</p>
+                            @endif
+                            @if($item->refills)
+                                <p style="margin: 0.5rem 0;">Refills: {{ $item->refills }}</p>
+                            @endif
+                            @if($item->purpose)
+                                <p style="margin: 0.5rem 0;">Purpose: <b>{{ $item->purpose }}</b></p>
+                            @endif
+                        </div>
+                    </div>
+                </td>
+            </tr>
+        </table>
+    </section>
+@endforeach
+<hr style="margin: 0.5rem 0; border-top-width: 0; border-bottom-width: 1px; border-color: #bbb">
+<p><b>Pharmacy Information</b>:</p>
+<div style="font-size: 14px; opacity: 0.75; ">
+    <p style="margin: 0.5rem 0;"><b>{{ $rxData->pharmacyName }}</b></p>
+    <p style="margin: 0.5rem 0;">{{$rxData->pharmacyAddressMemo}} {{$rxData->pharmacyCity}} {{$rxData->pharmacyState}}</p>
+    <p style="margin: 0.5rem 0;">Phone: {{$rxData->pharmacyPhone}}</p>
+</div>

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 3 - 2
resources/views/app/ticket/pdf-preview.blade.php


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.