|
@@ -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>
|