浏览代码

Visit UI - reusable child-reviews feature

Vijayakrishnan 3 年之前
父节点
当前提交
efd9d63f7e

+ 14 - 0
app/Models/Point.php

@@ -8,4 +8,18 @@ class Point extends Model
 {
     protected $table = 'point';
 
+    public function lastChildReview()
+    {
+        return $this->hasOne(Point::class, 'id', 'last_child_review_point_id');
+    }
+
+    public function lastChildReviewNote()
+    {
+        return $this->hasOne(Note::class, 'id', 'last_child_review_point_scoped_note_id');
+    }
+
+    public function lastChildPlan()
+    {
+        return $this->hasOne(Point::class, 'id', 'last_child_review_point_id');
+    }
 }

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

@@ -16,6 +16,7 @@
                 segment.find('.edit-container').html(_object.editHtml);
                 initRTEs(segment);
                 initSegmentMoes(segment);
+                initMoes();
             }
         }
 

+ 24 - 0
resources/views/app/patient/segment-templates/_child_review/edit-review.php

@@ -0,0 +1,24 @@
+<div visit-moe>
+    <a start show href="#">Edit</a>
+    <form url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
+        <input type="hidden" name="uid" value="<?= $point->uid ?>">
+        <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+        <input type="hidden" name="data">
+
+        <p class="mb-2"><b>Review</b></p>
+
+        <div class="mb-2">
+            <textarea data-name="value" class="form-control form-control-sm" rows="3"
+            ><?php
+                if ($point->lastChildReview && $point->last_child_review_point_scoped_note_id === $note->id) {
+                    $parsedReview = json_decode($point->lastChildReview->data);
+                    echo $parsedReview->value;
+                }
+                ?></textarea>
+        </div>
+        <div>
+            <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+        </div>
+    </form>
+</div>

+ 14 - 0
resources/views/app/patient/segment-templates/_child_review/last-review.php

@@ -0,0 +1,14 @@
+<?php if($point->lastChildReview): ?>
+    <?php $parsedReview = json_decode($point->lastChildReview->data); ?>
+    <div><?= $parsedReview->value ?></div>
+    <div class="text-secondary text-sm"></div>
+    <?php if($point->last_child_review_point_scoped_note_id === $note->id): ?>
+        <span class="text-secondary 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 else: ?>
+    <span class="text-secondary text-sm">None</span>
+<?php endif; ?>

+ 14 - 5
resources/views/app/patient/segment-templates/intake_medications/edit.php

@@ -50,9 +50,9 @@ foreach ($medications as $medication) {
                             <div class="ml-auto d-inline-flex align-items-baseline pr-2">
                                 <?php if ($medication->is_removed): ?>
                                     <?php if ($medication->is_removed_due_to_entry_error): ?>
-                                        <span class="font-weight-bold text-secondary" class="mr-2">Entry error</span>
+                                        <span class="font-weight-bold text-secondary mr-2">Entry error</span>
                                     <?php else: ?>
-                                        <span class="font-weight-bold text-secondary" class="mr-2">Removed on intake</span>
+                                        <span class="font-weight-bold text-secondary mr-2">Removed on intake</span>
                                     <?php endif; ?>
                                     <div visit-moe>
                                         <form show url="/api/visitPoint/undoMarkRemoved" class="mcp-theme-1">
@@ -108,9 +108,18 @@ foreach ($medications as $medication) {
 
                         </div>
                     </td>
-                    <td></td>
-                    <td></td>
-                    <td></td>
+                    <td>
+                        <?php
+                        $point = $medication;
+                        include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
+                        ?>
+                    </td>
+                    <td>
+                        <?php
+                        $point = $medication;
+                        include resource_path('views/app/patient/segment-templates/_child_review/edit-review.php');
+                        ?>
+                    </td>
                 </tr>
             <?php endforeach; ?>
         </table>