Explorar o código

Merge branch 'dev' of rav.triplestart.com:jmudaka/stagfe2 into dev

Samson Mutunga %!s(int64=3) %!d(string=hai) anos
pai
achega
cccb96f78f
Modificáronse 47 ficheiros con 594 adicións e 20 borrados
  1. 5 1
      resources/views/app/patient/note/dashboard.blade.php
  2. 44 0
      resources/views/app/patient/note/note-segment-list-slim.blade.php
  3. 20 19
      resources/views/app/patient/note/note-segment-list.blade.php
  4. 65 0
      resources/views/app/patient/note/segment-slim.blade.php
  5. 1 0
      resources/views/app/patient/segment-templates/omega_allergies/edit.blade.php
  6. 1 0
      resources/views/app/patient/segment-templates/omega_allergies/summary.blade.php
  7. 1 0
      resources/views/app/patient/segment-templates/omega_assessment_free_text/edit.blade.php
  8. 1 0
      resources/views/app/patient/segment-templates/omega_assessment_free_text/summary.blade.php
  9. 1 0
      resources/views/app/patient/segment-templates/omega_assessment_system/edit.blade.php
  10. 1 0
      resources/views/app/patient/segment-templates/omega_assessment_system/summary.blade.php
  11. 1 0
      resources/views/app/patient/segment-templates/omega_care_team/edit.blade.php
  12. 1 0
      resources/views/app/patient/segment-templates/omega_care_team/summary.blade.php
  13. 1 0
      resources/views/app/patient/segment-templates/omega_cc/edit.blade.php
  14. 1 0
      resources/views/app/patient/segment-templates/omega_cc/summary.blade.php
  15. 1 0
      resources/views/app/patient/segment-templates/omega_goals/edit.blade.php
  16. 1 0
      resources/views/app/patient/segment-templates/omega_goals/summary.blade.php
  17. 1 0
      resources/views/app/patient/segment-templates/omega_history_family/edit.blade.php
  18. 1 0
      resources/views/app/patient/segment-templates/omega_history_family/summary.blade.php
  19. 1 0
      resources/views/app/patient/segment-templates/omega_history_past_medical/edit.blade.php
  20. 1 0
      resources/views/app/patient/segment-templates/omega_history_past_medical/summary.blade.php
  21. 239 0
      resources/views/app/patient/segment-templates/omega_history_social/edit.blade.php
  22. 89 0
      resources/views/app/patient/segment-templates/omega_history_social/log.blade.php
  23. 92 0
      resources/views/app/patient/segment-templates/omega_history_social/summary.blade.php
  24. 1 0
      resources/views/app/patient/segment-templates/omega_history_surgical/edit.blade.php
  25. 1 0
      resources/views/app/patient/segment-templates/omega_history_surgical/summary.blade.php
  26. 1 0
      resources/views/app/patient/segment-templates/omega_informed_consent/edit.blade.php
  27. 1 0
      resources/views/app/patient/segment-templates/omega_informed_consent/summary.blade.php
  28. 1 0
      resources/views/app/patient/segment-templates/omega_medications/edit.blade.php
  29. 1 0
      resources/views/app/patient/segment-templates/omega_medications/summary.blade.php
  30. 1 0
      resources/views/app/patient/segment-templates/omega_objective_free_text/edit.blade.php
  31. 1 0
      resources/views/app/patient/segment-templates/omega_objective_free_text/summary.blade.php
  32. 1 0
      resources/views/app/patient/segment-templates/omega_objective_system/edit.blade.php
  33. 1 0
      resources/views/app/patient/segment-templates/omega_objective_system/summary.blade.php
  34. 1 0
      resources/views/app/patient/segment-templates/omega_plan_free_text/edit.blade.php
  35. 1 0
      resources/views/app/patient/segment-templates/omega_plan_free_text/summary.blade.php
  36. 1 0
      resources/views/app/patient/segment-templates/omega_plan_system/edit.blade.php
  37. 1 0
      resources/views/app/patient/segment-templates/omega_plan_system/summary.blade.php
  38. 1 0
      resources/views/app/patient/segment-templates/omega_problems/edit.blade.php
  39. 1 0
      resources/views/app/patient/segment-templates/omega_problems/summary.blade.php
  40. 1 0
      resources/views/app/patient/segment-templates/omega_ros/edit.blade.php
  41. 1 0
      resources/views/app/patient/segment-templates/omega_ros/summary.blade.php
  42. 1 0
      resources/views/app/patient/segment-templates/omega_subjective_free_text/edit.blade.php
  43. 1 0
      resources/views/app/patient/segment-templates/omega_subjective_free_text/summary.blade.php
  44. 1 0
      resources/views/app/patient/segment-templates/omega_subjective_system/edit.blade.php
  45. 1 0
      resources/views/app/patient/segment-templates/omega_subjective_system/summary.blade.php
  46. 1 0
      resources/views/app/patient/segment-templates/omega_vitals/edit.blade.php
  47. 1 0
      resources/views/app/patient/segment-templates/omega_vitals/summary.blade.php

+ 5 - 1
resources/views/app/patient/note/dashboard.blade.php

@@ -646,7 +646,11 @@
                                 @if($isVisitTemplateBased && $doesVisitTemplateLayoutExist)
                                     @include($visitLayoutPath)
                                 @elseif($isVisitTemplateBased && !$doesVisitTemplateUiConfigExist)
-                                    @include('app.patient.note.note-segment-list')
+                                    @if($note->visitTemplate->is_slim)
+                                        @include('app.patient.note.note-segment-list-slim')
+                                    @else 
+                                        @include('app.patient.note.note-segment-list')
+                                    @endif
                                 @elseif($isVisitTemplateBased && $doesVisitTemplateUiConfigExist)
                                     @include('app.patient.note.custom-visit')
                                 @else

+ 44 - 0
resources/views/app/patient/note/note-segment-list-slim.blade.php

@@ -0,0 +1,44 @@
+<?php  
+    $suggestionModeOn = request()->get('suggestion_mode') == 'on' && $note->is_signed_by_hcp 
+?> 
+<div class="segments-list" id="note-segments-list">
+    <?php
+    $previousHeading = null;
+    $previousSubHeading = null;
+    ?>
+    @foreach($note->segmentsLeft as $segment)
+        <?php
+        if ($segment->heading !== $previousHeading) {
+            if (!empty($previousHeading)) {
+                echo '</div></div>'; // <!-- end the previous parent section -->
+            }
+            if (!empty($segment->heading)) {
+
+	    ?>
+        <div class="note-content-node note-content-heading">
+            <div class="py-2 px-3 border-bottom font-size-16 font-weight-bold bg-light text-secondary {{ $previousHeading ? 'mt-4 border-top' : '' }}">
+                {{ $segment->heading }}
+            </div>
+            <div class="note-content-children ml-5 border-left">
+                <!-- open new node -->
+            <?php
+            }
+                $previousHeading = $segment->heading;
+            }
+            ?>
+            <div class="{{$segment->segmentTemplate->internal_name === 'medrisk_vigilence' ? 'd-none' : ''}}">
+                @if($suggestionModeOn)
+                    @include('app.patient.note.segment.suggestions_and_updates')
+                @else
+                    @include('app.patient.note.segment-slim')
+                @endif
+            </div>
+           
+    @endforeach
+    <?php
+    if (!empty($previousHeading)) {
+        echo '</div></div>'; // <!-- close any open parent section -->
+    }
+    ?>
+</div>
+@include('app.patient.note.segment_script')

+ 20 - 19
resources/views/app/patient/note/note-segment-list.blade.php

@@ -14,25 +14,26 @@
             }
             if (!empty($segment->heading)) {
 
-	?>
-	<div class="note-content-node note-content-heading">
-		<div class="py-2 px-3 border-bottom font-size-16 font-weight-bold bg-light text-secondary {{ $previousHeading ? 'mt-4 border-top' : '' }}">
-			{{ $segment->heading }}
-		</div>
-		<div class="note-content-children ml-5 border-left">
-			<!-- open new node -->
-        <?php
-	    }
-            $previousHeading = $segment->heading;
-        }
-        ?>
-        <div class="{{$segment->segmentTemplate->internal_name === 'medrisk_vigilence' ? 'd-none' : ''}}">
-            @if($suggestionModeOn)
-                @include('app.patient.note.segment.suggestions_and_updates')
-            @else
-                @include('app.patient.note.segment')
-            @endif
-        </div>
+	    ?>
+        <div class="note-content-node note-content-heading">
+            <div class="py-2 px-3 border-bottom font-size-16 font-weight-bold bg-light text-secondary {{ $previousHeading ? 'mt-4 border-top' : '' }}">
+                {{ $segment->heading }}
+            </div>
+            <div class="note-content-children ml-5 border-left">
+                <!-- open new node -->
+            <?php
+            }
+                $previousHeading = $segment->heading;
+            }
+            ?>
+            <div class="{{$segment->segmentTemplate->internal_name === 'medrisk_vigilence' ? 'd-none' : ''}}">
+                @if($suggestionModeOn)
+                    @include('app.patient.note.segment.suggestions_and_updates')
+                @else
+                    @include('app.patient.note.segment')
+                @endif
+            </div>
+           
     @endforeach
     <?php
     if (!empty($previousHeading)) {

+ 65 - 0
resources/views/app/patient/note/segment-slim.blade.php

@@ -0,0 +1,65 @@
+<?php $iName = $segment->segmentTemplate->internal_name; ?>
+
+<div class="border-bottom note-section visit-segment {{$note->is_signed_by_hcp ? '' : 'edit-trigger'}}"
+     data-segment-uid="{{ $segment->uid }}"
+     data-segment-template-uid="{{ $segment->segmentTemplate->uid }}"
+     data-segment-template-name="{{ $segment->segmentTemplate->internal_name }}">
+
+    <div class="d-flex align-items-baseline bg-light text-secondary p-1" style="border-bottom: 1px solid #dee2e6;">
+
+    <!-- title -->
+
+            <div style="color: black; text-decoration: underline; font-size: 13px;" class="font-weight-bold mr-2">
+                {{$segment->display_title}}:
+            </div>
+
+            <div class="flex-grow-1">
+                <div class="d-none if-not-edit inset-comment summary-container p-2xxx pl-4">
+                    @if($note->is_signed_by_hcp && $segment->accepted_suggestion_summary_html)
+                        {!! $segment->accepted_suggestion_summary_html !!}
+                    @else 
+                        {!! $segment->summary_html !!}
+                    @endif 
+                </div>
+
+                <?php if($iName !== 'ros') { ?>
+                <div class="d-none if-edit edit-container">
+                    {!! $segment->edit_html !!}
+                </div>
+                <?php } ?>
+   
+            </div>
+        
+        
+            @if(!$note->is_signed_by_hcp)
+                <a class="edit-trigger d-none if-edit c-pointer ml-3">
+                    <i class="fas fa-caret-up font-size-16"></i>
+                </a>
+
+                <!-- refresh -->
+                <a class="ml-3 font-weight-normal refresh-segment c-pointer {{$iName === 'medrisk_vigilence' ? 'on-hover-only' : ''}} screen-only"
+                data-segment-uid="{{$segment->uid}}"
+                title="Update with latest patient data">
+                    <i class="fa fa-sync"></i>
+                </a>
+
+            @endif
+
+        {{-- if segment has log feature, link --}}
+        @if($pro->pro_type === 'ADMIN' && file_exists(resource_path("views/app/patient/segment-templates/{$segment->segmentTemplate->internal_name}/log.blade.php")))
+            <a native="" target="_blank"
+               class="c-pointer ml-3 text-decoration-none"
+               open-in-stag-popup=""
+               title="{{$segment->display_title}} - Change Log"
+               popup-style="medium"
+               href="/note-segment-view/{{$patient->uid}}/{{$note->uid}}/{{$segment->uid}}/<?= $segment->segmentTemplate->internal_name ?>/log">
+               <i class="fas fa-history font-size-16"></i>
+            </a>
+        @endif
+
+    </div>
+
+
+    
+
+</div>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_allergies/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_allergies</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_allergies/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_allergies</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_assessment_free_text/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_assessment_free_text</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_assessment_free_text/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_assessment_free_text</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_assessment_system/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_assessment_system</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_assessment_system/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_assessment_system</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_care_team/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_care_team</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_care_team/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_care_team</h1>

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

@@ -0,0 +1 @@
+<h1>omega_cc</h1>

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

@@ -0,0 +1 @@
+<h1>omega_cc</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_goals/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_goals</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_goals/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_goals</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_history_family/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_history_family</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_history_family/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_history_family</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_history_past_medical/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_history_past_medical</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_history_past_medical/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_history_past_medical</h1>

+ 239 - 0
resources/views/app/patient/segment-templates/omega_history_social/edit.blade.php

@@ -0,0 +1,239 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+/** @var Segment $segment */
+
+if(!@$segment) $segment = null;
+
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$fields = [
+    [
+        "Tobacco" => ["Current every day smoker", "Current some day smoker", "Former smoker", "Heavy tobacco smoker", "Light tobacco smoker", "Never smoker", "Smoker, current status unknown", "Unknown if ever smoked "],
+    ],
+    [
+        "Alcohol" => ["Do not drink", "Drink daily", "Frequently drink", "Hx of Alcoholism", "Occasional drink"],
+        "Drug Abuse" => ["IVDU", "Illicit drug use", "No illicit drug use"],
+    ],
+    [
+        "Cardiovascular" => ["Eat healthy meals", "Regular exercise", "Take daily aspirin"],
+        "Safety" => ["Household Smoke detector", "Keep Firearms in home", "Wear seatbelts"],
+    ],
+    [
+        "Sexual Activity" => ["Exposure to STI", "Homosexual encounters", "Not sexually active", "Safe sex practices", "Sexually active"],
+        "Birth Gender" => ["Male", "Female", "Undifferentiated"],
+    ]
+];
+
+$customFields = $pro->canvasCustomItems('sochx');
+/*$customFields = array_map(function($_item) {
+    return $_item['label'];
+}, $customFields->toArray());*/
+
+if(!$customFields) $customFields = [];
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'SOCIAL_HISTORY', $sessionKey, true);
+
+$contentData = $parsed = false;
+
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $parsed = $point->lastChildReview->data;
+}
+
+if(!$contentData) {
+    $contentData = [
+        "common" => [],
+        "custom" => [],
+        "comments" => "",
+    ];
+}
+
+for ($i = 0; $i < count($fields); $i++) {
+    foreach($fields[$i] as $head => $values) {
+        for($k = 0; $k < count($values); $k++) {
+            $fName = $head . '_' . sanitize_field_name($values[$k]);
+            if(!isset($contentData["common"][$fName])) $contentData["common"][$fName] = null;
+        }
+    }
+}
+?>
+<hr class="hide-outside-popup mt-3 mb-0">
+<div class="p-3 mcp-theme-1">
+    <div {{!!$segment ? 'visit-moe' : 'moe'}} close-on-save close-on-cancel class="d-block">
+        <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1"
+                {{!$segment ? 'hook=onHxPopupClosure' : ''}}>
+            @if(!!@$segment)
+                <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+            @else
+                <input type="hidden" name="segmentUid" value="<?= $note->coreSegment->uid ?>">
+            @endif
+            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="data">
+
+            <div id="edit-univ_history_social-container">
+                <div class="d-flex align-items-start flex-wrap custom-items-container">
+                    @for ($i = 0; $i < count($fields); $i++)
+                        <div class="w-25">
+                            @foreach($fields[$i] as $head => $values)
+                                <div class="font-weight-bold mb-2">{{ $head }}</div>
+                                <div class="mb-3">
+                                    @for($k = 0; $k < count($values); $k++)
+                                        <?php $fName = $head . '_' . sanitize_field_name($values[$k]); ?>
+                                        <label class="d-flex align-items-start mb-1">
+                                            <input type="checkbox" name="{{ $fName }}" class="mx-0 mt-1"
+                                                   v-model="common['{{$fName}}']">
+                                            <div class="ml-2">
+                                                <div>
+                                                    <span class="mr-2 common-item">{{ $values[$k] }}</span>
+                                                    <div moe relative no-mask v-show="common['{{$fName}}']" >
+                                                        <a href="#" start show>
+                                                            <i class="fa-comment" :class="common['{{$fName}}__comments'] ? 'fas' : 'far'"></i>
+                                                        </a>
+                                                        <div url="/nop" right>
+                                                            <div class="mb-2">
+                                                                <textarea class="form-control form-control-sm ns-custom-comment min-width-200px"
+                                                                          v-model="common['{{$fName}}__comments']"></textarea>
+                                                            </div>
+                                                            <div class="">
+                                                                <button type="button" class="btn btn-sm btn-primary" cancel>Close
+                                                                </button>
+                                                            </div>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                                <span v-show="common['{{$fName}}'] && common['{{$fName}}__comments']"
+                                                      v-html="common['{{$fName}}__comments']"
+                                                      class="text-sm text-secondary">
+                                                </span>
+                                            </div>
+                                        </label>
+                                    @endfor
+                                </div>
+                            @endforeach
+                        </div>
+                    @endfor
+                </div>
+                <div class="row border-top pt-3">
+                    <div class="col-12">
+                        @include('app.patient.segment-templates._custom_items.edit')
+                    </div>
+                </div>
+                <hr class="m-neg-4">
+                <div class="mb-2">
+                    <textarea class="form-control form-control-sm" v-model="comments">{!! $parsed && @$parsed->content ? @$parsed->content : '' !!}</textarea>
+                </div>
+            </div>
+
+            @if(!!$segment)
+                <div>
+                    <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>
+            @else
+                <div>
+                    <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                    <button cancel class="btn btn-sm btn-default border" {!! @$closeOnSave ? 'onmousedown="return closeStagPopup()"' : '' !!}>Close</button>
+                </div>
+            @endif
+
+        </form>
+    </div>
+</div>
+<script>
+    (function() {
+
+        window.segmentInitializers.<?= !!@$segment ? $segment->segmentTemplate->internal_name : $segmentInternalName ?> = function() {
+
+            let model = <?= $contentData ? json_encode($contentData) : '{}' ?>;
+            model.newCustomItemLabel = '';
+            let myCustomFields = <?= json_encode($customFields) ?>;
+            if(!model.customFields) {
+                model.customFields = [];
+            }
+            for (let i = 0; i < myCustomFields.length; i++) {
+                let foundAt = -1;
+                for (let j = 0; j < model.customFields.length; j++) {
+                    if(model.customFields[j].label === myCustomFields[i].label) {
+                        foundAt = j;
+                        break;
+                    }
+                }
+                if(foundAt === -1) {
+                    model.customFields.push({
+                        label: myCustomFields[i].label,
+                        value: '',
+                        comments: '',
+                        uid: myCustomFields[i].uid
+                    })
+                }
+                else {
+                    model.customFields[foundAt].uid = myCustomFields[i].uid;
+                }
+            }
+
+            // if not own AND not active - remove from model.customFields
+            for (let i = model.customFields.length - 1; i >= 0 ; i--) {
+                let foundAt = -1;
+                for (let j = 0; j < myCustomFields.length; j++) {
+                    if(model.customFields[i].label === myCustomFields[j].label) {
+                        foundAt = j;
+                        break;
+                    }
+                }
+                if(foundAt === -1) {
+                    if(!!model.customFields[i].value) {
+                        model.customFields[i].other = true;
+                    }
+                    else {
+                        model.customFields.splice(i, 1);
+                    }
+                }
+            }
+
+            // sort by label
+            model.customFields.sort(function (a, b) {
+                return a.label.localeCompare(b.label);
+            });
+
+            model.itemKey = 'sochx';
+
+            new Vue({
+                el: '#edit-univ_history_social-container',
+                delimiters: ["@{{","}}"],
+                data: model,
+                mounted: function() {
+                    $('#edit-univ_history_social-container [moe][initialized]').removeAttr('initialized');
+                    initMoes();
+                },
+                watch: {
+                    $data: {
+                        handler: function(val, oldVal) {
+                            let parent = $('#edit-univ_history_social-container').closest('form');
+                            parent.find('[name="data"]').val(JSON.stringify(this.$data));
+                        },
+                        deep: true
+                    }
+                },
+                methods: {
+                    @include('app.patient.segment-templates._custom_items.script')
+                }
+            });
+
+        };
+
+    }).call(window);
+</script>

+ 89 - 0
resources/views/app/patient/segment-templates/omega_history_social/log.blade.php

@@ -0,0 +1,89 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+
+$fields = [
+    [
+        "Tobacco" => ["Current every day smoker", "Current some day smoker", "Former smoker", "Heavy tobacco smoker", "Light tobacco smoker", "Never smoker", "Smoker, current status unknown", "Unknown if ever smoked "],
+    ],
+    [
+        "Alcohol" => ["Do not drink", "Drink daily", "Frequently drink", "Hx of Alcoholism", "Occasional drink"],
+        "Drug Abuse" => ["IVDU", "Illicit drug use", "No illicit drug use"],
+    ],
+    [
+        "Cardiovascular" => ["Eat healthy meals", "Regular exercise", "Take daily aspirin"],
+        "Safety" => ["Household Smoke detector", "Keep Firearms in home", "Wear seatbelts"],
+    ],
+    [
+        "Sexual Activity" => ["Exposure to STI", "Homosexual encounters", "Not sexually active", "Safe sex practices", "Sexually active"],
+        "Birth Gender" => ["Male", "Female", "Undifferentiated"],
+    ]
+];
+
+$point = Point::getOnlyTopLevelPointOfCategory($note, 'SOCIAL_HISTORY', true);
+
+if($point) {
+    ?> <div class="popup-content-container px-3"> <?php
+    foreach ($point->childReviews as $childReview) {
+        $contentData = $parsed = false;
+        if ($childReview->data) {
+            $childReview->data = json_decode($childReview->data, true);
+            $contentData = $parsed = $childReview->data;
+            ?>
+            <div class="mb-1 font-weight-bold">{{$childReview->creatorPro->displayName()}} - {{friendly_date($childReview->note->effective_dateest)}}</div>
+            <div class="pl-3 bg-light border p-3 mb-3">
+            <?php
+
+            for ($i = 0; $i < count($fields); $i++):
+            foreach($fields[$i] as $head => $values):
+            for($k = 0; $k < count($values); $k++):
+            $fName = $head . '_' . sanitize_field_name($values[$k]);
+            if(@$contentData['common'][$fName]): ?>
+            <div>
+                <?= ucwords($head) ?>
+                <i class="fa fa-arrow-right text-sm text-secondary"></i>
+                <span class="font-weight-bold"><?= $values[$k] ?></span>
+                <?php if(@$contentData['common'][$fName . '__comments']): ?>
+                <span class="text-sm ml-1 text-secondary">(<?= $contentData['common'][$fName . '__comments'] ?>)</span>
+                <?php endif; ?>
+            </div>
+            <?php
+            endif;
+            endfor;
+            endforeach;
+            endfor;
+
+            // custom fields
+
+            if(isset($contentData['customFields']) && count($contentData['customFields'])):
+            ?> <div class=""> <?php
+                for ($i = 0; $i < count($contentData['customFields']); $i++):
+                $item = $contentData['customFields'][$i];
+                if($item['value']): ?>
+                <div>
+                    Custom
+                    <i class="fa fa-arrow-right text-sm text-secondary"></i>
+                    <span class="font-weight-bold"><?= $item['label'] ?></span>
+                    <?php if($item['comments']): ?>
+                    <span class="text-sm ml-1 text-secondary">(<?= $item['comments'] ?>)</span>
+                    <?php endif; ?>
+                </div>
+                <?php
+                endif;
+                endfor;
+                ?> </div> <?php
+            endif;
+
+            if(isset($contentData['comments']) && !empty(trim($contentData['comments']))) { ?>
+            <div class="mt-2 mb-1">
+                <b>Comments: </b><?= $contentData['comments'] ?>
+            </div>
+            <?php }
+        }
+    }
+    ?> </div> <?php
+}

+ 92 - 0
resources/views/app/patient/segment-templates/omega_history_social/summary.blade.php

@@ -0,0 +1,92 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+/** @var Segment $segment */
+
+$fields = [
+    [
+        "Tobacco" => ["Current every day smoker", "Current some day smoker", "Former smoker", "Heavy tobacco smoker", "Light tobacco smoker", "Never smoker", "Smoker, current status unknown", "Unknown if ever smoked "],
+    ],
+    [
+        "Alcohol" => ["Do not drink", "Drink daily", "Frequently drink", "Hx of Alcoholism", "Occasional drink"],
+        "Drug Abuse" => ["IVDU", "Illicit drug use", "No illicit drug use"],
+    ],
+    [
+        "Cardiovascular" => ["Eat healthy meals", "Regular exercise", "Take daily aspirin"],
+        "Safety" => ["Household Smoke detector", "Keep Firearms in home", "Wear seatbelts"],
+    ],
+    [
+        "Sexual Activity" => ["Exposure to STI", "Homosexual encounters", "Not sexually active", "Safe sex practices", "Sexually active"],
+        "Birth Gender" => ["Male", "Female", "Undifferentiated"],
+    ]
+];
+
+if(!@$note) {
+    $note = $patient->coreNote;
+}
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'SOCIAL_HISTORY', $sessionKey, true);
+
+$contentData = $parsed = false;
+
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $parsed = $point->lastChildReview->data;
+
+    for ($i = 0; $i < count($fields); $i++):
+        foreach($fields[$i] as $head => $values):
+            for($k = 0; $k < count($values); $k++):
+                $fName = $head . '_' . sanitize_field_name($values[$k]);
+                if(@$contentData['common'][$fName]): ?>
+                    <div>
+                        <?= ucwords($head) ?>
+                        <i class="fa fa-arrow-right text-sm text-secondary"></i>
+                        <span class="font-weight-bold"><?= $values[$k] ?></span>
+                        <?php if(@$contentData['common'][$fName . '__comments']): ?>
+                            <span class="text-sm ml-1 text-secondary">(<?= $contentData['common'][$fName . '__comments'] ?>)</span>
+                        <?php endif; ?>
+                    </div>
+                <?php
+                endif;
+            endfor;
+        endforeach;
+    endfor;
+
+    // custom fields
+
+    if(isset($contentData['customFields']) && count($contentData['customFields'])):
+        ?> <div class=""> <?php
+        for ($i = 0; $i < count($contentData['customFields']); $i++):
+            $item = $contentData['customFields'][$i];
+            if($item['value']): ?>
+                <div>
+                    Custom
+                    <i class="fa fa-arrow-right text-sm text-secondary"></i>
+                    <span class="font-weight-bold"><?= $item['label'] ?></span>
+                    <?php if($item['comments']): ?>
+                        <span class="text-sm ml-1 text-secondary">(<?= $item['comments'] ?>)</span>
+                    <?php endif; ?>
+                </div>
+            <?php
+            endif;
+        endfor;
+        ?> </div> <?php
+    endif;
+
+    if(isset($contentData['comments']) && !empty(trim($contentData['comments']))) { ?>
+        <div class="mt-2 mb-1">
+            <b>Comments: </b><?= $contentData['comments'] ?>
+        </div>
+    <?php }
+}
+else {
+    echo '<span class="text-secondary">-</span>';
+}
+?>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_history_surgical/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_history_surgical</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_history_surgical/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_history_surgical</h1>

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

@@ -0,0 +1 @@
+<h1>omega_informed_consent</h1>

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

@@ -0,0 +1 @@
+<h1>omega_informed_consent</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_medications/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_medications</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_medications/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_medications</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_objective_free_text/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_objective_free_text</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_objective_free_text/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_objective_free_text</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_objective_system/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_objective_system</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_objective_system/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_objective_system</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_plan_free_text/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_plan_free_text</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_plan_free_text/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_plan_free_text</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_plan_system/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_plan_system</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_plan_system/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_plan_system</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_problems/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_problems</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_problems/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_problems</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_ros/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_ros</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_ros/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_ros</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_subjective_free_text/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_subjective_free_text</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_subjective_free_text/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_subjective_free_text</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_subjective_system/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_subjective_system</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_subjective_system/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_subjective_system</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_vitals/edit.blade.php

@@ -0,0 +1 @@
+<h1>omega_vitals</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/omega_vitals/summary.blade.php

@@ -0,0 +1 @@
+<h1>omega_vitals</h1>