Răsfoiți Sursa

BPSA - log for each tlp

Vijayakrishnan 3 ani în urmă
părinte
comite
83b37de045

+ 44 - 3
resources/views/app/patient/segment-templates/biopsychosocial_assessment/edit.blade.php

@@ -137,6 +137,23 @@ if($otherImportantInformationPoint->lastChildReview && $otherImportantInformatio
 	$otherImportantInformationContent = $otherImportantInformationPoint->lastChildReview->data;
 }
 
+$tlPoints = [
+		'identification' => $identificationPoint,
+		'history_of_present_problem' => $historyOfPresentProblemPoint,
+		'psychiatric_history_prior_episodes_of_symptoms_diagnoses_courses_of_treatment_etc' => $psychiatricHistoryPriorEpisodesOfSymptomsDiagnosesCoursesOfTreatmentEtcPoint,
+		'trauma_history' => $traumaHistoryPoint,
+		'family_psychiatric_history' => $familyPsychiatricHistoryPoint,
+		'medical_conditions_and_history' => $medicalConditionsAndHistoryPoint,
+		'substance_use' => $substanceUsePoint,
+		'family_history' => $familyHistoryPoint,
+		'social_history' => $socialHistoryPoint,
+		'spiritual_cultural_factors' => $spiritualCulturalFactorsPoint,
+		'developmental_history' => $developmentalHistoryPoint,
+		'educational_vocational_history' => $educationalVocationalHistoryPoint,
+		'legal_history' => $legalHistoryPoint,
+		'snap' => $snapPoint,
+		'other_important_information' => $otherImportantInformationPoint,
+];
 
 $contents = [
 	'identification' => $identificationContent,
@@ -210,7 +227,7 @@ $labels = [
 	'other_important_information' => 'Other Important Information', 
 ];
 ?>
-<div class="">
+<div id="biopsychosocial_assessment-container">
 	@foreach($contents as $field => $content)
 		<div visit-moe close-on-save close-on-cancel class="d-block" id="biopsychosocial_assessment-{{$field}}-{{$note->id}}">
 			<form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1 frm-upsert-review-psych-intake-current-mental-status">
@@ -224,10 +241,34 @@ $labels = [
 						<label class="control-label mb-0" style="font-size:13px;">{{$labels[$field]}}:</label>
 					</div>
 					<div class="col-md-8 pr-0">
-						<input type="text" name="value" class="form-control form-control-sm" placeholder="{{$placeholders[$field]}}" value="{{$content['value']}}" data-name="value">
+						<div class="d-flex align-items-center">
+							<input type="text" class="form-control form-control-sm flex-grow-1 bpsa-save-on-change" placeholder="{{$placeholders[$field]}}" value="{{$content['value']}}" data-name="value">
+							<a native="" target="_blank"
+							   class="c-pointer px-2 text-decoration-none"
+							   open-in-stag-popup=""
+							   title="{{$labels[$field]}} - Change Log"
+							   popup-style="medium"
+							   href="/note-segment-view/{{$patient->uid}}/{{$note->uid}}/{{$segment->uid}}/<?= $segment->segmentTemplate->internal_name ?>/point-log?tlp={{$tlPoints[$field]->category}}">
+								<i class="fas fa-history on-hover-opaque"></i>
+							</a>
+						</div>
 					</div>
 				</div>
 			</form> 
 		</div>
 	@endforeach  
-</div>
+</div>
+<script>
+	(function() {
+		function init() {
+			$('#biopsychosocial_assessment-container').find('.bpsa-save-on-change')
+				.off('input change paste')
+				.on('input change paste', function() {
+					let form = $(this).closest('form');
+					fillJsonDataField(form);
+					form.find('[name="data"]').trigger('save-trigger');
+				});
+		}
+		window.segmentInitializers.biopsychosocial_assessment = init;
+	}).call(window);
+</script>

+ 30 - 0
resources/views/app/patient/segment-templates/biopsychosocial_assessment/point-log.blade.php

@@ -0,0 +1,30 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+
+$point = Point::getOnlyTopLevelPointOfCategory($note, request()->input('tlp'), 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) {
+                ?>
+                <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">
+                    {{$contentData['value']}}
+                </div>
+                <?php
+            }
+        }
+    }
+    ?> </div> <?php
+}