Procházet zdrojové kódy

Merge branch 'master' of rav.triplestart.com:jmudaka/stagfe2

= před 3 roky
rodič
revize
6efdc5e2ff

+ 3 - 0
public/css/style.css

@@ -358,6 +358,9 @@ body>nav.navbar {
 .mcp-theme-1 .min-width-50 {
     min-width: 50% !important;
 }
+.mcp-theme-1 .max-width-50 {
+    max-width: 50% !important;
+}
 .mcp-theme-1 .min-width-70px {
     min-width: 70px !important;
 }

+ 8 - 2
resources/views/app/patient/allergies-center.blade.php

@@ -149,7 +149,10 @@ function isFavoriteAllergy($_allergy, $_favorites) {
                     </div>
                 </td>
                 <td>
-                    <?php $segment = $note->getSegmentByInternalName('intake_allergies'); ?>
+                    <?php
+                    $segment = $note->getSegmentByInternalName('intake_allergies');
+                    if(!$segment) $segment = $note->getSegmentByInternalName('allergies');
+                    ?>
                     <div if-read-mode>
                         <div class="d-flex align-items-start">
                             <div class="flex-grow-1">
@@ -184,7 +187,10 @@ function isFavoriteAllergy($_allergy, $_favorites) {
                     </div>
                 </td>
                 <td>
-                    <?php $segment = $note->getSegmentByInternalName('plan_allergies'); ?>
+                    <?php
+                    $segment = $note->getSegmentByInternalName('plan_allergies');
+                    if(!$segment) $segment = $note->getSegmentByInternalName('allergies');
+                    ?>
                     <div if-read-mode>
                         <div class="d-flex align-items-start position-relative">
                             <div class="flex-grow-1">

+ 2 - 0
resources/views/app/patient/behavior-center.blade.php

@@ -54,6 +54,7 @@ $points = [
                         <div if-edit-mode>
                             <?php
                             $segment = $note->getSegmentByInternalName('intake_behavior');
+                            if(!$segment) $segment = $note->getSegmentByInternalName('behavior');
                             if($segment) {
                                 $currentValue = '';
                                 $previousValue = '';
@@ -129,6 +130,7 @@ $points = [
                         <div if-edit-mode>
                             <?php
                             $segment = $note->getSegmentByInternalName('plan_behavior');
+                            if(!$segment) $segment = $note->getSegmentByInternalName('behavior');
                             if($segment) {
                                 $currentValue = '';
                                 $previousValue = '';

+ 11 - 2
resources/views/app/patient/careteam-center.blade.php

@@ -153,7 +153,10 @@ list($careTeamMembers, $counts) = Point::getPointsOfCategoryExtended($patient, '
                     </div>
                 </td>
                 <td>
-                    <?php $segment = $note->getSegmentByInternalName('intake_care_team'); ?>
+                    <?php
+                    $segment = $note->getSegmentByInternalName('intake_care_team');
+                    if(!$segment) $segment = $note->getSegmentByInternalName('care_team');
+                    ?>
                     <div if-read-mode>
                         <div class="d-flex align-items-start">
                             <div class="flex-grow-1">
@@ -184,11 +187,17 @@ list($careTeamMembers, $counts) = Point::getPointsOfCategoryExtended($patient, '
                         if($segment) {
                             include resource_path('views/app/patient/segment-templates/_child_review/edit-review-in-place.php');
                         }
+                        else {
+                            echo "pling!";
+                        }
                         ?>
                     </div>
                 </td>
                 <td>
-                    <?php $segment = $note->getSegmentByInternalName('plan_care_team'); ?>
+                    <?php
+                    $segment = $note->getSegmentByInternalName('plan_care_team');
+                    if(!$segment) $segment = $note->getSegmentByInternalName('care_team');
+                    ?>
                     <div if-read-mode>
                         <div class="d-flex align-items-start position-relative">
                             <div class="flex-grow-1">

+ 2 - 0
resources/views/app/patient/exercise-center.blade.php

@@ -50,6 +50,7 @@ $points = [
                         <div if-edit-mode>
                             <?php
                             $segment = $note->getSegmentByInternalName('intake_exercise');
+                            if(!$segment) $segment = $note->getSegmentByInternalName('exercise');
                             if($segment) {
                             $currentValue = '';
                             $previousValue = '';
@@ -126,6 +127,7 @@ $points = [
                         <div if-edit-mode>
                             <?php
                             $segment = $note->getSegmentByInternalName('plan_exercise');
+                            if(!$segment) $segment = $note->getSegmentByInternalName('exercise');
                             if($segment) {
                             $currentValue = '';
                             $previousValue = '';

+ 8 - 2
resources/views/app/patient/goals-center.blade.php

@@ -96,7 +96,10 @@ list($goals, $counts) = Point::getPointsOfCategoryExtended($patient, 'GOAL', $no
                     </div>
                 </td>
                 <td>
-                    <?php $segment = $note->getSegmentByInternalName('intake_goals'); ?>
+                    <?php
+                    $segment = $note->getSegmentByInternalName('intake_goals');
+                    if(!$segment) $segment = $note->getSegmentByInternalName('goals');
+                    ?>
                     <div if-read-mode>
                         <div class="d-flex align-items-start">
                             <div class="flex-grow-1">
@@ -131,7 +134,10 @@ list($goals, $counts) = Point::getPointsOfCategoryExtended($patient, 'GOAL', $no
                     </div>
                 </td>
                 <td>
-                    <?php $segment = $note->getSegmentByInternalName('plan_goals'); ?>
+                    <?php
+                    $segment = $note->getSegmentByInternalName('plan_goals');
+                    if(!$segment) $segment = $note->getSegmentByInternalName('goals');
+                    ?>
                     <div if-read-mode>
                         <div class="d-flex align-items-start position-relative">
                             <div class="flex-grow-1">

+ 8 - 2
resources/views/app/patient/medications-center.blade.php

@@ -147,7 +147,10 @@ function isFavoriteMedication($_medication, $_favorites) {
                         </div>
                     </td>
                     <td>
-                        <?php $segment = $note->getSegmentByInternalName('intake_medications'); ?>
+                        <?php
+                        $segment = $note->getSegmentByInternalName('intake_medications');
+                        if(!$segment) $segment = $note->getSegmentByInternalName('medications');
+                        ?>
                         <div if-read-mode>
                             <div class="d-flex align-items-start">
                                 <div class="flex-grow-1">
@@ -182,7 +185,10 @@ function isFavoriteMedication($_medication, $_favorites) {
                         </div>
                     </td>
                     <td>
-                        <?php $segment = $note->getSegmentByInternalName('plan_medications'); ?>
+                        <?php
+                        $segment = $note->getSegmentByInternalName('plan_medications');
+                        if(!$segment) $segment = $note->getSegmentByInternalName('medications');
+                        ?>
                         <div if-read-mode>
                             <div class="d-flex align-items-start position-relative">
                                 <div class="flex-grow-1">

+ 0 - 1
resources/views/app/patient/note/dashboard.blade.php

@@ -545,7 +545,6 @@
                         @if($isVisitTemplateBased && $note->visitTemplate->internal_name === 'soap_visit')
                         <div class="w-50 border-left">
                             @if($isVisitTemplateBased && !$note->is_signed_by_hcp)
-                                {{--@include('app.patient.note.rhs-sidebar')--}}
                                 @include('app.patient.note.note-segment-list-rhs')
                             @endif
                         </div>

+ 1 - 0
resources/views/app/patient/note/note-segment-list-rhs.blade.php

@@ -35,3 +35,4 @@
     }
     ?>
 </div>
+@include('app.patient.note.segment_script-rhs')

+ 5 - 3
resources/views/app/patient/note/note-segment-list.blade.php

@@ -28,9 +28,11 @@
 				@include('app.patient.note.segment')
 			</div>
 		@else
-			<div class="{{in_array($segment->segmentTemplate->internal_name, config('app.note_lhs_segments')) ? '' : 'd-none'}}">
-				@include('app.patient.note.segment')
-			</div>
+			@if(in_array($segment->segmentTemplate->internal_name, config('app.note_lhs_segments')))
+				<div>
+					@include('app.patient.note.segment')
+				</div>
+			@endif
 		@endif
     @endforeach
     <?php

+ 113 - 0
resources/views/app/patient/note/segment_script-rhs.blade.php

@@ -0,0 +1,113 @@
+<script>
+    (function() {
+
+        function initRTEs(_parent) {
+            _parent.find('[note-rte]:not(.ql-container)').each(function() {
+
+                let noteRTE = $(this);
+
+                $(this).wrap(
+                    $('<div class="border-left border-right rte-holder"/>')
+                        .attr('data-shortcuts', '')
+                );
+
+                // give a unique id to this editor instance
+                var editorID = Math.ceil(Math.random() * 99999),
+                    fieldName = $(this).attr('data-field-name') ? $(this).attr('data-field-name') : 'free_text';
+
+                var el = this;
+                var existingContent = $(el).html();
+                var quill = new Quill(el, {
+                    theme: 'snow',
+                    modules: stagQuillConfig
+                });
+
+                var toolbar = $(quill.container).prev('.ql-toolbar');
+
+                // add button for new shortcut
+                if(!noteRTE.is('[use-shortcuts]') || !noteRTE.attr('use-shortcuts')) {
+                    var newSCButton = $('<button class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +
+                        'text-sm add-shortcut" data-editor-id="' + editorID + '">+ Shortcut</button>');
+                    toolbar.append(newSCButton);
+                }
+
+                quill.root.innerHTML = existingContent;
+
+                let setValue = function(delta, oldDelta, source) {
+                    var content = quill.root.innerHTML;
+                    let dataObject = {};
+                    dataObject[fieldName] = content;
+                    var dataValue = JSON.stringify(dataObject);
+                    let pElem = $(el).closest('[visit-moe]');
+                    if(!pElem.length) {
+                        pElem = $(el).closest('form');
+                    }
+                    let v = pElem.find('input[name=data]').val();
+                    if(!!v) {
+                        try {
+                            v = JSON.parse(v);
+                            v[fieldName] = content;
+                            v = JSON.stringify(v);
+                        }
+                        catch (e) {
+                            v = JSON.stringify(dataObject);
+                        }
+                    }
+                    else {
+                        v = JSON.stringify(dataObject);
+                    }
+                    pElem.find('input[name=data]').val(v);
+                }
+
+                let onTextChange = function(delta, oldDelta, source) {
+                    setValue(delta, oldDelta, source);
+                    $(el).trigger('rich-text-input');
+                }
+
+                quill.on('text-change', onTextChange);
+
+                $(quill.container)
+                    .find('.ql-editor[contenteditable]')
+                    .attr('data-field', fieldName)
+                    .attr('data-editor-id', editorID)
+                    .attr('with-shortcuts', 1);
+
+                // set value initially
+                setValue();
+            });
+        }
+
+        function init() {
+
+            $(document)
+                .off('input.auto-grow', '[visit-moe] form textarea')
+                .on('input.auto-grow', '[visit-moe] form textarea', function() {
+                    this.style.minHeight = "calc(1.5em + .5rem + 2px)";
+                    this.style.height = "calc(1.5em + .5rem + 2px)";
+                    this.style.height = (this.scrollHeight)+"px";
+                });
+
+            let parent = $('#note-rhs-segments-list');
+            initRTEs(parent);
+            initSegmentMoes(parent);
+            initStagSuggest();
+
+            // check and run all segment initializers
+            try {
+                if(window.segmentInitializers) {
+                    for(let x in window.segmentInitializers) {
+                        if(window.segmentInitializers.hasOwnProperty(x) && typeof window.segmentInitializers[x] === 'function') {
+                            window.segmentInitializers[x].call(window);
+                        }
+                    }
+                }
+            }
+            catch (e) {
+                console.warn('Error running 1 or more segment initializers.')
+            }
+        }
+
+        addMCInitializer('note-rhs-segments-list', init, '#note-rhs-segments-list');
+
+    })();
+</script>

+ 2 - 0
resources/views/app/patient/nutrition-center.blade.php

@@ -81,6 +81,7 @@ $points = [
                         <div if-edit-mode>
                             <?php
                             $segment = $note->getSegmentByInternalName('intake_nutrition');
+                            if(!$segment) $segment = $note->getSegmentByInternalName('nutrition');
                             if($segment) {
                                 include resource_path('views/app/patient/segment-templates/_child_review/nutrition/' . $p['category'] . '/edit-review.php');
                             }
@@ -100,6 +101,7 @@ $points = [
                         <div if-edit-mode>
                             <?php
                             $segment = $note->getSegmentByInternalName('plan_nutrition');
+                            if(!$segment) $segment = $note->getSegmentByInternalName('nutrition');
                             if($segment) {
                                 include resource_path('views/app/patient/segment-templates/_child_plan/nutrition/' . $p['category'] . '/edit-plan.php');
                             }

+ 8 - 2
resources/views/app/patient/problems-center.blade.php

@@ -186,7 +186,10 @@ function isFavoriteProblem($_problem, $_favorites) {
                     </div>
                 </td>
                 <td>
-                    <?php $segment = $note->getSegmentByInternalName('intake_problems'); ?>
+                    <?php
+                    $segment = $note->getSegmentByInternalName('intake_problems');
+                    if(!$segment) $segment = $note->getSegmentByInternalName('problems');
+                    ?>
                     <div if-read-mode>
                         <div class="d-flex align-items-start">
                             <div class="flex-grow-1">
@@ -221,7 +224,10 @@ function isFavoriteProblem($_problem, $_favorites) {
                     </div>
                 </td>
                 <td>
-                    <?php $segment = $note->getSegmentByInternalName('plan_problems'); ?>
+                    <?php
+                    $segment = $note->getSegmentByInternalName('plan_problems');
+                    if(!$segment) $segment = $note->getSegmentByInternalName('problems');
+                    ?>
                     <div if-read-mode>
                         <div class="d-flex align-items-start position-relative">
                             <div class="flex-grow-1">

+ 10 - 5
resources/views/app/patient/segment-templates/allergies/summary.blade.php

@@ -28,6 +28,8 @@ $plural = 'Allergies';
         <?php $rel = $point->relevanceToNote($note); ?>
         <?php $plan = $point->lastChildPlan; ?>
         <?php if($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
+        <?php $review = $point->lastChildReview; ?>
+        <?php if($review && @($review->data)) $review->data = json_decode($review->data); ?>
         <?php $numVisible++; ?>
         <tr>
             <td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
@@ -45,12 +47,15 @@ $plural = 'Allergies';
             </td>
             <td class="px-2 width-300px">
                 <div>
+                    <?php if(!!$review): ?>
+                    <div class="pl-3 mt-1 d-flex align-items-baseline">
+                        <b class="text-secondary mr-1">Subj:</b><span>{!! $review->data->value !!}</span>
+                    </div>
+                    <?php endif; ?>
                     <?php if(!!$plan): ?>
-                        <div class="pl-3 mt-1 d-flex align-items-baseline">
-                            <span>{!! $plan->data->value !!}</span>
-                        </div>
-                    <?php elseif($rel): ?>
-                        <div class="relevant-without-plan text-warning-mellow text-sm mt-1" data-target-segment="<?= $segment->segmentTemplate->internal_name ?>"><i class="fa fa-exclamation-triangle mr-1"></i>Plan missing</div>
+                    <div class="pl-3 mt-1 d-flex align-items-baseline">
+                        <b class="text-secondary mr-1">Plan:</b><span>{!! $plan->data->value !!}</span>
+                    </div>
                     <?php endif; ?>
                 </div>
                 <div class="d-flex align-items-baseline">

+ 10 - 5
resources/views/app/patient/segment-templates/goals/summary.blade.php

@@ -19,6 +19,8 @@ $plural = 'Goals';
         <?php $rel = $point->relevanceToNote($note); ?>
         <?php $plan = $point->lastChildPlan; ?>
         <?php if($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
+        <?php $review = $point->lastChildReview; ?>
+        <?php if($review && @($review->data)) $review->data = json_decode($review->data); ?>
         <?php $numVisible++; ?>
         <tr>
             <td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
@@ -36,12 +38,15 @@ $plural = 'Goals';
             </td>
             <td class="px-2 width-300px">
                 <div>
+                    <?php if(!!$review): ?>
+                    <div class="pl-3 mt-1 d-flex align-items-baseline">
+                        <b class="text-secondary mr-1">Subj:</b><span>{!! $review->data->value !!}</span>
+                    </div>
+                    <?php endif; ?>
                     <?php if(!!$plan): ?>
-                        <div class="pl-3 mt-1 d-flex align-items-baseline">
-                            <span>{!! $plan->data->value !!}</span>
-                        </div>
-                    <?php elseif($rel): ?>
-                        <div class="relevant-without-plan text-warning-mellow text-sm mt-1" data-target-segment="<?= $segment->segmentTemplate->internal_name ?>"><i class="fa fa-exclamation-triangle mr-1"></i>Plan missing</div>
+                    <div class="pl-3 mt-1 d-flex align-items-baseline">
+                        <b class="text-secondary mr-1">Plan:</b><span>{!! $plan->data->value !!}</span>
+                    </div>
                     <?php endif; ?>
                 </div>
                 <div class="d-flex align-items-baseline">

+ 8 - 3
resources/views/app/patient/segment-templates/medications/summary.blade.php

@@ -24,6 +24,8 @@ $plural = 'Medications';
         <?php $rel = $point->relevanceToNote($note); ?>
         <?php $plan = $point->lastChildPlan; ?>
         <?php if($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
+        <?php $review = $point->lastChildReview; ?>
+        <?php if($review && @($review->data)) $review->data = json_decode($review->data); ?>
         <?php $numVisible++; ?>
         <tr>
             <td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
@@ -41,12 +43,15 @@ $plural = 'Medications';
             </td>
             <td class="px-2 width-300px">
                 <div>
+                    <?php if(!!$review): ?>
+                    <div class="pl-3 mt-1 d-flex align-items-baseline">
+                        <b class="text-secondary mr-1">Subj:</b><span>{!! $review->data->value !!}</span>
+                    </div>
+                    <?php endif; ?>
                     <?php if(!!$plan): ?>
                     <div class="pl-3 mt-1 d-flex align-items-baseline">
-                        <span>{!! $plan->data->value !!}</span>
+                        <b class="text-secondary mr-1">Plan:</b><span>{!! $plan->data->value !!}</span>
                     </div>
-                    <?php elseif($rel): ?>
-                    <div class="relevant-without-plan text-warning-mellow text-sm mt-1" data-target-segment="<?= $segment->segmentTemplate->internal_name ?>"><i class="fa fa-exclamation-triangle mr-1"></i>Plan missing</div>
                     <?php endif; ?>
                 </div>
                 <div class="d-flex align-items-baseline">                

+ 10 - 5
resources/views/app/patient/segment-templates/problems/summary.blade.php

@@ -19,6 +19,8 @@ $plural = 'Problems';
         <?php $rel = $point->relevanceToNote($note); ?>
         <?php $plan = $point->lastChildPlan; ?>
         <?php if($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
+        <?php $review = $point->lastChildReview; ?>
+        <?php if($review && @($review->data)) $review->data = json_decode($review->data); ?>
         <?php $numVisible++; ?>
         <tr>
             <td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
@@ -36,12 +38,15 @@ $plural = 'Problems';
             </td>
             <td class="px-2 width-300px">
                 <div>
+                    <?php if(!!$review): ?>
+                    <div class="pl-3 mt-1 d-flex align-items-baseline">
+                        <b class="text-secondary mr-1">Subj:</b><span>{!! $review->data->value !!}</span>
+                    </div>
+                    <?php endif; ?>
                     <?php if(!!$plan): ?>
-                        <div class="pl-3 mt-1 d-flex align-items-baseline">
-                            <span>{!! $plan->data->value !!}</span>
-                        </div>
-                    <?php elseif($rel): ?>
-                        <div class="relevant-without-plan text-warning-mellow text-sm mt-1" data-target-segment="<?= $segment->segmentTemplate->internal_name ?>"><i class="fa fa-exclamation-triangle mr-1"></i>Plan missing</div>
+                    <div class="pl-3 mt-1 d-flex align-items-baseline">
+                        <b class="text-secondary mr-1">Plan:</b><span>{!! $plan->data->value !!}</span>
+                    </div>
                     <?php endif; ?>
                 </div>
                 <div class="d-flex align-items-baseline">