<template>
    <div class='screening-first-cont'>
        <van-form ref='form'>
            <div class='title'>筛查信息</div>
            <div v-if='ageShow'>
                <div class='no-req-label mt-5'>年龄</div>
                <van-field
                    v-model='form.currentAge'
                    readonly
                    placeholder='年龄'
                    class='input-back mt-2 form-input'
                />
            </div>
            <div v-if='sexShow'>
                <div class='no-req-label mt-5'>性别</div>
                <van-field
                    v-model='form.genderName'
                    readonly
                    placeholder='性别'
                    class='input-back mt-2 form-input'
                />
            </div>

            <div v-if='medicalHistoryShow'>
                <div class='label-title mt-5'>病史</div>
                <van-field
                    v-model='form.medicalHistoryName'
                    readonly
                    is-link
                    placeholder='请选择'
                    class='input-back mt-2 form-input'
                    :rules='rules.medicalHistoryName'
                    @click='showMedicalHistory= true'
                >
                    <template #input>
                        <span class='text-end' v-if='form.medicalHistoryName'>{{ form.medicalHistoryName }}</span>
                        <span class='text-end' v-if='!form.medicalHistoryName' style='color: #dfdfe1'>请选择</span>
                    </template>
                </van-field>
                <van-popup v-model:show='showMedicalHistory' position='bottom'>
                    <div class='p-4' style='height: 100%'>
                        <div class='flex justify-between items-center mb-4 pop-title'>
                            <div class='greyColor' @click='showMedicalHistory = false' style='font-weight: 400'>取消</div>
                            <div>病史（可多选）</div>
                            <div class='blueColor' @click='medicalHistoryConfirm'>确定</div>
                        </div>
                        <div style='height: 80%;overflow: auto'>
                            <CheckBtn multiple
                                      column-1
                                      :options='medicalHistoryList'
                                      v-model:value='form.medicalHistory'
                                      :fieldNames="{text: 'name', value: 'value'}"
                                      @change='e => form.medicalHistory = checkboxReject(form.medicalHistory, [99])'
                            />
                        </div>
                    </div>
                </van-popup>
            </div>

            <div v-if='familyHistoryShow'>
                <div class='label-title mt-5'>家族史（可多选）</div>
                <van-field class='checkbox-his'>
                    <template #input>
                        <van-checkbox-group v-model='form.familyHistory' class='w-full'>
                            <div v-for='(item, index) in familyHistoryInfoList' :key='item.value'>
                                <div
                                    @click='toggle(index)'
                                    class='form-input input-back mt-2 flex justify-between'
                                    :style="{borderRadius: form.familyHistory.includes(item.value) && [1, 3, 5, 7].includes(item.value) ? '8px 8px 0px 0px ': '8px'}"
                                >
                                    <div>{{ item.name }}</div>
                                    <div>
                                        <van-checkbox
                                            :name='item.value'
                                            :ref='el => checkboxRefs[index] = el'
                                            @click.stop='toggle(index)'
                                        />
                                    </div>
                                </div>
                                <div v-for='(item2, index2) in familyHistoryList'>
                                    <div
                                        v-if='form.familyHistory.includes(item.value) && item2.diseaseType == item.value'
                                        class='relation-bis'>
                                        <div class='top-title'>以下亲人若存在{{ item2.diseaseTypeName }}病史，请填写发病年龄</div>
                                        <div class='flex flex-wrap justify-between gap-x-2.5 gap-y-2.5'>
                                            <div v-for='(item1,index1) in item2.relativeAgeList' :key='index1'
                                                 style='width: 48%;'>
                                                <div>
                                                    <van-field
                                                        colon
                                                        label-width='42px'
                                                        v-model='item1.age'
                                                        :label='item1.relativeTypeName'
                                                        placeholder='请输入'
                                                        style='padding: 8px;border-radius: 4px'
                                                    >
                                                        <template #extra>
                                                            <span class='mr-2'>岁</span>
                                                        </template>
                                                    </van-field>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>


                        </van-checkbox-group>
                    </template>
                </van-field>
            </div>

            <div v-if='highShow'>
                <div class='label-title mt-5'>身高</div>
                <van-field
                    v-model='form.height'
                    clear-icon
                    placeholder='请输入10~300之间数字,允许1位小数'
                    class='input-back mt-2 form-input'
                    :rules='rules.height'
                >
                    <template #extra>
                        <span class='mr-2'>cm</span>
                    </template>
                </van-field>
            </div>
            <div v-if='highShow'>
                <div class='label-title mt-5'>体重</div>
                <van-field
                    v-model='form.weight'
                    clear-icon
                    placeholder='请输入20~500之间数字,允许2位小数'
                    class='input-back mt-2 form-input'
                    :rules='rules.weight'
                >
                    <template #extra>
                        <span class='mr-2'>kg</span>
                    </template>
                </van-field>
            </div>
            <div v-if='highShow'>
                <div class='no-req-label mt-5'>BMI</div>
                <van-field
                    v-model='form.bmi'
                    readonly
                    placeholder='请输入'
                    class='input-back mt-2 form-input'
                >
                    <template #extra>
                        <span class='mr-2'>kg/m²</span>
                    </template>
                </van-field>
            </div>
            <div v-if='waistShow'>
                <div class='label-title mt-5'>腰围</div>
                <van-field
                    v-model='form.waistline'
                    clear-icon
                    placeholder='请输入10~150之间数字,允许1位小数'
                    class='input-back mt-2 form-input'
                    :rules='rules.waistline'
                >
                    <template #extra>
                        <span class='mr-2'>cm</span>
                    </template>
                </van-field>
            </div>

            <div v-if='exerciseShow'>
                <div class='label-title mt-5'>锻炼频率</div>
                <van-field
                    v-model='form.exerciseFrequencyName'
                    readonly
                    is-link
                    placeholder='请选择'
                    class='input-back mt-2 form-input'
                    @click='showExerciseFrequency = true'
                    :rules='rules.exerciseFrequencyName'
                >
                    <template #input>
                        <span class='text-end' v-if='form.exerciseFrequencyName'>{{ form.exerciseFrequencyName }}</span>
                        <span class='text-end' v-if='!form.exerciseFrequencyName' style='color: #dfdfe1'>请选择</span>
                    </template>
                </van-field>
                <van-popup v-model:show='showExerciseFrequency' position='bottom'>
                    <div class='p-4' style='height: 100%'>
                        <div class='flex justify-between items-center mb-4 pop-title'>
                            <div class='greyColor' @click='showExerciseFrequency = false' style='font-weight: 400'>
                                取消
                            </div>
                            <div>锻炼频率（仅单选）</div>
                            <div></div>
                        </div>
                        <div style='height: 80%;overflow: auto'>
                            <CheckBtn clearable
                                column-1
                                :options='exerciseFrequencyList'
                                v-model:value='form.exerciseFrequency'
                                :fieldNames="{text: 'name', value: 'value'}"
                                @change='exerciseFrequencyConfirm'
                            />
                        </div>
                    </div>
                </van-popup>

                <div v-if='[1, 2, 3, 5, 6].includes(form.exerciseFrequency)'>
                    <div class='no-req-label mt-5'>每次锻炼时间</div>
                    <van-field
                        v-model='form.everyExercise'
                        clear-icon
                        placeholder='请输入'
                        class='input-back mt-2 form-input'
                    >
                        <template #extra>
                            <span class='mr-2'>分钟</span>
                        </template>
                    </van-field>

                    <div class='no-req-label mt-5'>可达到中等及以上运动强度</div>
                    <van-field
                        class='no-back form-input mt-2'
                        style='padding: 0'
                    >
                        <template #input>
                            <van-radio-group v-model='form.mediumStrength'
                                             direction='horizontal'
                                             shape="dot"
                                             class='w-full doc-radio-group'>
                                <van-radio v-for="item in store.getDict('CP00120')"
                                           :key='item.value' :name='item.value'
                                           label-position='left'>{{ item.name }}
                                </van-radio>
                            </van-radio-group>
                        </template>
                    </van-field>
                </div>
            </div>

            <div v-if='womanMHShow'>
                <div class='no-req-label mt-5'>女性病史</div>
                <van-field
                    v-model='form.femaleMedicalHistoryName'
                    readonly
                    is-link
                    placeholder='请选择'
                    class='input-back mt-2 form-input'
                    @click='showFemaleMedicalHistory= true'
                >
                    <template #input>
                        <span class='text-end' v-if='form.femaleMedicalHistoryName'>{{ form.femaleMedicalHistoryName
                            }}</span>
                        <span class='text-end' v-if='!form.femaleMedicalHistoryName' style='color: #dfdfe1'>请选择</span>
                    </template>
                </van-field>
                <van-popup v-model:show='showFemaleMedicalHistory' position='bottom'>
                    <div class='p-4' style='height: 100%'>
                        <div class='flex justify-between items-center mb-4 pop-title'>
                            <div class='greyColor' @click='showFemaleMedicalHistory = false' style='font-weight: 400'>
                                取消
                            </div>
                            <div>女性病史（可多选）</div>
                            <div class='blueColor' @click='femaleMedicalHistoryConfirm'>确定</div>
                        </div>
                        <div style='height: 80%;overflow: auto'>
                            <CheckBtn multiple
                                      column-1
                                      :options="store.getDict('CP00127')"
                                      v-model:value='form.femaleMedicalHistory'
                                      :fieldNames="{text: 'name', value: 'value'}"
                            />
                        </div>
                    </div>
                </van-popup>
            </div>
            <div v-if='medicationHShow'>
                <div class='no-req-label mt-5'>用药史</div>
                <van-field
                    v-model='form.medicineHistoryName'
                    readonly
                    is-link
                    placeholder='请选择'
                    class='input-back mt-2 form-input'
                    @click='showMedicineHistory= true'
                >
                    <template #input>
                        <span class='text-end' v-if='form.medicineHistoryName'>{{ form.medicineHistoryName }}</span>
                        <span class='text-end' v-if='!form.medicineHistoryName' style='color: #dfdfe1'>请选择</span>
                    </template>
                </van-field>
                <van-popup v-model:show='showMedicineHistory' position='bottom'>
                    <div class='p-4' style='height: 100%'>
                        <div class='flex justify-between items-center mb-4 pop-title'>
                            <div class='greyColor' @click='showMedicineHistory = false' style='font-weight: 400'>取消
                            </div>
                            <div>用药史（可多选）</div>
                            <div class='blueColor' @click='medicineHistoryConfirm'>确定</div>
                        </div>
                        <div style='height: 80%;overflow: auto'>
                            <CheckBtn multiple
                                      column-1
                                      :options='medicineHistoryList'
                                      v-model:value='form.medicineHistory'
                                      :fieldNames="{text: 'name', value: 'value'}"
                            />
                        </div>
                    </div>
                </van-popup>
            </div>

            <div v-if='triglycerideShow'>
                <div class='no-req-label mt-5'>高密度脂蛋白胆固醇</div>
                <van-field
                    v-model='form.hdlCholesterin'
                    clear-icon
                    placeholder='请输入'
                    class='input-back mt-2 form-input'
                >
                    <template #extra>
                        <span class='mr-2'>mmol/L</span>
                    </template>
                </van-field>
            </div>
            <div v-if='triglycerideShow'>
                <div class='no-req-label mt-5'>甘油三酯</div>
                <van-field
                    v-model='form.triglyceride'
                    clear-icon
                    placeholder='请输入'
                    class='input-back mt-2 form-input'
                >
                    <template #extra>
                        <span class='mr-2'>mmol/L</span>
                    </template>
                </van-field>
            </div>
            <div v-if='triglycerideShow'>
                <div class='no-req-label mt-5'>总胆固醇</div>
                <van-field
                    v-model='form.serumCholesterin'
                    clear-icon
                    placeholder='请输入'
                    class='input-back mt-2 form-input'
                >
                    <template #extra>
                        <span class='mr-2'>mmol/L</span>
                    </template>
                </van-field>
            </div>

            <div v-if='babyMHShow'>
                <div class='no-req-label mt-5'>有害物质接触或婴幼儿时期病史</div>
                <van-field
                    v-model='form.touchHarmfulName'
                    readonly
                    is-link
                    placeholder='请选择'
                    class='input-back mt-2 form-input'
                    @click='showTouchHarmful= true'
                >
                    <template #input>
                        <span class='text-end' v-if='form.touchHarmfulName'>{{ form.touchHarmfulName }}</span>
                        <span class='text-end' v-if='!form.touchHarmfulName' style='color: #dfdfe1'>请选择</span>
                    </template>
                </van-field>
                <van-popup v-model:show='showTouchHarmful' position='bottom'>
                    <div class='p-4' style='height: 100%'>
                        <div class='flex justify-between items-center mb-4 pop-title'>
                            <div class='greyColor' @click='showTouchHarmful = false' style='font-weight: 400'>取消</div>
                            <div>可多选</div>
                            <div class='blueColor' @click='touchHarmfulConfirm'>确定</div>
                        </div>
                        <div style='height: 80%;overflow: auto'>
                            <CheckBtn multiple
                                      column-1
                                      :options="store.getDict('CP00130')"
                                      v-model:value='form.touchHarmful'
                                      :fieldNames="{text: 'name', value: 'value'}"
                            />
                        </div>
                    </div>
                </van-popup>
            </div>

            <div v-if='bloodPressureShow'>
                <div class='flex items-center justify-between tip-box mt-5'>
                    <div class='doc-form-label shrink-0'>现测血压（mmHg）</div>
                    <BloodPressurePanel :pressureObj='pressureObj' />
                </div>
                <div class='sub-text my-3'>第一次</div>
                <table class='w-full mb-2'>
                    <tr class='sub-text'>
                        <td>收缩压(高压)</td>
                        <td style='width: 1em'></td>
                        <td>舒张压(低压)</td>
                    </tr>
                    <tr>
                        <td class='flex items-center'>
                            <van-field v-model='form.pressureOneSbp'
                                       name='pressureOneSbp'
                                       label=''
                                       type='number'
                                       placeholder='60~300，整数'
                                       maxlength='10'
                                       :rules='rules.pressureDbp'
                                       error-message-align='left'
                                       input-align='left'
                                       class='input-back form-input'
                            />
                        </td>
                        <td class='text-center'>
                            <span class='divide'>/</span>
                        </td>
                        <td>
                            <van-field v-model='form.pressureOneDbp'
                                       name='pressureOneDbp'
                                       label=''
                                       type='number'
                                       placeholder='30~300，整数'
                                       maxlength='10'
                                       :rules='rules.pressureSbp'
                                       error-message-align='left'
                                       input-align='left'
                                       class='input-back form-input'
                            />
                        </td>
                    </tr>
                </table>
                <BloodPressureBt :pressureObj='pressureObj' @getValue='setPressureOne'>第一次测量</BloodPressureBt>
                <div class='sub-text my-3'>第二次</div>
                <table class='w-full mb-2'>
                    <tr class='sub-text'>
                        <td>收缩压(高压)</td>
                        <td style='width: 1em'></td>
                        <td>舒张压(低压)</td>
                    </tr>
                    <tr>
                        <td>
                            <van-field v-model='form.pressureTwoSbp'
                                       name='pressureTwoSbp'
                                       label=''
                                       type='number'
                                       placeholder='60~300，整数'
                                       maxlength='10'
                                       :rules='rules.pressureDbp'
                                       error-message-align='left'
                                       input-align='left'
                                       class='input-back form-input'
                            />
                        </td>

                        <td class='text-center'>
                            <span class='divide'>/</span>
                        </td>
                        <td>
                            <van-field v-model='form.pressureTwoDbp'
                                       name='pressureTwoDbp'
                                       label=''
                                       type='number'
                                       placeholder='30~300，整数'
                                       maxlength='10'
                                       :rules='rules.pressureSbp'
                                       error-message-align='left'
                                       input-align='left'
                                       class='input-back form-input'
                            />
                        </td>
                    </tr>
                </table>
                <BloodPressureBt :pressureObj='pressureObj' @getValue='setPressureTwo'>第二次测量</BloodPressureBt>
            </div>

            <div v-if='eatHabitShow'>
                <div class='label-title mt-5'>饮食习惯</div>
                <van-field
                    v-model='form.dietaryHabitName'
                    readonly
                    is-link
                    placeholder='请选择'
                    class='input-back mt-2 form-input'
                    @click='showDietaryHabit= true'
                    :rules='rules.dietaryHabitName'
                >
                    <template #input>
                        <span class='text-end' v-if='form.dietaryHabitName'>{{ form.dietaryHabitName }}</span>
                        <span class='text-end' v-if='!form.dietaryHabitName' style='color: #dfdfe1'>请选择</span>
                    </template>
                </van-field>
                <van-popup v-model:show='showDietaryHabit' position='bottom'>
                    <div class='p-4' style='height: 100%'>
                        <div class='flex justify-between items-center mb-4 pop-title'>
                            <div class='greyColor' @click='showDietaryHabit = false' style='font-weight: 400'>取消</div>
                            <div>饮食习惯（可多选）</div>
                            <div class='blueColor' @click='dietaryHabitConfirm'>确定</div>
                        </div>
                        <div style='height: 80%;overflow: auto'>
                            <CheckBtn multiple
                                      column-1
                                      :options="store.getDict('CP00131')"
                                      v-model:value='form.dietaryHabit'
                                      :fieldNames="{text: 'name', value: 'value'}"
                            />
                        </div>
                    </div>
                </van-popup>
            </div>

            <div v-if='drinkShow'>
                <div class='label-title mt-5'>饮酒情况</div>
                <div class='bg-fa mt-2'>
                    <div class='label-title lh-24'>饮酒频率</div>
                    <van-field
                        class='form-input mt-2'
                        style='padding: 0;background: #FAFAFA'
                        :rules='rules.drinkFrequency'
                    >
                        <template #input>
                            <van-radio-group v-model='form.drinkFrequency'
                                             direction='horizontal'
                                             shape="dot"
                                             class='w-full doc-radio-group-now'
                                             @change='drinkFrequencyChange'
                            >
                                <van-radio v-for="item in store.getDict('CP00132')"
                                           :key='item.value' :name='item.value'
                                           label-position='left'>{{ item.name }}
                                </van-radio>
                            </van-radio-group>
                        </template>
                    </van-field>
                </div>

                <div class='bg-f5 mt-2' v-if='[2,3,4].includes(form.drinkFrequency)'>
                    <div class='label-title lh-24'>饮酒种类</div>
                    <van-field
                        class='form-input mt-2'
                        style='padding: 0;background: #F5F5F5'
                        :rules='rules.drinkKind'
                    >
                        <template #input>
                            <div class='flex justify-between gap-x-2.5 w-full' style='background: #F5F5F5'>
                                <div v-for="(item, index) in store.getDict('CP00133')" :key='item.value' class='bg-ff'>
                                    <div
                                        @click='toggleDrink(item)'
                                        :class="['form-input', 'flex', 'justify-between', this.form.drinkKind.includes(item.value)  ? 'active-drinkKind' : '' ]"
                                    >
                                        <div>{{ item.name }}</div>
                                    </div>
                                </div>

                            </div>
                        </template>
                    </van-field>
                    <div class='mt-2' v-if='form?.drinkKind?.includes(99)'>
                        <van-field
                            v-model='form.drinkKindOther'
                            clear-icon
                            placeholder='请输入饮酒种类名称'
                            class=' mt-2 form-input'
                        >
                        </van-field>
                    </div>
                </div>

                <div class='bg-f5 mt-2' v-if='[2,3,4].includes(form.drinkFrequency)'>
                    <div class='no-req-label lh-24'>请输入日酒饮量</div>
                    <div class='flex flex-wrap justify-between gap-x-2.5 gap-y-2.5 mt-2'
                         v-if='drinkKindCapacityList.length'>
                        <div v-for='(item,index) in drinkKindCapacityList' :key='index'
                             style='width: 48%;'>
                            <div>
                                <van-field
                                    colon
                                    label-width='42px'
                                    v-model='item.drinkCapacity'
                                    :label='item.drinkKindName'
                                    placeholder='请输入'
                                    style='padding: 8px;border-radius: 4px'
                                >
                                    <template #extra>
                                        <span class='mr-2'>mL</span>
                                    </template>
                                </van-field>
                            </div>
                        </div>
                    </div>
                    <div class='mt-2'>
                        <van-field
                            colon
                            label-width='40%'
                            v-model='form.dayDrink'
                            label='平均日饮酒量'
                            placeholder='请输入'
                            style='padding: 8px;border-radius: 4px'
                        >
                            <template #extra>
                                <span class='mr-2'>mL</span>
                            </template>
                        </van-field>
                    </div>
                </div>

                <div class='bg-f5 mt-2' v-if='[2,3,4].includes(form.drinkFrequency)'>
                    <div class='no-req-label lh-24'>请输入开始饮酒年龄</div>
                    <van-field
                        colon
                        v-model='form.startDrinkAge'
                        placeholder='请输入'
                        class='mt-2'
                        style='padding: 8px;border-radius: 4px'
                        :rules='rules.startDrinkAge'
                    >
                        <template #extra>
                            <span class='mr-2'>岁</span>
                        </template>
                    </van-field>
                </div>

                <div class='bg-f5 mt-2' v-if='[2,3,4].includes(form.drinkFrequency)'>
                    <div class='label-title lh-24'>是否戒酒</div>
                    <van-field
                        class='form-input mt-2'
                        style='padding: 0;background: #F5F5F5'
                        :rules='rules.giveDrink'
                    >
                        <template #input>
                            <van-radio-group v-model='form.giveDrink'
                                             direction='horizontal'
                                             shape="dot"
                                             class='w-full doc-radio-group-now'
                                             style='background: #F5F5F5'
                            >
                                <van-radio v-for="item in store.getDict('CP00120')"
                                           :key='item.value' :name='item.value'
                                           label-position='left'>{{ item.name }}
                                </van-radio>
                            </van-radio-group>
                        </template>
                    </van-field>
                </div>

                <div class='bg-f5 mt-2' v-if='[2,3,4].includes(form.drinkFrequency) && form.giveDrink == 1'>
                    <div class='no-req-label lh-24'>请输入开始戒酒年龄</div>
                    <van-field
                        colon
                        v-model='form.giveDrinkStart'
                        placeholder='请输入'
                        class='mt-2'
                        style='padding: 8px;border-radius: 4px'
                        :rules='rules.giveDrinkStart'
                    >
                        <template #extra>
                            <span class='mr-2'>岁</span>
                        </template>
                    </van-field>
                </div>
            </div>

            <div v-if='smokeShow'>
                <div class='label-title mt-5'>吸烟情况</div>

                <div class='bg-fa mt-2'>
                    <div class='label-title lh-24'>吸烟情况</div>
                    <van-field
                        class='form-input mt-2'
                        style='padding: 0;background: #FAFAFA'
                        :rules='rules.isSmoking'
                    >
                        <template #input>
                            <van-radio-group v-model='form.isSmoking'
                                             direction='horizontal'
                                             shape="dot"
                                             class='w-full doc-radio-group-now'
                            >
                                <van-radio v-for="item in store.getDict('CP00162')"
                                           :key='item.value' :name='item.value'
                                           label-position='left'>{{ item.name }}
                                </van-radio>
                            </van-radio-group>
                        </template>
                    </van-field>
                </div>
                <div class='bg-f5 mt-2' v-if='form.isSmoking === 3'>
                    <div class='label-title lh-24'>日吸烟量</div>
                    <van-field
                        colon
                        v-model='form.daySmoking'
                        placeholder='请输入'
                        class='mt-2'
                        style='padding: 8px;border-radius: 4px'
                        :rules='rules.daySmoking'
                    >
                    </van-field>
                </div>
                <div class='bg-f5 mt-2' v-if='form.isSmoking === 3'>
                    <div class='label-title lh-24'>开始吸烟年龄</div>
                    <van-field
                        colon
                        v-model='form.startSmoking'
                        placeholder='请输入'
                        class='mt-2'
                        style='padding: 8px;border-radius: 4px'
                        :rules='rules.startSmoking'
                    >
                        <template #extra>
                            <span class='mr-2'>岁</span>
                        </template>
                    </van-field>
                </div>

                <div class='bg-f5 mt-2' v-if='form.isSmoking === 2'>
                    <div class='label-title lh-24'>戒烟年龄</div>
                    <van-field
                        colon
                        v-model='form.giveSmokingAge'
                        placeholder='请输入'
                        class='mt-2'
                        style='padding: 8px;border-radius: 4px'
                        :rules='rules.giveSmokingAge'
                    >
                        <template #extra>
                            <span class='mr-2'>岁</span>
                        </template>
                    </van-field>
                </div>

                <div class='bg-f5 mt-2' v-if='form.diseaseArrays?.includes(1)'>
                    <div class='label-title lh-24'>经常吸入二手烟（家中有吸烟者，且经常吸入二手烟）</div>
                    <van-field
                        class='form-input mt-2'
                        style='padding: 0;background: #F5F5F5'
                        :rules='rules.secondSmoking'
                    >
                        <template #input>
                            <van-radio-group v-model='form.secondSmoking'
                                             direction='horizontal'
                                             shape="dot"
                                             class='w-full doc-radio-group-now'
                                             style='background: #F5F5F5'
                            >
                                <van-radio v-for="item in store.getDict('CP00120')"
                                           :key='item.value' :name='item.value'
                                           label-position='left'>{{ item.name }}
                                </van-radio>
                            </van-radio-group>
                        </template>
                    </van-field>
                </div>
            </div>

            <div v-if='blackSpinySkinShow'>
                <div class='no-req-label mt-5'>黑棘皮病</div>
                <van-field
                    class='no-back form-input mt-2'
                    style='padding: 0'
                >
                    <template #input>
                        <van-radio-group v-model='form.blackSpinySkin'
                                         direction='horizontal'
                                         shape="dot"
                                         class='w-full doc-radio-group'>
                            <van-radio v-for="item in store.getDict('CP00134')"
                                       :key='item.value' :name='item.value'
                                       label-position='left'>{{ item.name }}
                            </van-radio>
                        </van-radio-group>
                    </template>
                </van-field>
            </div>

            <div v-if='mentalTensionShow'>
                <div class='no-req-label mt-5'>长期精神紧张</div>
                <van-field
                    class='no-back form-input mt-2'
                    style='padding: 0'
                >
                    <template #input>
                        <van-radio-group v-model='form.mentalTension'
                                         direction='horizontal'
                                         shape="dot"
                                         class='w-full doc-radio-group'>
                            <van-radio v-for="item in store.getDict('CP00135')"
                                       :key='item.value' :name='item.value'
                                       label-position='left'>{{ item.name }}
                            </van-radio>
                        </van-radio-group>
                    </template>
                </van-field>
            </div>

            <div v-if='xanthomaShow'>
                <div class='no-req-label mt-5'>皮肤或肌腱黄色瘤</div>
                <van-field
                    class='no-back form-input mt-2'
                    style='padding: 0'
                >
                    <template #input>
                        <van-radio-group v-model='form.xanthoma'
                                         direction='horizontal'
                                         shape="dot"
                                         class='w-full doc-radio-group'>
                            <van-radio v-for="item in store.getDict('CP00135')"
                                       :key='item.value' :name='item.value'
                                       label-position='left'>{{ item.name }}
                            </van-radio>
                        </van-radio-group>
                    </template>
                </van-field>
            </div>

            <div v-if='tendoIncrassationShow'>
                <div class='no-req-label mt-5'>跟腱增厚</div>
                <van-field
                    class='no-back form-input mt-2'
                    style='padding: 0'
                >
                    <template #input>
                        <van-radio-group v-model='form.tendoIncrassation'
                                         direction='horizontal'
                                         shape="dot"
                                         class='w-full doc-radio-group'>
                            <van-radio v-for="item in store.getDict('CP00120')"
                                       :key='item.value' :name='item.value'
                                       label-position='left'>{{ item.name }}
                            </van-radio>
                        </van-radio-group>
                    </template>
                </van-field>
            </div>

            <div v-if='riskScoreShow'>
                <div class='no-req-label mt-5'>中国糖尿病风险评分</div>
                <van-field
                    class='no-back form-input mt-2'
                    style='padding: 0'
                >
                    <template #input>
                        <van-radio-group v-model='riskScoreInfo'
                                         direction='horizontal'
                                         shape="dot"
                                         class='w-full doc-radio-group'>
                            <van-radio v-for="item in store.getDict('CP00136')"
                                       :key='item.value' :name='item.value'
                                       label-position='left'>{{ item.name }}
                            </van-radio>
                        </van-radio-group>
                    </template>
                </van-field>
            </div>

            <div>
                <div class='no-req-label mt-5'>知情同意书</div>
                <DocImageUpload
                    description='支持上传jpg、png、jpeg文件，大小请在10M以内'
                    lengthMessage='抱歉，最多可上传6个文件。'
                    :imageData='[]'
                    @change='(ids, option) => form.informedConsent = ids'
                    :maxLength='6'
                    class='mt-2'
                />
            </div>

            <div>
                <div class='label-title lh-24'>专病高危评估结果</div>
                <van-field
                    class='form-input mt-2'
                    style='padding: 0'
                >
                    <template #input>
                        <div class='flex  gap-x-2.5 gap-y-2.5 w-full flex-wrap' style='background: #FFFFFF'>
                            <div v-for="(item, index) in store.getDict('CP00137')" :key='item.value' class='bg-ff'>
                                <div
                                    @click='toggleResult(item)'
                                    :class="['form-input', 'bg-fa', this.specialScreenResultSelect.includes(item.value)  ? 'active-drinkKind' : '' ]"
                                >
                                    <div>{{ item.name }}</div>
                                </div>
                            </div>

                        </div>
                    </template>
                </van-field>
            </div>
        </van-form>
    </div>
</template>

<script>

import { useStore } from '@/doctor/store'
import { checkboxReject, fetchDataHandle } from '@/utils/common'
import CheckBtn from '@/doctor/components/checkBtn/CheckBtn'
import BloodPressureBt from '@/doctor/components/bloodPressure/BloodPressureBt'
import BloodPressurePanel from '@/doctor/components/bloodPressure/BloodPressurePanel'
import DocImageUpload from '@/doctor/components/docImageUpload/DocImageUpload'

const defaultForm = (info = {}) => {
    const form = {
        id: undefined,
        residentInfoId: undefined,
        diseaseArrays: [],
        currentAge: undefined,
        gender: undefined,
        genderName: undefined,
        medicalHistory: [],
        medicalHistoryName: undefined,
        familyHistory: [],
        relativeType: undefined,
        height: undefined,
        weight: undefined,
        bmi: undefined,
        waistline: undefined,
        exerciseFrequency: undefined,
        exerciseFrequencyName: undefined,
        everyExercise: undefined,
        femaleMedicalHistory: undefined,
        femaleMedicalHistoryName: undefined,
        hdlCholesterin: undefined,
        triglyceride: undefined,
        serumCholesterin: undefined,
        touchHarmful: [],
        touchHarmfulName: undefined,
        pressureOneSbp: undefined,
        pressureOneDbp: undefined,
        pressureTwoSbp: undefined,
        pressureTwoDbp: undefined,
        dietaryHabit: [],
        dietaryHabitName: undefined,
        drinkFrequency: undefined,
        startDrinkAge: undefined,
        drinkKind: [],
        drinkKindOther: undefined,
        dayDrink: undefined,
        giveDrink: undefined,
        giveDrinkStart: undefined,
        // 吸烟情况
        isSmoking: undefined,
        daySmoking: undefined,
        startSmoking: undefined,
        secondSmoking: undefined,
        // 戒烟年龄
        giveSmokingAge: undefined,
        blackSpinySkin: undefined,
        mentalTension: undefined,
        xanthoma: undefined,
        tendoIncrassation: undefined,
        riskScore: undefined,
        specialScreenResult: [],
        hypertensionHighItem: [],
        diabetesHighItem: [],
        coronaryHighItem: [],
        strokeHighItem: [],
        pulmonaryHighItem: [],
        nephrosisHighItem: [],
        dyslipemiaHighItem: [],
        // 日饮酒量
        drinkKindCapacityList: [],
        diseaseRelativeList: [],
        mediumStrength: undefined,
        medicineHistory: [],
        medicineHistoryName: undefined,
        informedConsent: undefined,
        isExerciseFive: undefined
    }
    Reflect.ownKeys(form).forEach(key => {
        if (info[key] != undefined) {
            form[key] = info[key]
        }
    })
    return form
}
export default {
    components: { DocImageUpload, BloodPressurePanel, BloodPressureBt, CheckBtn },
    props: {
        info: Object,
        diseaseArraysInfo: Array
    },
    inject: ['pressureObj'],
    data() {
        return {
            store: useStore(),
            //病史弹窗
            showMedicalHistory: false,
            //女性病史
            showFemaleMedicalHistory: false,
            //用药史
            showMedicineHistory: false,
            //有害物质接触或婴幼儿时期病史
            showTouchHarmful: false,
            //饮食习惯
            showDietaryHabit: false,
            //锻炼频率
            showExerciseFrequency: false,

            checkboxRefs: [],
            checkboxDrinkRefs: [],
            form: {},
            formRight: {
                hypertensionHighItemSelect: [],
                diabetesHighItemSelect: [],
                coronaryHighItemSelect: [],
                strokeHighItemSelect: [],
                pulmonaryHighItemSelect: [],
                nephrosisHighItemSelect: [],
                dyslipemiaHighItemSelect: []
            },
            specialScreenResultSelect: [],
            riskScoreInfo: undefined,
            // 饮酒种类及饮用量关系
            drinkKindCapacityList: [],
            familyHistoryList: [],
            imageData: [],
            rules: {
                diseaseArrays: [{ required: true, message: '请选择' }],
                medicalHistoryName: [{ required: true, message: '请选择' }],
                familyHistory: [{ required: true, message: '请选择' }],
                height: [
                    { required: true, message: '请输入' },
                    {
                        validator: (value, rule) => {
                            let res = true
                            const regex = /^\d+(\.\d{1})?$/
                            if (value && !(Number(value) >= 10 && Number(value) <= 300 && regex.test(Number(value)))) {
                                res = false
                            }
                            return res
                        },
                        message: `请输入10到300之间的数字，允许一位小数`
                    }
                ],
                weight: [
                    { required: true, message: '请输入' },
                    {
                        validator: (value, rule) => {
                            let res = true
                            const regex = /^\d+(\.\d{1,2})?$/
                            if (value && !(Number(value) >= 20 && Number(value) <= 500 && regex.test(Number(value)))) {
                                res = false
                            }
                            return res
                        },
                        message: `请输入20~500之间数字,允许2位小数`
                    }
                ],
                waistline: [
                    { required: true, message: '请输入' },
                    {
                        validator: (value, rule) => {
                            let res = true
                            const regex = /^\d+(\.\d{1})?$/
                            if (value && !(Number(value) >= 10 && Number(value) <= 150 && regex.test(Number(value)))) {
                                res = false
                            }
                            return res
                        },
                        message: `请输入10~150之间数字,允许1位小数`
                    }
                ],
                hdlCholesterin: [{
                    validator: (value, rule) => {
                        const regex = /^\d+(\.\d{1,2})?$/
                        let res = true
                        if (value && !regex.test(value)) {
                            res = false
                        }
                        return res
                    },
                    message: `请输入正确的数字`
                }],
                triglyceride: [{
                    validator: (value, rule) => {
                        const regex = /^\d+(\.\d{1,2})?$/
                        let res = true
                        if (value && !regex.test(value)) {
                            res = false
                        }
                        return res
                    },
                    message: `请输入正确的数字`
                }],
                serumCholesterin: [{
                    validator: (value, rule) => {
                        const regex = /^\d+(\.\d{1,2})?$/
                        let res = true
                        if (value && !regex.test(value)) {
                            res = false
                        }
                        return res
                    },
                    message: `请输入正确的数字`
                }],
                exerciseFrequencyName: [{ required: true, message: '请选择' }],
                dietaryHabitName: [{ required: true, message: '请选择' }],
                drinkFrequency: [{ required: true, message: '请选择' }],
                isSmoking: [{ required: true, message: '请选择' }],
                specialScreenResult: [{ required: true, message: '请选择' }],
                secondSmoking: [{ required: true, message: '请选择' }],
                drinkKind: [{ required: true, message: '请选择' }],
                startDrinkAge: [{ required: true, message: '请输入' }],
                giveDrink: [{ required: true, message: '请选择' }],
                giveDrinkStart: [{ required: true, message: '请输入' }],
                giveSmokingAge: [{ required: true, message: '请输入' }],
                startSmoking: [{ required: true, message: '请输入' }],
                daySmoking: [{ required: true, message: '请输入' }],
                everyExercise: [{ required: true, message: '请输入' }],
                mediumStrength: [{ required: true, message: '请选择' }]
            }
        }
    },
    computed: {
        //判断年龄显示隐藏
        ageShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(1) || diseaseArrays.includes(2) || diseaseArrays.includes(3)
                || diseaseArrays.includes(5) || diseaseArrays.includes(6)) {
                res = true
            }
            return res
        },
        //判断性别显示隐藏
        sexShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(3)) {
                res = true
            }
            return res
        },
        //判断病史显示隐藏
        medicalHistoryShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(1) || diseaseArrays.includes(2) || diseaseArrays.includes(3) || diseaseArrays.includes(4)
                || diseaseArrays.includes(5) || diseaseArrays.includes(6) || diseaseArrays.includes(7)) {
                res = true
            }
            return res
        },
        //判断家族史显示隐藏
        familyHistoryShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(1) || diseaseArrays.includes(2) || diseaseArrays.includes(3) || diseaseArrays.includes(4)
                || diseaseArrays.includes(5) || diseaseArrays.includes(6) || diseaseArrays.includes(7)) {
                res = true
            }
            return res
        },
        //判断身高、体重、BMI显示隐藏
        highShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(1) || diseaseArrays.includes(2) || diseaseArrays.includes(4)
                || diseaseArrays.includes(6) || diseaseArrays.includes(7)) {
                res = true
            }
            return res
        },
        //判断腰围显示隐藏
        waistShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(1) || diseaseArrays.includes(2)) {
                res = true
            }
            return res
        },
        //判断锻炼频率显示隐藏
        exerciseShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(1) || diseaseArrays.includes(2) || diseaseArrays.includes(4)) {
                res = true
            }
            return res
        },
        //判断女性病史显示隐藏
        womanMHShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(2)) {
                res = true
            }
            return res
        },
        //判断用药史显示隐藏
        medicationHShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(2) || diseaseArrays.includes(4) || diseaseArrays.includes(6)) {
                res = true
            }
            return res
        },
        //判断高密度脂蛋白胆固醇、甘油三酯、总胆固醇显示隐藏
        triglycerideShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(2)) {
                res = true
            }
            return res
        },
        //判断有害物质接触或婴幼儿时期病史显示隐藏
        babyMHShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(5)) {
                res = true
            }
            return res
        },
        //判断血压显示隐藏
        bloodPressureShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(1)) {
                res = true
            }
            return res
        },
        //判断饮食习惯显示隐藏
        eatHabitShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(1)) {
                res = true
            }
            return res
        },
        //判断饮酒情况显示隐藏
        drinkShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(1)) {
                res = true
            }
            return res
        },
        //判断吸烟情况显示隐藏
        smokeShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(1) || diseaseArrays.includes(3) || diseaseArrays.includes(4) || diseaseArrays.includes(5) || diseaseArrays.includes(7)) {
                res = true
            }
            return res
        },
        //判断黑棘皮病显示隐藏
        blackSpinySkinShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(2)) {
                res = true
            }
            return res
        },
        //判断长期精神紧张显示隐藏
        mentalTensionShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(1)) {
                res = true
            }
            return res
        },
        //判断皮肤或肌腱黄色瘤显示隐藏
        xanthomaShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(7)) {
                res = true
            }
            return res
        },
        //判断跟腱增厚显示隐藏
        tendoIncrassationShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(7)) {
                res = true
            }
            return res
        },
        //判断中国糖尿病风险评分显示隐藏
        riskScoreShow() {
            let res = false
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(2)) {
                res = true
            }
            return res
        },
        //生成病史选择项
        medicalHistoryList() {
            //默认为无
            let result = []
            let res = [99]
            let list = this.store.getDict('CP00125')
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(1)) {
                let arr = [1, 2, 7]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(2)) {
                let arr = [3, 5, 18, 19]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(3)) {
                let arr = [1, 2, 7]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(4)) {
                let arr = [2, 7, 16, 17]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(5)) {
                let arr = [8, 9, 10, 11]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(6)) {
                let arr = [1, 2, 3, 5, 12, 13, 14, 15]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(7)) {
                let arr = [1, 2, 3, 5]
                res = [
                    ...res,
                    ...arr
                ]
            }
            res = Array.from(new Set(res))
            list.forEach(item1 => {
                res.forEach(item2 => {
                    if (item1.value == item2) {
                        result.push(item1)
                    }
                })
            })
            return result
        },
        //生成家族史选择项
        familyHistoryInfoList() {
            //默认为无
            let result = []
            let res = [9]
            let list = this.store.getDict('CP00149')
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(1)) {
                let arr = [2]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(2)) {
                let arr = [1]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(3)) {
                let arr = [3]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(4)) {
                let arr = [4]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(5)) {
                let arr = [5]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(6)) {
                let arr = [6]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(7)) {
                let arr = [7]
                res = [
                    ...res,
                    ...arr
                ]
            }
            res = Array.from(new Set(res))
            list.forEach(item1 => {
                res.forEach(item2 => {
                    if (item1.value == item2) {
                        result.push(item1)
                    }
                })
            })
            return result
        },
        //生成用药史选择项
        medicineHistoryList() {
            //默认为无
            let result = []
            let res = []
            let list = this.store.getDict('CP00129')
            const { diseaseArrays = [] } = this.form
            if (diseaseArrays.includes(2)) {
                let arr = [1, 2, 3, 4]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(4)) {
                let arr = [1]
                res = [
                    ...res,
                    ...arr
                ]
            }
            if (diseaseArrays.includes(6)) {
                let arr = [5]
                res = [
                    ...res,
                    ...arr
                ]
            }
            res = Array.from(new Set(res))
            list.forEach(item1 => {
                res.forEach(item2 => {
                    if (item1.value == item2) {
                        result.push(item1)
                    }
                })
            })
            return result
        },
        //锻炼频率单选list (pc端两个字典，移动端则合为一个字典提交时在分开为两个字段)
        exerciseFrequencyList() {
            let res = []
            let listOne = this.store.getDict(`CP00126`)
            // let listTwo = this.store.getDict(`CP00163`)
            let listTwo = [
                { value: 5, name: '每周5次及以上' },
                { value: 6, name: '每周不到5次' }
            ]
            return res = [...listOne, ...listTwo]

        }
    },
    watch: {
        'info': {
            handler() {
                this.initForm()
            },
            immediate: true
        },
        diseaseArraysInfo: {
            handler() {
                this.form.diseaseArrays = this.diseaseArraysInfo
            }
        },
        'form': {
            handler(now, old) {
                if (Object.keys(old).length === 0) return
                this.formChangeHandle()
            },
            deep: true
        },
        'form.height': {
            handler() {
                this.calculateBMI()
            }
        },
        'form.weight': {
            handler() {
                this.calculateBMI()
            }
        },
        //右侧高危选项变化监测
        'formRight': {
            handler(now, old) {
                if (Object.keys(old).length === 0) return
                this.changeFormRightHandle()
            },
            deep: true
        },
        // 计算日均饮酒量
        drinkKindCapacityList: {
            handler(val) {
                if (!val) {
                    this.form.dayDrink = 0
                    return
                }
                let num = 0
                val.forEach(e => {
                    if (e.drinkKind == 2) { // 啤酒
                        num = num + e.drinkCapacity * 0.1
                    } else if (e.drinkKind == 3) { // 红酒
                        num = num + e.drinkCapacity * 0.25
                    } else if (e.drinkKind == 4) { // 黄酒
                        num = num + e.drinkCapacity * 0.2
                    } else {
                        num = num + e.drinkCapacity
                    }

                })
                this.form.dayDrink = Math.round(num * 100) / 100
            },
            deep: true
        },
        //家族史
        'form.familyHistory': {
            handler() {
                //非空校验
                this.familyHistoryReq()
            }
        },
        'familyHistoryList': {
            handler(now, old) {
                if (old.length == 0) return
                if (this.form.diseaseArrays?.includes(3)) {
                    this.coronaryHigh()
                }
                //非空校验
                this.familyHistoryReq()
            },
            deep: true
        },
        //病种变更监听
        'form.diseaseArrays': {
            handler(val = []) {
                const option = this.store.getDict('CP00117')
                this.cleanFormRight()
                this.cleanMedicalHistory()
                this.cleanFamilyHistory()
                this.cleanMedicineHistory()
                this.changeFamilyHis()
            },
            immediate: true
        }
    },
    methods: {
        checkboxReject,
        //初始化表单
        initForm() {
            this.form = defaultForm(this.info)
            if (this.info.isExerciseFive == 1) {
                this.form.exerciseFrequency = 5
            }
            if (this.info.isExerciseFive == 2) {
                this.form.exerciseFrequency = 6
            }
            if (!this.info.id) {
                //是否是引用上一次复筛数据
                if (this.info.flag && this.info.flag == 'lastInfo') {
                    this.setUpdateInfo()
                } else {//新增时
                    this.form.diseaseArrays = [1, 2, 3, 4, 5, 6, 7]
                }
            } else {
                this.setUpdateInfo()
            }
        },
        //修改时 或者引用上一次复筛数据时赋值
        setUpdateInfo() {
            this.formRight.hypertensionHighItemSelect = this.form.hypertensionHighItem || []
            this.formRight.diabetesHighItemSelect = this.form.diabetesHighItem || []
            this.formRight.coronaryHighItemSelect = this.form.coronaryHighItem || []
            this.formRight.strokeHighItemSelect = this.form.strokeHighItem || []
            this.formRight.pulmonaryHighItemSelect = this.form.pulmonaryHighItem || []
            this.formRight.nephrosisHighItemSelect = this.form.nephrosisHighItem || []
            this.formRight.dyslipemiaHighItemSelect = this.form.dyslipemiaHighItem || []
            this.drinkKindCapacityList = this.form.drinkKindCapacityList || []
            this.familyHistoryList = this.form.diseaseRelativeList || []

            //修改时若中国糖尿病风险评分、专病高危评估结果存在时 以用户选择的结果为主展示
            //利用setTimeout改变值的赋值顺序让这两个值在watch事件结束后再被赋值
            setTimeout(() => {
                this.riskScoreInfo = this.form.riskScore
                this.specialScreenResultSelect = this.form.specialScreenResult || [9]
            }, 0)

            this.imageData = this.info.informedConsentUrl
        },
        //表单触发事件
        formChangeHandle() {
            //高血压
            if (this.form.diseaseArrays?.includes(1)) {
                this.hypertensionHigh()
            }
            //糖尿病
            if (this.form.diseaseArrays?.includes(2)) {
                this.diabetesHigh()
                //糖尿病风险
                this.diabetesHighCompute()
            }
            //冠心病
            if (this.form.diseaseArrays?.includes(3)) {
                this.coronaryHigh()
            }
            //脑卒中
            if (this.form.diseaseArrays?.includes(4)) {
                this.strokeHigh()
            }
            //慢阻肺
            if (this.form.diseaseArrays?.includes(5)) {
                this.pulmonaryHigh()
            }
            //慢性肾病
            if (this.form.diseaseArrays?.includes(6)) {
                this.nephrosisHigh()
            }
            //血脂异常
            if (this.form.diseaseArrays?.includes(7)) {
                this.dyslipemiaHigh()
            }
        },
        //右侧高危选项触发事件
        changeFormRightHandle() {
            let list = []
            const {
                hypertensionHighItemSelect = [],
                diabetesHighItemSelect = [],
                coronaryHighItemSelect = [],
                strokeHighItemSelect = [],
                pulmonaryHighItemSelect = [],
                nephrosisHighItemSelect = [],
                dyslipemiaHighItemSelect = []
            } = this.formRight
            //高血压高危选项
            if (hypertensionHighItemSelect.length >= 3) {
                list.push(1)
            }
            //糖尿病高危选项
            if (diabetesHighItemSelect.length >= 1) {
                list.push(2)
            }
            //冠心病高危选项
            if (coronaryHighItemSelect.length >= 3) {
                list.push(3)
            }
            //脑卒中高危选项
            if (strokeHighItemSelect.length >= 3) {
                list.push(4)
            }
            //慢阻肺高危选项
            if (pulmonaryHighItemSelect.length >= 1) {
                list.push(5)
            }
            //慢性肾脏病高危选项
            if (nephrosisHighItemSelect.length >= 2) {
                list.push(6)
            }
            //血脂异常高危选项
            if (dyslipemiaHighItemSelect.length >= 1) {
                list.push(7)
            }
            //不满足高危病种时默认为无
            if (!list.length) {
                list = [9]
            }
            list = Array.from(new Set(list))
            this.specialScreenResultSelect = list
            // this.form.specialScreenResult = this.specialScreenResultSelect
        },
        //清洗右侧高危选项表单
        cleanFormRight() {
            if (!this.form.diseaseArrays?.includes(1)) {
                this.formRight.hypertensionHighItemSelect = []
            }
            if (!this.form.diseaseArrays?.includes(2)) {
                this.formRight.diabetesHighItemSelect = []
            }
            if (!this.form.diseaseArrays?.includes(3)) {
                this.formRight.coronaryHighItemSelect = []
            }
            if (!this.form.diseaseArrays?.includes(4)) {
                this.formRight.strokeHighItemSelect = []
            }
            if (!this.form.diseaseArrays?.includes(5)) {
                this.formRight.pulmonaryHighItemSelect = []
            }
            if (!this.form.diseaseArrays?.includes(6)) {
                this.formRight.nephrosisHighItemSelect = []
            }
            if (!this.form.diseaseArrays?.includes(7)) {
                this.formRight.dyslipemiaHighItemSelect = []
            }
        },
        //清洗病史的选择数据（去掉不存在的病种对应的选项选择）
        cleanMedicalHistory() {
            if (!this.form.diseaseArrays.length) {
                this.form.medicalHistory = []
            } else {
                if (this.form.medicalHistory && this.form.medicalHistory.length) {
                    let res = []
                    this.medicalHistoryList.forEach(item => {
                        res.push(item.value)
                    })
                    let list = this.form.medicalHistory.filter(item => {
                            return res.includes(item)
                        }
                    ) || []
                    this.form.medicalHistory = list
                }
            }

        },
        //清洗家族史的选择数据
        cleanFamilyHistory() {
            if (!this.form.diseaseArrays.length) {
                this.form.familyHistory = []
            } else {
                if (this.form.familyHistory && this.form.familyHistory.length) {
                    let res = []
                    this.familyHistoryInfoList.forEach(item => {
                        res.push(item.value)
                    })
                    let list = this.form.familyHistory.filter(item => {
                            return res.includes(item)
                        }
                    ) || []
                    this.form.familyHistory = list
                }
            }
        },
        //清洗用药史的选择数据
        cleanMedicineHistory() {
            if (!this.form.diseaseArrays.length) {
                this.form.medicineHistory = []
            } else {
                if (this.form.medicineHistory && this.form.medicineHistory.length) {
                    let res = []
                    this.medicineHistoryList.forEach(item => {
                        res.push(item.value)
                    })
                    let list = this.form.medicineHistory.filter(item => {
                            return res.includes(item)
                        }
                    ) || []
                    this.form.medicineHistory = list
                }
            }
        },
        changeFamilyHis() {
            this.form.familyHistory = this.checkboxReject(this.form.familyHistory, [9])
            let temp = []
            this.form.familyHistory.forEach((item, index) => {
                if (item == 1 || item == 3 || item == 5 || item == 7) {
                    let name = this.store.getDictValue(this.store.getDict('CP00149'), item)
                    let base = this.familyHistoryList.filter(item1 => item1.diseaseType == item) || []
                    let obj = {
                        id_: index + 1,
                        diseaseTypeName: `${name}`,
                        diseaseType: item,
                        selectRelativeType: [],
                        checkRequired: false,
                        relativeAgeList: [
                            {
                                relativeTypeName: '父亲',
                                relativeType: 1,
                                gender: 1,
                                age: undefined,
                                inputRequired: false
                            },
                            {
                                relativeTypeName: '母亲',
                                relativeType: 2,
                                gender: 2,
                                age: undefined,
                                inputRequired: false
                            },
                            {
                                relativeTypeName: '兄弟',
                                relativeType: 3,
                                gender: 1,
                                age: undefined,
                                inputRequired: false
                            },
                            {
                                relativeTypeName: '姐妹',
                                relativeType: 4,
                                gender: 2,
                                age: undefined,
                                inputRequired: false
                            },
                            {
                                relativeTypeName: '儿子',
                                relativeType: 5,
                                gender: 1,
                                age: undefined,
                                inputRequired: false
                            },
                            { relativeTypeName: '女儿', relativeType: 6, gender: 2, age: undefined, inputRequired: false }
                        ]
                    }
                    if (base.length) {
                        obj = base[0]
                    }
                    temp.push(obj)
                }
            })
            this.familyHistoryList = temp
        },
        calculateBMI() {
            if (this.form.weight && this.form.height) {
                let res = this.form.weight / (this.form.height * this.form.height / 100 / 100)
                this.form.bmi = parseFloat(res.toFixed(1))
            } else {
                this.form.bmi = null
            }
        },
        hypertensionHigh() {
            const {
                currentAge,
                height = 0,
                weight = 0,
                waistline,
                familyHistory = [],
                isSmoking,
                medicalHistory = [],
                dietaryHabit = [],
                pressureOneSbp,
                pressureOneDbp,
                pressureTwoSbp,
                pressureTwoDbp,
                dayDrink,
                secondSmoking,
                gender,
                exerciseFrequency,
                everyExercise,
                mentalTension
            } = this.form
            let list = []
            if (((pressureOneSbp >= 120) || (pressureTwoSbp >= 120)) ||
                ((pressureOneDbp >= 80) || (pressureTwoDbp >= 80))
            ) {
                list.push(1)
            }
            if (currentAge >= 45) {
                list.push(2)
            }
            let res = weight / (height * height / 100 / 100)
            let bmi = parseFloat(res.toFixed(1))
            if ((bmi >= 24) ||
                (gender == 2 && waistline >= 85) ||
                (gender == 1 && waistline >= 90)) {
                list.push(3)
            }
            if (familyHistory.includes(2)) {
                list.push(4)
            }
            if (dietaryHabit.includes(4)) {
                list.push(5)
            }
            if (dayDrink >= 100) {
                list.push(6)
            }
            if (isSmoking == 3 || secondSmoking == 1) {
                list.push(7)
            }
            if (exerciseFrequency == 3 || exerciseFrequency == 4 || everyExercise < 30) {
                list.push(8)
            }
            if (mentalTension == 2) {
                list.push(9)
            }
            if (medicalHistory.includes(7)) {
                list.push(10)
            }
            if (medicalHistory.includes(2)) {
                list.push(11)
            }
            this.formRight.hypertensionHighItemSelect = Array.from(new Set(list))
        },
        diabetesHigh() {
            let list = []
            const {
                currentAge,
                medicalHistory = [],
                height = 0,
                weight = 0,
                waistline,
                gender,
                exerciseFrequency,
                everyExercise,
                familyHistory = [],
                femaleMedicalHistory = [],
                blackSpinySkin,
                medicineHistory = [],
                hdlCholesterin,
                triglyceride
            } = this.form
            if (currentAge >= 40) {
                list.push(1)
            }
            if (medicalHistory.includes(19)) {
                list.push(2)
            }
            let res = weight / (height * height / 100 / 100)
            let bmi = parseFloat(res.toFixed(1))
            if ((bmi >= 24) ||
                (gender == 2 && waistline >= 85) ||
                (gender == 1 && waistline >= 90)) {
                list.push(3)
            }
            if (exerciseFrequency == 3 || exerciseFrequency == 4 || everyExercise < 30) {
                list.push(4)
            }
            if (familyHistory.includes(1)) {
                list.push(5)
            }
            if (femaleMedicalHistory.includes(1)) {
                list.push(6)
            }
            if (femaleMedicalHistory.includes(3)) {
                list.push(7)
            }
            if (blackSpinySkin == 2) {
                list.push(8)
            }
            if (medicalHistory.includes(1) || medicineHistory.includes(1)) {
                list.push(9)
            }
            if ((hdlCholesterin != null && hdlCholesterin < 0.9) || (triglyceride != null && triglyceride > 2.22) || medicineHistory.includes(2)) {
                list.push(10)
            }
            if (medicalHistory.includes(3) || medicalHistory.includes(5)) {
                list.push(11)
            }
            if (medicineHistory.includes(3)) {
                list.push(12)
            }
            if (medicineHistory.includes(4)) {
                list.push(13)
            }
            let socre = this.diabetesHighScore()
            if (socre >= 25) {
                list.push(14)
            }
            this.formRight.diabetesHighItemSelect = Array.from(new Set(list))
        },
        //冠心病高危选择
        coronaryHigh() {
            let list = []
            const { currentAge, gender, isSmoking, medicalHistory = [], familyHistory = [] } = this.form
            if (gender == 1) {
                list.push(2)
                if (currentAge >= 45) {
                    list.push(1)
                }
            }
            if (gender == 2 && currentAge >= 55) {
                list.push(1)
            }
            if (isSmoking == 3) {
                list.push(3)
            }
            if (medicalHistory.includes(1)) {
                list.push(4)
            }
            if (medicalHistory.includes(2)) {
                list.push(5)
            }
            if (medicalHistory.includes(7)) {
                list.push(6)
            }
            if (familyHistory.includes(3)) {
                let obj = this.familyHistoryList.filter(item => item.diseaseType == 3)[0] || {}
                let objList = obj.selectRelativeType || []
                let listArry = obj?.relativeAgeList || []
                let flag = 0
                listArry.forEach(item => {
                    if (item.gender == 1 && item.age && item.age < 55) {
                        flag++
                    }
                    if (item.gender == 2 && item.age && item.age < 65) {
                        flag++
                    }
                })
                if (flag > 0 && objList.length) {
                    list.push(7)
                }
            }
            this.formRight.coronaryHighItemSelect = Array.from(new Set(list))
        },
        strokeHigh() {
            let list = []
            const {
                medicalHistory = [],
                medicineHistory = [],
                isSmoking,
                familyHistory = [],
                exerciseFrequency,
                everyExercise,
                height = 0,
                weight = 0
            } = this.form
            if (medicalHistory.includes(1) || medicineHistory.includes(1)) {
                list.push(1)
            }
            if (medicalHistory.includes(16) || medicalHistory.includes(17)) {
                list.push(2)
            }
            if (isSmoking == 3) {
                list.push(3)
            }
            if (medicalHistory.includes(7)) {
                list.push(4)
            }
            if (medicalHistory.includes(2)) {
                list.push(5)
            }
            if (exerciseFrequency == 3 || exerciseFrequency == 4 || everyExercise < 30) {
                list.push(6)
            }
            let res = weight / (height * height / 100 / 100)
            let bmi = parseFloat(res.toFixed(1))
            if (bmi >= 26) {
                list.push(7)
            }
            if (familyHistory.includes(4)) {
                list.push(8)
            }
            this.formRight.strokeHighItemSelect = Array.from(new Set(list))
        },
        pulmonaryHigh() {
            let list = []
            const {
                currentAge,
                isSmoking,
                secondSmoking,
                medicalHistory = [],
                familyHistory = [],
                touchHarmful = []
            } = this.form
            if (currentAge >= 35) {
                list.push(1)
            }
            if (isSmoking == 3) {
                list.push(2)
            }
            if (touchHarmful.includes(1)) {
                list.push(3)
            }
            if (medicalHistory.includes(8)) {
                list.push(4)
            }
            if (medicalHistory.includes(11)) {
                list.push(5)
            }
            if (medicalHistory.includes(9)) {
                list.push(6)
            }
            if (medicalHistory.includes(10)) {
                list.push(7)
            }
            if (familyHistory.includes(5)) {
                list.push(8)
            }
            if (touchHarmful.includes(4)) {
                list.push(9)
            }
            if (touchHarmful.includes(2)) {
                list.push(10)
            }
            if (touchHarmful.includes(3)) {
                list.push(11)
            }
            if (touchHarmful.includes(5)) {
                list.push(12)
            }
            if (touchHarmful.includes(6)) {
                list.push(13)
            }
            if (touchHarmful.includes(7)) {
                list.push(14)
            }
            this.formRight.pulmonaryHighItemSelect = Array.from(new Set(list))
        },
        nephrosisHigh() {
            let list = []
            const {
                currentAge,
                familyHistory = [],
                medicalHistory = [],
                height = 0,
                weight = 0,
                medicineHistory = []
            } = this.form
            if (currentAge > 65) {
                list.push(1)
            }
            if (familyHistory.includes(6)) {
                list.push(2)
            }
            if (medicalHistory.includes(2)) {
                list.push(3)
            }
            if (medicalHistory.includes(1)) {
                list.push(4)
            }
            if (medicalHistory.includes(3) || medicalHistory.includes(5)) {
                list.push(5)
            }
            if (medicalHistory.includes(12)) {
                list.push(6)
            }
            let res = weight / (height * height / 100 / 100)
            let bmi = parseFloat(res.toFixed(1))
            if (bmi >= 28) {
                list.push(7)
            }
            if (medicalHistory.includes(14) || medicalHistory.includes(15)) {
                list.push(8)
            }
            if (medicineHistory.includes(5)) {
                list.push(9)
            }
            if (medicalHistory.includes(13)) {
                list.push(10)
            }
            this.formRight.nephrosisHighItemSelect = Array.from(new Set(list))
        },
        dyslipemiaHigh() {
            let list = []
            const {
                currentAge,
                gender,
                medicalHistory = [],
                height = 0,
                weight = 0,
                isSmoking,
                familyHistory = [],
                xanthoma,
                tendoIncrassation
            } = this.form
            if (medicalHistory.includes(3) || medicalHistory.includes(5)) {
                list.push(1)
            }
            let res = weight / (height * height / 100 / 100)
            let bmi = parseFloat(res.toFixed(1))
            if (medicalHistory.includes(1) || medicalHistory.includes(2) || bmi >= 28 || isSmoking == 3) {
                list.push(2)
            }
            if (familyHistory.includes(3) || familyHistory.includes(4) || familyHistory.includes(7)) {
                list.push(3)
            }
            if (xanthoma == 2) {
                list.push(4)
            }
            if (tendoIncrassation == 1) {
                list.push(5)
            }
            this.formRight.dyslipemiaHighItemSelect = Array.from(new Set(list))
        },

        diabetesHighCompute() {
            let score = this.diabetesHighScore()
            if (score < 25) {
                this.riskScoreInfo = 2
            }
            if (score >= 25) {
                this.riskScoreInfo = 1
            }
        },

        //糖尿病风险评分
        diabetesHighScore() {
            let total = 0
            const {
                currentAge,
                height = 0,
                weight = 0,
                waistline,
                gender,
                familyHistory = [],
                pressureOneSbp,
                pressureTwoSbp
            } = this.form
            //年龄分数
            if (currentAge >= 20 && currentAge <= 24) {
                total += 0
            }
            if (currentAge >= 25 && currentAge <= 34) {
                total += 4
            }
            if (currentAge >= 35 && currentAge <= 39) {
                total += 8
            }
            if (currentAge >= 40 && currentAge <= 44) {
                total += 11
            }
            if (currentAge >= 45 && currentAge <= 49) {
                total += 12
            }
            if (currentAge >= 50 && currentAge <= 54) {
                total += 13
            }
            if (currentAge >= 55 && currentAge <= 59) {
                total += 15
            }
            if (currentAge >= 60 && currentAge <= 64) {
                total += 16
            }
            if (currentAge >= 65 && currentAge <= 74) {
                total += 18
            }
            //体质分数
            let res1 = weight / (height * height / 100 / 100)
            let bmi = parseFloat(res1.toFixed(1))
            if (bmi < 22) {
                total += 0
            }
            if (bmi >= 22 && bmi <= 23.9) {
                total += 1
            }
            if (bmi >= 24 && bmi <= 29.9) {
                total += 3
            }
            if (bmi >= 30) {
                total += 5
            }
            //腰围分数 以及性别分数
            //男性
            if (gender == 1) {
                total += 2
                if (waistline < 75) {
                    total += 0
                }
                if (waistline >= 75 && waistline <= 79.9) {
                    total += 3
                }
                if (waistline >= 80 && waistline <= 84.9) {
                    total += 5
                }
                if (waistline >= 85 && waistline <= 89.9) {
                    total += 7
                }
                if (waistline >= 90 && waistline <= 94.9) {
                    total += 8
                }
                if (waistline >= 95) {
                    total += 10
                }
            }
            //女性
            if (gender == 2) {
                total += 0
                if (waistline < 70) {
                    total += 0
                }
                if (waistline >= 70 && waistline <= 74.9) {
                    total += 3
                }
                if (waistline >= 75 && waistline <= 79.9) {
                    total += 5
                }
                if (waistline >= 80 && waistline <= 84.9) {
                    total += 7
                }
                if (waistline >= 85 && waistline <= 89.9) {
                    total += 8
                }
                if (waistline >= 90) {
                    total += 10
                }
            }
            //糖尿病家族史
            if (familyHistory.includes(1)) {
                total += 6
            }
            //收缩压分数(取两次测试结果的最大值)
            let pressureSbp = pressureTwoSbp || 0
            let res = Number(pressureOneSbp || 0) - Number(pressureTwoSbp || 0)
            if (res > 0) {
                pressureSbp = pressureOneSbp
            }
            if (pressureSbp < 110) {
                total += 0
            }
            if (pressureSbp >= 110 && pressureSbp <= 119) {
                total += 1
            }
            if (pressureSbp >= 120 && pressureSbp <= 129) {
                total += 3
            }
            if (pressureSbp >= 130 && pressureSbp <= 139) {
                total += 6
            }
            if (pressureSbp >= 140 && pressureSbp <= 149) {
                total += 7
            }
            if (pressureSbp >= 150 && pressureSbp <= 159) {
                total += 8
            }
            if (pressureSbp >= 160) {
                total += 10
            }
            return total

        },
        //家族史 非空校验
        familyHistoryReq() {
            let flag = 0
            // this.familyHistoryList.forEach(item => {
            //     let list = item.selectRelativeType || []
            //     if (!item.selectRelativeType.length) {
            //         item.checkRequired = true
            //         flag++
            //     } else {
            //         item.checkRequired = false
            //     }
            //     item.relativeAgeList.forEach(item1 => {
            //         if (list.includes(item1.relativeType) && !item1.age) {
            //             item1.inputRequired = true
            //             flag++
            //         } else {
            //             item1.inputRequired = false
            //         }
            //         if (!list.includes(item1.relativeType)) {
            //             item1.age = undefined
            //         }
            //     })
            // })
            return flag
        },
        // 饮酒种类变化
        drinkKindChange(val = [], option) {
            // console.log(val, option)
            this.drinkKindCapacityList = val.map(e => {
                const item = this.drinkKindCapacityList.find(i => i.drinkKind == e) || {}
                return {
                    drinkKind: e,
                    drinkKindName: this.store.getDictValue('CP00133', e),
                    drinkCapacity: item.drinkCapacity || 0
                }
            })
        },
        drinkFrequencyChange() {
            const val = this.form.drinkFrequency
            if (!val || val == 1) {
                this.drinkKindCapacityList = []
            }
        },

        //锻炼频率弹窗确认选择
        exerciseFrequencyConfirm() {
            this.exerciseFrequencyList.forEach(item => {
                if (item.value == this.form.exerciseFrequency) {
                    this.form.exerciseFrequencyName = item.name
                }
            })
            this.showExerciseFrequency = false
        },
        //病史弹窗确认选择
        medicalHistoryConfirm() {
            let res = []
            this.medicalHistoryList.forEach(item => {
                let selected = this.form.medicalHistory.filter(i => i == item.value)
                if (selected && selected.length) {
                    res.push(item.name)
                }
            })
            this.form.medicalHistoryName = res.join()
            this.showMedicalHistory = false
        },
        //女性病史弹窗确认选择
        femaleMedicalHistoryConfirm() {
            let res = []
            this.store.getDict('CP00127').forEach(item => {
                let selected = this.form.femaleMedicalHistory.filter(i => i == item.value)
                if (selected && selected.length) {
                    res.push(item.name)
                }
            })
            this.form.femaleMedicalHistoryName = res.join()
            this.showFemaleMedicalHistory = false
        },
        //用药史弹窗确认选择
        medicineHistoryConfirm() {
            let res = []
            this.medicineHistoryList.forEach(item => {
                let selected = this.form.medicineHistory.filter(i => i == item.value)
                if (selected && selected.length) {
                    res.push(item.name)
                }
            })
            this.form.medicineHistoryName = res.join()
            this.showMedicineHistory = false
        },
        //有害物质接触或婴幼儿时期病史弹窗确认选择
        touchHarmfulConfirm() {
            let res = []
            this.store.getDict('CP00130').forEach(item => {
                let selected = this.form.touchHarmful.filter(i => i == item.value)
                if (selected && selected.length) {
                    res.push(item.name)
                }
            })
            this.form.touchHarmfulName = res.join()
            this.showTouchHarmful = false
        },
        //饮食习惯弹窗确认选择
        dietaryHabitConfirm() {
            let res = []
            this.store.getDict('CP00131').forEach(item => {
                let selected = this.form.dietaryHabit.filter(i => i == item.value)
                if (selected && selected.length) {
                    res.push(item.name)
                }
            })
            this.form.dietaryHabitName = res.join()
            this.showDietaryHabit = false
        },
        //血压仪器测量
        setPressureOne(val) {
            if (!val) return
            this.form.pressureOneSbp = val.systolicPressure
            this.form.pressureOneDbp = val.diastolicPressure
        },
        setPressureTwo(val) {
            if (!val) return
            this.form.pressureTwoSbp = val.systolicPressure
            this.form.pressureTwoDbp = val.diastolicPressure
        },

        //家族史多选
        toggle(index) {
            this.checkboxRefs[index].toggle()
            this.changeFamilyHis()
        },
        //饮酒种类
        toggleDrink(val) {
            if (this.form.drinkKind.includes(val.value)) {
                this.form.drinkKind = this.form.drinkKind.filter(e => e !== val.value)
            } else {
                this.form.drinkKind.push(val.value)
            }
            this.drinkKindChange(this.form.drinkKind)
        },
        //专病高危评估结果
        toggleResult(val) {
            if (this.specialScreenResultSelect.includes(val.value)) {
                this.specialScreenResultSelect = this.specialScreenResultSelect.filter(e => e !== val.value)
            } else {
                this.specialScreenResultSelect.push(val.value)
            }
            this.specialScreenResultSelect = this.checkboxReject(this.specialScreenResultSelect, [9])
            // this.form.specialScreenResult = this.specialScreenResultSelect
        },
        //提交
        onSubmit() {
            return new Promise((resolve, reject) => {
                this.$refs.form.validate().then(() => {

                    if (!this.specialScreenResultSelect.length) {
                        this.$message.info('请选择专病高危评估结果')
                        return
                    }
                    let exerciseFrequencyInfo = ''
                    let isExerciseFiveInfo = ''
                    const { exerciseFrequency } = this.form
                    if (exerciseFrequency == 5) {
                        exerciseFrequencyInfo = 1
                        isExerciseFiveInfo = 1
                    } else if (exerciseFrequency == 6) {
                        exerciseFrequencyInfo = 1
                        isExerciseFiveInfo = 2
                    } else {
                        exerciseFrequencyInfo = exerciseFrequency
                    }
                    let res = {
                        ...this.form,

                        exerciseFrequency: exerciseFrequencyInfo,
                        isExerciseFive: isExerciseFiveInfo,

                        hypertensionHighItem: this.formRight.hypertensionHighItemSelect,
                        diabetesHighItem: this.formRight.diabetesHighItemSelect,
                        coronaryHighItem: this.formRight.coronaryHighItemSelect,
                        strokeHighItem: this.formRight.strokeHighItemSelect,
                        pulmonaryHighItem: this.formRight.pulmonaryHighItemSelect,
                        nephrosisHighItem: this.formRight.nephrosisHighItemSelect,
                        dyslipemiaHighItem: this.formRight.dyslipemiaHighItemSelect,
                        specialScreenResult: this.specialScreenResultSelect,
                        drinkKindCapacityList: this.drinkKindCapacityList,
                        diseaseRelativeList: this.familyHistoryList,
                        riskScore: this.riskScoreInfo
                    }
                    resolve(
                        fetchDataHandle(res, {
                            diseaseArrays: 'arrToStr',
                            medicalHistory: 'arrToStr',
                            familyHistory: 'arrToStr',
                            relativeType: 'arrToStr',
                            femaleMedicalHistory: 'arrToStr',
                            medicineHistory: 'arrToStr',
                            touchHarmful: 'arrToStr',
                            dietaryHabit: 'arrToStr',
                            drinkKind: 'arrToStr',
                            specialScreenResult: 'arrToStr',
                            highItem: 'arrToStr',
                            hypertensionHighItem: 'arrToStr',
                            diabetesHighItem: 'arrToStr',
                            coronaryHighItem: 'arrToStr',
                            strokeHighItem: 'arrToStr',
                            pulmonaryHighItem: 'arrToStr',
                            nephrosisHighItem: 'arrToStr',
                            dyslipemiaHighItem: 'arrToStr'
                        })
                    )
                }).catch((e) => {
                    console.warn('FormCont error', e)
                })
            })
        }

    }

}
</script>

<style lang='less' scoped>
.title {
    font-weight: bold;
    margin-bottom: 20px;
}

.label-title {
    font-size: 13px;
    color: #595959;
    font-weight: 500;

    &::after {
        content: "*";
        color: red;
        font-weight: bold;
        margin-left: 4px;
    }
}

.no-req-label {
    font-size: 13px;
    color: #595959;
    font-weight: 500;
}

.form-input {
    padding: 8px 12px;
    border-radius: 8px;
}

.input-back {
    background: #FAFAFA;
}

.pop-title {
    color: #262626;
    font-size: 16px;
    line-height: 24px;
    font-weight: bold;
}

.checkbox-his {
    padding: 0px !important;
    margin-top: 4px;
}

.relation-bis {
    background: #F5F5F5;
    padding: 8px 12px;
    border-radius: 0px 0px 8px 8px;

    .top-title {
        color: #8C8C8C;
        font-size: 12px;
        line-height: 24px;
        margin-bottom: 4px;
    }
}

.bg-fa {
    background: #FAFAFA;
    border-radius: 8px;
    padding: 8px;
}

.bg-ff {
    background: #FFFFFF;
    border-radius: 8px;
}

.bg-f5 {
    background: #F5F5F5;
    border-radius: 8px;
    padding: 8px;
}

.doc-radio-group-now {
    column-gap: 10px;
    row-gap: 10px;
    background-color: #FAFAFA;

    .van-radio {
        background-color: #FFFFFF;
        width: 48%;
        padding: 8px 12px;
        border-radius: 8px;
        justify-content: space-between;
        margin-right: 0;
        flex-grow: 1;
    }
}

.active-drinkKind {
    //border: 1px solid var(--van-primary-color);
    background-color: #F0F6FF;
    color: var(--van-primary-color);
}

.lh-24 {
    line-height: 24px;
}

:deep(.van-popup) {
    height: 50% !important;
}

:deep(.van-cell-group--inset) {
    overflow: visible;
}

:deep(.van-cell) {
    overflow: visible;
}

:deep(.van-cell:after) {
    border-bottom: 0px;
}
</style>
