Parcourir la source

Note - Dx - Previous HPI/Plan support

Vijayakrishnan il y a 4 ans
Parent
commit
ff85b227f2
1 fichiers modifiés avec 45 ajouts et 6 suppressions
  1. 45 6
      resources/views/app/patient/canvas-sections/dx/form.blade.php

+ 45 - 6
resources/views/app/patient/canvas-sections/dx/form.blade.php

@@ -12,8 +12,11 @@ if(!$contentData || !isset($contentData['items']) || !count($contentData['items'
                 "title" => "",
                 "icd" => "",
                 "coa" => "Chronic",
-                "detail" => "",
+                "previous_hpi" => "",
+                "detail" => "", // actually HPI (name retained to avoid breakage)
+                "previous_plan" => "",
                 "plan" => "",
+                "note_uid" => "",
             ]
         ]
     ];
@@ -68,7 +71,7 @@ $formID = rand(0, 100000);
             </th>
             <th class="px-2 text-secondary border-bottom-0 w-35">
                 <div class="d-flex align-items-center font-weight-normal">
-                    <span>Title</span>
+                    <span class="font-weight-bold">Title</span>
                     <div class="hide-if-dashboard ml-auto">
                         <div v-if="favorites && favorites.length" class="d-inline-flex2">
                             <div moe relative>
@@ -126,7 +129,11 @@ $formID = rand(0, 100000);
                         <option value="Acute">Acute</option>
                     </select>
                 </div>
-                <textarea type="text" class="form-control form-control-sm" v-model="item.detail" placeholder="Detail"></textarea>
+                <div class="px-2 py-1 bg-white border-bottom text-secondary" v-if="item.previous_hpi">
+                    <b><i class="fa fa-clock mr-1 text-sm"></i>Previous HPI: </b><br>
+                    <div v-html="item.previous_hpi"></div>
+                </div>
+                <textarea type="text" class="form-control form-control-sm" v-model="item.detail" placeholder="Updated HPI *"></textarea>
             </td>
             {{--<td>
                 <input type="text" :data-index="index"
@@ -142,7 +149,12 @@ $formID = rand(0, 100000);
                           dx-rte :data-index="index" data-field="detail"
                           v-model="item.detail"></textarea>
             </td>--}}
-            <td><textarea type="text" class="form-control form-control-sm"
+            <td>
+                <div class="px-2 py-1 bg-white border-bottom text-secondary" v-if="item.previous_plan">
+                    <b><i class="fa fa-clock mr-1 text-sm"></i>Previous Plan: </b><br>
+                    <div v-html="item.previous_plan"></div>
+                </div>
+                <textarea type="text" class="form-control form-control-sm"
                           dx-rte :data-index="index" data-field="plan"
                           v-model="item.plan"></textarea>
             </td>
@@ -186,19 +198,44 @@ $formID = rand(0, 100000);
         for (let i = 0; i < favorites.length; i++) {
             favorites[i].data = JSON.parse(favorites[i].data);
         }
+
+        let saved = <?= json_encode($contentData['items']) ?>;
+        // if FU, copy hpi into previous_hpi for each item, and empty out hpi
+        @if(@$note && $note->new_or_fu_or_na === 'FU')
+            for (let i = 0; i < saved.length; i++) {
+                if(saved[i].note_uid !== '{{$note->uid}}') {
+                    if(saved[i].detail) saved[i].previous_hpi = saved[i].detail;
+                    if(saved[i].plan) saved[i].previous_plan = saved[i].plan;
+                    saved[i].detail = '';
+                    saved[i].plan = '';
+                    saved[i].note_uid = '{{$note->uid}}';
+                }
+            }
+        console.log('ALIX', saved)
+        @endif
+
         function init() {
             window.clientDXApp = new Vue({
                 el: '#dxSection',
                 data: {
                     includeAll: false,
-                    items: <?= json_encode($contentData['items']) ?>,
+                    items: saved,
                     inclusion: [],
                     favorites: favorites,
                 },
                 mounted: function() {
                     this.inclusion = [];
                     for (let i = 0; i < this.items.length; i++) {
-                        this.inclusion[i] = this.items[i].included;
+                        @if(@$note && $note->new_or_fu_or_na === 'FU')
+                            if(this.items[i].note_uid !== '{{$note->uid}}') {
+                                this.inclusion[i] = this.items[i].included = false;
+                            }
+                            else {
+                                this.inclusion[i] = this.items[i].included;
+                            }
+                        @else
+                            this.inclusion[i] = this.items[i].included;
+                        @endif
                     }
                     this.initRTE();
                     this.initTitleAutoSuggest();
@@ -302,6 +339,8 @@ $formID = rand(0, 100000);
 
                             var toolbar = $(qe.container).prev('.ql-toolbar');
 
+                            toolbar.append('<b class="float-left text-secondary ml-1 mr-2 pt-1">Updated Plan *</b>');
+
                             // add button for new shortcut
                             var newSCButton = $('<button type="button" tabindex="-1" ' +
                                 'class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +