|
@@ -1,10 +1,8 @@
|
|
|
<?php
|
|
|
-
|
|
|
-use App\Models\Point;
|
|
|
-
|
|
|
-$category = 'VITALS';
|
|
|
-$endPoint = 'upsertNoteSingleton';
|
|
|
-
|
|
|
+if(!@$sessionKey) {
|
|
|
+ $sessionKey = request()->cookie('sessionKey');
|
|
|
+}
|
|
|
+$point = App\Models\Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'VITALS', $sessionKey, true);
|
|
|
$vitalLabels = [
|
|
|
"heightInInches" => "Ht. (in.)",
|
|
|
"weightPounds" => "Wt. (lbs.)",
|
|
@@ -17,11 +15,10 @@ $vitalLabels = [
|
|
|
"pulseOx" => "Pulse Ox.",
|
|
|
"smokingStatus" => "Smoking Status",
|
|
|
];
|
|
|
-
|
|
|
-$point = Point::where('added_in_note_id', $note->id)->where('category', $category)->orderBy('id', 'DESC')->first();
|
|
|
$contentData = null;
|
|
|
-if (!!@$point->data) {
|
|
|
- $contentData = json_decode($point->data, true);
|
|
|
+if ($point->lastChildReview && $point->lastChildReview->note->id === $note->id && $point->lastChildReview->data) {
|
|
|
+ $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
|
|
|
+ $contentData = $point->lastChildReview->data;
|
|
|
}
|
|
|
|
|
|
if(!$contentData) {
|
|
@@ -47,9 +44,11 @@ if(!$contentData) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-$previousVitals = Point::where('client_id', $patient->id)
|
|
|
- ->where('added_in_note_id', '<>', $note->id)
|
|
|
- ->where('category', $category)
|
|
|
+$previousVitals = [];
|
|
|
+
|
|
|
+$previousVitals = \App\Models\Point::where('parent_point_id', $point->id)
|
|
|
+ ->where('category', 'REVIEW')
|
|
|
+ ->where('added_in_note_id', '!=', $note->id)
|
|
|
->orderBy('id', 'DESC')
|
|
|
->limit(4)
|
|
|
->get();
|
|
@@ -72,7 +71,7 @@ foreach ($previousVitals as $p) {
|
|
|
$newFormat[$k] = '';
|
|
|
}
|
|
|
}
|
|
|
- $newFormat['date'] = $p->note->effective_dateest;
|
|
|
+ $newFormat['date'] = $p->note->effective_dateest; // unfriendly_date($p->created_at);
|
|
|
$previousData[] = $newFormat;
|
|
|
$previousDataAssoc[$newFormat['date']] = $newFormat; // for easy iter to cols
|
|
|
}
|
|
@@ -80,11 +79,17 @@ foreach ($previousVitals as $p) {
|
|
|
|
|
|
$copyTriggerAdded = [];
|
|
|
|
|
|
+if(!@$segment) {
|
|
|
+ $segment = $note->coreSegment;
|
|
|
+}
|
|
|
+
|
|
|
?>
|
|
|
<div visit-moe close-on-save close-on-cancel class="d-block">
|
|
|
- <form show url="/api/visitPoint/<?= $endPoint ?>" class="mcp-theme-1">
|
|
|
+ <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
|
|
|
+ <input type="hidden" name="uid" value="<?= $point->uid ?>">
|
|
|
+ <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
|
|
|
<input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
|
|
|
- <input type="hidden" name="category" value="<?= $category ?>">
|
|
|
+ <input type="hidden" name="category" value="VITALS">
|
|
|
<input type="hidden" name="data" value="{{json_encode($contentData)}}">
|
|
|
|
|
|
<table class="table table-sm table-bordered mb-2 table-edit-sheet">
|
|
@@ -238,8 +243,8 @@ $copyTriggerAdded = [];
|
|
|
</form>
|
|
|
</div>
|
|
|
<script>
|
|
|
- window.segmentInitializers.<?= $segment->segmentTemplate->internal_name ?> = function () {
|
|
|
- let parentSegment = $('[data-segment-template-name="<?= $segment->segmentTemplate->internal_name ?>"] ');
|
|
|
+ window.segmentInitializers.omega_vitals = function () {
|
|
|
+ let parentSegment = $('[data-segment-template-name="omega_vitals"] ');
|
|
|
|
|
|
function __refreshBMI() {
|
|
|
var height = parseInt(parentSegment.find('[data-name="heightInInches"]').val());
|