Browse Source

sleep apnea update

Peter Muturi 2 years ago
parent
commit
db45560aec

+ 121 - 0
resources/views/app/patient/module-specific-summary-renderers/sleep_study_intake/plan.blade.php

@@ -0,0 +1,121 @@
+<?php $keysToSkip = [
+    'how_weight_affects_your_life_1',
+    'how_weight_affects_your_life',
+    'first_notice_on_weight_gain',
+    'first_notice_on_weight_gain',
+    'first_notice_on_weight_gain',
+    'first_notice_on_weight_gain',
+    'first_notice_on_weight_gain',
+    'gained_more_than_20_pounds',
+    'gained_more_than_20_pounds',
+    'gained_more_than_20_pounds_when',
+    'weight_1_year_ago',
+    'weight_5_years_ago',
+    'weight_10_years_ago',
+    'weight_gain_life_events',
+    'weight_gain_life_events_medication_list',
+    'previous_weight_loss_programs',
+    'previous_weight_loss_programs_others_list',
+    'max_weight_loss',
+    'greatest_challenge',
+    'weight_loss_medication',
+    'weight_loss_medication_other',
+    'wlm_what_worked',
+    'wlm_what_didnt_work',
+    'wlm_why_or_why_not',
+    'breakfast_days_per_week',
+    'breakfast_hour',
+    'breakfast_min',
+    'no_of_times_you_eat_per_day',
+    'beverages_you_drink',
+    'eats_at_night',
+    'eats_at_night_when',
+    'food_intolerances_list',
+    'food_triggers',
+    'food_triggers_other',
+    'food_cravings',
+    'food_cravings_favourites',
+    'medical_history_exercise_type',
+    'medical_history_hours',
+    'medical_history_mins',
+    'medical_history_no_of_times_per_week',
+    'sleeping_hours_per_night',
+    'feels_rested_in_morning',
+    'past_medical_history',
+    'past_medical_history_other',
+    'eating_disorder',
+    'eating_disorder_text',
+    'past_surgical_history',
+    'past_surgical_history_other',
+    'medication_list',
+    'alergies_medications',
+    'alergies_food',
+    'social_history_smoking',
+    'current_smoker_packs_per_day',
+    'past_smoker_quit_years_ago',
+    'social_history_alcohol',
+    'regular_drinks_per_day',
+    'prior_alcoholism_treatment',
+    'social_history_drugs',
+    'social_history_drugs_text',
+    'social_history_marijuana',
+    'current_user_drinks_per_day',
+    'family_history_obesity',
+    'family_history_diabetes',
+    'family_history_other',
+    'family_history_other_text',
+    'family_history_alcoholism',
+    'fhdos',
+    'age_periods_started',
+    'age_periods_ended',
+    'periods_frequency',
+    'periods_intensity',
+    'no_of_pregnancies',
+    'no_of_children',
+    'age_of_first_pregnancy',
+    'age_of_last_pregnancy',
+    'system_review',
+    'women_only',
+    'comments'
+]; ?>
+@if($points && count($points))
+    <?php
+        ob_start();
+        $j = 0;
+        foreach ($points as $point) {
+            $j++;
+            ?>
+            <tr>
+                <td class="font-weight-normal">
+                    @include('app.patient.module-specific-summary-renderers.data-dump', compact('point'))
+                </td>
+                <td></td>
+            </tr>
+            <?php
+        }
+        $output = ob_get_contents();
+        ob_end_clean();
+    ?>
+    @if($output && !!trim(strip_tags($output)))
+    <div class="d-flex border-bottom">
+        <a class="mr-2 min-width-110px hide-if-note-signed"
+            open-in-stag-popup
+           href="/module-view/{{$note->uid}}/weight_loss_intake/edit"
+           mc-initer="edit-weight_loss_intake-container-{{$note->id}}"
+           title="Weight Loss Intake"
+           popup-style="stag-popup-md overflow-visible">
+            Weight Loss
+        </a>
+        <span class="mr-2 min-width-110px font-weight-bold show-if-note-signed">
+            Weight Loss
+        </span>
+
+        <div class="flex-grow-1">
+            <table class="table table-bordered table-xs table-cage mb-0">
+                <?= $output ?>
+            </table>
+        </div>
+    </div>
+    @endif
+@endif
+

+ 44 - 0
resources/views/app/patient/module-specific-summary-renderers/sleep_study_intake/subjective.blade.php

@@ -0,0 +1,44 @@
+<?php $keysToSkip = [
+    'smart_goal_for_weight_loss'
+]; 
+?>
+@if($points && count($points))
+    <?php
+    ob_start();
+    $j = 0;
+    foreach ($points as $point) {
+    $j++;
+    ?>
+    <tr>
+        <td>
+            @include('app.patient.module-specific-summary-renderers.data-dump', compact('point'))
+        </td>
+        <td></td>
+    </tr>
+    <?php
+    }
+    $output = ob_get_contents();
+    ob_end_clean();
+    ?>
+    @if($output && !!trim(strip_tags($output)))
+        <div class="d-flex border-bottom">
+            <a class="mr-2 min-width-110px hide-if-note-signed"
+               open-in-stag-popup
+               href="/module-view/{{$note->uid}}/weight_loss_intake/edit"
+               mc-initer="edit-weight_loss_intake-container-{{$note->id}}"
+               title="Weight Loss Intake"
+               popup-style="stag-popup-md overflow-visible">
+                Weight Loss
+            </a>
+            <span class="mr-2 min-width-110px font-weight-bold show-if-note-signed">
+                Weight Loss
+            </span>
+
+            <div class="flex-grow-1">
+                <table class="table table-bordered table-xs table-cage mb-0">
+                    <?= $output ?>
+                </table>
+            </div>
+        </div>
+    @endif
+@endif

+ 927 - 0
resources/views/app/patient/modules/sleep_study_intake/edit.blade.php

@@ -0,0 +1,927 @@
+<?php
+use App\Models\Client;
+use App\Models\Note;
+use App\Models\Point;
+/** @var Client $patient */
+/** @var Note $note */
+/** @var Point $point */
+
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'SLEEP_STUDY_INTAKE', $sessionKey);
+
+// replace content data
+$contentData = [
+    "how_weight_affects_your_life" => "",
+    "first_notice_on_weight_gain" => "",
+    "first_notice_on_weight_gain" => "",
+    "first_notice_on_weight_gain" => "",
+    "first_notice_on_weight_gain" => "",
+    "first_notice_on_weight_gain" => "",
+    "gained_more_than_20_pounds" => "",
+    "gained_more_than_20_pounds" => "",
+    "gained_more_than_20_pounds_when" => "",
+    "weight_1_year_ago" => "",
+    "weight_5_years_ago" => "",
+    "weight_10_years_ago" => "",
+    "weight_gain_life_events" => [],
+    "weight_gain_life_events_medication_list" => "",
+    "previous_weight_loss_programs" => [],
+    "previous_weight_loss_programs_others_list" => "",
+    "max_weight_loss" => "",
+    "greatest_challenge" => "",
+    "weight_loss_medication" => [],
+    "weight_loss_medication_other" => "",
+    "wlm_what_worked" => "",
+    "wlm_what_didnt_work" => "",
+    "wlm_why_or_why_not" => "",
+    "breakfast_days_per_week" => "",
+    "breakfast_hour" => "",
+    "breakfast_min" => "",
+    "no_of_times_you_eat_per_day" => "",
+    "beverages_you_drink" => "",
+    "eats_at_night" => "",
+    "eats_at_night_when" => "",
+    "food_intolerances_list" => "",
+    "food_triggers" => [],
+    "food_triggers_other" => "",
+    "food_cravings" => [],
+    "food_cravings_favourites" => "",
+    "medical_history_exercise_type" => "",
+    "medical_history_hours" => "",
+    "medical_history_mins" => "",
+    "medical_history_no_of_times_per_week" => "",
+    "sleeping_hours_per_night" => "",
+    "feels_rested_in_morning" => "",
+    "past_medical_history" => [],
+    "past_medical_history_other" => "",
+    "eating_disorder" => "",
+    "eating_disorder_text" => "",
+    "past_surgical_history" => [],
+    "past_surgical_history_other" => "",
+    "medication_list" => "",
+    "alergies_medications" => "",
+    "alergies_food" => "",
+    "social_history_smoking" => [],
+    "current_smoker_packs_per_day" => "",
+    "past_smoker_quit_years_ago" => "",
+    "social_history_alcohol" => [],
+    "regular_drinks_per_day" => "",
+    "prior_alcoholism_treatment" => "",
+    "social_history_drugs" => [],
+    "social_history_drugs_text" => "",
+    "social_history_marijuana" => [],
+    "current_user_drinks_per_day" => "",
+    "family_history_obesity" => [],
+    "family_history_diabetes" => [],
+    "family_history_other" => [],
+    "family_history_other_text" => "",
+    "family_history_alcoholism" => "",
+    "fhdos" => "",
+    "age_periods_started" => "",
+    "age_periods_ended" => "",
+    "periods_frequency" => "",
+    "periods_intensity" => "",
+    "no_of_pregnancies" => "",
+    "no_of_children" => "",
+    "age_of_first_pregnancy" => "",
+    "age_of_last_pregnancy" => "",
+    "system_review" => [],
+    "women_only" => [],
+    "comments" => "",
+	"smart_goal_for_weight_loss" => "",
+];
+
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $point->lastChildReview->data;
+}
+?>
+<div class="p-3 mcp-theme-1">
+
+    <div visit-moe close-on-save close-on-cancel class="d-block">
+        <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="<?= $note->coreSegment->uid ?>">
+            <input type="hidden" name="data" value="{{json_encode($contentData)}}">
+
+            <div id="edit-sleep_study_intake-container" class="customized-form">
+
+                @include('app.patient.modules._undo_changes', compact('point'))
+
+                <div class="row mb-1">
+					<div class="col-md-12 section">
+						<div class="form-group">
+                        <label>How does your weight affect your life and health?</label>
+						<textarea class="form-control inline flex-grow-1" v-model="data.how_weight_affects_your_life_1"></textarea>
+						</div>
+					</div>
+					<div class="col-md-12">
+						<h6 class="my-3"><b><u>Weight History</u></b></h6>
+					</div>
+					<div class="col-md-12 section bg-light pt-2 mb-3">
+						<div class="form-group">
+							<label>When did you first notice that you were gaining weight? </label>
+							<div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="radio" v-model="data.first_notice_on_weight_gain"
+										id="wg-childhood" value="childhood">
+									<label class="form-check-label" for="wg-childhood">Childhood</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="radio" v-model="data.first_notice_on_weight_gain"
+										id="wg-teens" value="teens">
+									<label class="form-check-label" for="wg-teens">Teens</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="radio" v-model="data.first_notice_on_weight_gain"
+										id="wg-adulthood" value="adulthood">
+									<label class="form-check-label" for="wg-adulthood">Adulthood</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="radio" v-model="data.first_notice_on_weight_gain"
+										id="wg-pregnancy" value="pregnancy">
+									<label class="form-check-label" for="wg-pregnancy">Pregnancy</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="radio" v-model="data.first_notice_on_weight_gain"
+										id="wg-menopause" value="menopause">
+									<label class="form-check-label" for="wg-menopause">Menopause</label>
+								</div>
+							</div>
+						</div>
+					</div>
+					<div class="col-md-12 section">
+						<div class="form-group">
+							<label>Did you ever gain more than 20 pounds in less than 3 months?</label>
+							<div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="radio" v-model="data.gained_more_than_20_pounds"
+										id="gm-yes" value="yes">
+									<label class="form-check-label" for="gm-yes">Yes</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="radio" v-model="data.gained_more_than_20_pounds"
+										id="gm-no" value="no">
+									<label class="form-check-label" for="gm-no">No</label>
+								</div>
+							</div>
+							<div class="d-flex mt-3">
+								<label>If so, when?</label>
+								<input type="text" class="form-control inline flex-grow-1"
+									v-model="data.gained_more_than_20_pounds_when" />
+							</div>
+						</div>
+					</div>
+					<div class="col-md-12 section">
+						<div class="form-group">
+							<div class="d-flex flex-wrap">
+								<label class="mr-3">How much did you weigh:</label>
+								<div class="d-flex mr-3">
+									<label>one year ago?</label>
+									<input type="text" class="form-control inline width-50px" v-model="data.weight_1_year_ago">
+								</div>
+								<div class="d-flex mr-3">
+									<label>Five years ago?</label>
+									<input type="text" class="form-control inline width-50px" v-model="data.weight_5_years_ago">
+								</div>
+								<div class="d-flex">
+									<label>10 years ago?</label>
+									<input type="text" class="form-control inline width-50px" v-model="data.weight_10_years_ago">
+								</div>
+							</div>
+						</div>
+					</div>
+
+					<div class="col-md-12 section bg-light pt-2 mb-3">
+						<div class="form-group">
+							<label>Life events associated with weight gain (check all that apply):</label>
+							<div class="unified-checks flex-basis-20">
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_gain_life_events" id="le-marriage" value="marriage">
+									<label class="form-check-label" for="le-marriage">Marriage</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_gain_life_events" id="le-divorce" value="divorce">
+									<label class="form-check-label" for="le-divorce">Divorce</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_gain_life_events" id="le-pregnancy" value="pregnancy">
+									<label class="form-check-label" for="le-pregnancy">Pregnancy</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_gain_life_events" id="le-abuse" value="abuse">
+									<label class="form-check-label" for="le-abuse">Abuse</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_gain_life_events" id="le-illness" value="illness">
+									<label class="form-check-label" for="le-illness">Illness</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_gain_life_events" id="le-travel" value="travel">
+									<label class="form-check-label" for="le-travel">Travel</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_gain_life_events" id="le-injury" value="injury">
+									<label class="form-check-label" for="le-injury">Injury</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_gain_life_events" id="le-nightshift_work"
+										value="nightshift_work">
+									<label class="form-check-label" for="le-nightshift_work">Nightshift Work</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_gain_life_events" id="le-job_change"
+										value="job_change">
+									<label class="form-check-label" for="le-job_change">Job Change</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_gain_life_events" id="le-quitting_smoking"
+										value="quitting_smoking">
+									<label class="form-check-label" for="le-quitting_smoking">Quitting Smoking</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_gain_life_events" id="le-alcohol" value="alcohol">
+									<label class="form-check-label" for="le-alcohol">Alcohol</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_gain_life_events" id="le-drugs" value="drugs">
+									<label class="form-check-label" for="le-drugs">Drugs</label>
+								</div>
+								<div class="d-flex flex-grow-1 align-items-end">
+									<div class="form-check form-check-inline mr-3">
+										<input class="form-check-input" type="checkbox" v-model="data.weight_gain_life_events" id="le-medication"
+											value="medication">
+										<label class="form-check-label" for="le-medication">Medication</label>
+									</div>
+									<div class="d-flex flex-grow-1 align-items-end">
+										<label class="text-nowrap mb-0 mr-3">please list:</label>
+										<input type="text" class="form-control d-inline flex-grow-1" v-model="data.weight_gain_life_events_medication_list" />
+									</div>
+								</div>
+
+							</div>
+						</div>
+					</div>
+
+					<div class="col-md-12 section">
+						<div class="form-group">
+							<label>Previous weight-loss programs (check all that apply):</label>
+							<div class="unified-checks flex-basis-20">
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-weight_watchers" value="weight_watchers">
+									<label class="form-check-label" for="pwl-weight_watchers">Weight Watchers</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-nutrisystem" value="nutrisystem">
+									<label class="form-check-label" for="pwl-nutrisystem">Nutrisystem</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-jenny_craig" value="jenny_craig">
+									<label class="form-check-label" for="pwl-jenny_craig">Jenny Craig</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-la_weight_loss" value="la_weight_loss">
+									<label class="form-check-label" for="pwl-la_weight_loss">LA Weight Loss</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-atkins" value="atkins">
+									<label class="form-check-label" for="pwl-atkins">Atkins</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-south_beach" value="south_beach">
+									<label class="form-check-label" for="pwl-south_beach">South Beach</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-zone_diet" value="zone_diet">
+									<label class="form-check-label" for="pwl-zone_diet">Zone diet</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-medifast" value="medifast">
+									<label class="form-check-label" for="pwl-medifast">Medifast</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-dash_diet" value="dash_diet">
+									<label class="form-check-label" for="pwl-dash_diet">Dash Diet</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-paleo_diet" value="paleo_diet">
+									<label class="form-check-label" for="pwl-paleo_diet">Paleo Diet</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-hcg_diet" value="hcg_diet">
+									<label class="form-check-label" for="pwl-hcg_diet">HCG diet</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-mediterranean_diet" value="mediterranean_diet">
+									<label class="form-check-label" for="pwl-mediterranean_diet">Mediterranean diet</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-ornish_diet" value="ornish_diet">
+									<label class="form-check-label" for="pwl-ornish_diet">Ornish diet</label>
+								</div>
+
+								<div class="d-flex flex-grow-1 align-items-end">
+									<div class="form-check form-check-inline mr-3">
+										<input class="form-check-input" type="checkbox" v-model="data.previous_weight_loss_programs" id="pwl-other"
+											value="other">
+										<label class="form-check-label" for="pwl-other">Other</label>
+									</div>
+									<div class="d-flex flex-grow-1 align-items-end">
+										<label class="text-nowrap mb-0 mr-3">please list:</label>
+										<input type="text" class="form-control d-inline flex-grow-1" v-model="data.previous_weight_loss_programs_others_list" />
+									</div>
+								</div>
+
+							</div>
+						</div>
+					</div>
+
+					<div class="col-md-12 section bg-light pt-2 mb-3">
+						<div class="form-group">
+							<div class="d-flex">
+								<label>What was your maximum weight loss?</label>
+								<input type="text" class="form-control inline flex-grow-1" v-model="data.max_weight_loss">
+							</div>
+							<div class="mt-3">
+								<div class="d-flex flex-column">
+									<label>What are your greatest challenges with dieting?</label>
+									<textarea class="form-control inline" v-model="data.greatest_challenge"></textarea>
+								</div>
+							</div>
+						</div>
+					</div>
+
+					<div class="col-md-12 section">
+						<div class="form-group">
+							<label>Have you ever taken medication to lose weight? (check all that apply):</label>
+							<div class="unified-checks flex-basis-23">
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_loss_medication" id="wlm-phentermine" value="phentermine">
+									<label class="form-check-label" for="wlm-phentermine">Phentermine (Adipex)</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_loss_medication" id="wlm-meridia" value="meridia">
+									<label class="form-check-label" for="wlm-meridia">Meridia</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_loss_medication" id="wlm-xenecal" value="xenecal">
+									<label class="form-check-label" for="wlm-xenecal">Xenecal/Alli</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_loss_medication" id="wlm-phen" value="phen">
+									<label class="form-check-label" for="wlm-phen">Phen/Fen</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_loss_medication" id="wlm-phendimetrazine" value="phendimetrazine">
+									<label class="form-check-label" for="wlm-phendimetrazine">Phendimetrazine(Bontril)</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_loss_medication" id="wlm-topamax" value="topamax">
+									<label class="form-check-label" for="wlm-topamax">Topamax</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_loss_medication" id="wlm-saxenda" value="saxenda">
+									<label class="form-check-label" for="wlm-saxenda">Saxenda</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_loss_medication" id="wlm-diethylpropion" value="diethylpropion">
+									<label class="form-check-label" for="wlm-diethylpropion">Diethylpropion</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_loss_medication" id="wlm-bupropion" value="bupropion">
+									<label class="form-check-label" for="wlm-bupropion">Bupropion (Wellbutrin)</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_loss_medication" id="wlm-belviq" value="belviq">
+									<label class="form-check-label" for="wlm-belviq">Belviq</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_loss_medication" id="wlm-qsymia" value="qsymia">
+									<label class="form-check-label" for="wlm-qsymia">Qsymia</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.weight_loss_medication" id="wlm-contrave" value="contrave">
+									<label class="form-check-label" for="wlm-contrave">Contrave</label>
+								</div>
+
+								<div class="d-flex flex-grow-1 align-items-end">
+									<div class="form-check form-check-inline mr-3">
+										<input class="form-check-input" type="checkbox" v-model="data.weight_loss_medication" id="wlm-other"
+											value="other">
+										<label class="form-check-label" for="wlm-other">Other</label>
+									</div>
+									<div class="d-flex flex-grow-1 align-items-end">
+										<label class="text-nowrap mb-0 mr-3">(including supplements):</label>
+										<input type="text" class="form-control d-inline flex-grow-1" v-model="data.weight_loss_medication_other" />
+									</div>
+								</div>
+							</div>
+							<div class="form-group mt-3">
+								<div class="d-flex">
+									<label>What worked?</label>
+									<input type="text" class="form-control inline flex-grow-1" v-model="data.wlm_what_worked" />
+								</div>
+							</div>
+							<div class="form-group">
+								<div class="d-flex">
+									<label>What didn't work?</label>
+									<input type="text" class="form-control inline flex-grow-1" v-model="data.wlm_what_didnt_work" />
+								</div>
+							</div>
+							<div class="form-group">
+								<div class="d-flex">
+									<label>Why or why not?</label>
+									<input type="text" class="form-control inline flex-grow-1" v-model="data.wlm_why_or_why_not" />
+								</div>
+							</div>
+						</div>
+					</div>
+
+					<div class="col-md-12">
+						<h6 class="my-3"><b><u>Nutritional History</u></b></h6>
+					</div>
+					<div class="col-md-12 section bg-light pt-2 mb-3">
+						<div class="form-group">
+							<div class="d-flex flex-wrap">
+								<label class="mr-3">How often do you eat breakfast?</label>
+								<div class="d-flex mr-3">
+									<input type="text" class="form-control inline" v-model="data.breakfast_days_per_week">
+									<label>days per week at</label>
+								</div>
+								<div class="d-flex mr-3">
+									<input type="text" class="form-control inline" style="width:50px" v-model="data.breakfast_hour">
+									<label>:</label>
+								</div>
+								<div class="d-flex mr-3">
+									<input type="text" class="form-control inline" style="width:50px" v-model="data.breakfast_min">
+									<label>a.m</label>
+								</div>
+							</div>
+						</div>
+
+						<div class="form-group">
+							<div class="d-flex flex-wrap">
+								<label class="mr-3">Number of times you eat per day:</label>
+								<div class="d-flex mr-3">
+									<input type="text" class="form-control inline" v-model="data.no_of_times_you_eat_per_day">
+								</div>
+								<div class="d-flex mr-3 flex-grow-1">
+									<label> What beverages do you drink?</label>
+									<input type="text" class="form-control inline flex-grow-1" v-model="data.beverages_you_drink">
+								</div>
+							</div>
+						</div>
+
+						<div class="form-group">
+							<label>Do you get up at night to eat?</label>
+							<div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="radio" v-model="data.eats_at_night" id="eats-at-night-yes" value="yes">
+									<label class="form-check-label" for="eats-at-night-yes">Yes</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="radio" v-model="data.eats_at_night" id="eats-at-night-no" value="no">
+									<label class="form-check-label" for="eats-at-night-no">No</label>
+								</div>
+							</div>
+							<div class="d-flex mt-3">
+								<label>If so, how often?</label>
+								<input type="text" class="form-control inline" v-model="data.eats_at_night_when">
+								<label>times</label>
+							</div>
+						</div>
+
+						<div class="form-group">
+							<div class="d-flex">
+								<label>List any food intolerances/restrictions:</label>
+								<input type="text" class="form-control inline flex-grow-1" v-model="data.food_intolerances_list">
+							</div>
+						</div>
+						<div class="form-group">
+							<label>Food triggers (check all that apply):</label>
+							<div class="unified-checks flex-basis-20">
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_triggers" id="ft-stress" value="stress">
+									<label class="form-check-label" for="ft-stress">Stress</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_triggers" id="ft-boredom" value="boredom">
+									<label class="form-check-label" for="ft-boredom">Boredom</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_triggers" id="ft-anger" value="anger">
+									<label class="form-check-label" for="ft-anger">Anger</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_triggers" id="ft-insomnia" value="insomnia">
+									<label class="form-check-label" for="ft-insomnia">Insomnia</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_triggers" id="ft-seeking_reward" value="seeking_reward">
+									<label class="form-check-label" for="ft-seeking_reward">Seeking reward</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_triggers" id="ft-parties" value="parties">
+									<label class="form-check-label" for="ft-parties">Parties</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_triggers" id="ft-eating_out" value="eating_out">
+									<label class="form-check-label" for="ft-eating_out">Eating out</label>
+								</div>
+								<div class="d-flex flex-grow-1 align-items-end">
+									<div class="form-check form-check-inline mr-3">
+										<input class="form-check-input" type="checkbox" v-model="data.food_triggers" id="ft-other"
+											value="other">
+										<label class="form-check-label" for="ft-other">Other</label>
+									</div>
+									<div class="d-flex flex-grow-1 align-items-end">
+										<input type="text" class="form-control d-inline flex-grow-1" v-model="data.food_triggers_other" />
+									</div>
+								</div>
+							</div>
+						</div>
+						<div class="form-group">
+							<label>Food cravings:</label>
+							<div class="unified-checks flex-basis-20">
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_cravings" id="fc-sugar" value="sugar">
+									<label class="form-check-label" for="fc-sugar">Sugar</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_cravings" id="fc-chocolate" value="chocolate">
+									<label class="form-check-label" for="fc-chocolate">Chocolate</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_cravings" id="fc-starches" value="starches">
+									<label class="form-check-label" for="fc-starches">Starches</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_cravings" id="fc-salty" value="salty">
+									<label class="form-check-label" for="fc-salty">Salty</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_cravings" id="fc-fast_food" value="fast_food">
+									<label class="form-check-label" for="fc-fast_food">Fast food</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_cravings" id="fc-high_fat" value="high_fat">
+									<label class="form-check-label" for="fc-high_fat">High fat</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.food_cravings" id="fc-largr_portions" value="largr_portions">
+									<label class="form-check-label" for="fc-largr_portions">Large portions</label>
+								</div>
+								<div class="d-flex flex-grow-1 align-items-end">
+									<div class="form-check form-check-inline mr-3">
+										<input class="form-check-input" type="checkbox" v-model="data.food_cravings" id="fc-other"
+											value="other">
+										<label class="form-check-label" for="fc-other">Favorite foods</label>
+									</div>
+									<div class="d-flex flex-grow-1 align-items-end">
+										<input type="text" class="form-control d-inline flex-grow-1" v-model="data.food_cravings_favourites" />
+									</div>
+								</div>
+							</div>
+						</div>
+
+
+					</div>
+
+					<div class="col-md-12">
+						<h6 class="my-3"><b><u>Exercise & Sleep</u></b></h6>
+					</div>
+
+					<div class="col-md-12 section bg-light pt-2 mb-3">
+						<div class="form-group">
+							<div class="d-flex">
+								<label>Exercise type:</label>
+								<input type="text" class="form-control inline flex-grow-1" v-model="data.medical_history_exercise_type">
+							</div>
+						</div>
+						<div class="form-group">
+							<div class="d-flex flex-wrap">
+								<label class="mr-3">Duration:</label>
+								<div class="d-flex mr-3">
+									<input type="text" class="form-control inline" v-model="data.medical_history_hours">
+									<label>hours</label>
+								</div>
+								<div class="d-flex mr-3">
+									<input type="text" class="form-control inline" style="width:50px" v-model="data.medical_history_mins">
+									<label>minutes</label>
+								</div>
+								<div class="d-flex mr-3 flex-grow-1">
+									<label>Number of times per week:</label>
+									<input type="text" class="form-control inline flex-grow-1" v-model="data.medical_history_no_of_times_per_week">
+
+								</div>
+							</div>
+						</div>
+					</div>
+
+					<div class="col-md-12">
+						<div class="form-group">
+							<div class="d-flex flex-wrap">
+								<label class="mr-3">How many hours do you sleep per night?</label>
+								<div class="d-flex mr-3">
+									<input type="text" class="form-control inline" v-model="data.sleeping_hours_per_night">
+								</div>
+								<div class="d-flex mr-3 flex-grow-1">
+									<label>Do you feel rested in the morning?</label>
+									<input type="text" class="form-control inline flex-grow-1" v-model="data.feels_rested_in_morning">
+								</div>
+							</div>
+						</div>
+					</div>
+
+                    <div class="col-md-12">
+						<h6 class="my-3"><b><u>Past medical history (check all that apply)</u></b></h6>
+					</div>
+					<div class="col-md-12 section bg-light py-2 mb-3">
+						<div class="c-pointer"
+							 open-in-stag-popup
+							 href="/note-segment-view-by-name/{{$note->uid}}/past_medical_history/edit"
+							 mc-initer="edit-univ_history_past_medical-container-{{$note->id}}"
+							 title="Past Medical History"
+							 update-parent
+							 popup-style="overflow-visible">
+							@include('app.patient.segment-templates.omega_history_past_medical.summary')
+						</div>
+					</div>
+
+                    <div class="col-md-12">
+						<h6 class="my-3"><b><u>Medications</u></b></h6>
+					</div>
+					<div class="col-md-12 section bg-light py-2 mb-3">
+						<div class="c-pointer"
+							 open-in-stag-popup
+							 href="/medications-center/{{$patient->uid}}/{{$note->uid}}"
+							 mc-initer="medications-center-{{$note->id}}"
+							 title="Medications Center"
+							 update-parent
+							 popup-style="overflow-visible">
+							@include('app.patient.segment-templates.omega_medications.active-linear-summary')
+						</div>
+					</div>
+
+                    <div class="col-md-12">
+						<h6 class="my-3"><b><u>Allergies</u></b></h6>
+					</div>
+
+					<div class="col-md-12 section bg-light py-2 mb-3">
+						<div class="c-pointer"
+							 open-in-stag-popup
+							 href="/allergies-center/{{$patient->uid}}/{{$note->uid}}"
+							 mc-initer="allergies-center-{{$note->id}}"
+							 title="Allergies Center"
+							 update-parent
+							 popup-style="overflow-visible">
+							@include('app.patient.segment-templates.omega_allergies.active-linear-summary')
+						</div>
+					</div>
+
+					<div class="col-md-12">
+						<h6 class="my-3"><b><u>Social History</u></b></h6>
+					</div>
+
+					<div class="col-md-12 section bg-light py-2 mb-3">
+						<div class="c-pointer"
+						   open-in-stag-popup
+						   href="/note-segment-view-by-name/{{$note->uid}}/history_social/edit"
+						   mc-initer="edit-univ_history_social-container-{{$note->id}}"
+						   title="Social History"
+						   popup-style="overflow-visible">
+							@include('app.patient.segment-templates.omega_history_social.summary')
+						</div>
+					</div>
+
+					<div class="col-md-12">
+						<h6 class="my-3"><b><u>Family History</u></b></h6>
+					</div>
+
+					<div class="col-md-12 section bg-light py-2 mb-3">
+						<div class="c-pointer"
+							 open-in-stag-popup
+							 href="/note-segment-view-by-name/{{$note->uid}}/history_family/edit"
+							 mc-initer="edit-univ_history_family-container-{{$note->id}}"
+							 title="Family History"
+							 popup-style="overflow-visible">
+							@include('app.patient.segment-templates.omega_history_family.summary')
+						</div>
+					</div>
+
+					<div class="col-md-12">
+						<h6 class="my-3"><b><u>Gynecologic History</u></b></h6>
+					</div>
+
+					<div class="col-md-12 section bg-light pt-2 mb-3">
+						<div class="form-group">
+							<div class="d-flex flex-wrap">
+								<label class="mr-3">Age periods started?</label>
+								<div class="d-flex mr-3">
+									<input type="text" class="form-control inline" v-model="data.age_periods_started" style="width:50px">
+								</div>
+								<div class="d-flex mr-3">
+									<label>Age periods ended</label>
+									<input type="text" class="form-control inline" style="width:50px" v-model="data.age_periods_ended">
+								</div>
+							</div>
+						</div>
+						<div class="form-group">
+							<label>Periods are:</label>
+							<div class="d-flex">
+								<div class="mr-5">
+									<div class="form-check form-check-inline">
+										<input class="form-check-input" type="radio" v-model="data.periods_frequency" id="periods-frequency-regular" value="regular">
+										<label class="form-check-label" for="periods-frequency-regular">Regular</label>
+									</div>
+									<div class="form-check form-check-inline">
+										<input class="form-check-input" type="radio" v-model="data.periods_frequency" id="periods-frequency-irregular" value="irregular">
+										<label class="form-check-label" for="periods-frequency-irregular">Irregular</label>
+									</div>
+								</div>
+								<div>
+									<div class="form-check form-check-inline">
+										<input class="form-check-input" type="radio" v-model="data.periods_intensity" id="periods-intensity-heavy" value="heavy">
+										<label class="form-check-label" for="periods-intensity-heavy">Heavy</label>
+									</div>
+									<div class="form-check form-check-inline">
+										<input class="form-check-input" type="radio" v-model="data.periods_intensity" id="periods-intensity-normal" value="normal">
+										<label class="form-check-label" for="periods-intensity-normal">Normal</label>
+									</div>
+									<div class="form-check form-check-inline">
+										<input class="form-check-input" type="radio" v-model="data.periods_intensity" id="periods-intensity-light" value="light">
+										<label class="form-check-label" for="periods-intensity-light">Light</label>
+									</div>
+								</div>
+							</div>
+						</div>
+						<div class="form-group">
+							<div class="d-flex flex-wrap">
+								<label class="mr-3">Number of pregnancies:</label>
+								<div class="d-flex mr-3">
+									<input type="text" class="form-control inline" v-model="data.no_of_pregnancies" style="width:50px">
+								</div>
+								<div class="d-flex mr-3">
+									<label>Number of children:</label>
+									<input type="text" class="form-control inline" style="width:50px" v-model="data.no_of_children">
+								</div>
+							</div>
+						</div>
+						<div class="form-group">
+							<div class="d-flex flex-wrap">
+								<label class="mr-3">Age of first pregnancy:</label>
+								<div class="d-flex mr-3">
+									<input type="text" class="form-control inline" v-model="data.age_of_first_pregnancy" style="width:50px">
+								</div>
+								<div class="d-flex mr-3">
+									<label>Age of last pregnancy:</label>
+									<input type="text" class="form-control inline" style="width:50px" v-model="data.age_of_last_pregnancy">
+								</div>
+							</div>
+						</div>
+
+
+
+					</div>
+
+					<div class="col-md-12">
+						<h6 class="my-3"><b><u>System Review</u></b></h6>
+					</div>
+
+					<div class="col-md-12 section bg-light py-2 mb-3">
+						<div class="c-pointer"
+							 open-in-stag-popup
+							 href="/note-segment-view-by-name/{{$note->uid}}/omega_ros/edit"
+							 mc-initer="init-ros-{{$note->id}}"
+							 title="Review Of Systems"
+							 popup-style="overflow-visible">
+							@include('app.patient.segment-templates.omega_ros.summary')
+						</div>
+					</div>
+
+					<div class="col-md-12">
+						<h6 class="my-3"><b><u>(Women only)</u></b></h6>
+					</div>
+
+					<div class="col-md-12 section bg-light pt-2 mb-3">
+						<div class="form-group">
+							<div class="unified-checks flex-basis-31">
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.women_only" id="wo-periods_absence" value="periods_absence">
+									<label class="form-check-label" for="wo-periods_absence">Absence of periods	</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.women_only" id="wo-hot_flashes" value="hot_flashes">
+									<label class="form-check-label" for="wo-hot_flashes">Hot flashes</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.women_only" id="wo-bladder_habits_change" value="bladder_habits_change">
+									<label class="form-check-label" for="wo-bladder_habits_change">Change in bladder habits</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.women_only" id="wo-abnormal_menstruation" value="abnormal_menstruation">
+									<label class="form-check-label" for="wo-abnormal_menstruation">Abnormal/excessive menstruation</label>
+								</div>
+								<div class="form-check form-check-inline">
+									<input class="form-check-input" type="checkbox" v-model="data.women_only" id="wo-facial_hair" value="facial_hair">
+									<label class="form-check-label" for="wo-facial_hair"> Facial hair</label>
+								</div>
+
+							</div>
+						</div>
+					</div>
+
+					<div class="col-md-12 section mt-2">
+						<div class="form-group">
+                            <label>Comments:</label>
+                            <textarea type="text" class="form-control inline flex-grow-1" v-model="data.comments"></textarea>
+						</div>
+					</div>
+
+					<div class="col-md-12">
+						<h6 class="my-3"><b><u>Plan</u></b></h6>
+					</div>
+					<div class="col-md-12 section bg-light pt-2 mb-3">
+						<div class="form-group">
+							<label>(list all current medications, including over-the-counter medications, supplements, and herbs):</label>
+						</div>
+						<div class="form-group">
+                            <label>SMART Goal for Weight Loss:</label>
+                            <textarea type="text" class="form-control inline flex-grow-1" v-model="data.smart_goal_for_weight_loss"></textarea>
+						</div>
+					</div>
+
+				</div>
+
+                <div class="mt-3 pt-3 border-top text-center">
+                    <button type="button" v-on:click.prevent="saveForm()" class="btn btn-sm btn-primary mr-2">Submit</button>
+                    <button type="button" onclick="closeStagPopup()" class="btn btn-sm btn-default border">Cancel</button>
+                </div>
+
+            </div>
+
+            <div class="d-none">
+                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    </div>
+</div>
+<script>
+    (function() {
+        function init() {
+
+            runMCInitializer('hide-moes');
+            // any JS can come here
+            // will be run on page-load as well as whenever this segment is refreshed
+            new Vue({
+                el: '#edit-sleep_study_intake-container',
+                delimiters: ["@{{","}}"],
+                data: {
+                    data: <?= json_encode($contentData) ?>
+                },
+                watch: {
+                    $data: {
+                        handler: function(val, oldVal) {
+                            let parent = $('#edit-sleep_study_intake-container').closest('form');
+                            parent.find('[name="data"]').val(JSON.stringify(this.data));
+
+                            // autosave on change
+                            autoSaveSegment(parent.find('[submit]').first());
+                        },
+                        deep: true
+                    }
+                },
+                methods: {
+                    saveForm: function() {
+                        let parent = $('#edit-sleep_study_intake-container').closest('form');
+                        parent.find('[name="data"]').val(JSON.stringify(this.data));
+                        autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                refreshSegment('omega_subjective_system');
+								refreshSegment('omega_plan_system');
+                            }
+                        });
+                        return false;
+                    }
+                }
+            });
+
+			// if in popup (omega template), add provision to toggle relevance
+			@include('app.patient.segment-templates._common_actions.toggle-relevance', ['container' => '#edit-sleep_study_intake-container'])
+        }
+
+        addMCInitializer('edit-sleep_study_intake-container-{{$note->id}}', init, '#edit-sleep_study_intake-container');
+
+    })();
+</script>

+ 10 - 1
resources/views/app/patient/note/dashboard.blade.php

@@ -552,6 +552,15 @@ use App\Models\Handout;
                     "href" => "/module-view/{$note->uid}/weight_loss_intake/edit",
                     "initer" => "edit-weight_loss_intake-container-{$note->id}"
                 ],
+                [],
+                [
+                  "name" => 'Sleep Study Intake',
+                  "title" => 'Sleep Study Intake',
+                  "style" => 'stag-popup-md',
+                  "href" => "/module-view/{$note->uid}/sleep_study_intake/edit",
+                  "initer" => "edit-sleep_study_intake-container-{$note->id}"
+                ],
+
             ];
             ?>
             <div moe relative class="px-2 border-left screen-only">
@@ -601,7 +610,7 @@ use App\Models\Handout;
                         <div class="d-flex">
                             @include('app.patient.note.partials.flag-note-by-supervisor')
                         </div>
-                        
+
 
                         @if($note->is_signed_by_hcp )
                             <div class="d-flex align-items-baseline">

+ 351 - 19
resources/views/app/patient/segment-templates/a_p/edit.blade.php

@@ -2,38 +2,130 @@
 
 use App\Models\Point;
 
-$category = 'INFORMED_CONSENT';
+$category = 'SLEEP_APNEA_A_P';
 $endPoint = 'upsertNoteSingleton';
 
 $point = Point::where('added_in_note_id', $note->id)->where('category', $category)->orderBy('id', 'DESC')->first();
-$contentData = [
-    "informed_consent" => false
-];
+$contentData = (object) [];
 if (!!@$point->data) {
     $contentData = json_decode($point->data, true);
 }
+
+$questionnaire = [
+  'check_questions' => [
+    'overnight_oximetry' => [
+      'option' => [
+        'value' => 'SleepExam_OverNightOxyTest',
+        'label' => 'Over Night Oximetry'
+      ],
+      'field' => 'SleepExam_OverNightOxyTestNotes'
+    ],
+    'stress_test' => [
+      'option' => [
+        'value' => 'SleepExam_StressTest',
+        'label' => 'Stress Test'
+      ],
+      'field' => 'SleepExam_StressTestNotes'
+    ],
+    'study_fullnight' => [
+      'option' => [
+        'value' => 'SleepExam_StudyFullNight',
+        'label' => 'Sleep Study - Full Night'
+      ],
+      'field' => 'SleepExam_StudyFullNightNotes'
+    ],
+    'study_splitnight' => [
+      'option' => [
+        'value' => 'SleepExam_StudySplitNight',
+        'label' => 'Sleep Study - Split Night'
+      ],
+      'field' => 'SleepExam_StudySplitNightNotes'
+    ],
+    'apnea_hypopnea' => [
+      'option' => [
+        'value' => 'SleepExam_ApneaHypopnea',
+        'label' => 'Apnea / Hypopnea'
+      ],
+      'field' => 'SleepExam_ApneaHypopneaNotes'
+    ],
+    'multiple_sleep_latency_test' => [
+      'option' => [
+        'value' => 'SleepExam_MultipleSleepLatencyTest',
+        'label' => 'Multiple Sleep Latency Test'
+        ],
+      'field' => 'SleepExam_MultipleSleepLatencyTestNotes'
+    ],
+    'maint_of_wakefulness' => [
+      'option' => [
+        'value' => 'SleepExam_MaintOfWakefulnessTest',
+        'label' => 'Maintenance of Wakefulness'
+      ],
+      'field' => 'SleepExam_MaintOfWakefulnessTestNotes'
+    ],
+  ]
+];
+
 ?>
+
+<style>
+    .select-esc-option {
+        max-width: 80px;
+        min-width: auto !important;
+    }
+    .textarea-option {
+      max-width: 200px;
+      resize: none;
+    }
+</style>
+
+<!-- Modal -->
+<div class="modal fade" id="addDropdownOptionModal" tabindex="-1" aria-labelledby="addDropdownOptionModalLabel" aria-hidden="true">
+    <div class="modal-dialog" style="margin-top:200px;">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title font-weight-bold" id="addDropdownOptionModalLabel"><span></span> - Enter new List Item</h5>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <form>
+                    <div class="row">
+                        <div class="col-12">
+                            <div class="form-group">
+                                <label>Field Label</label>
+                                <input type="text" class="form-control" name="fieldLabel" />
+                            </div>
+                        </div>
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
+                <button type="button" class="btn btn-primary" save-option data-dismiss="modal">Save changes</button>
+            </div>
+        </div>
+    </div>
+</div>
+
 <div visit-moe close-on-save close-on-cancel class="d-block pb-2">
     <form show url="/api/visitPoint/<?= $endPoint ?>" class="mcp-theme-1">
         <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
         <input type="hidden" name="category" value="<?= $category ?>">
         <input type="hidden" name="data" value="{{json_encode($contentData)}}">
-        @if(false)
-        <label class="d-flex align-items-baseline">
-            <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
-                <input type="checkbox" data-name="informed_consent" {{@($contentData["informed_consent"] ? 'checked' : '')}}>
-            </div>
-            <div>
-                <div>This is a {{$note->method}} visit that was performed on {{friendly_date($note->effective_dateest)}}. Verbal consent to participate was obtained.</div>
-                <div>This visit occurred during the Coronavirus (COVID-19) Public Health Emergency.</div>
-                <div>I discussed with the patient the nature of our visit, that:</div>
-                <div class="ml-3">- I would evaluate the patient and recommend diagnostics and treatments based on my assessment.</div>
-                <div class="ml-3">- Our sessions are not being recorded, and that personal health information is protected.</div>
-                <div class="ml-3">- Our team would provide follow-up care in person if/when the patient needs it.</div>
-                <div class="ml-3">- No physical exam was performed due to the remote nature of this evaluation.</div>
+        <div id="edit_a_p" class="p-1">
+            <p><b>Tests Performed</b></p>
+            <div class="mb-4 d-flex align-items-start">
+              <label class="mb-0 mr-3">
+                <input type="checkbox" name="SleepExam_OverNightOxyTest" data-name="SleepExam_OverNightOxyTest" <?= @$contentData['SleepExam_OverNightOxyTest'] === true ? 'checked':'' ?> />
+                <span>Over Night Oximetry</span>
+              </label>
+              <div>
+                  <textarea class="form-control textarea-option" name="name"></textarea>
+                  <span add-dropdown-option data-name="Dozing" data-title="Dozing" class="ml-1 c-pointer" data-toggle="modal" data-target="#addDropdownOptionModal"><i class="fas fa-plus-circle fa-fw text-success"></i></span>
+              </div>
             </div>
-        </label>
-        @endif
+        </div>
         <div class="pt-2">
             <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <div class="d-inline-flex align-self-stretch align-items-center">
@@ -46,5 +138,245 @@ if (!!@$point->data) {
         </div>
     </form>
 </div>
+<script>
+    (function() {
+        window.segmentInitializers.<?= $segment->segmentTemplate->internal_name ?> = function() {
+            // any JS can come here
+            // will be run on page-load as well as whenever this segment is refreshed
+            new Vue({
+                el: '#edit_a_p',
+                delimiters: ["@{{", "}}"],
+                data: {
+                    addDropdownOptionModal: null,
+                    form: $('#edit_a_p').closest('form'),
+                    data: <?= json_encode($contentData) ?>,
+                    defaultDropdownOptions: {
+                        Dozing: [{
+                                label: 'Never Chance of Doze',
+                                value: 0
+                            },
+                            {
+                                label: 'Slight Chance of Dozing',
+                                value: 1
+                            },
+                            {
+                                label: 'Moderate Chance of Dozing',
+                                value: 2
+                            },
+                            {
+                                label: 'High Chance of Dozing',
+                                value: 3
+                            },
+                        ],
+                        Sitting: [{
+                                label: 0,
+                                value: 0
+                            },
+                            {
+                                label: 1,
+                                value: 1
+                            },
+                            {
+                                label: 2,
+                                value: 2
+                            },
+                            {
+                                label: 3,
+                                value: 3
+                            },
+                        ],
+                        Watching: [{
+                                label: 0,
+                                value: 0
+                            },
+                            {
+                                label: 1,
+                                value: 1
+                            },
+                            {
+                                label: 2,
+                                value: 2
+                            },
+                            {
+                                label: 3,
+                                value: 3
+                            },
+                        ],
+                        Sitting_Inactive: [{
+                                label: 0,
+                                value: 0
+                            },
+                            {
+                                label: 1,
+                                value: 1
+                            },
+                            {
+                                label: 2,
+                                value: 2
+                            },
+                            {
+                                label: 3,
+                                value: 3
+                            },
+                        ],
+                        Passenger_Car: [{
+                                label: 0,
+                                value: 0
+                            },
+                            {
+                                label: 1,
+                                value: 1
+                            },
+                            {
+                                label: 2,
+                                value: 2
+                            },
+                            {
+                                label: 3,
+                                value: 3
+                            },
+                        ],
+                        Sitting_Quietly: [{
+                                label: 0,
+                                value: 0
+                            },
+                            {
+                                label: 1,
+                                value: 1
+                            },
+                            {
+                                label: 2,
+                                value: 2
+                            },
+                            {
+                                label: 3,
+                                value: 3
+                            },
+                        ],
+                        LyingDown: [{
+                                label: 0,
+                                value: 0
+                            },
+                            {
+                                label: 1,
+                                value: 1
+                            },
+                            {
+                                label: 2,
+                                value: 2
+                            },
+                            {
+                                label: 3,
+                                value: 3
+                            },
+                        ],
+                        SittingandTalking: [{
+                                label: 0,
+                                value: 0
+                            },
+                            {
+                                label: 1,
+                                value: 1
+                            },
+                            {
+                                label: 2,
+                                value: 2
+                            },
+                            {
+                                label: 3,
+                                value: 3
+                            },
+                        ],
+                        Traffic: [{
+                                label: 0,
+                                value: 0
+                            },
+                            {
+                                label: 1,
+                                value: 1
+                            },
+                            {
+                                label: 2,
+                                value: 2
+                            },
+                            {
+                                label: 3,
+                                value: 3
+                            },
+                        ]
+                    }
+                },
+                watch: {
+                    $data: {
+                        handler: function(val, oldVal) {
+                            this.saveForm();
+                        },
+                        deep: true
+                    }
+                },
+                methods: {
+                    saveForm: function() {
+                        var self = this;
+                        var url = self.form.attr('url');
+                        var data = self.data;
+                        var dataInput = self.form.find('[name="mainData"]');
+                        dataInput.val(JSON.stringify(data));
+                        var dataArray = self.form.serializeArray();
+                        dataArray.push({name: 'data', value: dataInput.val()});
+                        $.post(url, dataArray, function(response) {}, 'json');
+                    },
+                    calculateScore: function() {
+                        var self = this;
+                        var fields = self.form.find('[score-input]');
+                        var score = 0;
+                        $.each(fields, function(i, field) {
+                            var value = parseInt($(field).val());
+                            value = isNaN(value) ? 0 : value;
+                            score = score + value;
+                        });
+                        self.data.Score = score;
+                        self.saveForm();
+                    },
+                    initOnSelectChange: function() {
+                        var self = this;
+                        self.form.find('select').on('change', function() {
+                            self.calculateScore();
+                        });
+                    },
+                    initOnAddDropdownOption: function() {
+                        var self = this;
+                        self.addDropdownOptionModal = $('#addDropdownOptionModal');
+                        self.form.find('[add-dropdown-option]').off('click');
+                        self.form.find('[add-dropdown-option]').click(function(e) {
+                            var btn = $(e.currentTarget);
+                            var name = btn.data('name');
+                            var title = btn.data('title');
+                            self.addDropdownOptionModal.find('#addDropdownOptionModalLabel').find('span').text(title);
+                            self.addDropdownOptionModal.find('[save-option]').off('click');
+                            self.addDropdownOptionModal.find('[save-option]').click(function() {
+                                var newOption = self.addDropdownOptionModal.find('input[name=fieldLabel]').val();
+                                var options = self.data.dropdownOptions[name];
+                                var value = options.length;
+                                options[value] = {label: newOption, value: value};
+                                self.data.dropdownOptions[name] = options;
+                                Vue.set(self.data, name, value);
+                                self.saveForm();
+                                //TODO: Refresh UI to show new value
+                            });
 
+                        });
+                    },
+                },
+                mounted: function() {
+                    if (!this.data.dropdownOptions) {
+                        this.data.dropdownOptions = this.defaultDropdownOptions;
+                        this.$forceUpdate();
+                    }
+                    this.initOnSelectChange();
+                    this.initOnAddDropdownOption();
 
+                }
+            });
+        };
+    })();
+</script>

+ 12 - 11
resources/views/app/patient/segment-templates/epworth_sleepiness_scale/edit.blade.php

@@ -14,7 +14,8 @@ if (!!@$point->data) {
 ?>
 <style>
     .select-esc-option {
-        max-width: 200px;
+        max-width: 80px;
+        min-width: auto !important;
     }
 </style>
 
@@ -55,7 +56,7 @@ if (!!@$point->data) {
         <input type="hidden" name="mainData" value="{{json_encode($contentData)}}">
         <div id="edit_epworth_sleepiness_scale" class="p-1">
             <div class="mb-2">
-                <label class="text-sm text-secondary mb-1">How likely are you to doze off or fall asleep in the following situations, in contrast to feeling just tired? This refers to your usual way of life in recent times. Use the following scale (0, 1, 2, and 3) to choose the most appropriate number for each situation.</label>
+                <label class="mb-1">How likely are you to doze off or fall asleep in the following situations, in contrast to feeling just tired? This refers to your usual way of life in recent times. Use the following scale (0, 1, 2, and 3) to choose the most appropriate number for each situation.</label>
                 <div class="d-flex align-items-center">
                     <select v-if="data.dropdownOptions" data-name="Dozing" class="form-control form-control-sm select-esc-option" score-input v-model="data.Dozing">
                         <option value=""></option>
@@ -68,7 +69,7 @@ if (!!@$point->data) {
                 </div>
             </div>
             <div class="d-flex align-items-center flex-wrap mb-2">
-                <label class="text-sm text-secondary mb-0 mr-2">Sitting and reading</label>
+                <label class="mb-0 mr-2">Sitting and reading</label>
                 <select v-if="data.dropdownOptions" data-name="Sitting" class="form-control form-control-sm select-esc-option" score-input v-model="data.Sitting">
                     <option value=""></option>
                     <option v-for="o in data.dropdownOptions.Sitting" :value="o.value">@{{ o.label }}</option>
@@ -78,7 +79,7 @@ if (!!@$point->data) {
                 </div>
             </div>
             <div class="d-flex align-items-center flex-wrap mb-2">
-                <label class="text-sm text-secondary mb-0 mr-2">Watching TV</label>
+                <label class="mb-0 mr-2">Watching TV</label>
                 <select v-if="data.dropdownOptions" data-name="Watching" class="form-control form-control-sm select-esc-option" score-input v-model="data.Watching">
                     <option value=""></option>
                     <option v-for="o in data.dropdownOptions.Watching" :value="o.value">@{{ o.label }}</option>
@@ -88,7 +89,7 @@ if (!!@$point->data) {
                 </div>
             </div>
             <div class="d-flex align-items-center flex-wrap mb-2">
-                <label class="text-sm text-secondary mb-0 mr-2">Sitting inactive in a public place (e.g. a theatre or a meeting)</label>
+                <label class="mb-0 mr-2">Sitting inactive in a public place (e.g. a theatre or a meeting)</label>
                 <select v-if="data.dropdownOptions" data-name="Sitting_Inactive" class="form-control form-control-sm select-esc-option" score-input v-model="data.Sitting_Inactive">
                     <option value=""></option>
                     <option v-for="o in data.dropdownOptions.Sitting_Inactive" :value="o.value">@{{ o.label }}</option>
@@ -98,7 +99,7 @@ if (!!@$point->data) {
                 </div>
             </div>
             <div class="d-flex align-items-center flex-wrap mb-2">
-                <label class="text-sm text-secondary mb-0 mr-2">As a passenger in a car for an hour without a break</label>
+                <label class="mb-0 mr-2">As a passenger in a car for an hour without a break</label>
                 <select v-if="data.dropdownOptions" data-name="Passenger_Car" class="form-control form-control-sm select-esc-option" score-input v-model="data.Passenger_Car">
                     <option value=""></option>
                     <option v-for="o in data.dropdownOptions.Passenger_Car" :value="o.value">@{{ o.label }}</option>
@@ -108,7 +109,7 @@ if (!!@$point->data) {
                 </div>
             </div>
             <div class="d-flex align-items-center flex-wrap mb-2">
-                <label class="text-sm text-secondary mb-0 mr-2">Sitting quietly after a lunch without alcohol</label>
+                <label class="mb-0 mr-2">Sitting quietly after a lunch without alcohol</label>
                 <select v-if="data.dropdownOptions" data-name="Sitting_Quietly" class="form-control form-control-sm select-esc-option" score-input v-model="data.Sitting_Quietly">
                     <option value=""></option>
                     <option v-for="o in data.dropdownOptions.Sitting_Quietly" :value="o.value">@{{ o.label }}</option>
@@ -118,7 +119,7 @@ if (!!@$point->data) {
                 </div>
             </div>
             <div class="d-flex align-items-center flex-wrap mb-2">
-                <label class="text-sm text-secondary mb-0 mr-2">Lying down to rest in the afternoon when circumstances permit</label>
+                <label class="mb-0 mr-2">Lying down to rest in the afternoon when circumstances permit</label>
                 <select v-if="data.dropdownOptions" data-name="LyingDown" class="form-control form-control-sm select-esc-option" score-input v-model="data.LyingDown">
                     <option value=""></option>
                     <option v-for="o in data.dropdownOptions.LyingDown" :value="o.value">@{{ o.label }}</option>
@@ -128,7 +129,7 @@ if (!!@$point->data) {
                 </div>
             </div>
             <div class="d-flex align-items-center flex-wrap mb-2">
-                <label class="text-sm text-secondary mb-0 mr-2">Sitting and talking to someone</label>
+                <label class="mb-0 mr-2">Sitting and talking to someone</label>
                 <select v-if="data.dropdownOptions" data-name="SittingandTalking" class="form-control form-control-sm select-esc-option" score-input v-model="data.SittingandTalking">
                     <option value=""></option>
                     <option v-for="o in data.dropdownOptions.SittingandTalking" :value="o.value">@{{ o.label }}</option>
@@ -138,7 +139,7 @@ if (!!@$point->data) {
                 </div>
             </div>
             <div class="d-flex align-items-center flex-wrap mb-2">
-                <label class="text-sm text-secondary mb-0 mr-2">In a car, while stopped for a few minutes in traffic</label>
+                <label class="mb-0 mr-2">In a car, while stopped for a few minutes in traffic</label>
                 <select v-if="data.dropdownOptions" data-name="Traffic" class="form-control form-control-sm select-esc-option" score-input v-model="data.Traffic">
                     <option value=""></option>
                     <option v-for="o in data.dropdownOptions.Traffic" :value="o.value">@{{ o.label }}</option>
@@ -416,4 +417,4 @@ if (!!@$point->data) {
             });
         };
     })();
-</script>
+</script>

+ 10 - 10
resources/views/app/patient/segment-templates/epworth_sleepiness_scale/summary.blade.php

@@ -39,56 +39,56 @@ function getvalueLabel($value, $key, $contentData)
         <div>
             <div class="p-1">
                 <div class="mb-2">
-                    <label class="text-sm text-secondary mb-1">How likely are you to doze off or fall asleep in the following situations, in contrast to feeling just tired? This refers to your usual way of life in recent times. Use the following scale (0, 1, 2, and 3) to choose the most appropriate number for each situation.</label>
+                    <label class="mb-1">How likely are you to doze off or fall asleep in the following situations, in contrast to feeling just tired? This refers to your usual way of life in recent times. Use the following scale (0, 1, 2, and 3) to choose the most appropriate number for each situation.</label>
                     <div>
                         <span class="font-weight-bold">{{ @$contentData['Dozing'] }}</span>
                         <span> - {{ getvalueLabel(@$contentData['Dozing'], 'Dozing', $contentData) }}</span>
                     </div>
                 </div>
                 <div class="d-flex align-items-center flex-wrap mb-2">
-                    <label class="text-sm text-secondary mb-0 mr-2">Sitting and reading</label>
+                    <label class="mb-0 mr-2">Sitting and reading</label>
                     <div>
                         <span class="font-weight-bold">{{ @$contentData['Sitting'] ?? '--' }}</span>
                     </div>
                 </div>
                 <div class="d-flex align-items-center flex-wrap mb-2">
-                    <label class="text-sm text-secondary mb-0 mr-2">Watching TV</label>
+                    <label class="mb-0 mr-2">Watching TV</label>
                     <div>
                         <span class="font-weight-bold">{{ @$contentData['Watching'] ?? '--' }}</span>
                     </div>
                 </div>
                 <div class="d-flex align-items-center flex-wrap mb-2">
-                    <label class="text-sm text-secondary mb-0 mr-2">Sitting inactive in a public place (e.g. a theatre or a meeting)</label>
+                    <label class="mb-0 mr-2">Sitting inactive in a public place (e.g. a theatre or a meeting)</label>
                     <div>
                         <span class="font-weight-bold">{{ @$contentData['Sitting_Inactive'] ?? '--' }}</span>
                     </div>
                 </div>
                 <div class="d-flex align-items-center flex-wrap mb-2">
-                    <label class="text-sm text-secondary mb-0 mr-2">As a passenger in a car for an hour without a break</label>
+                    <label class="mb-0 mr-2">As a passenger in a car for an hour without a break</label>
                     <div>
                         <span class="font-weight-bold">{{ @$contentData['Passenger_Car'] ?? '--' }}</span>
                     </div>
                 </div>
                 <div class="d-flex align-items-center flex-wrap mb-2">
-                    <label class="text-sm text-secondary mb-0 mr-2">Sitting quietly after a lunch without alcohol</label>
+                    <label class="mb-0 mr-2">Sitting quietly after a lunch without alcohol</label>
                     <div>
                         <span class="font-weight-bold">{{ @$contentData['Sitting_Quietly'] ?? '--' }}</span>
                     </div>
                 </div>
                 <div class="d-flex align-items-center flex-wrap mb-2">
-                    <label class="text-sm text-secondary mb-0 mr-2">Lying down to rest in the afternoon when circumstances permit</label>
+                    <label class="mb-0 mr-2">Lying down to rest in the afternoon when circumstances permit</label>
                     <div>
                         <span class="font-weight-bold">{{ @$contentData['LyingDown'] ?? '--' }}</span>
                     </div>
                 </div>
                 <div class="d-flex align-items-center flex-wrap mb-2">
-                    <label class="text-sm text-secondary mb-0 mr-2">Sitting and talking to someone</label>
+                    <label class="mb-0 mr-2">Sitting and talking to someone</label>
                     <div>
                         <span class="font-weight-bold">{{ @$contentData['SittingandTalking'] ?? '--' }}</span>
                     </div>
                 </div>
                 <div class="d-flex align-items-center flex-wrap mb-2">
-                    <label class="text-sm text-secondary mb-0 mr-2">In a car, while stopped for a few minutes in traffic</label>
+                    <label class="mb-0 mr-2">In a car, while stopped for a few minutes in traffic</label>
                     <div>
                         <span class="font-weight-bold">{{ @$contentData['Traffic'] ?? '--' }}</span>
                     </div>
@@ -108,4 +108,4 @@ function getvalueLabel($value, $key, $contentData)
         <div>Please click here to document Epworth Sleepiness Scale.</div>
         @endif
     </div>
-</div>
+</div>

+ 3 - 3
resources/views/layouts/template.blade.php

@@ -158,7 +158,7 @@
                             <a class="dropdown-item" href="{{ route('practice-management.myFavorites') }}">Favorites</a>
                             <a class="dropdown-item" href="{{ route('practice-management.proAvailability') }}">Availability</a>
                             <a class="dropdown-item" href="{{ route('practice-management.proCalendar') }}">Calendar</a>
-                            
+
                             <a class="dropdown-item" href="{{ route('practice-management.rpmMatrix') }}">RPM Matrix</a>
 
                             <a class="dropdown-item" href="{{ route('mcp.notes') }}">Notes</a>
@@ -189,13 +189,13 @@
                 </li>
 
                 @if($pro->pro_type === 'ADMIN')
-                    
+
 		<li class="nav-item dropdown">
                         <a class="nav-link dropdown-toggle" href="#" id="practice-management" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                             <i class="mr-1 fas fa-tasks"></i> Admin
                         </a>
                         <div class="dropdown-menu mcp-theme-1 no-overflow-menu p-0" aria-labelledby="practice-management">
-                            
+
                             <a class="dropdown-item" href="{{ route('practice-management.claims-report') }}">Claims Report</a>
                             <a class="dropdown-item" href="{{ route('practice-management.problems-report') }}">Problems Report</a>
                             <a class="dropdown-item" href="{{ route('practice-management.coverages') }}">Coverage Center</a>