소스 검색

Note print fixes

Vijayakrishnan 3 년 전
부모
커밋
5f20ab5a0c

+ 4 - 1
app/Http/Controllers/NoteController.php

@@ -115,7 +115,10 @@ class NoteController extends Controller
     }
 
     public function print(Request $request, Client $patient, Note $note) {
-        return view("app.patient.note.print", compact('patient', 'note'));
+        if($note->visitTemplate) {
+            return view("app.patient.note.print.print", compact('patient', 'note'));
+        }
+        return view("app.patient.note.print.print-legacy", compact('patient', 'note'));
     }
 
     public function resolve(Request $request, Client $patient, Note $note) {

+ 7 - 0
resources/views/app/patient/note/note-section-list-print.blade.php

@@ -0,0 +1,7 @@
+<div id="note-section-list">
+	<?php $canvasData = json_decode($patient->canvas_data, true); ?>
+	<?php $previousHeading = null; ?>
+	@foreach($note->sections as $section)
+		@include('app.patient.note.section-print')
+	@endforeach
+</div>

+ 128 - 31
resources/views/app/patient/note/note-segment-list-print.blade.php

@@ -1,39 +1,136 @@
-<div class="segments-list" id="note-segments-list">
+<div class="segments-list note-segments-print-list {{ $note->is_signed_by_hcp ? 'note-signed-by-hcp' : '' }}" id="note-segments-list">
     <?php
     $previousHeading = null;
     $previousSubHeading = null;
 	$segments = $note->segments->filter(function($_x) {
-		return !!$_x->is_active;
-	});
-    ?>
-    @foreach($segments as $segment)
-		@if($segment->segmentTemplate->internal_name !== 'medrisk_vigilence' && $segment->left_or_right !== 'RIGHT')
-		<?php
-        if ($segment->heading !== $previousHeading) {
-            if (!empty($previousHeading)) {
-                echo '</div></div>'; // <!-- end the previous parent section -->
+		$ok = !!$_x->is_active && $_x->segmentTemplate->internal_name !== 'medrisk_vigilence' && strpos($_x->segmentTemplate->internal_name, 'lifestyle_') !== 0;
+        if($ok) {
+            $content = $_x->summary_html;
+            if ($_x->accepted_suggestion_summary_html) {
+                $content = $_x->accepted_suggestion_summary_html;
             }
-            if (!empty($segment->heading)) {
-
-	?>
-	<div class="note-content-node note-content-heading">
-		<div class="py-2 px-3 border-bottom font-size-16 font-weight-bold bg-light text-secondary {{ $previousHeading ? 'mt-4 border-top' : '' }}">
-			{{ $segment->heading }}
-		</div>
-		<div class="note-content-children ml-5 border-left">
-			<!-- open new node -->
-        <?php
-	    }
-            $previousHeading = $segment->heading;
+            $trimmed = trim(strip_tags($content));
+            $ok = ($trimmed !== '' && $trimmed !== '-');
         }
-        ?>
-        @include('app.patient.note.segment-print')
-		@endif
-    @endforeach
-    <?php
-    if (!empty($previousHeading)) {
-        echo '</div></div>'; // <!-- close any open parent section -->
-    }
+        return $ok;
+	});
+	$printSegments = [];
+	foreach($segments as $segment) {
+		if($segment->left_or_right !== 'RIGHT') {
+			$printSegments[] = $segment;
+		}
+	}
+	foreach($segments as $segment) {
+		if($segment->left_or_right === 'RIGHT') {
+			$printSegments[] = $segment;
+		}
+	}
     ?>
+    @foreach($printSegments as $segment)
+		@include('app.patient.note.segment-print')
+    @endforeach
 </div>
-
+<script>
+    $(document).ready(function() {
+        $('.note-segments-print-list table.point-table').each(function() {
+            if(!$(this).find('tbody>tr').length) {
+                $(this).closest('.visit-segment').remove();
+            }
+            if($(this).closest('.note_template_soap_visit').length) {
+                if(['nutrition', 'exercise', 'behavior'].indexOf($(this).closest('.visit-segment').attr('data-segment-template-name')) === -1) {
+                    convertPointTableToSimpleParas($(this));
+                }
+                else {
+                    convertNEBTables($(this));
+                }
+            }
+        });
+        $('.note-segments-print-list table.table-cage').each(function() {
+            if($(this).closest('.note_template_omega_soap_visit').length) {
+                if(['omega_allergies', 'omega_medications', 'omega_goals', 'omega_care_team', 'omega_subjective_system'].indexOf($(this).closest('.visit-segment').attr('data-segment-template-name')) !== -1) {
+                    convertCageTableToSimpleParas($(this), 'Subjective');
+                }
+                else if(['omega_plan_system'].indexOf($(this).closest('.visit-segment').attr('data-segment-template-name')) !== -1) {
+                    convertCageTableToSimpleParas($(this), 'Plan');
+                }
+            }
+        });
+        if(isEmpty($('[data-segment-template-name="nutrition"] .summary-container'))) $('[data-segment-template-name="nutrition"]').remove();
+        if(isEmpty($('[data-segment-template-name="exercise"] .summary-container'))) $('[data-segment-template-name="exercise"]').remove();
+        if(isEmpty($('[data-segment-template-name="behavior"] .summary-container'))) $('[data-segment-template-name="behavior"]').remove();
+        function isEmpty(_el) {
+            return $.trim(_el.text().replaceAll('-', '')) === '';
+        }
+        function convertPointTableToSimpleParas(_table) {
+            let parent = _table.parent();
+            parent.find('[if-edit-mode]').remove();
+            $(_table).find('tbody>tr').each(function() {
+                if($(this).find('>td').length > 1) {
+                    let newD = $('<div class="mb-2"/>');
+                    $('<p class=""/>').html($(this).find('td:eq(1)').html()).appendTo(newD);
+                    $('<p class="pl-3 remove-if-empty-parent"/>').append('<b class="text-secondary">Subjective:</b>').append('<div class="d-inline-block pl-2 remove-if-empty">' + $(this).find('td:eq(2)').html() + '</div>').appendTo(newD);
+                    $('<p class="pl-3 remove-if-empty-parent"/>').append('<b class="text-secondary">Plan:</b>').append('<div class="d-inline-block pl-2 remove-if-empty">' + $(this).find('td:eq(3)').html() + '</div>').appendTo(newD);
+                    newD.appendTo(parent)
+                    newD.find('.text-sm.text-secondary, [if-edit-mode], i.fa').remove();
+                    newD.find('[if-read-mode]').show().addClass('d-inline-block');
+                    newD.find('.bg-warning-mellow.p-2.rounded').removeClass('bg-warning-mellow p-2 rounded');
+                    newD.find('.inline-html-container+.text-sm').remove();
+                    newD.find('.remove-if-empty').each(function() {
+                        if(isEmpty($(this))) {
+                            $(this).closest('.remove-if-empty-parent').remove();
+                        }
+                    });
+                }
+            });
+            $(_table).remove();
+        }
+        function convertCageTableToSimpleParas(_table, _label = 'Subjective') {
+            let parent = _table.parent();
+            parent.find('[if-edit-mode]').remove();
+            $(_table).find('tbody>tr').each(function() {
+                if($(this).find('>td').length > 1) {
+                    let newD = $('<div class="mb-2"/>');
+                    $('<p class=""/>').html($(this).find('td:eq(1)').html()).appendTo(newD);
+                    $('<p class="pl-3 remove-if-empty-parent"/>').append('<b class="text-secondary">' + _label + ':</b>').append('<div class="d-inline-block pl-2 remove-if-empty">' + $(this).find('td:eq(2)').html() + '</div>').appendTo(newD);
+                    newD.appendTo(parent)
+                    newD.find('.text-sm.text-secondary, [if-edit-mode], i.fa').remove();
+                    newD.find('[if-read-mode]').show().addClass('d-inline-block');
+                    newD.find('.bg-warning-mellow.p-2.rounded').removeClass('bg-warning-mellow p-2 rounded');
+                    newD.find('.grow-till-300px').removeClass('grow-till-300px');
+                    // newD.find('.text-sm.text-info').remove();
+                    newD.find('.inline-html-container+.text-sm').remove();
+                    newD.find('.remove-if-empty').each(function() {
+                        if(isEmpty($(this))) {
+                            $(this).closest('.remove-if-empty-parent').remove();
+                        }
+                    });
+                }
+            });
+            $(_table).remove();
+        }
+        function convertNEBTables(_table) {
+            let parent = _table.parent();
+            parent.find('[if-edit-mode]').remove();
+            $(_table).find('tbody>tr').each(function() {
+                if(!isEmpty($(this).find('td:eq(1)')) || !isEmpty($(this).find('td:eq(2)'))) {
+                    let newD = $('<div class="mb-2"/>');
+                    $('<p class=""/>').html($(this).find('td:eq(0)').html())
+                        .append($('<p class="remove-if-empty-parent"/>').append('<b class="text-secondary">Current:</b>').append('<div class="d-inline-block pl-2 remove-if-empty">' + $(this).find('td:eq(1)').html() + '</div>'))
+                        .append($('<p class="remove-if-empty-parent"/>').append('<b class="text-secondary">Plan:</b>').append('<div class="d-inline-block pl-2 remove-if-empty">' + $(this).find('td:eq(2)').html() + '</div>'))
+                        .appendTo(newD);
+                    newD.appendTo(parent)
+                    newD.find('.text-sm.text-secondary, [if-edit-mode], i.fa').remove();
+                    newD.find('[if-read-mode]').show().addClass('d-inline-block');
+                    newD.find('.bg-warning-mellow.p-2.rounded').removeClass('bg-warning-mellow p-2 rounded');
+                    newD.find('.inline-html-container+.text-sm').remove();
+                    newD.find('.remove-if-empty').each(function() {
+                        if(isEmpty($(this))) {
+                            $(this).closest('.remove-if-empty-parent').remove();
+                        }
+                    });
+                }
+            });
+            $(_table).remove();
+        }
+    });
+</script>

+ 0 - 45
resources/views/app/patient/note/print.blade.php

@@ -1,45 +0,0 @@
-<?php
-/** @var App\Models\Note $note */
-/** @var App\Models\Pro $pro */
-/** @var App\Models\Section $section */
-/** @var $allSections */
-?>
-@extends ('layouts.print')
-
-@section('content')
-
-    <div id="note-single-header" class="pb-3 d-flex align-items-start note_template_{{$note->visitTemplate ? $note->visitTemplate->internal_name : ''}}">
-
-        <div class="p-2">
-            <div class="mb-2 d-flex align-items-baseline">
-                <div class="mr-2 font-weight-bold text-secondary">Name:</div>
-                <div>{{$patient->displayName()}}</div>
-            </div>
-            <div class="mb-2 d-flex align-items-baseline">
-                <div class="mr-2 font-weight-bold text-secondary">DOB:</div>
-                <div>{{$patient->dob}}</div>
-            </div>
-            <div class="mb-2 d-flex align-items-baseline">
-                <div class="mr-2 font-weight-bold text-secondary">Visit Date:</div>
-                <div>{{friendly_date($note->effective_dateest)}}</div>
-            </div>
-            <div class="mb-2 d-flex align-items-baseline">
-                <div class="mr-2 font-weight-bold text-secondary">Signed By:</div>
-                <div class="mr-2">{{$note->hcpPro->displayName()}}</div>
-                <div class="mr-2">on</div>
-                <div class="mr-2">{{$note->signed_by_hcp_at}}</div>
-            </div>
-        </div>
-
-    </div>
-
-    <div class="card mb-0 {{ $note->is_cancelled ? 'cancelled-item' : '' }} border-0 rounded-0">
-
-        <div class="card-body p-0">
-            <div class="note_template_{{$note->visitTemplate ? $note->visitTemplate->internal_name : ''}}">
-                @include('app.patient.note.note-segment-list-print')
-            </div>
-        </div>
-    </div>
-
-@endsection

+ 24 - 0
resources/views/app/patient/note/print/print-legacy.blade.php

@@ -0,0 +1,24 @@
+<?php
+/** @var App\Models\Note $note */
+/** @var App\Models\Pro $pro */
+/** @var App\Models\Section $section */
+/** @var $allSections */
+?>
+@extends ('layouts.print-note')
+
+@section('content')
+
+    <div class="note-print print-width">
+
+        <div class="card mb-0 {{ $note->is_cancelled ? 'cancelled-item' : '' }} border-0 rounded-0">
+
+            <div class="card-body p-0">
+                <div class="note_template_legacy">
+                    @include('app.patient.note.note-section-list-print')
+                </div>
+            </div>
+        </div>
+
+    </div>
+
+@endsection

+ 24 - 0
resources/views/app/patient/note/print/print.blade.php

@@ -0,0 +1,24 @@
+<?php
+/** @var App\Models\Note $note */
+/** @var App\Models\Pro $pro */
+/** @var App\Models\Section $section */
+/** @var $allSections */
+?>
+@extends ('layouts.print-note')
+
+@section('content')
+
+    <div class="note-print print-width">
+
+        <div class="card mb-0 {{ $note->is_cancelled ? 'cancelled-item' : '' }} border-0 rounded-0">
+
+            <div class="card-body p-0">
+                <div class="note_template_{{$note->visitTemplate ? $note->visitTemplate->internal_name : ''}}">
+                    @include('app.patient.note.note-segment-list-print')
+                </div>
+            </div>
+        </div>
+
+    </div>
+
+@endsection

+ 33 - 0
resources/views/app/patient/note/section-print.blade.php

@@ -0,0 +1,33 @@
+<?php
+if (!$section->sectionTemplate->is_page_driven) {
+    $trimmed = trim(strip_tags($section->summary_html));
+}
+?>
+<?php
+if ($section->sectionTemplate->is_page_driven || ($trimmed !== '' && $trimmed !== '-')):
+?>
+<div class="p-3 note-section events-none">
+    <div class="d-flex align-items-start">
+        <span class="font-weight-bold mb-2 d-flex align-items-center">
+            {{$section->sectionTemplate->title}}
+        </span>
+        <?php $sectionInternalName = $section->sectionTemplate->internal_name; ?>
+    </div>
+
+    <div class="inset-comment summary-container">
+        <?php if ($section->sectionTemplate->is_page_driven): ?>
+            @include("app.patient.page-sections.{$sectionInternalName}.summary")
+        <?php else: ?>
+            <?php
+            if($trimmed !== '' && $trimmed !== '-'):
+                ?>
+                {!! $section->summary_html !!}
+                <?php
+            endif;
+            ?>
+        <?php endif; ?>
+    </div>
+
+</div>
+<?php endif; ?>
+

+ 3 - 31
resources/views/app/patient/note/segment-print.blade.php

@@ -1,41 +1,14 @@
 <?php $iName = $segment->segmentTemplate->internal_name; ?>
 <?php $isLSSegment = strpos($iName, 'lifestyle_') === 0; ?>
-
-<div class="border-bottom note-section visit-segment {{$note->is_signed_by_hcp ? '' : 'edit-trigger'}} {{strpos($iName, 'lifestyle_') === 0 && $iName !== 'lifestyle_general' ? 'zero-height' : ''}}"
+<div class="note-section visit-segment mb-3 {{strpos($iName, 'lifestyle_') === 0 && $iName !== 'lifestyle_general' ? 'zero-height' : ''}}"
      data-segment-uid="{{ $segment->uid }}"
      data-segment-template-uid="{{ $segment->segmentTemplate->uid }}"
      data-segment-template-name="{{ $segment->segmentTemplate->internal_name }}">
 
-    <div class="d-flex align-items-baseline bg-light text-secondary p-2" style="border-bottom: 1px solid #dee2e6;">
-
-    <!-- title -->
-
+    <div class="d-flex align-items-baseline">
         <span class="font-weight-bold d-flex align-items-center {{$isLSSegment || $iName === 'medrisk_vigilence' ? '' : 'xxxmb-2'}}" style="">
-            <span style="color: black; text-decoration: underline; font-size: 13px;">
-                {{$segment->display_title}}
-            </span>
+            {{$segment->display_title}}
         </span>
-
-        @if($isLSSegment)
-            @if($iName === 'lifestyle_general')
-                <a href="#" class="ls-segment-trigger ml-2" data-target="lifestyle_general">General</a>
-                <span class="mx-2 text-secondary text-sm">|</span>
-                <a href="#" class="ls-segment-trigger" data-target="lifestyle_nutrition">Nutrition</a>
-                <span class="mx-2 text-secondary text-sm">|</span>
-                <a href="#" class="ls-segment-trigger" data-target="lifestyle_physical_activity">Physical Act.</a>
-                <span class="mx-2 text-secondary text-sm">|</span>
-                <a href="#" class="ls-segment-trigger" data-target="lifestyle_sleep">Sleep</a>
-                <span class="mx-2 text-secondary text-sm">|</span>
-                <a href="#" class="ls-segment-trigger" data-target="lifestyle_social">Social Relns.</a>
-                <span class="mx-2 text-secondary text-sm">|</span>
-                <a href="#" class="ls-segment-trigger" data-target="lifestyle_substances">Subst. Use</a>
-                <span class="mx-2 text-secondary text-sm">|</span>
-                <a href="#" class="ls-segment-trigger" data-target="lifestyle_stress">Stress</a>
-            @else
-                <span class="text-info ml-auto font-weight-normal">(click to view)</span>
-            @endif
-        @endif
-
     </div>
 
     <?php if(!$isLSSegment): ?>
@@ -51,4 +24,3 @@
     <?php endif ?>
 
 </div>
-

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 200 - 0
resources/views/layouts/print-note.blade.php


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