소스 검색

Omega - informed consent + cc

Vijayakrishnan 3 년 전
부모
커밋
90b3277504

+ 64 - 1
resources/views/app/patient/segment-templates/omega_cc/edit.blade.php

@@ -1 +1,64 @@
-<h1>omega_cc</h1>
+<?php
+$category = 'CHIEF_COMPLAINT';
+$endPoint = 'upsertNoteSingleton';
+
+use App\Models\Point;
+
+$point = Point::where('added_in_note_id', $segment->note->id)->where('category', $category)->orderBy('id', 'DESC')->first();
+$parsed = null;
+if ($point && !!@$point->data) {
+    $parsed = json_decode($point->data);
+}
+
+if(!$parsed || !@$parsed->free_text) {
+    $problemPoints = Point::getPointsOfCategory($patient, 'PROBLEM');
+    $problemNames = [];
+    foreach ($problemPoints as $problemPoint) {
+        if($problemPoint->relevanceToNote($note)) {
+            $problemNames[] = $problemPoint->data->name;
+        }
+    }
+    $problems = '';
+    for($i = 0; $i < count($problemNames); $i++) {
+        if($i > 0) {
+            if($i === count($problemNames) - 1) {
+                $problems .= " and ";
+            }
+            else {
+                $problems .= ", ";
+            }
+        }
+        $problems .= $problemNames[$i];
+    }
+    $defaultCC = "Patient {$patient->name_first} {$patient->name_last} " .
+        "is a {$patient->age_in_years} year old" .
+        ($patient->sex ? ($patient->sex === 'F' ? ' female' : ($patient->sex === 'M' ? ' male' : ' ' . $patient->sex)) : '') .
+        ($problems ? " with a history of {$problems}" : "") .
+        ($note->new_or_fu_or_na === 'NEW' ? ' presenting for establishing care' : ' presenting for follow-up') .
+        ".";
+    $parsed = json_decode(json_encode([
+        "free_text" => $defaultCC
+    ]));
+}
+?>
+<div visit-moe close-on-save close-on-cancel class="d-block">
+    <form show url="/api/visitPoint/<?= $endPoint ?>" class="mcp-theme-1">
+        <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+        <input type="hidden" name="category" value="<?= $category ?>">
+        <input type="hidden" name="data">
+        <div note-rte
+             class="form-group mb-2 border-left border-right rte-holder"
+             data-field-name="free_text"
+        ><?= $parsed && @$parsed->free_text ? $parsed->free_text : '' ?></div>
+        <div class="m-2">
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
+            <div class="d-inline-flex align-self-stretch align-items-center">
+                <span class="autosave-indicator saving text-sm text-secondary">Saving changes &hellip;</span>
+                <span class="autosave-indicator saved text-sm text-secondary">
+                    <i class="fa fa-check"></i>
+                    Saved
+                </span>
+            </div>
+        </div>
+    </form>
+</div>

+ 55 - 1
resources/views/app/patient/segment-templates/omega_cc/summary.blade.php

@@ -1 +1,55 @@
-<h1>omega_cc</h1>
+<?php
+$category = 'CHIEF_COMPLAINT';
+
+use App\Models\Point;
+
+$point = Point::where('added_in_note_id', $segment->note->id)->where('category', $category)->orderBy('id', 'DESC')->first();
+$parsed = null;
+if ($point && !!@$point->data) {
+    $parsed = json_decode($point->data);
+}
+
+if(!$parsed || !@$parsed->free_text) {
+    /*
+    list($problemPoints, $counts) = Point::getPointsOfCategoryExtended($patient, 'PROBLEM', $note);
+    $problemNames = [];
+    foreach ($problemPoints as $problemPoint) {
+        if($problemPoint->relevanceToNote($note)) {
+            $problemNames[] = $problemPoint->data->name;
+        }
+    }
+    $problems = '';
+    for($i = 0; $i < count($problemNames); $i++) {
+        if($i > 0) {
+            if($i === count($problemNames) - 1) {
+                $problems .= " and ";
+            }
+            else {
+                $problems .= ", ";
+            }
+        }
+        $problems .= $problemNames[$i];
+    }
+    $defaultCC = "Patient {$patient->name_first} {$patient->name_last} " .
+        "is a {$patient->age_in_years} year old" .
+        ($patient->sex ? ($patient->sex === 'F' ? ' female' : ($patient->sex === 'M' ? ' male' : ' ' . $patient->sex)) : '') .
+        ($problems ? " with a history of {$problems}" : "") .
+        ($note->new_or_fu_or_na === 'NEW' ? ' presenting for establishing care' : ' presenting for follow-up') .
+        ".";
+    $parsed = json_decode(json_encode([
+        "free_text" => $defaultCC
+    ]));
+    */
+}
+?>
+<div>
+    <?php
+    if (!!$parsed && @$parsed->free_text) {
+        echo $parsed->free_text;
+    }
+    else {
+        echo "-";
+    }
+    ?>
+</div>
+

+ 40 - 1
resources/views/app/patient/segment-templates/omega_informed_consent/edit.blade.php

@@ -1 +1,40 @@
-<h1>omega_informed_consent</h1>
+<?php
+
+use App\Models\Point;
+
+$category = 'INFORMED_CONSENT';
+$endPoint = 'upsertNoteSingleton';
+
+$point = Point::where('added_in_note_id', $note->id)->where('category', $category)->orderBy('id', 'DESC')->first();
+$contentData = [
+    "informed_consent" => false
+];
+if (!!@$point->data) {
+    $contentData = json_decode($point->data, true);
+}
+?>
+<div visit-moe close-on-save close-on-cancel class="d-block px-3 py-2">
+    <form show url="/api/visitPoint/<?= $endPoint ?>" class="mcp-theme-1 mt-2">
+        <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+        <input type="hidden" name="category" value="<?= $category ?>">
+        <input type="hidden" name="data" value="{{json_encode($contentData)}}">
+
+        <label class="d-flex align-items-baseline mb-2">
+            <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
+                <input type="checkbox" data-name="informed_consent" {{@($contentData["informed_consent"] ? 'checked' : '')}}>
+            </div>
+            <span>Informed consent for treatment obtained and patient questions answered.</span>
+        </label>
+
+        <div class="pt-2">
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
+            <div class="d-inline-flex align-self-stretch align-items-center">
+                <span class="autosave-indicator saving text-sm text-secondary">Saving changes &hellip;</span>
+                <span class="autosave-indicator saved text-sm text-secondary">
+                    <i class="fa fa-check"></i>
+                    Saved
+                </span>
+            </div>
+        </div>
+    </form>
+</div>

+ 26 - 1
resources/views/app/patient/segment-templates/omega_informed_consent/summary.blade.php

@@ -1 +1,26 @@
-<h1>omega_informed_consent</h1>
+<?php
+
+use App\Models\Point;
+
+$category = 'INFORMED_CONSENT';
+$endPoint = 'upsertNoteSingleton';
+
+$point = Point::where('added_in_note_id', $note->id)->where('category', $category)->orderBy('id', 'DESC')->first();
+$contentData = [
+    "informed_consent" => false
+];
+if (!!@$point->data) {
+    $contentData = json_decode($point->data, true);
+}
+?>
+
+<div class="d-flex align-items-baseline mb-2">
+    <div class="align-self-stretch min-width-30px text-left">
+        @if(@($contentData["informed_consent"]))
+            <i class="fa fa-check"></i>
+        @else
+            <i class="fa fa-exclamation-triangle"></i>
+        @endif
+    </div>
+    <span class="flex-grow-1">Informed consent for treatment obtained and patient questions answered.</span>
+</div>