Explorar o código

Omega-subjective-free-text => init with intake_date for note #1

Vijayakrishnan %!s(int64=3) %!d(string=hai) anos
pai
achega
64c69be220

+ 58 - 3
resources/views/app/patient/segment-templates/omega_subjective_free_text/edit.blade.php

@@ -1,4 +1,59 @@
 <?php
-$category = 'SUBJECTIVE_GENERAL';
-$endPoint = 'upsertNoteSingleton';
-include resource_path('views/app/patient/segment-templates/_simple_text_segment/edit.php');
+
+use App\Models\Point;
+
+$point = Point::where('added_in_note_id', $note->id)->where('category', 'SUBJECTIVE_GENERAL')->orderBy('id', 'DESC')->first();
+$parsed = null;
+if (!!@$point->data) {
+    $parsed = json_decode($point->data);
+}
+$content = '';
+if (!!$parsed && @$parsed->free_text) {
+    $content = $parsed->free_text;
+}
+else {
+    if($note->visit_number === 1) {
+        $intakeDataFields = config('patient-intake-data');
+        $patientCanvasData = json_decode($patient->canvas_data ?? null);
+        $patientIntakeData = null;
+        if ($patientCanvasData && @$patientCanvasData->INTAKE_DATA) {
+            $patientIntakeData = @$patientCanvasData->INTAKE_DATA;
+            foreach($intakeDataFields as $key=>$label) {
+                if($key == 'ethnicity_checkboxes') {
+                    foreach($label as $eKey => $eLabel) {
+                        if(@$patientIntakeData->{$eKey}) {
+                            $content .= $eLabel . ': ' . @$patientIntakeData->{$eKey} . '&nbsp;&nbsp;&nbsp;';
+                        }
+                    }
+                }
+                else {
+                    if(@$patientIntakeData->{$key}) {
+                        $content .= ($key !== 'stickyNote' ? $label . ': ' : '<br>') . @$patientIntakeData->{$key} . '&nbsp;&nbsp;&nbsp;';
+                    }
+                }
+            }
+        }
+    }
+}
+?>
+<div visit-moe close-on-save close-on-cancel class="d-block">
+    <form show url="/api/visitPoint/upsertNoteSingleton" class="mcp-theme-1">
+        <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+        <input type="hidden" name="category" value="SUBJECTIVE_GENERAL">
+        <input type="hidden" name="data">
+        <div note-rte
+             class="form-group mb-2 border-left border-right rte-holder"
+             data-field-name="free_text"
+        ><?= $content ?></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>

+ 47 - 2
resources/views/app/patient/segment-templates/omega_subjective_free_text/summary.blade.php

@@ -1,3 +1,48 @@
 <?php
-$category = 'SUBJECTIVE_GENERAL';
-include resource_path('views/app/patient/segment-templates/_simple_text_segment/summary.php');
+
+use App\Models\Point;
+
+$point = Point::where('added_in_note_id', $note->id)->where('category', 'SUBJECTIVE_GENERAL')->orderBy('id', 'DESC')->first();
+$parsed = null;
+if (!!@$point->data) {
+    $parsed = json_decode($point->data);
+}
+?>
+<div class="wrapping-pre-container">
+    <?php
+    if (!!$parsed && @$parsed->free_text) {
+        echo $parsed->free_text;
+    }
+    else {
+        if($note->visit_number === 1) {
+            $intakeDataFields = config('patient-intake-data');
+            $patientCanvasData = json_decode($patient->canvas_data ?? null);
+            $patientIntakeData = null;
+            if ($patientCanvasData && @$patientCanvasData->INTAKE_DATA) {
+                $patientIntakeData = @$patientCanvasData->INTAKE_DATA;
+                foreach($intakeDataFields as $key=>$label) {
+                    if($key == 'ethnicity_checkboxes') {
+                        foreach($label as $eKey => $eLabel) {
+                            if(@$patientIntakeData->{$eKey}) {
+                                echo $eLabel . ': ' . @$patientIntakeData->{$eKey} . '&nbsp;&nbsp;&nbsp;';
+                            }
+                        }
+                    }
+                    else {
+                        if(@$patientIntakeData->{$key}) {
+                            echo ($key !== 'stickyNote' ? $label . ': ' : '<br>') . @$patientIntakeData->{$key} . '&nbsp;&nbsp;&nbsp;';
+                        }
+                    }
+                }
+            }
+            else {
+                echo "-";
+            }
+        }
+        else {
+            echo "-";
+        }
+    }
+    ?>
+</div>
+