瀏覽代碼

Exercise segments - strength training

Vijayakrishnan 3 年之前
父節點
當前提交
7177892619

二進制
public/img/exercise-rx/strength.png


+ 2 - 19
resources/views/app/patient/exercise-center.blade.php

@@ -30,28 +30,11 @@ $points = [
                     <td>
                         <div class="d-flex align-items-center">
                             <b class="mr-2">{{$p['name']}}</b>
-                            @if($p['category'] === 'HIGH_SUGAR_BEVERAGES')
-                                <img src="/img/nutrition-rx/hsb.png" class="icon-nutrition-rx-row" alt="">
-                            @elseif($p['category'] === 'WATER_INTAKE')
-                                <img src="/img/nutrition-rx/wi.png" class="icon-nutrition-rx-row" alt="">
-                            @elseif($p['category'] === 'VEGETABLES')
-                                <img src="/img/nutrition-rx/vc.png" class="icon-nutrition-rx-row" alt="">
-                            @elseif($p['category'] === 'DAILY_INTAKE_CARBOHYDRATES' || $p['category'] === 'DAILY_INTAKE_CALORIES')
-                                <img src="/img/nutrition-rx/ig.png" class="icon-nutrition-rx-row" alt="">
+                            @if($p['category'] === 'STRENGTH_TRAINING')
+                                <img src="/img/exercise-rx/strength.png" class="icon-nutrition-rx-row" alt="">
                             @endif
                         </div>
                         <div class="text-sm mt-1">
-                            @if($p['category'] === 'HIGH_SUGAR_BEVERAGES')
-                                E.g. soda, sweet tea, coffee, juice, etc.
-                            @elseif($p['category'] === 'WATER_INTAKE')
-                                Ounces per day
-                            @elseif($p['category'] === 'FAST_FOOD')
-                                Meals per week
-                            @elseif($p['category'] === 'PORTION_SIZES')
-                                Servings per meal
-                            @elseif($p['category'] === 'DAILY_INTAKE_CARBOHYDRATES' || $p['category'] === 'DAILY_INTAKE_CALORIES')
-
-                            @endif
                         </div>
                     </td>
                     <td class="w-40">

+ 84 - 66
resources/views/app/patient/segment-templates/_child_plan/exercise/STRENGTH_TRAINING/edit-plan.php

@@ -1,21 +1,31 @@
 <?php
+
+/*
+Format:
+{
+    active: true/false,
+    muscleStrengthening: true/false,
+    allMajorMuscleGroups: true/false,
+    reps: number,
+    sets: number,
+    resistanceBandsBodyWeight: true/false,
+    memo: text
+}
+ */
+
 $currentValue = '';
 $previousValue = '';
 $previousChildPlan = null;
 if (@$point) {
     if ($point->lastChildPlan && $point->last_child_plan_point_scoped_note_id === $note->id) {
-        $parsedPlan = json_decode($point->lastChildPlan->data);
-        if(@$parsedPlan->value) {
-            $currentValue = $parsedPlan->value;
-            $previousChildPlan = \App\Models\Point::where('id', '<', $point->lastChildPlan->id)
-                ->where('category', 'PLAN')
-                ->where('parent_point_id', $point->id)
-                ->orderBy('id', 'DESC')
-                ->first();
-            if($previousChildPlan && $previousChildPlan->data) {
-                $parsedPlan = json_decode($previousChildPlan->data);
-                $previousValue = $parsedPlan->value;
-            }
+        $currentValue = json_decode($point->lastChildPlan->data);
+        $previousChildPlan = \App\Models\Point::where('id', '<', $point->lastChildPlan->id)
+            ->where('category', 'PLAN')
+            ->where('parent_point_id', $point->id)
+            ->orderBy('id', 'DESC')
+            ->first();
+        if($previousChildPlan && $previousChildPlan->data) {
+            $previousValue = json_decode($previousChildPlan->data);
         }
     }
     else {
@@ -24,79 +34,87 @@ if (@$point) {
             ->orderBy('id', 'DESC')
             ->first();
         if($previousChildPlan && $previousChildPlan->data) {
-            $parsedPlan = json_decode($previousChildPlan->data);
-            if(@$parsedPlan->value) {
-                $previousValue = $parsedPlan->value;
-            }
+            $previousValue = json_decode($previousChildPlan->data);
         }
     }
 }
 ?>
-<div moe wide class="d-inline">
+<div visit-moe fixed-center largest relative class="d-inline">
     <a start show href="#" class="px-1 text-center d-block" title="<?= !empty($currentValue) ? 'Edit Plan' : 'Add Plan'?>">
         <i class="fa <?= !empty($currentValue) ? 'fa-pencil-alt' : 'fa-plus-square'?>"></i>
     </a>
-    <?php if($point): ?>
-        <form url="/api/visitPoint/upsertChildPlan" class="mcp-theme-1 w-100 frm-upsert-review-plan-nutrition" left>
+    <form url="/api/visitPoint/<?= $point ? 'upsertChildPlan' : 'addTopLevel' ?>"
+          class="mcp-theme-1 frm-review-plan-exercise" right>
+
+        <?php if($point): ?>
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
             <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
-            <input type="hidden" name="data">
-
-            <?php if($segment->segmentTemplate->internal_name === 'intake_problems' && $previousValue): ?>
-                <div class="d-none disallow-if-value-same-as"><?= str_compact($previousValue) ?></div>
-            <?php endif; ?>
-
-            <?php if($previousValue): ?>
-                <div class="mb-2">
-                    <div class="d-flex align-items-baseline mb-1">
-                        <span class="text-sm text-secondary">Previous Plan / <?= friendlier_date($previousChildPlan->created_at) ?>) (click to copy)</span>
-                    </div>
-                    <div class="p-2 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
-                </div>
-            <?php endif; ?>
-
-            <p class="mb-2"><b>Change goal:</b></p>
-
-            <div class="mb-2">
-                <div note-rte
-                    <?= $segment->segmentTemplate->internal_name === 'intake_problems' ? 'use-shortcuts="hpi,user"' : '' ?>
-                     class="form-group mb-2 border-left border-right rte-holder"
-                     data-field-name="value"><?= $currentValue ?></div>
-            </div>
-            <div>
-                <button type="submit"  class="btn btn-sm btn-primary mr-2">Save</button>
-                <button cancel class="btn btn-sm btn-default border">Cancel</button>
-            </div>
-        </form>
-    <?php else: ?>
-        <form url="/api/visitPoint/addTopLevel" class="mcp-theme-1 frm-add-review-plan-nutrition w-100" left>
+        <?php else: ?>
             <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
             <input type="hidden" name="category" value="<?= $p['category'] ?>">
             <input type="hidden" name="additionReasonCategory" value="ON_INTAKE">
+        <?php endif; ?>
+
+        <?php if ($point): ?>
             <input type="hidden" name="data">
+        <?php else: ?>
+            <input type="hidden" name="childPlanData">
+        <?php endif; ?>
 
-            <?php if($previousValue): ?>
-                <div class="mb-2">
-                    <div class="d-flex align-items-baseline mb-1">
-                        <span class="text-sm text-secondary">Previous Plan / <?= friendlier_date($previousChildPlan->created_at) ?>) (click to copy)</span>
-                    </div>
-                    <div class="p-2 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
+        <?php if($previousValue): ?>
+            <div class="mb-2">
+                <div class="d-flex align-items-baseline mb-1">
+                    <span class="text-sm text-secondary">Previous Plan / <?= friendlier_date($previousChildPlan->created_at) ?>)</span>
+                </div>
+                <div class="p-2 bg-light border inline-html-container">
+                    <?php $plan = $previousValue; ?>
+                    <?php include(resource_path('views/app/patient/segment-templates/_child_plan/exercise/' . $p['category'] . '/view-plan.php')); ?>
                 </div>
-            <?php endif; ?>
+            </div>
+        <?php endif; ?>
 
-            <p class="mb-2"><b>Change goal:</b></p>
+        <p class="mb-2"><b>Change Goal:</b></p>
 
-            <div class="mb-2">
-                <div note-rte
-                     class="form-group mb-2 border-left border-right rte-holder"
-                     data-field-name="planValue"><?= $currentValue ?></div>
+        <label class="mb-2 d-flex align-items-center">
+            <input type="checkbox" data-name="active" <?= @($currentValue->active) ? 'checked' : ''?>>
+            <span class="ml-2">Prescribe strength training?</span>
+        </label>
+
+        <div if-active>
+            <label class="mb-2 d-flex align-items-baseline">
+                <input type="checkbox" data-name="muscleStrengthening" <?= @($currentValue->muscleStrengthening) ? 'checked' : ''?>>
+                <span class="ml-2">Do muscle strengthening exercises on moderate or greater intensity at least two days per week</span>
+            </label>
+            <label class="mb-2 d-flex align-items-baseline">
+                <input type="checkbox" data-name="allMajorMuscleGroups" <?= @($currentValue->allMajorMuscleGroups) ? 'checked' : ''?>>
+                <span class="ml-2">Do exercises to strengthen all major muscle groups: legs, hips, back, chest, abdomen, shoulders and arms</span>
+            </label>
+            <div class="row mb-2">
+                <div class="col-6">
+                    <label class="mb-1">Number of sets for each exercise</label>
+                    <input type="text" data-name="sets" class="form-control form-control-sm" value="<?= @($currentValue->sets) ?>">
+                </div>
+                <div class="col-6">
+                    <label class="mb-1">Number of repetitions per set</label>
+                    <input type="text" data-name="reps" class="form-control form-control-sm" value="<?= @($currentValue->reps) ?>">
+                </div>
             </div>
-            <div>
-                <button type="submit" class="btn btn-sm btn-primary mr-2">Save</button>
-                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            <label class="mb-2 d-flex align-items-baseline">
+                <input type="checkbox" data-name="resistanceBandsBodyWeight" <?= @($currentValue->resistanceBandsBodyWeight) ? 'checked' : ''?>>
+                <span class="ml-2">Use resistance bands or using body weight to do exercises</span>
+            </label>
+            <div if-active class="mb-2">
+                <label for="" class="mb-1">Memo</label>
+                <div note-rte slim-rte
+                     class="form-group mb-2 border-left border-right rte-holder"
+                     data-field-name="memo"><?= @($currentValue->memo) ?></div>
             </div>
-        </form>
-    <?php endif; ?>
+        </div>
+        <div>
+            <button type="submit"  class="btn btn-sm btn-primary mr-2">Save</button>
+            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+        </div>
+    </form>
 </div>
 <?php if(!empty($currentValue)): ?>
     <div visit-moe relative class="d-inline">

+ 5 - 3
resources/views/app/patient/segment-templates/_child_plan/exercise/STRENGTH_TRAINING/last-plan.php

@@ -1,9 +1,11 @@
-<div class="mb-1 font-weight-bold text-secondary">Change Goal</div>
+<div class="mb-1 font-weight-bold text-secondary">Current Strength Training</div>
 <?php if ($point->lastChildPlan): ?>
     <?php $parsedPlan = json_decode($point->lastChildPlan->data); ?>
     <div class="<?= $point->last_child_plan_point_scoped_note_id === $note->id ? 'bg-warning-mellow p-2 rounded' : '' ?>">
-        <div class="inline-html-container"><?= $parsedPlan->value ?></div>
-        <div class="text-secondary text-sm"></div>
+        <div class="inline-html-container">
+            <?php $plan = $parsedPlan; ?>
+            <?php include(resource_path('views/app/patient/segment-templates/_child_plan/exercise/' . $p['category'] . '/view-plan.php')); ?>
+        </div>
 
         <?php if ($point->last_child_plan_point_scoped_note_id === $patient->core_note_id): ?>
             <span class="text-sm">(updated on the patient's chart)</span>

+ 36 - 0
resources/views/app/patient/segment-templates/_child_plan/exercise/STRENGTH_TRAINING/view-plan.php

@@ -0,0 +1,36 @@
+<?php
+if(@$plan && @($plan->active)) {
+    if (@($plan->muscleStrengthening)) {
+    ?>
+        <div class="mb-1">Do muscle strengthening exercises on moderate or greater intensity at least two days per week.</div>
+    <?php
+    }
+    if (@($plan->allMajorMuscleGroups)) {
+        ?>
+        <div class="mb-1">Do exercises to strengthen all major muscle groups: legs, hips, back, chest, abdomen, shoulders and arms.</div>
+        <?php
+    }
+    if (@($plan->sets)) {
+        ?>
+        <div class="mb-1">Sets per exercise: <?= $plan->sets ?>.</div>
+        <?php
+    }
+    if (@($plan->reps)) {
+        ?>
+        <div class="mb-1">Repetitions per set: <?= $plan->reps ?>.</div>
+        <?php
+    }
+    if (@($plan->resistanceBandsBodyWeight)) {
+        ?>
+        <div class="mb-1">Use resistance bands or using body weight to do exercises.</div>
+        <?php
+    }
+    ?>
+    <div class="text-secondary"><?= @($plan->memo) ?: '' ?></div>
+    <?php
+}
+else {
+    ?> - <?php
+}
+?>
+

+ 84 - 66
resources/views/app/patient/segment-templates/_child_review/exercise/STRENGTH_TRAINING/edit-review.php

@@ -1,21 +1,31 @@
 <?php
+
+/*
+Format:
+{
+    active: true/false,
+    muscleStrengthening: true/false,
+    allMajorMuscleGroups: true/false,
+    reps: number,
+    sets: number,
+    resistanceBandsBodyWeight: true/false,
+    memo: text
+}
+ */
+
 $currentValue = '';
 $previousValue = '';
 $previousChildReview = null;
 if (@$point) {
     if ($point->lastChildReview && $point->last_child_review_point_scoped_note_id === $note->id) {
-        $parsedReview = json_decode($point->lastChildReview->data);
-        if(@$parsedReview->value) {
-            $currentValue = $parsedReview->value;
-            $previousChildReview = \App\Models\Point::where('id', '<', $point->lastChildReview->id)
-                ->where('category', 'REVIEW')
-                ->where('parent_point_id', $point->id)
-                ->orderBy('id', 'DESC')
-                ->first();
-            if($previousChildReview && $previousChildReview->data) {
-                $parsedReview = json_decode($previousChildReview->data);
-                $previousValue = $parsedReview->value;
-            }
+        $currentValue = json_decode($point->lastChildReview->data);
+        $previousChildReview = \App\Models\Point::where('id', '<', $point->lastChildReview->id)
+            ->where('category', 'REVIEW')
+            ->where('parent_point_id', $point->id)
+            ->orderBy('id', 'DESC')
+            ->first();
+        if($previousChildReview && $previousChildReview->data) {
+            $previousValue = json_decode($previousChildReview->data);
         }
     }
     else {
@@ -24,79 +34,87 @@ if (@$point) {
             ->orderBy('id', 'DESC')
             ->first();
         if($previousChildReview && $previousChildReview->data) {
-            $parsedReview = json_decode($previousChildReview->data);
-            if(@$parsedReview->value) {
-                $previousValue = $parsedReview->value;
-            }
+            $previousValue = json_decode($previousChildReview->data);
         }
     }
 }
 ?>
-<div moe wide class="d-inline">
+<div visit-moe fixed-center largest relative class="d-inline">
     <a start show href="#" class="px-1 text-center d-block" title="<?= !empty($currentValue) ? 'Edit Subjective' : 'Add Subjective'?>">
         <i class="fa <?= !empty($currentValue) ? 'fa-pencil-alt' : 'fa-plus-square'?>"></i>
     </a>
-    <?php if($point): ?>
-        <form url="/api/visitPoint/upsertChildReview" class="mcp-theme-1 w-100 frm-upsert-review-plan-nutrition" left>
+    <form url="/api/visitPoint/<?= $point ? 'upsertChildReview' : 'addTopLevel' ?>"
+          class="mcp-theme-1 frm-review-plan-exercise" right>
+
+        <?php if($point): ?>
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
             <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
-            <input type="hidden" name="data">
-
-            <?php if($segment->segmentTemplate->internal_name === 'intake_problems' && $previousValue): ?>
-                <div class="d-none disallow-if-value-same-as"><?= str_compact($previousValue) ?></div>
-            <?php endif; ?>
-
-            <?php if($previousValue): ?>
-                <div class="mb-2">
-                    <div class="d-flex align-items-baseline mb-1">
-                        <span class="text-sm text-secondary">Previous Subjective / <?= friendlier_date($previousChildReview->created_at) ?>) (click to copy)</span>
-                    </div>
-                    <div class="p-2 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
-                </div>
-            <?php endif; ?>
-
-            <p class="mb-2"><b>Current Daily Calories</b></p>
-
-            <div class="mb-2">
-                <div note-rte
-                     <?= $segment->segmentTemplate->internal_name === 'intake_problems' ? 'use-shortcuts="hpi,user"' : '' ?>
-                     class="form-group mb-2 border-left border-right rte-holder"
-                     data-field-name="value"><?= $currentValue ?></div>
-            </div>
-            <div>
-                <button type="submit"  class="btn btn-sm btn-primary mr-2">Save</button>
-                <button cancel class="btn btn-sm btn-default border">Cancel</button>
-            </div>
-        </form>
-    <?php else: ?>
-        <form url="/api/visitPoint/addTopLevel" class="mcp-theme-1 frm-add-review-plan-nutrition w-100" left>
+        <?php else: ?>
             <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
             <input type="hidden" name="category" value="<?= $p['category'] ?>">
             <input type="hidden" name="additionReasonCategory" value="ON_INTAKE">
+        <?php endif; ?>
+
+        <?php if ($point): ?>
             <input type="hidden" name="data">
+        <?php else: ?>
+            <input type="hidden" name="childReviewData">
+        <?php endif; ?>
 
-            <?php if($previousValue): ?>
-                <div class="mb-2">
-                    <div class="d-flex align-items-baseline mb-1">
-                        <span class="text-sm text-secondary">Previous Subjective / <?= friendlier_date($previousChildReview->created_at) ?>) (click to copy)</span>
-                    </div>
-                    <div class="p-2 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
+        <?php if($previousValue): ?>
+            <div class="mb-2">
+                <div class="d-flex align-items-baseline mb-1">
+                    <span class="text-sm text-secondary">Previous Subjective / <?= friendlier_date($previousChildReview->created_at) ?>)</span>
+                </div>
+                <div class="p-2 bg-light border inline-html-container">
+                    <?php $review = $previousValue; ?>
+                    <?php include(resource_path('views/app/patient/segment-templates/_child_review/exercise/' . $p['category'] . '/view-review.php')); ?>
                 </div>
-            <?php endif; ?>
+            </div>
+        <?php endif; ?>
 
-            <p class="mb-2"><b>Current Daily Calories</b></p>
+        <p class="mb-2"><b>Current Strength Training</b></p>
 
-            <div class="mb-2">
-                <div note-rte
-                     class="form-group mb-2 border-left border-right rte-holder"
-                     data-field-name="reviewValue"><?= $currentValue ?></div>
+        <label class="mb-2 d-flex align-items-center">
+            <input type="checkbox" data-name="active" <?= @($currentValue->active) ? 'checked' : ''?>>
+            <span class="ml-2">Currently doing strength training?</span>
+        </label>
+
+        <div if-active>
+            <label class="mb-2 d-flex align-items-baseline">
+                <input type="checkbox" data-name="muscleStrengthening" <?= @($currentValue->muscleStrengthening) ? 'checked' : ''?>>
+                <span class="ml-2">Currently doing muscle strengthening exercises on moderate or greater intensity at least two days per week</span>
+            </label>
+            <label class="mb-2 d-flex align-items-baseline">
+                <input type="checkbox" data-name="allMajorMuscleGroups" <?= @($currentValue->allMajorMuscleGroups) ? 'checked' : ''?>>
+                <span class="ml-2">Currently doing exercises to strengthen all major muscle groups: legs, hips, back, chest, abdomen, shoulders and arms</span>
+            </label>
+            <div class="row mb-2">
+                <div class="col-6">
+                    <label class="mb-1">Number of sets for each exercise</label>
+                    <input type="text" data-name="sets" class="form-control form-control-sm" value="<?= @($currentValue->sets) ?>">
+                </div>
+                <div class="col-6">
+                    <label class="mb-1">Number of repetitions per set</label>
+                    <input type="text" data-name="reps" class="form-control form-control-sm" value="<?= @($currentValue->reps) ?>">
+                </div>
             </div>
-            <div>
-                <button type="submit" class="btn btn-sm btn-primary mr-2">Save</button>
-                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            <label class="mb-2 d-flex align-items-baseline">
+                <input type="checkbox" data-name="resistanceBandsBodyWeight" <?= @($currentValue->resistanceBandsBodyWeight) ? 'checked' : ''?>>
+                <span class="ml-2">Currently using resistance bands or using body weight to do exercises</span>
+            </label>
+            <div if-active class="mb-2">
+                <label for="" class="mb-1">Memo</label>
+                <div note-rte slim-rte
+                     class="form-group mb-2 border-left border-right rte-holder"
+                     data-field-name="memo"><?= @($currentValue->memo) ?></div>
             </div>
-        </form>
-    <?php endif; ?>
+        </div>
+        <div>
+            <button type="submit"  class="btn btn-sm btn-primary mr-2">Save</button>
+            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+        </div>
+    </form>
 </div>
 <?php if(!empty($currentValue)): ?>
     <div visit-moe relative class="d-inline">

+ 5 - 2
resources/views/app/patient/segment-templates/_child_review/exercise/STRENGTH_TRAINING/last-review.php

@@ -1,8 +1,11 @@
-<div class="mb-1 font-weight-bold text-secondary">Current Daily Calories</div>
+<div class="mb-1 font-weight-bold text-secondary">Current Strength Training</div>
 <?php if ($point->lastChildReview): ?>
     <?php $parsedReview = json_decode($point->lastChildReview->data); ?>
     <div class="<?= $point->last_child_review_point_scoped_note_id === $note->id ? 'bg-warning-mellow p-2 rounded' : '' ?>">
-        <div class="inline-html-container"><?= @$parsedReview->value ?></div>
+        <div class="inline-html-container">
+            <?php $review = $parsedReview; ?>
+            <?php include(resource_path('views/app/patient/segment-templates/_child_review/exercise/' . $p['category'] . '/view-review.php')); ?>
+        </div>
 
         <?php if ($point->last_child_review_point_scoped_note_id === $patient->core_note_id): ?>
             <span class="text-sm">(updated on the patient's chart)</span>

+ 36 - 0
resources/views/app/patient/segment-templates/_child_review/exercise/STRENGTH_TRAINING/view-review.php

@@ -0,0 +1,36 @@
+<?php
+if(@$review && @($review->active)) {
+    if (@($review->muscleStrengthening)) {
+    ?>
+        <div class="mb-1">Currently doing muscle strengthening exercises on moderate or greater intensity at least two days per week.</div>
+    <?php
+    }
+    if (@($review->allMajorMuscleGroups)) {
+        ?>
+        <div class="mb-1">Currently doing exercises to strengthen all major muscle groups: legs, hips, back, chest, abdomen, shoulders and arms.</div>
+        <?php
+    }
+    if (@($review->sets)) {
+        ?>
+        <div class="mb-1">Sets per exercise: <?= $review->sets ?>.</div>
+        <?php
+    }
+    if (@($review->reps)) {
+        ?>
+        <div class="mb-1">Repetitions per set: <?= $review->reps ?>.</div>
+        <?php
+    }
+    if (@($review->resistanceBandsBodyWeight)) {
+        ?>
+        <div class="mb-1">Currently using resistance bands or using body weight to do exercises.</div>
+        <?php
+    }
+    ?>
+    <div class="text-secondary"><?= @($review->memo) ?: '' ?></div>
+    <?php
+}
+else {
+    ?> - <?php
+}
+?>
+