<?php

use App\Models\Point;

$category = 'COVID_INTAKE';

$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'COVID_INTAKE', $sessionKey, true);


$contentData = [
    "ans_how_are_you" => '',
    "ans_is_address_correct" => null, // yes/no
    "ans_corrected_address" => '',
    "ans_has_worked_with_an_np_before" => null, // yes/no
    "ans_has_worked_with_an_np_before_expl_feedback" => null, // yes/no
    "ans_goal_expl_feedback" => null, // yes/no
    "ans_quick_intake_expl_feedback" => null, // yes/no
    "ans_normal_temp_is_986" => null, // yes/no
    "ans_baseline_expl_feedback_1" => null, // yes/no
    "ans_baseline_expl_feedback_2" => null, // yes/no

    "ans_baseline_temperature" => '',
    "ans_currently_running_high" => '',

    "ans_baseline_blood_ox" => '',
    "ans_blood_ox_by_self" => '', // yes/no
    "ans_blood_ox_expl_feedback" => null, // yes/no
    "ans_blood_ox_condition_covid" => null, // yes/no
    "ans_condition_covid_how_now" => '',
    "ans_condition_covid_recovered" => '',
    "ans_condition_covid_lingering_symptoms" => '',
    "ans_blood_ox_condition_asthma" => null, // yes/no
    "ans_condition_asthma_how_now" => '',
    "ans_condition_asthma_recovered" => '',
    "ans_condition_asthma_lingering_symptoms" => '',
    "ans_blood_ox_condition_copd" => null, // yes/no
    "ans_condition_copd_how_now" => '',
    "ans_condition_copd_recovered" => '',
    "ans_condition_copd_lingering_symptoms" => '',
    "ans_blood_ox_condition_other" => '',
    "ans_condition_other_how_now" => '',
    "ans_condition_other_recovered" => '',
    "ans_condition_other_lingering_symptoms" => '',

    "ans_baseline_heart_rate" => '',
    "ans_baseline_bp" => '',
    "ans_bp_by_self" => '', // yes/no
    "ans_high_bp_ever" => null, // yes/no
    "ans_bp_medicine" => null, // yes/no
    "ans_bp_medicine_1_type" => '',
    "ans_bp_medicine_1_dose" => '',
    "ans_bp_medicine_2_type" => '',
    "ans_bp_medicine_2_dose" => '',
    "ans_bp_medicine_3_type" => '',
    "ans_bp_medicine_3_dose" => '',
    "ans_cardiac_heart_ever_cad" => null, // yes/no
    "ans_cardiac_heart_ever_irr" => null, // yes/no
    "ans_cardiac_heart_ever_chf" => null, // yes/no
    "ans_cardiac_heart_ever_other" => '',
    "ans_chest_pain" => null, // yes/no
    "ans_shortness_of_breath" => null, // yes/no
    "ans_fatigue" => null, // yes/no
    "ans_headache" => null, // yes/no,
    "ans_increase_in_heart_rate" => null, // yes/no,
    "ans_increase_in_heart_rate_frequency" => '',
    "ans_monitor_bp_before_after_workouts" => null, // yes/no,

    "ans_covid_vaccine" => null, // yes/no,
    "ans_covid_vaccine_no_long_term_safety" => '',
    "ans_covid_vaccine_no_short_term_side_effects" => '',
    "ans_covid_vaccine_no_logistic_issues" => '',
    "ans_covid_vaccine_no_covid19_doubts" => '',
    "ans_covid_vaccine_no_vaccine_efficacy_doubts" => '',
    "ans_covid_vaccine_no_other" => '',
    "ans_covid_vaccine_yes_which" => '',
    "ans_covid_vaccine_yes_dose1_date" => '',
    "ans_covid_vaccine_yes_dose2_date" => '',
    "ans_covid_vaccine_dose1_symptoms" => '',
    "ans_covid_vaccine_dose1_symptoms_start" => '',
    "ans_covid_vaccine_dose1_symptoms_duration" => '',
    "ans_covid_vaccine_dose1_symptoms_medications" => '',
    "ans_covid_vaccine_dose1_symptoms_any_from_list" => '',
    "ans_covid_vaccine_dose2_symptoms" => '',
    "ans_covid_vaccine_dose2_symptoms_start" => '',
    "ans_covid_vaccine_dose2_symptoms_duration" => '',
    "ans_covid_vaccine_dose2_symptoms_medications" => '',
    "ans_covid_vaccine_dose2_symptoms_any_from_list" => '',
    "ans_covid_help_for_vaccination" => '',
    "ans_covid_cdc_checklist_vaccinated_social_gatherings" => null, // yes/no
    "ans_covid_cdc_checklist_vaccinated_social_distancing" => null, // yes/no
    "ans_covid_cdc_checklist_vaccinated_mask_wearing" => null, // yes/no
    "ans_covid_cdc_checklist_vaccinated_hand_washing" => null, // yes/no
    "ans_covid_cdc_checklist_vaccinated_face_rubbing" => null, // yes/no
    "ans_covid_cdc_checklist_not_vaccinated_social_gatherings" => null, // yes/no
    "ans_covid_cdc_checklist_not_vaccinated_social_distancing" => null, // yes/no
    "ans_covid_cdc_checklist_not_vaccinated_mask_wearing" => null, // yes/no
    "ans_covid_cdc_checklist_not_vaccinated_hand_washing" => null, // yes/no
    "ans_covid_cdc_checklist_not_vaccinated_face_rubbing" => null, // yes/no

    "ans_plan_reported_only_baseline_vitals" => null, // checkbox
    "ans_plan_instructed_cdc_guidelines" => null, // checkbox
    "ans_plan_not_vaccinated_advised_to_get_vaccinated" => null, // checkbox
    "ans_plan_not_vaccinated_advised_vaccine_safety" => null, // checkbox
    "ans_plan_not_vaccinated_stressed_vaccine_benefits" => null, // checkbox
    "ans_plan_not_vaccinated_discussed_barriers_to_vaccination" => null, // checkbox
    "ans_plan_not_vaccinated_all_qns_answered" => null, // checkbox
    "ans_plan_1_dose_encouraged_to_get_2nd_dose" => null, // checkbox
    "ans_plan_1_dose_explained_antibody_development" => null, // checkbox
    "ans_plan_1_dose_discussed_barriers_to_vaccination" => null, // checkbox
    "ans_plan_1_dose_all_qns_answered" => null, // checkbox
    "ans_plan_ls_patient_confirms_understanding_ls_mods" => null, // checkbox
    "ans_plan_ls_patient_elects_supervised_ls_mods" => null, // checkbox
    "ans_plan_ls_explained_exercise_risks" => null, // checkbox
    "ans_plan_ls_instructed_bp_random_times_daily" => null, // checkbox,
    "ans_total_mins_spent" => '',
    "remarks" => null,

];

if ($point->lastChildReview && $point->lastChildReview->data) {
    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
    $contentData = $point->lastChildReview->data;
}


?>
<div class="events-none form-read-mode">
    <div class="mb-2">
        <label><b>{{ $patient->displayName() }}</b> is a <b>{{$patient->age_in_years }} year(s) </b> 
            @if($patient->sex == 'M')
                <b>Male</b>
            @elseif($patient->sex == 'F')
                <b>Female</b>
            @else
                <b>(Unspecified Gender)</b>
            @endif
         presenting via telehealth for consultation regarding COVID-19 prevention and early detection.</label>
    </div>
    <div class="mb-2 ml-3">
        <div class="mb-2">
        Points discussed:
        </div>
        <ul>
            <li>Recent surge in cases and hospitalizations.</li>
            <li>Importance of self-monitoring and vigilance of vital signs.</li>
            <li>Importance of vaccination.</li>
            <li>Ongoing risk of breakthrough COVID as COVID becomes endemic like flu.</li>
            <li>Early warning signs of COVID relating to temperature and hypoxia.</li>
        </ul>
    </div>
    @if(@$contentData['ans_goal_expl_feedback'] == 'yes')
    <div class="mb-2">
        <?= segment_template_summary_value_display('Patient verbalized understanding.') ?>
    </div>
    @elseif(@$contentData['ans_goal_expl_feedback'] == 'no')
    <div class="mb-2">
        <?= segment_template_summary_value_display('Patient verbalized lack of understanding.') ?>
    </div>
    @else
    <div class="mb-2">
        <?= segment_template_summary_value_display('') ?>
    </div>
    @endif

    <hr class="my-3">

    <div class="mb-2">
        <label class="d-inline">Explained that baseline vital signs are individualized, and vary due to age esp. Such as temperature, which runs cooler as we age.</label>
        @if(@$contentData['ans_baseline_expl_feedback_1'] == 'yes')
        <?= segment_template_summary_value_display('Patient verbalized understanding.') ?>
        @elseif(@$contentData['ans_baseline_expl_feedback_1'] == 'no')
        <?= segment_template_summary_value_display('Patient verbalized lack of understanding.') ?>
        @else
        <?= segment_template_summary_value_display('') ?>
        @endif
    </div>

    <hr class="my-3">
    <div class="mb-2">
        Asked patient the following:
    </div>

    <div class="ml-3">

        <div class="mb-2">
            <label>-Baseline temperature, to which they replied: </label>
            <?= segment_template_summary_value_display(@$contentData['ans_baseline_temperature']) ?>
        </div>

        <div class="mb-2">
            <label class="mb-1">-If they currently feel like they're running a fever, to which they replied:</label>
            <?= segment_template_summary_value_display(@$contentData['ans_currently_running_high']) ?>
        </div>

        <div class="mb-2">
            <label>-Baseline SpO2, to which they replied:</label>
            <?= segment_template_summary_value_display(@$contentData['ans_baseline_blood_ox']) ?>
        </div>

        <div class="mb-2">
            <label>-If they have ever used fingertip oximeter, to which they replied:</label>
            <?= segment_template_summary_value_display(ucwords(@$contentData['ans_blood_ox_by_self'])) ?>
        </div>

    </div>

    <hr class="my-3">

    <div class="mb-2">
        <label>Discussed risk of asymptomatic hypoxia during COVID.</label>
        @if(@$contentData['ans_blood_ox_expl_feedback'] == 'yes')
        <?= segment_template_summary_value_display('Patient verbalized understanding.') ?>
        @elseif(@$contentData['ans_blood_ox_expl_feedback'] == 'no')
        <?= segment_template_summary_value_display('Patient verbalized lack of understanding.') ?>
        @else
        <?= segment_template_summary_value_display('') ?>
        @endif
    </div>

    <hr class="my-3">

    <div class="mb-2">
        <div>
            <label>Asked patient if they have ever had COVID, to which:</label>
            @if(@$contentData['ans_blood_ox_condition_covid'] == 'yes')
                <?= segment_template_summary_value_display('Patient reports having COVID.') ?>
            @elseif(@$contentData['ans_blood_ox_condition_covid'] == 'no')
                <?= segment_template_summary_value_display('Patient denies having COVID.') ?>
            @else
                <?= segment_template_summary_value_display('') ?>
            @endif
            
        </div>
        <div>
            <label>Asked patient how they are feeling now, to which they replied</label>
            <?= segment_template_summary_value_display(@$contentData['ans_condition_covid_how_now']) ?>
        </div>
        <div class="mb-2">
            <label> Asked patient if they've recovered completely, to which they replied</label>
            <?= segment_template_summary_value_display(@$contentData['ans_condition_covid_recovered']) ?>
        </div>
        <div class="mb-2">
            <label>Asked patient if they have any lingering symptoms like shortness of breath, weakness, or brain fog, to which they replied <?= segment_template_summary_value_display(@$contentData['ans_condition_covid_lingering_symptoms']) ?></label>
            
        </div>
    </div>

    <hr class="my-3">
    <div class="mb-2">
        <div>
            <label>Asked patient if they have ever had asthma, to which:</label>
            @if(@$contentData['ans_blood_ox_condition_asthma'] == 'yes')
                <?= segment_template_summary_value_display('Patient reports having Asthma.') ?>
            @elseif(@$contentData['ans_blood_ox_condition_asthma'] == 'no')
                <?= segment_template_summary_value_display('Patient denies having Asthma.') ?>
            @else
                <?= segment_template_summary_value_display('') ?>
            @endif
        </div>

        <div>
            <label>Asked patient if they have ever had COPD, to which:</label>
            @if(@$contentData['ans_blood_ox_condition_copd'] == 'yes')
                <?= segment_template_summary_value_display('Patient reports having COPD.') ?>
            @elseif(@$contentData['ans_blood_ox_condition_copd'] == 'no')
                <?= segment_template_summary_value_display('Patient denies having COPD.') ?>
            @else
                <?= segment_template_summary_value_display('') ?>
            @endif
        </div>
        <div>
            <label>Asked patient if they have ever had any other lung condition that affects oxygen, to which they replied</label>
            <?= segment_template_summary_value_display(@$contentData['ans_blood_ox_condition_other']) ?>
        </div>

    </div>

    <hr class="my-3">
    <div class="mb-2">
        <div class="mb-2">
                <label>Asked patient their baseline heart rate and BP:</label>
                <div class="mr-3 d-inline">Heart Rate: <?= segment_template_summary_value_display(@$contentData['ans_baseline_heart_rate']) ?></div>
                        <div class="d-inline">BP: <?= segment_template_summary_value_display(@$contentData['ans_baseline_bp']) ?></div>
            </div>

            <div class="mb-2">
                <label>Asked patient if they have ever operated a digital BP / pulse meter. Patient response:</label>
                <?= segment_template_summary_value_display(ucwords(@$contentData['ans_bp_by_self'])) ?>
            </div>

            <div class="mb-2">
                <label>Asked patient if ever Dx of HTN, patient response:</label>
                <?= segment_template_summary_value_display(ucwords(@$contentData['ans_high_bp_ever'])) ?>
            </div>

            <div class="mb-2">
                <label>Asked patient if they have ever taken BP medicine, patient response:</label>
                <?= segment_template_summary_value_display(ucwords(@$contentData['ans_bp_medicine'])) ?>
            </div>

            @if(@$contentData['ans_bp_medicine'] == 'yes')
                <div class="mb-3 ml-3">
                <label class="mb-2">BP medicine reported:</label>
                @if(!strlen(@$contentData['ans_bp_medicine_1_type']) && !strlen(@$contentData['ans_bp_medicine_2_type']) && !strlen(@$contentData['ans_bp_medicine_3_type']))
                    <?= segment_template_summary_value_display('None') ?>
                @endif
                <div class="pl-3">
                    @if(@$contentData['ans_bp_medicine_1_type'])
                    <div class="mb-2">
                        ▸ <?= segment_template_summary_value_display(@$contentData['ans_bp_medicine_1_type']) ?>:
                        <?= segment_template_summary_value_display(@$contentData['ans_bp_medicine_1_dose']) ?>
                    </div>
                    @endif

                    @if(@$contentData['ans_bp_medicine_2_type'])
                    <div class="mb-2">
                        ▸ <?= segment_template_summary_value_display(@$contentData['ans_bp_medicine_2_type']) ?>:
                        <?= segment_template_summary_value_display(@$contentData['ans_bp_medicine_2_dose']) ?>
                    </div>
                    @endif

                    @if(@$contentData['ans_bp_medicine_3_type'])
                    <div class="mb-2">
                        ▸ <?= segment_template_summary_value_display(@$contentData['ans_bp_medicine_3_type']) ?>:
                        <?= segment_template_summary_value_display(@$contentData['ans_bp_medicine_3_dose']) ?>
                    </div>
                    @endif
                </div>
            </div>
            @endif

            <div class="mb-2">
                <label>CAD or other atherosclerosis:</label>
                <?= segment_template_summary_value_display(ucwords(@$contentData['ans_cardiac_heart_ever_cad'])) ?>
            </div>
            <div class="mb-2">
                <label>Irregular heart rhythm</label>
                <?= segment_template_summary_value_display(ucwords(@$contentData['ans_cardiac_heart_ever_irr'])) ?>
            </div>
            <div class="mb-2">
                <label>CHF</label>
                <?= segment_template_summary_value_display(ucwords(@$contentData['ans_cardiac_heart_ever_chf'])) ?>
            </div>
            <div class="mb-2">
                <label>Other</label>
                <?= segment_template_summary_value_display(@$contentData['ans_cardiac_heart_ever_other']) ?>
            </div>
    </div>
    <hr class="my-3">

    <div class="mb-2">
    <label>Asked patient following:</label>
        <div class="ml-3">            
            <ul>
                <li>
                    <label> Chest pain, patient response:</label>
                    <?= segment_template_summary_value_display(ucwords(@$contentData['ans_chest_pain'])) ?>
                </li>
                <li>
                    <label>Shortness of breath,patient response:</label>
                    <?= segment_template_summary_value_display(ucwords(@$contentData['ans_shortness_of_breath'])) ?>
                </li>
                <li>
                    <label>Fatigue or light-headedness, patient response:</label>
                    <?= segment_template_summary_value_display(ucwords(@$contentData['ans_fatigue'])) ?>
                </li>
                <li>
                    <label>Headache, patient response:</label>
                    <?= segment_template_summary_value_display(ucwords(@$contentData['ans_headache'])) ?>
                </li>
                <li>
                    <label>Ever feels increase in heart rate, patient response:</label>
                    <?= segment_template_summary_value_display(ucwords(@$contentData['ans_increase_in_heart_rate'])) ?>
                    @if(@$contentData['ans_increase_in_heart_rate'] == 'yes')
                    ; How often: <?= segment_template_summary_value_display(ucwords(@$contentData['ans_increase_in_heart_rate_frequency'])) ?>
                    @endif
                </li>
            </ul>
        </div>
    </div>
    <hr class="my-3">
    <div class="mb-2">
        <label>Do you monitor your BP before / after workouts? Response:</label>
        <?= segment_template_summary_value_display(ucwords(@$contentData['ans_monitor_bp_before_after_workouts'])) ?>
    </div>

    <hr class="my-3">

    <p>Regarding vaccine status:
        @if(@$contentData['ans_vaccine_status_declined_to_answer'] == 'yes')
            <?= segment_template_summary_value_display('Patient declined to provide vaccine status.') ?>
        @else
            @if(@$contentData['ans_vaccine_status'])
                <?= segment_template_summary_value_display(@$contentData['ans_vaccine_status']) ?>
            @else
                <?= segment_template_summary_value_display('') ?>
            @endif
        @endif
    </p>

    <p>Regarding booster status:
        @if(@$contentData['ans_booster_status_declined_to_answer'] == 'yes')
            <?= segment_template_summary_value_display('Patient declined to provide booster status.') ?>
        @else
            @if(@$contentData['ans_booster_status'])
                <?= segment_template_summary_value_display(@$contentData['ans_booster_status']) ?>
            @else
                <?= segment_template_summary_value_display('') ?>
            @endif
        @endif
    </p>

    <div class="mb-3">
        <label>Asked patient about current behaviors they are partaking to stay safe, to which they replied:</label>
        <?= segment_template_summary_value_display(@$contentData['ans_current_behaviors_to_stay_safe']) ?>
    </div>

    <p>Education Provided:
    @if(!strlen(@$contentData['ans_edu_provided_use_of_smd']) && !strlen(@$contentData['ans_edu_provided_asymptomatic_hypoxia']) && !strlen(@$contentData['ans_edu_provided_cdc_guidelines']))
        <?= segment_template_summary_value_display('') ?>
    @endif
    </p>
    <div class="pl-3 mb-3">
        @if(@$contentData['ans_edu_provided_use_of_smd'] == 'yes')
        <div>
            ▸ Appropriate use of self-monitoring devices
        </div>
        @endif
        @if(@$contentData['ans_edu_provided_asymptomatic_hypoxia'] == 'yes')
        <div>
            ▸ Asymptomatic hypoxia
        </div>
        @endif
        @if(@$contentData['ans_edu_provided_cdc_guidelines'] == 'yes')
        <div>
            ▸ CDC guidelines
        </div>
        @endif
    </div>
    <div class="mb-3">
        <label>A total of <?= segment_template_summary_value_display(@$contentData['ans_total_mins_spent'], '', 'ml-0') ?> minutes was spent on this visit counseling or educating a patient or caregiver, documentation, and care coordination. Over 50% of this time was directed towards counseling and education.</label>        
    </div>
    
    @if(@$contentData['remarks'])
        <div class="mb-3">
            <label class="font-weight-bold">Remarks:</label>
            <div class="border p-3"><?= nl2br(@$contentData['remarks']) ?></div>      
        </div>
    @endif
</div>
