Эх сурвалжийг харах

Client dashboard hx section to be as in omega summaries

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

+ 1 - 1
resources/views/app/patient/point-based-partials/fhx.blade.php

@@ -20,7 +20,7 @@
         @endif
     </div>
     <div class="bg-light border p-2 mb-3 point-content">
-        @include('app.patient.segment-templates.history_family.summary', compact('patient'))
+        @include('app.patient.segment-templates.omega_history_family.summary-dashboard', ['patient' => $patient, 'note' => $patient->coreNote])
     </div>
 </div>
 <script>

+ 1 - 1
resources/views/app/patient/point-based-partials/pmhx.blade.php

@@ -20,7 +20,7 @@
         @endif
     </div>
     <div class="bg-light border p-2 mb-3 point-content">
-        @include('app.patient.segment-templates.past_medical_history.summary', compact('patient'))
+        @include('app.patient.segment-templates.omega_history_past_medical.summary-dashboard', ['patient' => $patient, 'note' => $patient->coreNote])
     </div>
 </div>
 <script>

+ 1 - 1
resources/views/app/patient/point-based-partials/shx.blade.php

@@ -20,7 +20,7 @@
         @endif
     </div>
     <div class="bg-light border p-2 mb-3 point-content">
-        @include('app.patient.segment-templates.history_surgical.summary', compact('patient'))
+        @include('app.patient.segment-templates.omega_history_surgical.summary-dashboard', ['patient' => $patient, 'note' => $patient->coreNote])
     </div>
 </div>
 <script>

+ 1 - 1
resources/views/app/patient/point-based-partials/sochx.blade.php

@@ -20,7 +20,7 @@
         @endif
     </div>
     <div class="bg-light border p-2 mb-3 point-content">
-        @include('app.patient.segment-templates.history_social.summary', compact('patient'))
+        @include('app.patient.segment-templates.omega_history_social.summary-dashboard', ['patient' => $patient, 'note' => $patient->coreNote])
     </div>
 </div>
 <script>

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

@@ -0,0 +1,100 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+
+if(!@$note) {
+    $note = $patient->coreNote;
+}
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'FAMILY_HISTORY', $sessionKey, true);
+
+$contentData = $parsed = false;
+
+$rel = !!$point->relevanceToNote($note);
+
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $parsed = $point->lastChildReview->data;
+}
+
+$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',
+];
+
+if($contentData && !@$contentData['unknown'] && !!$contentData['count']) {
+    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=""><b>Positive for</b>: {!!  implode(', ', $positives) !!}</div>
+        @endif
+        @if(count($negatives))
+            <div class=""><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
+    }
+}
+else if(@$contentData['unknown']) {
+    ?>
+    <div class="text-secondary">Family history is unknown/unavailable</div>
+    <?php
+}
+else {
+?>
+<div class="text-secondary">-</div>
+<?php
+}
+?>

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

@@ -0,0 +1,159 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+
+if(!@$note) {
+    $note = $patient->coreNote;
+}
+
+$fields = [
+    [
+        "Head" => ["Trauma"],
+        "Eyes" => ["Blindness", "Cataracts", "Glaucoma", "Wears glasses/contacts"],
+        "Ears" => ["Hearing aids"],
+        "Nose/Sinuses" => ["Allergic Rhinitis", "Sinus infections"],
+        "Mouth/Throat/Teeth" => ["Dentures"],
+        "Cardiovascular" => ["Aneurysm", "Angina", "DVT", "Dysrhythmia", "HTN", "Murmur", "Myocardial infarction", "Other heart disease"],
+    ],
+    [
+        "Respiratory" => ["Asthma", "Bronchitis", "COPD - Bronchitis/Emphysema", "Pleuritis", "Pneumonia"],
+        "Gastrointestinal" => ["Cirrhosis", "GERD", "Gallbladder disease", "Heartburn", "Hemorrhoids", "Hepatitis", "Hiatal hernia", "Jaundice", "Ulcer"],
+        "Genitourinary" => ["Hernia", "Incontinence", "Nephrolithiasis", "Other kidney disease", "STDs", "UTI(s)"],
+    ],
+    [
+        "Musculoskeletal" => ["Arthritis", "Gout", "M/S injury"],
+        "Skin" => ["Dermatitis", "Mole(s)", "Other skin condition(s)", "Psoriasis"],
+        "Neurological" => ["Epilepsy", "Seizures", "Severe headaches, migraines", "Stroke", "TIA"],
+        "Psychiatric" => ["Bipolar disorder", "Depression", "Hallucinations, delusions", "Suicidal ideation", "Suicide attempts"],
+    ],
+    [
+        "Endocrine" => ["Goiter", "Hyperlipidemia", "Hypothyroidism", "Thyroid disease", "Thyroiditis", "Type I DM", "Type II DM"],
+        "Heme/Onc" => ["Anemia", "Cancer"],
+        "Infectious" => ["HIV", "STDs", "Tuberculosis (dz)", "Tuberculosis (exposure)"],
+    ]
+];
+
+$contentData = [
+    "bloodType" => "",
+    "bloodRH" => "",
+    "common" => [],
+    "customFields" => [],
+    "comments" => "",
+];
+$isempty = false;
+
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'PAST_MEDICAL_HISTORY', $sessionKey, true);
+
+$contentData = $parsed = false;
+
+$rel = !!$point->relevanceToNote($note);
+
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $parsed = $point->lastChildReview->data;
+}
+
+if ($contentData) {
+
+    $blood = [];
+    if(isset($contentData['bloodType'])) {
+        $blood[] = $contentData['bloodType'];
+    }
+    if(isset($contentData['bloodRH'])) {
+        $blood[] = $contentData['bloodRH'];
+    }
+    $blood = implode(" ", $blood);
+    if(!empty(trim($blood))) { ?>
+        <div class="mb-2">
+            <div><b>Blood Type &amp; RH: </b><?= $blood ?></div>
+        </div>
+    <?php }
+
+	$commonMap = [];
+
+    for ($i = 0; $i < count($fields); $i++):
+        foreach($fields[$i] as $head => $values):
+            for($k = 0; $k < count($values); $k++):
+		        $value = $values[$k];
+                $fName = $head . '_' . sanitize_field_name($values[$k]);
+                if(@$contentData['common'][$fName]) {
+                    if(!isset($commonMap[$head])) {
+                        $commonMap[$head] = [];
+                    }
+                    $commonMap[$head][] = ['value' => $value, 'fName' => $fName, 'comments' => @$contentData['common'][$fName.'__comments']];
+                ?>
+                    <div class="d-none">
+                        <?= 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
+                }
+            endfor;
+        endforeach;
+    endfor;
+
+	// var_dump(json_encode($commonMap));
+	?> <div> <?php
+	foreach($commonMap as $head => $set):
+		?>
+		<div>
+			<span class="font-weight-bold"><?= ucwords($head) ?></span>
+			<i class="fa fa-arrow-right text-secondary d-none_"></i>
+			<span class="">
+			<?php $out = []; foreach($set as $item) { $out[] = '<span class="__font-weight-bold">' . $item['value'] . '</span>' . ($item['comments'] ? ('<span class="text-sm ml-1 text-secondary">(' . $item['comments'] . ')</span>') : ''); } if(!empty($out)) echo ' • '; echo implode(' • ', $out); ?>
+			</span>
+		</div>
+		<?php
+	endforeach;
+	?>
+
+	<?php
+
+    // 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']): ?>
+                <span>
+                    <span class="font-weight-bold">Other: </span>
+		            <i class="fa fa-arrow-right d-none"></i>
+                </span>
+                <span>
+                    <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; ?>
+                </span>
+            <?php
+            endif;
+        endfor;
+        ?> </div> <?php
+    endif;
+
+	echo '</div>';
+
+    if(isset($contentData['comments']) && !empty(trim($contentData['comments']))) { ?>
+        <div class="mt-2 mb-1">
+            <b>Comments: </b><?= $contentData['comments'] ?>
+        </div>
+    <?php }
+
+} else {
+    echo '<div class="text-secondary">-</div>';
+}
+?>
+

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

@@ -0,0 +1,97 @@
+<?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;
+
+$rel = !!$point->relevanceToNote($note);
+
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $parsed = $point->lastChildReview->data;
+
+    $prevHead = ''; $items = [];
+    for ($i = 0; $i < count($fields); $i++) {
+        foreach($fields[$i] as $head => $values) {
+            $items = [];
+            for($k = 0; $k < count($values); $k++) {
+                $fName = $head . '_' . sanitize_field_name($values[$k]);
+                if(@$contentData['common'][$fName]) {
+                    $items[] = $values[$k] . (@$contentData['common'][$fName . '__comments'] ? '<span class="text-sm ml-1 text-secondary">(' . $contentData['common'][$fName . '__comments'] . ')</span>' : '');
+                }
+            }
+            if(count($items) && trim(implode('', $items)) !== '') {
+            ?>
+                <div>
+                    <b><?= $head ?></b>
+                    <i class="fa fa-arrow-right text-sm text-secondary"></i>
+                    <?= implode(' • ', $items) ?>
+                </div>
+            <?php
+            }
+        }
+    }
+
+    // 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>';
+}
+?>

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

@@ -0,0 +1,91 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+/** @var Segment $segment */
+
+if(!@$note) {
+    $note = $patient->coreNote;
+}
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$fields = [
+    [
+        "" => ["Aneurysm repair", "Appendectomy", "Back surgery", "Bariatric surgery/gastric bypass", "Bilateral tubal ligation", "Breast resection/mastectomy", "CABG", "Carotid endarterectomy/stent", "Carpal tunnel release surgery",]
+    ],
+    [
+        "" => ["Cataract/lens surgery", "Cesarean section", "Cholecystectomy/bile duct surgery", "Dilation and curettage", "Hemorrhoid surgery", "Hip arthroplasty", "Hip replacement", "Hysterectomy", "Inguinal hernia repair",]
+    ],
+    [
+        "" => ["Knee arthroplasty", "LASIK", "Laminectomy", "Nasal surgery", "PTCA/PCI", "Pacemaker/defibrillator", "Prostate surgery", "Prostatectomy", "Rotator cuff surgery",]
+    ],
+    [
+        "" => ["Sinus surgery", "Skin cancer excision", "Spinal fusion", "TAH-BSO", "TURP", "Tonsillectomy/Adenoidectomy", "Vasectomy",]
+    ]
+];
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'SURGICAL_HISTORY', $sessionKey, true);
+
+$contentData = $parsed = false;
+
+$rel = !!$point->relevanceToNote($note);
+
+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>
+                        <!--Common
+                        <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>';
+}
+?>