浏览代码

Merge branch 'sleep-apnea-intake' of https://rav.triplestart.com/jmudaka/stagfe2 into sleep-apnea-intake

Peter Muturi 2 年之前
父节点
当前提交
a0808dee61

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

@@ -288,6 +288,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 				watch: {
 					$data: {
 						handler: function(val, oldVal) {
+							console.log('Changed');
 							this.autoSaveForm();
 						},
 						deep: true
@@ -347,6 +348,19 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
                             self.calculateScore();
                         });
                     },
+					onInputChange: function(evt){
+						var self = this;
+						var input = evt.target;
+						var name = input.name || $(input).data('name');
+						value = input.value;
+						if($(input).is(':radio')){
+							if(!input.checked){
+								value = null;
+							}
+						}
+						self.data[name] = value;
+						self.autoSaveForm();
+					},
 				},
 				mounted: function() {
 					if (!this.data.dropdownOptions) {

+ 702 - 1
resources/views/app/patient/modules/sleep_study_intake/partials/obstructive_sleep_apnea.blade.php

@@ -1,5 +1,706 @@
+<?php
+$questionnaire = [
+    'ess' => [
+        'title' => 'Epworth Sleepiness Scale',
+        'questions' => [
+            'do_you_snore' => [
+                'title' => 'Do you snore?',
+                'options' => [
+                    [
+                        'value' => 'SnoreYes',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'SnoreNo',
+                        'label' => 'No'
+                    ]
+                ]
+            ],
+            'your_snoring_is' => [
+                'title' => 'Your Snoring is...?',
+                'options' => [
+                    [
+                        'value' => 'SofterSnoring',
+                        'label' => 'Softer than talking'
+                    ],
+                    [
+                        'value' => 'MidSnoring',
+                        'label' => 'As loud as talking'
+                    ],
+                    [
+                        'value' => 'LouderSnoring',
+                        'label' => 'Louder than talking'
+                    ]
+                ]
+            ],
+            'your_snoring_occurs' => [
+                'title' => 'Your snoring occurs:',
+                'options' => [
+                    [
+                        'value' => 'SnoringEveryNight',
+                        'label' => 'Every night'
+                    ],
+                    [
+                        'value' => 'AFewTimesSnoring',
+                        'label' => 'A few times a week'
+                    ],
+                    [
+                        'value' => 'OnceAWeekSnoring',
+                        'label' => 'Once a week or less'
+                    ]
+                ]
+            ],
+            'do_you_snore_in_every_body_poisition' => [
+                'title' => 'Do you snore in every body poisition?',
+                'options' => [
+                    [
+                        'value' => 'yessnoreposition',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'NoSnorePosition',
+                        'label' => 'No'
+                    ],
+                    [
+                        'value' => 'DontKnowSnorePosition',
+                        'label' => "I don't know"
+                    ]
+                ]
+            ],
+            'your_snoring_is_also_interrupted_by_pauses_choking' => [
+                'title' => 'Your snoring is also interrupted by pauses/choking?:',
+                'options' => [
+                    [
+                        'value' => 'FrequentSnoring',
+                        'label' => 'Frequent'
+                    ],
+                    [
+                        'value' => 'OccasionalSnoring',
+                        'label' => 'Occasionally'
+                    ],
+                    [
+                        'value' => 'NeverSnoring',
+                        'label' => "Never"
+                    ]
+                ]
+            ],
+            'do_you_have_or_ever_had_a_bed_partner' => [
+                'title' => 'Do you have, or ever had a bed partner?',
+                'options' => [
+                    [
+                        'value' => 'PartnerYes',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'PartnerNo',
+                        'label' => 'No'
+                    ]
+                ]
+            ],
+            'has_your_bed_partner_ever_said_that_you_have_pauses_in_your_breathing_or_stop_breathing_during_sleep' => [
+                'title' => 'Has your bed partner ever said that you have pauses in your breathing or stop breathing during sleep?:',
+                'options' => [
+                    [
+                        'value' => 'PartnerSaysYes',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'PartnerSaysNo',
+                        'label' => 'No'
+                    ]
+                ]
+            ],
+            'do_you_feel_that_in_some_way_your_sleep_is_not_refreshing_or_restful' => [
+                'title' => 'Do you feel that in some way your sleep is not refreshing or restful?',
+                'options' => [
+                    [
+                        'value' => 'UnrestfulEveryday',
+                        'label' => 'Nearly every day'
+                    ],
+                    [
+                        'value' => 'OnceAWeekUnrestful',
+                        'label' => 'Once or twice a week'
+                    ],
+                    [
+                        'value' => '3to4Unrestful',
+                        'label' => '3 to 4 times a week'
+                    ],
+                    [
+                        'value' => 'HardlyUnrestful',
+                        'label' => 'Hardly ever'
+                    ],
+
+                ]
+            ],
+            'do_you_feel_fatigued_exhausted_tired_or_not_up_to_par' => [
+                'title' => 'Do you feel fatigued, exhausted, tired, or not up to par?',
+                'options' => [
+                    [
+                        'value' => 'ExhaustedEveryDay',
+                        'label' => 'Nearly every day'
+                    ],
+                    [
+                        'value' => 'ExhaustedOnceAWeek',
+                        'label' => 'Once or twice a week'
+                    ],
+                    [
+                        'value' => '3To4TimesExhausted',
+                        'label' => '3 to 4 times a week'
+                    ],
+                    [
+                        'value' => 'HardlyEverExhausted',
+                        'label' => 'Hardly ever'
+                    ],
+
+                ]
+            ],
+            'do_you_frequently_wake_up_with_morning_headaches' => [
+                'title' => 'Do you frequently wake up with morning headaches?',
+                'options' => [
+                    [
+                        'value' => 'HeadacheYes',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'HeadachesNo',
+                        'label' => 'No'
+                    ],
+
+                ]
+            ],
+            'do_you_frequently_wake_up_with_morning_headaches' => [
+                'title' => 'How would you rate your memory?',
+                'options' => [
+                    [
+                        'value' => 'ExMemory',
+                        'label' => 'Excellent'
+                    ],
+                    [
+                        'value' => 'PoorMemory',
+                        'label' => 'Fair'
+                    ],
+                    [
+                        'value' => 'GoodMemory',
+                        'label' => 'Good'
+                    ],
+                    [
+                        'value' => 'HeadacheNo',
+                        'label' => 'Poor'
+                    ],
+
+                ]
+            ],
+            'do_you_frequently_wake_up_with_morning_headaches' => [
+                'title' => 'How would you rate your sex life?',
+                'options' => [
+                    [
+                        'value' => 'ExSexLife',
+                        'label' => 'Excellent'
+                    ],
+                    [
+                        'value' => 'FairSexLife',
+                        'label' => 'Fair'
+                    ],
+                    [
+                        'value' => 'GoodSexLife',
+                        'label' => 'Good'
+                    ],
+                    [
+                        'value' => 'PoorSexLife',
+                        'label' => 'Poor'
+                    ],
+                    [
+                        'value' => 'NASexLife',
+                        'label' => 'NA'
+                    ],
+
+                ]
+            ],
+        ]
+    ],
+    'rls' => [
+        'title' => 'Restless Legs Syndrome',
+        'questions' => [
+            'do_you_experience_creeping_crawling_feeling_and_urge_to_move_your_legs' => [
+                'title' => 'Do you experience creeping/crawling feeling and urge to move your legs?',
+                'options' => [
+                    [
+                        'value' => 'MoveLegsYes',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'MoveLegsNo',
+                        'label' => 'No'
+                    ],
+
+                ]
+            ],
+            'do_these_sensations_and_urge_to_move_your_legs_occur_during_periods_of_rest_or_inactivity_and_are_relieved_by_movement' => [
+                'title' => 'Do these sensations and urge to move your legs occur during periods of rest or inactivity, and are relieved by movement?',
+                'options' => [
+                    [
+                        'value' => 'legsmoveyes',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'legsmoveNo',
+                        'label' => 'No'
+                    ],
+                    [
+                        'value' => 'legsmoveNA',
+                        'label' => 'NA'
+                    ],
+
+                ]
+            ],
+            'do_the_sensations_and_urge_to_move_bother_you_more_in_the_evening_and_at_night_rather_than_during_the_day' => [
+                'title' => 'Do the sensations and urge to move bother you more in the evening and at night, rather than during the day?',
+                'options' => [
+                    [
+                        'value' => 'sensationyes',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'sensationno',
+                        'label' => 'No'
+                    ],
+                    [
+                        'value' => 'sensationna',
+                        'label' => 'NA'
+                    ],
+
+                ]
+            ],
+            'does_your_bed_partner_tell_you_that_you_jerk_your_legs_arms_when_you_are_asleep' => [
+                'title' => 'Does your bed partner tell you that you jerk your legs/arms when you are asleep?',
+                'options' => [
+                    [
+                        'value' => 'jerklegsYes',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'jerklegsno',
+                        'label' => 'No'
+                    ],
+                    [
+                        'value' => 'kerklegsNA',
+                        'label' => 'NA'
+                    ],
+
+                ]
+            ],
+        ]
+    ],
+    'narcolepsy' => [
+        'title' => 'Narcolepsy',
+        'questions' => [
+            'have_you_ever_experience_sudden_body_weakness_brought_on_by_laughter_surprise_or_fear' => [
+                'title' => 'Have you ever experience sudden body weakness brought on by laughter, surprise, or fear?',
+                'options' => [
+                    [
+                        'value' => 'BodyMovementYes',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'BodyMovementNo',
+                        'label' => 'No'
+                    ],
+                ]
+            ],
+            'have_you_ever_experienced_seeing_or_hearing_things_that_was_not_real_when_you_were_falling_asleep_or_had_just_awakened' => [
+                'title' => 'Have you ever experienced seeing or hearing things that was not real when you were falling asleep or had just awakened?',
+                'options' => [
+                    [
+                        'value' => 'hearingthingsyes',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'hearingthingsno',
+                        'label' => 'No'
+                    ],
+                ]
+            ],
+            'have_you_ever_felt_as_if_you_were_awake_but_could_not_move_sleep_paralysis' => [
+                'title' => 'Have you ever felt as if you were awake but could not move (sleep paralysis)?',
+                'options' => [
+                    [
+                        'value' => 'sleepparalysisyes',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'sleepparalysisno',
+                        'label' => 'No'
+                    ],
+                ]
+            ],
+        ]
+    ],
+    'insomnia' => [
+        'title' => 'Insomnia',
+        'questions' => [
+            'do_you_have_trouble_initiating_and_or_maintaining_sleep' => [
+                'title' => 'Do you have trouble initiating and/or maintaining sleep?',
+                'options' => [
+                    [
+                        'value' => 'NearlyEveryDayTrouble',
+                        'label' => 'Nearly every day'
+                    ],
+                    [
+                        'value' => 'OnceorTwice',
+                        'label' => 'Once or twice a week'
+                    ],
+                    [
+                        'value' => '3to4TimesWeeksTrouble',
+                        'label' => '3 to 4 times a week'
+                    ],
+                    [
+                        'value' => 'HardEverTrouble',
+                        'label' => 'Hardly ever'
+                    ],
+                ]
+            ],
+            'how_long_does_it_take_to_fall_asleep_at_night' => [
+                'title' => 'How long does it take to fall asleep at night?',
+                'options' => [
+                    [
+                        'value' => 'sleepinstantly',
+                        'label' => 'Fall asleep right away'
+                    ],
+                    [
+                        'value' => 'SleepInHalfHour',
+                        'label' => 'Half an hour'
+                    ],
+                    [
+                        'value' => 'SleepIn1Hour',
+                        'label' => '1 hour'
+                    ],
+                    [
+                        'value' => 'SleepIn2Hours',
+                        'label' => '2 hours'
+                    ],
+                    [
+                        'value' => 'SleepIn3hours',
+                        'label' => '3 or more hours'
+                    ],
+                ]
+            ],
+            'how_often_do_you_wake_up_in_the_middle_of_the_night' => [
+                'title' => 'How often do you wake up in the middle of the night?',
+                'options' => [
+                    [
+                        'inlineField' => true,
+                        'name' => 'WakeUpTimes',
+                        'label' => 'times'
+                    ],
+                ]
+            ],
+            'how_long_does_it_take_to_fall_back_asleep_when_you_wake_up_in_the_middle_of_the_night' => [
+                'title' => 'How long does it take to fall back asleep when you wake up in the middle of the night?',
+                'options' => [
+                    [
+                        'value' => 'rightawaybacktosleep',
+                        'label' => 'Right away'
+                    ],
+                    [
+                        'value' => 'halfanhours',
+                        'label' => 'Half an hour'
+                    ],
+                    [
+                        'value' => 'halfhourbacaktosleep',
+                        'label' => '1 hour'
+                    ],
+                    [
+                        'value' => '2hoursbacktosleep',
+                        'label' => '2 or more hours'
+                    ],
+                ]
+            ],
+            'do_you_wake_up_very_early_in_the_morning_and_find_it_hard_to_get_back_to_sleep' => [
+                'title' => 'Do you wake up very early in the morning and find it hard to get back to sleep?',
+                'options' => [
+                    [
+                        'value' => 'wakeupearlyyes',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'wakeupearlyno',
+                        'label' => 'No'
+                    ],
+                ]
+            ],
+            'in_the_past_month_have_you_been_bothered_by' => [
+                'title' => 'In the past month, have you been bothered by:',
+                'options' => [
+                    [
+                        'nested' => true,
+                        'key' => 'feeling_down_depressed_or_hopeless',
+                        'title' => 'Feeling down, depressed, or hopeless?',
+                        'options' => [
+                            [
+                                'value' => 'wakeupearlyy',
+                                'label' => 'Yes'
+                            ],
+                            [
+                                'value' => 'wakeupearlyn',
+                                'label' => 'No'
+                            ],
+                        ]
+                    ],
+                    [
+                        'nested' => true,
+                        'key' => 'by_nerves_or_feeling_anxious_or_on_edge',
+                        'title' => 'By "nerves" or feeling anxious or on edge?',
+                        'options' => [
+                            [
+                                'value' => 'wakeupearlyyess',
+                                'label' => 'Yes'
+                            ],
+                            [
+                                'value' => 'wakeupearlynon',
+                                'label' => 'No'
+                            ],
+                        ]
+                    ],
+                    [
+                        'nested' => true,
+                        'key' => 'had_an_anxiety_attack_suddenly_feeling_fear_or_panic',
+                        'title' => 'Had an anxiety attack (Suddenly feeling fear or panic)?',
+                        'options' => [
+                            [
+                                'value' => 'wakeupearlyyesss',
+                                'label' => 'Yes'
+                            ],
+                            [
+                                'value' => 'wakeupearlynonono',
+                                'label' => 'No'
+                            ],
+                        ]
+                    ],
+                ]
+            ],
+        ]
+    ],
+    'sleep_habits' => [
+        'title' => 'Sleep habits',
+        'questions' => [
+            'on_the_weekdays_what_time_do_you_go_to_bed' => [
+                'title' => 'On the weekdays, what time do you go to bed?',
+                'options' => [
+                    [
+                        'value' => 'badtime8to10',
+                        'label' => '8 to 10 pm'
+                    ],
+                    [
+                        'value' => '10pmbedtime',
+                        'label' => '10 pm to midnight'
+                    ],
+                    [
+                        'value' => 'midnightbedtime',
+                        'label' => 'Midnight to 2 am'
+                    ],
+                    [
+                        'value' => '2to4bedtime',
+                        'label' => '2 to 4 am'
+                    ],
+
+                ]
+            ],
+            'on_the_weekdays_what_time_do_you_get_up_in_the_morning' => [
+                'title' => 'On the weekdays, what time do you get up in the morning?',
+                'options' => [
+                    [
+                        'value' => 'weekday5to7',
+                        'label' => '5 to 7 a.m.'
+                    ],
+                    [
+                        'value' => 'weekdays7to9am',
+                        'label' => '7 to 9 a.m.'
+                    ],
+                    [
+                        'value' => 'weekdays9to11',
+                        'label' => '9 to 11 a.m.'
+                    ],
+                    [
+                        'value' => 'weekdays11to1pm',
+                        'label' => '11 a.m to 1 p.m'
+                    ],
+
+                ]
+            ],
+            'on_the_weekends_what_time_do_you_go_to_bed' => [
+                'title' => 'On the weekends, what time do you go to bed?',
+                'options' => [
+                    [
+                        'value' => '8to10pmweekendssleep',
+                        'label' => '8 to 10 p.m.'
+                    ],
+                    [
+                        'value' => '10weekendssleep',
+                        'label' => '10 p.m. to Midnight'
+                    ],
+                    [
+                        'value' => 'midnightto2amsleep',
+                        'label' => 'midnight to 2 a.m.'
+                    ],
+                    [
+                        'value' => '2to4amweekendsleep',
+                        'label' => '2 to 4 a.m.'
+                    ],
+
+                ]
+            ],
+            'on_the_weekends_what_time_do_you_get_up_in_the_morning' => [
+                'title' => 'On the weekends, what time do you get up in the morning?',
+                'options' => [
+                    [
+                        'value' => '8to10pmweekendswakeup',
+                        'label' => '5 to 7 p.m.'
+                    ],
+                    [
+                        'value' => '10weekendswakeup',
+                        'label' => '7 to 9 a.m.'
+                    ],
+                    [
+                        'value' => 'midnightto2amwakeup',
+                        'label' => '9 to 11 a.m.'
+                    ],
+                    [
+                        'value' => '2to4amweekendwakeup',
+                        'label' => '11 a.m. to 1 p.m.'
+                    ],
+
+                ]
+            ],
+            'what_do_you_feel_is_your_ideal_amount_of_sleep_per_day' => [
+                'title' => 'What do you feel is your ideal amount of sleep per day?',
+                'options' => [
+                    [
+                        'value' => 'hourofsleep1',
+                        'label' => '2-4 hours'
+                    ],
+                    [
+                        'value' => 'hourofsleep5',
+                        'label' => '5 hours'
+                    ],
+                    [
+                        'value' => 'hourofsleep6',
+                        'label' => '6 hours'
+                    ],
+                    [
+                        'value' => 'hourofsleep7',
+                        'label' => '7 hours'
+                    ],
+                    [
+                        'value' => 'hourofsleep8',
+                        'label' => '8 hours'
+                    ],
+                    [
+                        'value' => 'hourofsleep9',
+                        'label' => '9 hours'
+                    ],
+                    [
+                        'value' => 'hourofsleep10',
+                        'label' => '10 hours'
+                    ],
+
+                ]
+            ],
+            'estimate_the_average_number_of_hours_of_sleep_you_had_per_day_during_the_last_week' => [
+                'title' => 'Estimate the average number of hours of sleep you had per day during the last week.',
+                'options' => [
+                    [
+                        'value' => 'averagesleep1',
+                        'label' => '2-4 hours'
+                    ],
+                    [
+                        'value' => 'averagesleep5',
+                        'label' => '5 hours'
+                    ],
+                    [
+                        'value' => 'averagesleep6',
+                        'label' => '6 hours'
+                    ],
+                    [
+                        'value' => 'averagesleep7',
+                        'label' => '7 hours'
+                    ],
+                    [
+                        'value' => 'averagesleep8',
+                        'label' => '8 hours'
+                    ],
+                    [
+                        'value' => 'averagesleep9',
+                        'label' => '9 hours'
+                    ],
+                    [
+                        'value' => 'averagesleep10',
+                        'label' => '10 hours'
+                    ],
+
+                ]
+            ],
+            'are_you_a_shift_worker' => [
+                'title' => 'Estimate the average number of hours of sleep you had per day during the last week.Are you a shift worker?',
+                'options' => [
+                    [
+                        'value' => 'shiftworkeryes',
+                        'label' => 'Yes'
+                    ],
+                    [
+                        'value' => 'shiftworkerno',
+                        'label' => 'No'
+                    ],
+
+                ]
+            ],
+        ]
+    ]
+];
+?>
 <div class="row mb-1">
     <div class="col-md-12 section">
-        cbc
+        <div>
+            @foreach($questionnaire as $qK => $qV)
+            <div class="bg-light border mb-3 p-2">
+                <h3 class="font-weight-bold" style="font-size:16px;">{{ $qV['title'] }}</h3>
+                <div class="pl-2">
+                    @foreach($qV['questions'] as $questionKey => $questionValue)
+                    <div class="form-group">
+                        <label class="font-weight-bold">{{ $questionValue['title'] }}</label>
+                        <div class="d-flex align-items-start flex-wrap pl-2">
+                            @foreach($questionValue['options'] as $option)
+                            @if(@$option['inlineField'])
+                            <div class="d-flex align-items-center flex-erap mb-0 mr-3">
+                                <input type="text" class="form-control mr-2" name="{{ $questionKey }}" data-name="{{ $questionKey }}" value="{{ @$contentData[$questionKey] }}" @keyup="onInputChange" />
+                                <span>{{ $option['label'] }}</span>
+                            </div>
+                            @elseif(@$option['nested'])
+                            <div class="w-100">
+                                <div class="d-flex flex-wrap align-items-start">
+                                    <label class="font-weight-bold">{{ $option['title'] }}</label>
+                                    <div class="ml-2">
+                                        @foreach($option['options'] as $_option)
+                                        <label class="mb-0 mr-3">
+                                            <input type="radio" name="{{ $option['key'] }}" value="{{ $_option['value'] }}" data-name="{{ $_option['value'] }}" <?= @$contentData[$option['key']] === $_option['value']  ? 'checked' : '' ?> @change="onInputChange" />
+                                            <span>{{ $_option['label'] }}</span>
+                                        </label>
+                                        @endforeach
+                                    </div>
+                                </div>
+                            </div>
+                            @else
+                            <label class="mb-0 mr-3">
+                                <input type="radio" name="{{ $questionKey }}" data-name="{{ $questionKey }}" value="{{ $option['value'] }}" <?= @$contentData[$questionKey] === $option['value'] ? 'checked' : '' ?> @change="onInputChange" />
+                                <span>{{ $option['label'] }}</span>
+                            </label>
+                            @endif
+                            @endforeach
+                        </div>
+                    </div>
+                    @endforeach
+                </div>
+            </div>
+            @endforeach
+        </div>
     </div>
 </div>