Эх сурвалжийг харах

Dynamic questions engine (wip)

Vijayakrishnan 3 жил өмнө
parent
commit
11c04ea89a

+ 0 - 6
resources/views/app/dq-engine/edit.blade.php

@@ -1,9 +1,3 @@
-{{--
-inputs:
-    template
-    data // any currently saved data
-    any other inputs like $note, $client
---}}
 <?php
 <?php
 $template = json_decode(file_get_contents(resource_path('views/app/dq-templates/' . $template)));
 $template = json_decode(file_get_contents(resource_path('views/app/dq-templates/' . $template)));
 $loadedData = $data;
 $loadedData = $data;

+ 23 - 5
resources/views/app/dq-engine/read.blade.php

@@ -1,5 +1,23 @@
-{{--
-inputs:
-    pointData
---}}
-READ
+<?php
+$template = json_decode(file_get_contents(resource_path('views/app/dq-templates/' . $template)));
+$loadedData = $data;
+if(!$loadedData || !@$loadedData->lines || !@$loadedData->dataMap) {
+    $loadedData = $template;
+}
+function _renderDQLine($_line, $loadedData) {
+    if (!!@$loadedData->dataMap->{$_line->key}) {
+        $result = str_replace('{value}', $loadedData->dataMap->{$_line->key}, $_line->resultSummary);
+        echo '<span class="mr-2 text-nowrap">• ' . $result . '</span>';
+        if (@$_line->lines) {
+            foreach ($_line->lines as $line) {
+                _renderDQLine($line, $loadedData);
+            }
+        }
+    }
+}
+?>
+<div class="dq-read-container">
+    @foreach ($template->lines as $line)
+        <?php _renderDQLine($line, $loadedData); ?>
+    @endforeach
+</div>

+ 2 - 2
resources/views/app/dq-templates/test.json

@@ -3,13 +3,13 @@
     {
     {
       "key": "onset",
       "key": "onset",
       "helpText": "When did the problem begin?",
       "helpText": "When did the problem begin?",
-      "resultSummary": "Onset: {value}",
+      "resultSummary": "<b>Onset</b>: {value}",
       "fieldType": "date"
       "fieldType": "date"
     },
     },
     {
     {
       "key": "location",
       "key": "location",
       "helpText": "Where is the CC located?",
       "helpText": "Where is the CC located?",
-      "resultSummary": "Location: {value}",
+      "resultSummary": "<b>Location</b>: {value}",
       "fieldType": "time"
       "fieldType": "time"
     }
     }
   ],
   ],

+ 1 - 1
resources/views/app/patient/note/edit-hpi.blade.php

@@ -94,7 +94,7 @@
 
 
                 <div>
                 <div>
                     <button submit class="btn btn-sm btn-primary mr-2">Save</button>
                     <button submit class="btn btn-sm btn-primary mr-2">Save</button>
-                    <button cancel class="btn btn-sm btn-default border" onclick="closeStagPopup()">Cancel</button>
+                    <button cancel class="btn btn-sm btn-default border" onclick="closeStagPopup()">Close</button>
                 </div>
                 </div>
             </form>
             </form>
         </div>
         </div>

+ 30 - 0
resources/views/app/patient/note/last-hpi.blade.php

@@ -0,0 +1,30 @@
+<?php if ($point->lastChildReview): ?>
+<?php $parsedReview = json_decode($point->lastChildReview->data); ?>
+<div class="<?= $point->last_child_review_point_scoped_note_id === $note->id ? 'bg-warning-mellow p-2 rounded' : '' ?>">
+    <div>
+        <?php
+        if(!@$template) {
+            $template = 'test.json';
+        }
+        $data = $parsedReview ? $parsedReview : null;
+        ?>
+        @include('app.dq-engine.read', compact('template', 'note', 'patient', 'point', 'data'))
+    </div>
+
+    <?php if ($point->last_child_review_point_scoped_note_id === $patient->core_note_id): ?>
+    <span class="text-sm">(reviewed on the patient's chart)</span>
+    <?php else: ?>
+    <?php if ($point->last_child_review_point_scoped_note_id === $note->id): ?>
+    <span class="text-sm">(reviewed on this note)</span>
+    <?php else: ?>
+    <a native target="_blank"
+       href="<?= route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $point->lastChildReviewNote]) ?>">
+        <?= friendlier_date_time($point->last_child_review_effective_date) ?>
+    </a>
+    <?php endif; ?>
+    <?php endif; ?>
+
+</div>
+<?php else: ?>
+<span class="text-secondary text-sm">None</span>
+<?php endif; ?>

+ 4 - 1
resources/views/app/patient/problems-center.blade.php

@@ -74,7 +74,9 @@ $ccSegment = $note->getSegmentByInternalName('chief_complaint');
                             include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
                             include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
                             ?>
                             ?>
                         </div>--}}
                         </div>--}}
-                        <div class="flex-grow-1">dg read ui</div>
+                        <div class="flex-grow-1">
+                            @include('app.patient.note.last-hpi')
+                        </div>
                         <div>
                         <div>
                             <div class="">
                             <div class="">
                                 <a class="pl-2 view-review-log"
                                 <a class="pl-2 view-review-log"
@@ -90,6 +92,7 @@ $ccSegment = $note->getSegmentByInternalName('chief_complaint');
                                 <a class="pl-2 view-review-log"
                                 <a class="pl-2 view-review-log"
                                    native target="_blank"
                                    native target="_blank"
                                    open-in-stag-popup
                                    open-in-stag-popup
+                                   update-parent
                                    mc-initer="edit-hpi-{{$problem->id}}"
                                    mc-initer="edit-hpi-{{$problem->id}}"
                                    popup-style="stag-popup-md"
                                    popup-style="stag-popup-md"
                                    title="HPI<?= !!@($problem->data->name) ? ' for ' . @($problem->data->name) : '' ?> / <?= $patient->displayName() ?>"
                                    title="HPI<?= !!@($problem->data->name) ? ' for ' . @($problem->data->name) : '' ?> / <?= $patient->displayName() ?>"