Vijayakrishnan 3 жил өмнө
parent
commit
b7d0001ef7

+ 12 - 0
app/Models/Point.php

@@ -316,6 +316,18 @@ class Point extends Model
         return $point;
         return $point;
     }
     }
 
 
+    public static function getOnlyTopLevelPointOfCategory(Note $_note, String $_category, $_assoc = false) {
+        $point = Point
+            ::where('client_id', $_note->client_id)
+            ->where('category', $_category)
+            ->where('intention', 'TOP_LEVEL')
+            ->first();
+        if ($point && $point->data) {
+            $point->data = json_decode($point->data, $_assoc);
+        }
+        return $point;
+    }
+
     public static function getOrCreateOnlyTopLevelPointOfCategory(Note $_note, String $_category, $_sessionKey, $_assoc = false) {
     public static function getOrCreateOnlyTopLevelPointOfCategory(Note $_note, String $_category, $_sessionKey, $_assoc = false) {
         $point = Point
         $point = Point
             ::where('client_id', $_note->client_id)
             ::where('client_id', $_note->client_id)

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

@@ -97,6 +97,18 @@
 
 
         @endif
         @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">
+                <span>Change Log</span>
+            </a>
+        @endif
+
     </div>
     </div>
 
 
     <?php if(!$isLSSegment): ?>
     <?php if(!$isLSSegment): ?>

+ 92 - 0
resources/views/app/patient/segment-templates/history_family/log.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 */
+
+$labels = [
+    'general_no_health_concern' => 'No health concern',
+    'general_arthritis' => 'Arthritis',
+    'general_asthma' => 'Asthma',
+    'general_bleeding_disorder' => 'Bleeding disorder',
+    'general_cad_lt_age_55' => 'CAD &gt; age 55',
+    'general_copd' => 'COPD',
+    'general_diabetes' => 'Diabetes',
+    'general_heart_attack' => 'Heart attack',
+    'general_heart_disease' => 'Heart disease',
+    'general_high_cholesterol' => 'High cholesterol',
+    'general_hypertension' => 'Hypertension',
+    'general_mental_illness' => 'Mental illness',
+    'general_osteoporosis' => 'Osteoporosis',
+    'general_stroke' => 'Stroke',
+    'cancer_breast_ca' => 'Breast cancer',
+    'cancer_colon_ca' => 'Colon cancer',
+    'cancer_other_ca' => 'Other cancer',
+    'cancer_ovarian_ca' => 'Ovarian cancer',
+    'cancer_uterine_ca' => 'Uterine cancer',
+];
+
+$point = Point::getOnlyTopLevelPointOfCategory($note, 'FAMILY_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;
+
+            if($contentData && !$contentData['unknown'] && !!$contentData['count']) {
+                ?>
+                <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 < $contentData['count']; $i++) {
+                    ?>
+                    <div class="<?= $i > 0 ? 'mt-2' : '' ?>">
+                        <div class="">
+                            <b><?= isset($contentData['items'][$i]['relationship']) ? $contentData['items'][$i]['relationship'] : '--' ?></b>
+                            <?php if(isset($contentData['items'][$i]['status']) && !empty($contentData['items'][$i]['status'])): ?>
+                            <span class="ml-1 text-secondary">(<?= $contentData['items'][$i]['status'] ?>)</span>
+                            <?php endif; ?>
+                        </div>
+                        <div class="ml-3">
+                            <?php
+                            $positives = [];
+                            $negatives = [];
+                            foreach ($labels as $k => $v) {
+                                if(isset($contentData['items'][$i][$k])) {
+                                    if(strtolower($contentData['items'][$i][$k]) === 'yes') {
+                                        $positives[] = $v;
+                                    }
+                                    else {
+                                        $negatives[] = $v;
+                                    }
+                                }
+                            }
+                            ?>
+                            @if(count($positives))
+                                <div class="pt-1"><b>Positive for</b>: {!!  implode(', ', $positives) !!}</div>
+                            @endif
+                            @if(count($negatives))
+                                <div class="pt-1"><b>Negative for</b>: {!!  implode(', ', $negatives) !!}</div>
+                            @endif
+                        </div>
+                        <?php if(isset($contentData['items'][$i]['comments']) && !empty($contentData['items'][$i]['comments'])): ?>
+                        <div class="ml-3 pt-1 client-rs-contents">
+                            <b>Comments: </b><?= $contentData['items'][$i]['comments'] ?>
+                        </div>
+                        <?php endif; ?>
+                    </div>
+                    <?php
+                }
+                ?>
+                </div>
+                <?php
+            }
+        }
+    }
+    ?> </div> <?php
+}