<template>
  <div class="app-container">
    <div class="div-left">
      <el-steps direction="vertical" :active="stepActive">
        <el-step v-for="(item, index) in stepArr" :key="index">
          <div slot="title" @click="stepActive = index" style="cursor: pointer">
            <a :href="`#${item}`">{{ item }}</a>
          </div>
        </el-step>
      </el-steps>
    </div>
    <div class="div-right" style="padding: 0 20px">
      <el-card class="box-card">
        <a name="基本信息"></a>
        <div class="div-title1">
          基本信息（编号：{{ form.memberId || "-" }}）
        </div>
        <div>
          <el-descriptions class="margin-top" :column="3">
            <el-descriptions-item label="姓名">{{
              form.name
            }}</el-descriptions-item>
            <el-descriptions-item label="性别">
              {{ form.gender == 0 ? "男" : "女" }}
            </el-descriptions-item>
            <el-descriptions-item label="出生日期">
              {{ parseTime(form.birthDate, "{y}-{m}-{d}") }}
            </el-descriptions-item>
            <el-descriptions-item label="年龄">
              {{ form.age }}
            </el-descriptions-item>
            <el-descriptions-item label="手机号码">
              {{ form.phone }}
            </el-descriptions-item>
            <el-descriptions-item label="门诊号/住院号">
              {{ form.visitNumber }}
            </el-descriptions-item>
            <el-descriptions-item label="门诊/住院时间">
              {{ parseTime(form.visitTime, "{y}-{m}-{d}") }}
            </el-descriptions-item>
            <el-descriptions-item label="责任医生">
              {{ form.doctor }}
            </el-descriptions-item>
            <el-descriptions-item label="建档人">
              {{ form.createBy }}
            </el-descriptions-item>
            <el-descriptions-item label="建档时间">
              {{ form.createTime }}
            </el-descriptions-item>
            <el-descriptions-item label="档案状态">
              <span :class="`status${form.status}`">{{
                status[form.status]
              }}</span>
            </el-descriptions-item>
          </el-descriptions>
        </div>
        <!-- 诊疗信息（就诊时间，主诉，既往史，体格检查） -->
        <div prop="JBXX_ZS" style="margin-top: 10px">
          <div class="div-title2">主诉</div>
          <el-input
            :disabled="form.status != 0 && form.status != 3"
            type="textarea"
            :rows="2"
            placeholder="请输入"
            v-model="detailsForm['JBXX_ZS']"
          >
          </el-input>
        </div>
        <div prop="JBXX_JWBS" style="margin-top: 20px">
          <div class="div-title2">既往病史</div>
          <el-checkbox-group v-model="detailsForm['JBXX_JWBS']">
            <el-checkbox
              :disabled="form.status != 0 && form.status != 3"
              v-for="(item, index) in pastMedicalHistory"
              :label="item"
            >
            </el-checkbox>
            <el-input
              style="margin-left: 10; width: 150px"
              :disabled="form.status != 0 && form.status != 3"
              v-model="detailsForm['JBXX_JWBS_QT']"
              placeholder="其他"
            />
          </el-checkbox-group>
        </div>
        <div prop="JBXX_TGJCJG" style="margin-top: 20px">
          <div class="div-title2">体格检查结果</div>
          <el-input
            :disabled="form.status != 0 && form.status != 3"
            type="textarea"
            :rows="2"
            placeholder="请输入"
            v-model="detailsForm['JBXX_TGJCJG']"
          >
          </el-input>
        </div>
      </el-card>

      <!-- 档案详情-->
      <el-form ref="detailsForm" :model="detailsForm" class="formStep">
        <!-- 主要诊断 -->
        <el-card class="box-card">
          <a name="主要诊断"></a>
          <div class="div-title1">主要诊断</div>
          <el-form-item prop="JBXX_ZYZD" style="margin-bottom: 0">
            <el-checkbox-group v-model="detailsForm['JBXX_ZYZD']">
              <el-checkbox
                :disabled="form.status != 0 && form.status != 3"
                v-for="(item, index) in medicalHistory"
                :label="item"
              >
              </el-checkbox>
              <el-input
                style="margin-left: 10; width: 150px"
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['JBXX_ZYZD_QT']"
                placeholder="其他"
              />
            </el-checkbox-group>
          </el-form-item>
        </el-card>

        <!-- 病情评估 -->
        <el-card class="box-card">
          <div>
            <a name="病情评估"></a>
            <div class="div-title1">病情评估</div>
            <div class="div-title2">
              人体成分分析
              <span
                @click="getHumanBody"
                class="foem-item-pg"
                :class="{
                  'item-pg-disabled': form.status != 0 && form.status != 3,
                }"
                >同步</span
              >
            </div>
          </div>
          <div class="human-body">
            <el-form-item label="体重" prop="PG_RTCF_TZ">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_TZ']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item label="去脂体重" prop="PG_RTCF_QZTZ">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_QZTZ']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item label="肌肉量" prop="PG_RTCF_JRL">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_JRL']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item label="总水分（TBW）" prop="PG_RTCF_TBW">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_TBW']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item label="蛋白质" prop="PG_RTCF_DBZ">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_DBZ']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item label="骨质" prop="PG_RTCF_GZ">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_GZ']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item label="脂肪" prop="PG_RTCF_ZF">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_ZF']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item label="体脂百分比（PBF）" prop="PG_RTCF_PBF">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_PBF']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item label="骨骼肌" prop="PG_RTCF_GGJ">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_GGJ']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item label="体质指数（BMI）" prop="PG_RTCF_BMI">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_BMI']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item label="腰臀比（WHR）" prop="PG_RTCF_WHR">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_WHR']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item label="内脏脂肪水平" prop="PG_RTCF_NZZFSP">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_NZZFSP']"
                placeholder="请输入"
              />
            </el-form-item>
            <!-- <el-form-item label="身体各成分百分比" prop="PG_RTCF_STGCFBFB">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_STGCFBFB']"
                placeholder="请输入"
              />
            </el-form-item> -->
            <el-form-item label="体型类型" prop="PG_RTCF_TXLX">
              <el-select
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_TXLX']"
                collapse-tags
                placeholder="请选择"
              >
                <el-option
                  v-for="(item, index) in systemType"
                  :key="index"
                  :label="item"
                  :value="item"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="身体年龄" prop="PG_RTCF_STNL">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_STNL']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item label="健康评分" prop="PG_RTCF_JKPF">
              <el-input
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_RTCF_JKPF']"
                placeholder="请输入"
              />
            </el-form-item>
          </div>
          <div style="height: 10px"></div>
          <a name="中医体质辨识"></a>
          <div class="div-title2">
            中医体质辨识
            <span
              v-if="userInfo.tenantId == '1902202356883206144'"
              @click="getEvaQr"
              class="foem-item-pg"
              :class="{
                'item-pg-disabled': form.status != 0 && form.status != 3,
              }"
              >二维码</span
            >
            <span
              v-if="userInfo.tenantId == '1902202356883206144'"
              @click="getEvaTb"
              class="foem-item-pg"
              :class="{
                'item-pg-disabled': form.status != 0 && form.status != 3,
              }"
              >同步</span
            >
          </div>
          <div>
            <el-form-item
              class="item-form-jjtz"
              prop="PG_TZBS_ZYTZ"
              label="主要体质"
              style="margin-bottom: 0"
            >
              <el-radio-group
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['PG_TZBS_ZYTZ']"
              >
                <el-radio
                  v-for="(item, index) in habitus"
                  :key="index"
                  :label="item"
                >
                </el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item
              class="item-form-jjtz"
              prop="PG_TZBS_JJTZ"
              label="兼夹体质"
              style="margin-bottom: 5px"
            >
              <div style="width: 100%">
                <el-checkbox-group
                  :disabled="form.status != 0 && form.status != 3"
                  v-model="detailsForm['PG_TZBS_JJTZ']"
                >
                  <el-checkbox
                    v-for="(item, index) in habitus"
                    :key="index"
                    :label="item"
                  >
                  </el-checkbox>
                </el-checkbox-group>
              </div>
            </el-form-item>
          </div>
          <div style="height: 10px"></div>
          <a name="体态评估"></a>
          <div>
            <div class="div-title2">体态评估</div>
            <div class="human-body">
              <el-form-item label="" prop="PG_TT_TAPS_DF">
                <template v-slot:label>
                  <span>TAPS体态自觉评估得分(3-15分)</span>
                  <span
                    class="foem-item-pg"
                    :class="{
                      'item-pg-disabled': form.status != 0 && form.status != 3,
                    }"
                    @click="
                      handleComponents('PG_TT_TAPS_DF', 'TAPS体态自觉评估')
                    "
                  >
                    评估
                  </span>
                </template>
                <el-input
                  :disabled="form.status != 0 && form.status != 3"
                  v-model="detailsForm['PG_TT_TAPS_DF']"
                  type="number"
                  placeholder="请输入"
                />
              </el-form-item>
              <el-form-item prop="PG_TT_TRACE_DF">
                <template v-slot:label>
                  <span>TRACE体态临床评估得分(0-11分)</span>
                  <span
                    class="foem-item-pg"
                    :class="{
                      'item-pg-disabled': form.status != 0 && form.status != 3,
                    }"
                    @click="
                      handleComponents('PG_TT_TRACE_DF', 'TRACE体态临床评估')
                    "
                  >
                    评估
                  </span>
                </template>
                <el-input
                  :disabled="form.status != 0 && form.status != 3"
                  v-model="detailsForm['PG_TT_TRACE_DF']"
                  type="number"
                  placeholder="请输入"
                />
              </el-form-item>
              <el-form-item prop="PG_TT_SRS22_DF">
                <template v-slot:label>
                  <span>SRS-22问卷评估得分(1~5分)</span>
                  <span
                    class="foem-item-pg"
                    :class="{
                      'item-pg-disabled': form.status != 0 && form.status != 3,
                    }"
                    @click="
                      handleComponents('PG_TT_SRS22_DF', 'SRS-22问卷评估')
                    "
                  >
                    评估
                  </span>
                </template>
                <el-input
                  :disabled="form.status != 0 && form.status != 3"
                  v-model="detailsForm['PG_TT_SRS22_DF']"
                  type="number"
                  placeholder="请输入"
                />
              </el-form-item>
            </div>
            <div style="height: 10px"></div>
            <div class="div-title2">失眠评估</div>
            <div class="human-body">
              <el-form-item prop="PG_SM_PHQ-9_DF">
                <template v-slot:label>
                  <span> 患者健康问卷（PHQ-9）评估得分(0-27分)</span>
                  <span
                    class="foem-item-pg"
                    :class="{
                      'item-pg-disabled': form.status != 0 && form.status != 3,
                    }"
                    @click="
                      handleComponents(
                        'PG_SM_PHQ-9_DF',
                        '患者健康问卷（PHQ-9）'
                      )
                    "
                  >
                    评估
                  </span>
                </template>
                <el-input
                  :disabled="form.status != 0 && form.status != 3"
                  v-model="detailsForm['PG_SM_PHQ-9_DF']"
                  type="number"
                  placeholder="请输入"
                />
              </el-form-item>
              <el-form-item prop="PG_SM_EPSW_DF">
                <template v-slot:label>
                  <span>Epworth嗜睡评估得分(0-24分)</span>
                  <span
                    class="foem-item-pg"
                    :class="{
                      'item-pg-disabled': form.status != 0 && form.status != 3,
                    }"
                    @click="
                      handleComponents('PG_SM_EPSW_DF', 'Epworth嗜睡评估')
                    "
                  >
                    评估
                  </span>
                </template>
                <el-input
                  :disabled="form.status != 0 && form.status != 3"
                  v-model="detailsForm['PG_SM_EPSW_DF']"
                  type="number"
                  placeholder="请输入"
                />
              </el-form-item>
              <el-form-item prop="PG_SM_PSQI_DF">
                <template v-slot:label>
                  <span>匹兹堡睡眠质量指数（PSQI）评估得分(0~21分)</span>

                  <span
                    class="foem-item-pg"
                    :class="{
                      'item-pg-disabled': form.status != 0 && form.status != 3,
                    }"
                    @click="
                      handleComponents(
                        'PG_SM_PSQI_DF',
                        '匹兹堡睡眠质量指数（PSQI）'
                      )
                    "
                  >
                    评估
                  </span>
                </template>
                <el-input
                  :disabled="form.status != 0 && form.status != 3"
                  v-model="detailsForm['PG_SM_PSQI_DF']"
                  type="number"
                  placeholder="请输入"
                />
              </el-form-item>
            </div>
            <div style="height: 10px"></div>
            <div class="div-title2">焦虑评估</div>
            <div class="human-body">
              <el-form-item prop="PG_JL_HAMD-24_DF">
                <template v-slot:label>
                  <span>汉密尔顿抑郁评估（HAMD-24）得分(0-76分)</span>
                  <span
                    class="foem-item-pg"
                    :class="{
                      'item-pg-disabled': form.status != 0 && form.status != 3,
                    }"
                    @click="
                      handleComponents(
                        'PG_JL_HAMD-24_DF',
                        '汉密尔顿抑郁评估（HAMD-24）'
                      )
                    "
                  >
                    评估
                  </span>
                </template>
                <el-input
                  :disabled="form.status != 0 && form.status != 3"
                  v-model="detailsForm['PG_JL_HAMD-24_DF']"
                  type="number"
                  placeholder="请输入"
                />
              </el-form-item>
              <el-form-item prop="PG_JL_SAS_DF">
                <template v-slot:label>
                  <span>焦虑自评（SAS）得分(0-80分)</span>
                  <span
                    class="foem-item-pg"
                    :class="{
                      'item-pg-disabled': form.status != 0 && form.status != 3,
                    }"
                    @click="handleComponents('PG_JL_SAS_DF', '焦虑自评（SAS）')"
                  >
                    评估
                  </span>
                </template>
                <el-input
                  :disabled="form.status != 0 && form.status != 3"
                  v-model="detailsForm['PG_JL_SAS_DF']"
                  type="number"
                  placeholder="请输入"
                />
              </el-form-item>
            </div>
          </div>
        </el-card>

        <!-- 治疗类型 -->
        <el-card class="box-card">
          <a name="治疗类型"></a>
          <div class="div-title1">治疗类型</div>
          <el-form-item prop="ZLFA_ZLLX" style="margin-bottom: 0">
            <el-radio-group
              :disabled="form.status != 0 && form.status != 3"
              v-model="detailsForm['ZLFA_ZLLX']"
            >
              <el-radio label="中西医结合治疗"> </el-radio>
              <el-radio label="单纯中医治疗"> </el-radio>
            </el-radio-group>
          </el-form-item>
        </el-card>

        <!-- 诊疗方法 -->
        <el-card class="box-card">
          <a name="诊疗方法"></a>
          <div style="font-size: 22px; margin-bottom: 0px" class="div-title1">
            诊疗方法
          </div>
          <div
            v-for="(i, ind) in healType"
            :key="ind"
            v-if="getzzffShow(i.title)"
          >
            <div
              class="div-title2"
              style="line-height: 36px; margin: 14px 0 0 0"
            >
              {{ i.title }}
            </div>
            <div v-for="(j, jnd) in i.list" :key="jnd">
              <div>
                <div class="div-title">{{ j.title }}</div>
                <el-radio
                  :disabled="form.status != 0 && form.status != 3"
                  border
                  v-if="k.type == 'but'"
                  v-for="(k, knd) in j.list"
                  :key="knd"
                  :label="k.value || k.title"
                  v-model="detailsForm[j.valueCode]"
                >
                </el-radio>
                <el-checkbox
                  :disabled="form.status != 0 && form.status != 3"
                  border
                  v-if="m.type == 'checkout'"
                  v-for="(m, mnd) in j.list"
                  :key="mnd"
                  v-model="detailsForm[j.valueCode]"
                  :label="m.value || m.title"
                >
                </el-checkbox>
                <el-input
                  style="width: 150px; margin: 5px"
                  v-if="j.valueCode == 'ZLFA_YW_SMZ'"
                  v-model="detailsForm['ZLFA_YW_SMZ_QT']"
                  placeholder="其他药物"
                ></el-input>
                <div
                  v-for="(o, ond) in j.list"
                  :key="ond"
                  class="human-body"
                  v-if="o.type == 'input'"
                >
                  <el-input
                    style="width: 300px; margin: 5px"
                    :disabled="form.status != 0 && form.status != 3"
                    v-model="detailsForm[j.valueCode]"
                  ></el-input>
                </div>
              </div>
              <!-- <div v-else>
                <div class="div-title">{{ j.title }}</div>
                <div style="" v-for="(k, knd) in j.list" :key="knd">
                  <div class="div-title">
                    {{ k.title }}
                  </div>
                  <el-checkbox
                    :disabled="form.status != 0 && form.status != 3"
                    border
                    v-for="(p, pnd) in k.list"
                    :key="pnd + 'c'"
                    v-if="p.type == 'checkout'"
                    v-model="detailsForm[k.valueCode]"
                    :label="p.value || p.title"
                  >
                    {{ p.value || p.title }}
                  </el-checkbox>

                  <el-radio
                    :disabled="form.status != 0 && form.status != 3"
                    border
                    v-if="l.type == 'but'"
                    v-for="(l, lnd) in k.list"
                    :key="lnd"
                    :label="p.value || p.title"
                    v-model="detailsForm[k.valueCode]"
                  >
                  </el-radio>
                  <div
                    v-for="(o, ond) in k.list"
                    :key="ond"
                    class="human-body"
                    v-if="o.type == 'input'"
                  >
                    <el-input
                      style="width: 300px; margin: 5px"
                      :disabled="form.status != 0 && form.status != 3"
                      v-model="detailsForm[k.valueCode]"
                    ></el-input>
                  </div>
                </div>
              </div> -->
            </div>
          </div>
        </el-card>

        <!-- 治疗效果 -->
        <el-card class="box-card">
          <a name="治疗效果"></a>
          <div class="div-title1">治疗效果</div>
          <div>
            <el-form-item prop="ZLFA_ZLXG" style="margin-bottom: 0">
              <el-radio-group
                :disabled="form.status != 0 && form.status != 3"
                v-model="detailsForm['ZLFA_ZLXG']"
              >
                <el-radio label="治愈"> </el-radio>
                <el-radio label="显效"> </el-radio>
                <el-radio label="好转"> </el-radio>
                <el-radio label="无效"> </el-radio>
              </el-radio-group>
            </el-form-item>
          </div>
        </el-card>
        <!-- 不良事件 -->
        <el-card class="box-card">
          <a name="治疗过程"></a>
          <div class="div-title1">治疗过程</div>
          <div class="div-title2">不良事件</div>
          <div>
            <el-form-item prop="ZLGC_BLSJ">
              <el-checkbox-group v-model="detailsForm['ZLGC_BLSJ']">
                <el-checkbox
                  :disabled="form.status != 0 && form.status != 3"
                  v-for="(item, index) in adverse"
                  :label="item"
                >
                </el-checkbox>
                <el-input
                  style="margin-left: 10; width: 150px"
                  :disabled="form.status != 0 && form.status != 3"
                  v-model="detailsForm['ZLGC_BLSJ_QT']"
                  placeholder="其他"
                />
              </el-checkbox-group>
            </el-form-item>
          </div>
          <div class="div-title2">并发症</div>
          <div>
            <el-form-item prop="ZLGC_BFZ" style="margin-bottom: 0">
              <el-checkbox-group v-model="detailsForm['ZLGC_BFZ']">
                <el-checkbox
                  :disabled="form.status != 0 && form.status != 3"
                  v-for="(item, index) in complication"
                  :label="item"
                >
                </el-checkbox>
                <el-input
                  style="margin-left: 10; width: 150px"
                  :disabled="form.status != 0 && form.status != 3"
                  v-model="detailsForm['ZLGC_BFZ_QT']"
                  placeholder="其他"
                />
              </el-checkbox-group>
            </el-form-item>
          </div>
        </el-card>
        <!-- 诊疗费用 -->
        <el-card class="box-card">
          <a name="诊疗费用"></a>
          <div class="div-title1">诊疗费用</div>
          <el-form-item
            label="总体费用按照区间进行选择"
            prop="ZLFA_ZTFY"
            class="div-zlfy-label"
          >
            <el-radio-group
              :disabled="form.status != 0 && form.status != 3"
              v-model="detailsForm['ZLFA_ZTFY']"
            >
              <el-radio label="<300元" value="<300元"> </el-radio>
              <el-radio label="300 ~ 900元" value="<300元"> </el-radio>
              <el-radio label="900 ~ 2000元" value="<300元"> </el-radio>
              <el-radio label="2000 ~ 5000元" value="<300元"> </el-radio>
              <el-radio label=">5000元" value="<300元"> </el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item
            label="检查费用按照区间进行选择"
            prop="ZLFA_JCFY"
            class="div-zlfy-label"
          >
            <el-radio-group
              :disabled="form.status != 0 && form.status != 3"
              v-model="detailsForm['ZLFA_JCFY']"
            >
              <el-radio label="<300元"> </el-radio>
              <el-radio label="300 ~ 900元"> </el-radio>
              <el-radio label="900 ~ 2000元"> </el-radio>
              <el-radio label="2000 ~ 5000元"> </el-radio>
              <el-radio label=">5000元"> </el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item
            label="中医治疗费用按照区间进行选择"
            prop="ZLFA_ZYZLFY"
            class="div-zlfy-label"
          >
            <el-radio-group
              :disabled="form.status != 0 && form.status != 3"
              v-model="detailsForm['ZLFA_ZYZLFY']"
            >
              <el-radio label="<300元"> </el-radio>
              <el-radio label="300 ~ 900元"> </el-radio>
              <el-radio label="900 ~ 2000元"> </el-radio>
              <el-radio label="2000 ~ 5000元"> </el-radio>
              <el-radio label=">5000元"> </el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item
            label="药物费用按照区间进行选择"
            prop="ZLFA_YWFY"
            class="div-zlfy-label"
          >
            <el-radio-group
              :disabled="form.status != 0 && form.status != 3"
              v-model="detailsForm['ZLFA_YWFY']"
            >
              <el-radio label="<300元"> </el-radio>
              <el-radio label="300 ~ 900元"> </el-radio>
              <el-radio label="900 ~ 2000元"> </el-radio>
              <el-radio label="2000 ~ 5000元"> </el-radio>
              <el-radio label=">5000元"> </el-radio>
            </el-radio-group>
          </el-form-item>
        </el-card>
        <!-- 随访队列 -->
        <el-card class="box-card">
          <a name="随访队列"></a>
          <div class="div-title1" style="margin-bottom: 18px">随访队列</div>
          <div style="width: 360px">
            <!-- collapse-tags -->
            <el-select
              :disabled="form.status != 0 && form.status != 3"
              v-model="detailsForm['SFDL']"
              multiple
              placeholder="请选择"
            >
              <el-option
                v-for="item in followupList"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </div>
        </el-card>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button
          :disabled="form.status != 0 && form.status != 3"
          style="width: 200px; margin: 50px 0 20px 0"
          type="primary"
          @click="submitDetailsForm"
          >确 定</el-button
        >
      </div>
    </div>
    <!-- 动态量表组件框 -->
    <el-dialog
      class="popup"
      :title="title"
      :visible.sync="open"
      width="1200px"
      append-to-body
    >
      <component
        @getScaleResult="getScaleResult"
        :scaleCode="scaleCode"
        class="popup-module"
        :is="componentsCode"
      ></component>
    </el-dialog>
    <!-- 人体成分报告 -->
    <el-dialog
      class="popup"
      title="人体成分报告"
      :visible.sync="humanBodyOpen"
      width="640px"
      append-to-body
    >
      <img width="560" :src="selectReportUrl" />
    </el-dialog>
    <el-dialog
      class="popup"
      title="中医体质辨识测评二维码"
      :visible.sync="zytzOpen"
      width="540px"
      append-to-body
    >
      <div>
        <img width="500" :src="pathUrl" />
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  queryRecord,
  saveAidRecord,
  selectByMemberId,
  selectReportByMemberId,
  zytzQrcode,
  evaResult,
} from "@/api/medicalFile";
import { followupQuery } from "@/api/followupFile";
// 体态评估
import TAPS from "./components/posture/TAPS"; // TAPS体态自觉评估
import TRACE from "./components/posture/TRACE"; // TRACE体态临床评估
import SRS22 from "./components/posture/SRS22"; // SRS-22问卷评估
// 失眠评估
import PHQ from "./components/insomnia/PHQ-9"; // 患者健康问卷（PHQ-9）
import epworth from "./components/insomnia/epworth"; // Epworth嗜睡评估
import PSQI from "./components/insomnia/PSQI"; // 匹兹堡睡眠质量指数（PSQI）
// 焦虑评估
import HAMD24 from "./components/anxiety/HAMD"; // 汉密尔顿抑郁量表（HAMD-24）
import SAS from "./components/anxiety/SAS"; // 焦虑自评量表
export default {
  name: "Notice",
  components: {
    PHQ,
    epworth,
    PSQI,
    HAMD24,
    SAS,
    TAPS,
    TRACE,
    SRS22,
  },
  data() {
    return {
      userInfo: {}, // 用户信息
      zytzOpen: false,
      pathUrl: "",
      followupList: [],
      title: "", // 弹出框标题
      open: false, // 是否显示弹出框
      status: {
        0: "保存",
        1: "待审核",
        2: "通过",
        3: "驳回",
      },
      // 既往病史
      pastMedicalHistory: [
        "高血压",
        "冠心病",
        "心绞痛",
        "心肌梗死病史",
        "心力衰竭",
        "心律失常",
        "哮喘",
        "慢性阻塞性肺疾病",
        "肺结核（活动期或陈旧性）",
        "胃溃疡",
        "十二指肠溃疡",
        "肝炎（类型及状态）",
        "肝硬化",
        "胆结石",
        "胆囊炎",
        "慢性肠炎",
        "肾炎",
        "肾结石",
        "肾功能不全",
        "前列腺疾病",
        "妇科疾病",
        "糖尿病",
        "甲状腺疾病（甲亢、甲减、甲状腺结节等）",
        "癫痫",
        "中风病史（脑梗塞、脑出血）及后遗症",
        "帕金森病",
      ],
      // 量表组件集合
      component: {
        // 体态评估
        PG_TT_TAPS_DF: "TAPS",
        PG_TT_TRACE_DF: "TRACE",
        PG_TT_SRS22_DF: "SRS22",
        // 失眠评估
        "PG_SM_PHQ-9_DF": "PHQ", // 患者健康问卷（PHQ-9）
        PG_SM_EPSW_DF: "epworth", // Epworth嗜睡评估
        PG_SM_PSQI_DF: "PSQI", // 匹兹堡睡眠质量指数（PSQI）
        // 焦虑评估
        "PG_JL_HAMD-24_DF": "HAMD24", // 汉密尔顿抑郁评估（HAMD-24）
        PG_JL_SAS_DF: "SAS", // 焦虑自评（SAS）
      },
      componentsCode: "", // 量表组件code
      scaleCode: "", // 量表code
      stepActive: 0,
      // 不良事件
      adverse: [
        "局部出血/血肿",
        "晕针",
        "‌断针/滞针",
        "局部疼痛或酸胀‌",
        "过敏反应",
      ],
      // 并发症
      complication: [
        "局部化脓性感染‌",
        "深部组织感染",
        "神经损伤",
        "内脏穿孔",
        "血管损伤",
        "‌脓毒血症",
        "臂丛神经损伤‌",
      ],
      stepArr: [
        "基本信息",
        "主要诊断",
        "病情评估",
        "治疗类型",
        "诊疗方法",
        "治疗效果",
        "治疗过程",
        "诊疗费用",
        "随访队列",
      ],
      // 现病史
      medicalHistory: [
        "肥胖症",
        "失眠病",
        "中风病",
        "面瘫病",
        "项痹病",
        "腰痛病",
        "痉挛性斜颈",
      ],
      // 体型类型
      systemType: [
        "隐形肥胖型",
        "脂肪过多型",
        "肥胖型",
        "肌肉不足型",
        "健康匀称型",
        "超重肌肉型",
        "消瘦型",
        "低脂肪型",
        "运动员型",
      ],
      // 体质辨识
      habitus: [
        "平和质",
        "气虚质",
        "阳虚质",
        "阴虚质",
        "痰湿质",
        "湿热质",
        "血瘀质",
        "气郁质",
        "特禀质",
      ],
      // 治疗类型
      healType: [
        {
          title: "肥胖症",
          list: [
            {
              title: "行为心理干预",
              valueCode: "ZLFA_XWXLGY",
              list: [
                {
                  title:
                    "行为技能训练：辅导有效的应对压力技巧，避免因情绪波动导致过度进食，训练正念饮食，提高对饥饿和饱足感的感知能力",
                  value: "行为技能训练",
                  type: "checkout",
                },
                {
                  title:
                    "目标设定与追踪：与患者共同设立短期和长期减重目标，定期进行进度评估，强化正面反馈，提高自我管理能力",
                  value: "目标设定与追踪",
                  type: "checkout",
                },
              ],
            },
            {
              title: "运动干预",
              valueCode: "ZLFA_YDGY",
              list: [
                {
                  title:
                    "有氧运动：如快走、慢跑、游泳等，建议每周至少进行150分钟中等强度的有氧运动",
                  value: "有氧运动",
                  type: "checkout",
                },
                {
                  title:
                    "抗阻运动：如举重、俯卧撑等，建议每周进行2-3次抗阻运动",
                  value: "抗阻运动",
                  type: "checkout",
                },
              ],
            },
            {
              title: "临床营养治疗",
              valueCode: "ZLFA_LCYYZL",
              list: [
                {
                  title:
                    "限能量饮食：在限制能量摄入（日常饮食能量减去30%）的基础上，营养素比例符合平衡膳食的要求",
                  value: "限能量饮食",
                  type: "checkout",
                },
                {
                  title: "高蛋白饮食：每日蛋白质摄入量超过20%，但一般不高于35%",
                  value: "高蛋白饮食",
                  type: "checkout",
                },
                {
                  title: "低碳水化合物饮食：碳水化合物供能比一般在20%-40%",
                  value: "低碳水化合物饮食",
                  type: "checkout",
                },
                {
                  title:
                    "断食：如5+2模式，1周中5天相对正常进食，其他2天摄取平常的1/4能量",
                  value: "断食",
                  type: "checkout",
                },
              ],
            },
            {
              title: "针灸疗法",
              valueCode: "ZLFA_ZJ_LF",
              list: [
                {
                  title: "毫针/电针疗法",
                  type: "checkout",
                },
                {
                  title: "温针疗法",
                  type: "checkout",
                },
                {
                  title: "耳穴贴压疗法",
                  type: "checkout",
                },
                {
                  title: "穴位埋针法",
                  type: "checkout",
                },
                {
                  title: "穴位埋线法",
                  type: "checkout",
                },
              ],
            },
            {
              title: "针灸穴位",
              valueCode: "ZLFA_ZJ_XW",
              list: [
                {
                  title: "神门：安神定志，改善睡眠质量",
                  value: "神门",
                  type: "checkout",
                },
                {
                  title: "三阴交：调理脾胃，养血安神",
                  value: "三阴交",
                  type: "checkout",
                },
                {
                  title: "百会：调节大脑功能，促进睡眠",
                  value: "百会",
                  type: "checkout",
                },
                {
                  title: "安眠：直接作用于睡眠中枢，帮助入睡",
                  value: "安眠",
                  type: "checkout",
                },
              ],
            },
            {
              title: "药物治疗",
              valueCode: "ZLFA_YW",
              list: [
                {
                  title: "奥利司他：通过抑制胃肠道脂肪酶，减少脂肪吸收",
                  value: "奥利司他",
                  type: "checkout",
                },
                {
                  title: "利拉鲁肽：GLP-1受体激动剂，延缓胃排空，增加饱腹感",
                  value: "利拉鲁肽",
                  type: "checkout",
                },
                {
                  title: "贝那鲁肽：GLP-1受体激动剂，作用机制与利拉鲁肽类似",
                  value: "贝那鲁肽",
                  type: "checkout",
                },
                {
                  title:
                    "司美格鲁肽：GLP-1受体激动剂，每周一次给药，减重效果显著",
                  value: "司美格鲁肽",
                  type: "checkout",
                },
                {
                  title: "替尔泊肽：GLP-1受体激动剂，适用于肥胖症治疗",
                  value: "替尔泊肽",
                  type: "checkout",
                },
              ],
            },
          ],
        },
        {
          title: "失眠症",
          list: [
            {
              title: "生活习惯",
              valueCode: "ZLFA_SHXG",
              list: [
                {
                  title:
                    "科学膳食：避免午后摄入咖啡、茶、酒精等刺激性饮品，以及睡前过度进食",
                  value: "科学膳食",
                  type: "checkout",
                },
                {
                  title:
                    "充足日照：增加日间自然光照，减少夜间人工光源，特别是电子产品的使用",
                  value: "充足日照",
                  type: "checkout",
                },
                {
                  title:
                    "合理运动：推荐瑜伽、太极拳、八段锦等传统运动，有助于改善睡眠质量",
                  value: "合理运动",
                  type: "checkout",
                },
              ],
            },
            {
              title: "心理调适",
              valueCode: "ZLFA_XLTS",
              list: [
                {
                  title:
                    "放松训练：包括渐进式肌肉放松训练、腹式呼吸、冥想等，可降低紧张与过度警觉，提高睡眠质量",
                  value: "放松训练",
                  type: "checkout",
                },
                {
                  title:
                    "音乐疗法：轻柔舒缓的音乐可以降低神经系统兴奋性，减轻焦虑情绪从而改善睡眠",
                  value: "音乐疗法",
                  type: "checkout",
                },
                {
                  title:
                    "认知调整：不灾难化和过分关注失眠，不因偶尔失眠而产生挫败感，培养失眠的耐受性",
                  value: "认知调整",
                  type: "checkout",
                },
              ],
            },
            {
              title: "针灸疗法",
              valueCode: "ZLFA_ZJ_LF_SMZ",
              list: [
                {
                  title: "毫针/电针疗法",
                  type: "checkout",
                },
                {
                  title: "温针疗法",
                  type: "checkout",
                },
                {
                  title: "耳穴贴压疗法",
                  type: "checkout",
                },
                {
                  title: "穴位埋针法",
                  type: "checkout",
                },
                {
                  title: "穴位埋线法",
                  type: "checkout",
                },
              ],
            },
            {
              title: "针灸穴位",
              valueCode: "ZLFA_ZJ_XW_SMZ",
              list: [
                {
                  title: "神门：安神定志，改善睡眠质量",
                  value: "神门",
                  type: "checkout",
                },
                {
                  title: "三阴交：调理脾胃，养血安神",
                  value: "三阴交",
                  type: "checkout",
                },
                {
                  title: "百会：调节大脑功能，促进睡眠",
                  value: "百会",
                  type: "checkout",
                },
                {
                  title: "安眠：直接作用于睡眠中枢，帮助入睡",
                  value: "安眠",
                  type: "checkout",
                },
              ],
            },
            {
              title: "药物治疗",
              valueCode: "ZLFA_YW_SMZ",
              list: [
                {
                  title:
                    "苯二氮䓬受体激动剂（BZRAs）：艾司唑仑、阿普唑仑、劳拉西泮等",
                  value: "苯二氮䓬受体激动剂（BZRAs）",
                  type: "checkout",
                },
                {
                  title:
                    "非苯二氮䓬类药物（non-BZDs）：唑吡坦、扎来普隆、右佐匹克隆、佐匹克隆",
                  value: "非苯二氮䓬类药物（non-BZDs）",
                  type: "checkout",
                },
                {
                  title: "褪黑素和褪黑素受体激动剂：调节生物钟，改善睡眠",
                  value: "褪黑素和褪黑素受体激动剂",
                  type: "checkout",
                },
                {
                  title:
                    "抗抑郁药物：具有镇静作用的抗抑郁药物，如曲唑酮、米氮平等，可用于失眠伴抑郁症状的患者",
                  value: "抗抑郁药物",
                  type: "checkout",
                },
                // {
                //   title:
                //     "其他药物：选择性食欲素受体拮抗剂苏沃雷生，可用于改善睡眠质量",
                //   value: "其他药物",
                //   type: "checkout",
                // },
              ],
            },
          ],
        },
        {
          title: "其他",
          list: [
            {
              title: "针灸疗法",
              valueCode: "ZLFA_ZJ_LF_QT",
              list: [
                {
                  title: "毫针/电针疗法",
                  type: "checkout",
                },
                {
                  title: "温针疗法",
                  type: "checkout",
                },
                {
                  title: "耳穴贴压疗法",
                  type: "checkout",
                },
                {
                  title: "穴位埋针法",
                  type: "checkout",
                },
                {
                  title: "穴位埋线法",
                  type: "checkout",
                },
              ],
            },
            {
              title: "针灸穴位",
              valueCode: "ZLFA_ZJ_XW_QT",
              list: [
                {
                  title: "填写",
                  type: "input",
                },
              ],
            },
            {
              title: "药物治疗",
              valueCode: "ZLFA_YW_QT",
              list: [
                {
                  title: "填写",
                  type: "input",
                },
              ],
            },
          ],
        },
      ],
      form: {},
      detailsForm: {
        JBXX_ZYZD: [], //主要诊断
        JBXX_ZYZD_QT: "", //主要诊断_其他
        PG_RTCF_TZ: "", //体重
        PG_RTCF_QZTZ: "", //去脂体重
        PG_RTCF_JRL: "", //肌肉量
        PG_RTCF_TBW: "", //总水分（TBW）
        PG_RTCF_DBZ: "", //蛋白质
        PG_RTCF_GZ: "", //骨质量（GZ）
        G_RTCF_ZF: "", //脂肪
        PG_RTCF_PBF: "", //体脂百分比
        PG_RTCF_GGJ: "", //骨骼肌
        PG_RTCF_BMI: "", //体质指数（BMI）
        PG_RTCF_WHR: "", //腰臀比（WHR）
        PG_RTCF_NZZFSP: "", //内脏脂肪水平
        PG_RTCF_STGCFBFB: "", //身体成分脂肪百分比
        PG_RTCF_TXLX: "", //体型类型
        PG_RTCF_STNL: "", //身体年龄
        PG_RTCF_JKPF: "", //健康评分
        PG_TZBS_ZYTZ: "", //主要体质
        PG_TZBS_JJTZ: [], //兼夹体质
        PG_TT_TAPS_DF: "", //体型评分（TAPS）得分
        PG_TT_TRACE_DF: "", //体型评分（TRACE）得分
        PG_TT_SRS22_DF: "", //体型评分（SRS-22）得分
        "PG_SM_PHQ-9_DF": "", // 患者健康问卷（PHQ-9）评估得分
        PG_SM_EPSW_DF: "", //Epworth嗜睡评估得分
        PG_SM_PSQI_DF: "", //匹兹堡睡眠质量指数（PSQI）评估得分
        "PG_JL_HAMD-24_DF": "", //汉密尔顿抑郁评估（HAMD-24）得分
        PG_JL_SAS_DF: "", //焦虑自评量表（SAS）得分
        ZLFA_ZLLX: "", //治疗方式
        ZLFA_XWXLGY: [], // 行为心理干预
        ZLFA_YDGY: [], //运动干预
        ZLFA_ZJ_LF: [], //针灸疗法-疗法
        ZLFA_ZJ_XW: [], //针灸疗法-穴位
        ZLFA_YW: [], //药物治疗
        ZLFA_SHXG: [], // 生活习惯
        ZLFA_XLTS: [], //心理调适

        ZLFA_LCYYZL: [], //临床用药治疗
        ZLFA_ZJ_LF_SMZ: [], // 失眠症-针灸疗法-疗法
        ZLFA_ZJ_XW_SMZ: [], // 失眠症-针灸疗法-穴位
        ZLFA_YW_SMZ: [], // 失眠症-药物治疗
        ZLFA_YW_SMZ_QT: "", // 失眠症-药物治疗-其他
        ZLFA_ZJ_LF_QT: [], // 其他-针灸疗法-疗法
        ZLFA_ZJ_XW_QT: "", // 其他-针灸疗法-穴位
        ZLFA_YW_QT: "", // 其他-药物治疗

        ZLGC_BLSJ: [], // 不良事件
        ZLGC_BLSJ_QT: "", // 不良事件_其他
        ZLGC_BFZ: [], // 并发症
        ZLGC_BFZ_QT: "", // 并发症_其他

        JBXX_ZS: "", //主诉
        JBXX_JWBS: [], // 既往病史
        JBXX_JWBS_QT: "", // 既往病史_其他
        JBXX_TGJCJG: "", // 体格检查结果

        SFDL: [], //随访队列
      }, // 档案详情表单
      qzUrl: process.env.VUE_APP_API_QZURL, // 二维码路径
      selectReportUrl: "",
      humanBodyOpen: false,
    };
  },
  created() {
    this.form = JSON.parse(this.$route.query.data);
    let treatmentId = this.$route.query.treatmentId;
    this.treatmentId = treatmentId;
    this.handleDetails(treatmentId);
    this.getFollowupQuery(); // 获取随访队列信息

    this.userInfo = JSON.parse(localStorage.getItem("user"));
  },
  methods: {
    // 中医体质辨识测评二维码
    getEvaQr() {
      zytzQrcode({
        param: {
          id: this.form.id,
          // rewrite: 1,
          path: `${process.env.VUE_APP_VISIT_URL}medicalEva?id=${this.form.id}&name=${this.form.name}&phone=${this.form.phone}&tenantId=${this.userInfo.tenantId}`,
        },
      }).then((res) => {
        this.zytzOpen = true;
        this.pathUrl = this.qzUrl + res.data;
      });
    },
    // 中医体质辨识测评结果同步
    getEvaTb() {
      evaResult({ param: { evaId: this.form.id } }).then((res) => {
        if (!res.data) {
          this.$modal.msgError("暂无结果");
          return;
        }
        this.$modal.msgSuccess("同步成功");
        let result1 = res.data.result1;
        let result2 = res.data.result2;
        const zytz = this.extractConstitutionTypes(result1);
        const jjtz = this.extractConstitutionTypes(result2);
        this.detailsForm.PG_TZBS_ZYTZ = zytz.join(","); // 主要体质
        this.detailsForm.PG_TZBS_JJTZ = jjtz; // 兼夹体质
      });
    },
    extractConstitutionTypes(comment) {
      const regex = /【(.*?)】/g;
      const matches = [];
      let match;
      while ((match = regex.exec(comment)) !== null) {
        matches.push(match[1]);
      }
      return matches;
    },
    // 人体成分报告
    getHumanBodyReport() {
      selectReportByMemberId({
        memberId: this.form.visitNumber,
      }).then((res) => {
        if (!res.data.id) {
          this.$modal.msgError("暂无报告");
          return;
        }
        this.humanBodyOpen = true;
        this.selectReportUrl = `${this.qzUrl}${res.data.fileName}`;
      });
    },
    // 查询人体成分
    getHumanBody() {
      selectByMemberId({
        id: this.form.id,
      }).then((res) => {
        if (!res.data.id) {
          this.$modal.msgError("暂无数据");
          return;
        }
        this.$modal.msgSuccess("同步成功");
        const {
          weight, //体重
          fat, //脂肪
          bone, //骨质
          protein, //蛋白质
          water, //水分
          muscle, //肌肉
          smm, //骨骼肌
          pbf, //体脂百分比
          bmi, //体质指数
          whr, //腰臀比（2位小数）
          vfi, //内脏脂肪指数
          bodyAge, //身体年龄
          score, //健康评分
          bodyType, //体型判定
          lbm, //瘦体重（去脂体重）
        } = res.data;

        console.log("人体成分");

        this.detailsForm.PG_RTCF_TZ = weight; // 体重
        this.detailsForm.PG_RTCF_QZTZ = lbm; // 去脂体重
        this.detailsForm.PG_RTCF_JRL = muscle; // 肌肉量
        this.detailsForm.PG_RTCF_TBW = water; // 总水分（TBW）
        this.detailsForm.PG_RTCF_DBZ = protein; // 蛋白质
        this.detailsForm.PG_RTCF_GZ = bone; // 骨质量（GZ）
        this.detailsForm.PG_RTCF_ZF = fat; // 脂肪
        this.detailsForm.PG_RTCF_PBF = pbf; // 体脂百分比
        this.detailsForm.PG_RTCF_GGJ = smm; //骨骼肌
        this.detailsForm.PG_RTCF_BMI = bmi; // 体质指数（BMI）
        this.detailsForm.PG_RTCF_WHR = whr; // 腰臀比（WHR）
        this.detailsForm.PG_RTCF_NZZFSP = vfi; // 内脏脂肪水平
        // this.detailsForm.PG_RTCF_STGCFBFB = ""; // 身体各成分百分比
        this.detailsForm.PG_RTCF_TXLX = bodyType; // 体型类型
        this.detailsForm.PG_RTCF_STNL = bodyAge; // 身体年龄
        this.detailsForm.PG_RTCF_JKPF = score; // 健康评分
      });
    },
    // 判断是否显示诊疗方法
    getzzffShow(_title) {
      const { JBXX_ZYZD, JBXX_ZYZD_QT } = this.detailsForm;
      if (_title == "肥胖症" && JBXX_ZYZD.includes("肥胖症")) {
        return true;
      }
      if (_title == "失眠症" && JBXX_ZYZD.includes("失眠病")) {
        return true;
      }
      if (_title == "其他") {
        let flat = false;
        JBXX_ZYZD.forEach((item) => {
          if (item != "肥胖症" && item != "失眠病") {
            flat = true;
          }
        });
        if (JBXX_ZYZD_QT) {
          return true;
        }
        return flat;
      }
      return false;
    },
    // 获取随访队列信息
    getFollowupQuery() {
      followupQuery({
        pageNum: -1,
        param: {
          status: 1,
        },
      }).then((res) => {
        this.followupList = res.data.list;
        let commonQueue = JSON.parse(localStorage.getItem("commonQueue"));
        commonQueue?.forEach((i) => {
          this.followupList.unshift(i);
        });
      });
    },
    // 获取子组件量表结果
    getScaleResult(_scaleResult, _code) {
      this.detailsForm[_code] = String(_scaleResult);
      this.open = false; // 关闭弹出框
    },
    // 动态组件code
    handleComponents(_code, _title) {
      this.componentsCode = this.component[_code]; // 动态组件code
      this.scaleCode = _code; // 量表code
      this.open = true; // 打开弹出框
      this.title = _title; // 弹出框标题
    },
    /** 详情按钮操作 */
    handleDetails(treatmentId) {
      this.getDetailsForm(); //重置详情表单
      // this.form = JSON.parse(JSON.stringify(row));
      queryRecord({
        treatmentId: treatmentId,
      }).then((res) => {
        let arrList = [
          "JBXX_ZYZD",
          "PG_TZBS_JJTZ",
          "SFDL",
          "ZLFA_ZJ_LF",
          "ZLFA_ZJ_XW",
          "ZLFA_YW",
          "ZLFA_ZJ_LF_SMZ",
          "ZLFA_ZJ_XW_SMZ",
          "ZLFA_YW_SMZ",
          "ZLFA_ZJ_LF_QT",
          "ZLFA_XWXLGY",
          "ZLFA_YDGY",
          "ZLFA_LCYYZL",
          "ZLFA_SHXG",
          "ZLFA_XLTS",
          "ZLGC_BLSJ",
          "ZLGC_BFZ",
          "JBXX_JWBS",
        ];
        let recordValDict = res.data.recordValDict;
        for (let key in recordValDict) {
          if (arrList.includes(key)) {
            recordValDict[key] = recordValDict[key][0].answer;
          } else {
            recordValDict[key] = recordValDict[key][0].answer.join(",");
          }
        }
        this.detailsForm = {
          ...this.detailsForm,
          ...recordValDict,
        };
        console.log(" this.detailsForm", this.detailsForm);

        this.drawer = true;
        this.title = "诊疗档案详情";
      });
    },
    // 诊疗方案点击
    handleButClick(_item, _row) {
      // 待审核、通过状态下不允许修改
      if (this.form.status == 1 || this.form.status == 2) {
        return;
      }
      this.detailsForm[_item.valueCode] = _row.value || _row.title;
    },
    getDetailsForm() {
      this.detailsForm = {
        JBXX_ZYZD: [], //主要诊断
        JBXX_ZYZD_QT: "", //主要诊断_其他
        PG_RTCF_TZ: "", //体重
        PG_RTCF_QZTZ: "", //去脂体重
        PG_RTCF_JRL: "", //肌肉量
        PG_RTCF_TBW: "", //总水分（TBW）
        PG_RTCF_DBZ: "", //蛋白质
        PG_RTCF_GZ: "", //骨质量（GZ）
        G_RTCF_ZF: "", //脂肪
        PG_RTCF_PBF: "", //体脂百分比
        PG_RTCF_GGJ: "", //骨骼肌
        PG_RTCF_BMI: "", //体质指数（BMI）
        PG_RTCF_WHR: "", //腰臀比（WHR）
        PG_RTCF_NZZFSP: "", //内脏脂肪水平
        PG_RTCF_STGCFBFB: "", //身体各成分百分比
        PG_RTCF_TXLX: "", //体型类型
        PG_RTCF_STNL: "", //身体年龄
        PG_RTCF_JKPF: "", //健康评分
        PG_TZBS_ZYTZ: "", //主要体质
        PG_TZBS_JJTZ: [], //兼夹体质
        PG_TT_TAPS_DF: "", //体型评分（TAPS）得分
        PG_TT_TRACE_DF: "", //体型评分（TRACE）得分
        PG_TT_SRS22_DF: "", //体型评分（SRS-22）得分
        "PG_SM_PHQ-9_DF": "", // 患者健康问卷（PHQ-9）评估得分
        PG_SM_EPSW_DF: "", //Epworth嗜睡评估得分
        PG_SM_PSQI_DF: "", //匹兹堡睡眠质量指数（PSQI）评估得分
        "PG_JL_HAMD-24_DF": "", //汉密尔顿抑郁评估（HAMD-24）得分
        PG_JL_SAS_DF: "", //焦虑自评量表（SAS）得分
        ZLFA_ZLLX: "", //治疗方式
        ZLFA_XWXLGY: [], // 行为心理干预
        ZLFA_YDGY: [], //运动干预
        ZLFA_ZJ_LF: [], //针灸疗法-疗法
        ZLFA_ZJ_XW: [], //针灸疗法-穴位
        ZLFA_YW: [], //药物治疗
        ZLFA_SHXG: [], // 生活习惯
        ZLFA_XLTS: [], //心理调适

        ZLFA_LCYYZL: [], //临床用药治疗
        ZLFA_ZJ_LF_SMZ: [], // 失眠症-针灸疗法-疗法
        ZLFA_ZJ_XW_SMZ: [], // 失眠症-针灸疗法-穴位
        ZLFA_YW_SMZ: [], // 失眠症-药物治疗
        ZLFA_YW_SMZ_QT: "", // 失眠症-药物治疗-其他
        ZLFA_ZJ_LF_QT: [], // 其他-针灸疗法-疗法
        ZLFA_ZJ_XW_QT: "", // 其他-针灸疗法-穴位
        ZLFA_YW_QT: "", // 其他-药物治疗

        ZLGC_BLSJ: [], // 不良事件
        ZLGC_BLSJ_QT: "", // 不良事件_其他
        ZLGC_BFZ: [], // 并发症
        ZLGC_BFZ_QT: "", // 并发症_其他

        BXX_ZS: "", //主诉
        JBXX_JWBS: [], // 既往病史
        JBXX_JWBS_QT: "", // 既往病史_其他
        JBXX_TGJCJG: "", // 体格检查结果

        SFDL: [], //随访队列
      };
    },

    submitDetailsForm: function () {
      this.$refs["detailsForm"].validate((valid) => {
        if (valid) {
          let codeAndAnswerList = [];
          for (let key in this.detailsForm) {
            let data = {
              questionCode: key,
              answer: "",
            };
            if (typeof this.detailsForm[key] === "string") {
              data.answer = this.detailsForm[key].split(",");
            } else {
              data.answer = this.detailsForm[key];
            }
            codeAndAnswerList.push(data);
          }

          saveAidRecord({
            treatmentId: this.form.id,
            codeAndAnswerList,
          }).then((response) => {
            this.handleDetails(this.treatmentId);
            this.$modal.msgSuccess("保存成功");
          });
        }
      });
    },
  },
};
</script>
<style scoped src="@/assets/styles/common.css"></style>
<!-- box-shadow: 0 2px 12px 0 rgba(0,0,0,.1); -->
<style scoped>
.div-zlfy-label {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.div-zlfy-label >>> .el-form-item__label {
  width: 210px;
}
.div-title {
  font-weight: bold;
  vertical-align: middle;
  font-size: 14px;
  color: #606266;
  line-height: 26px;
  -webkit-box-sizing: border-box;
}
>>> .el-radio {
  padding: 0 10px !important;
  line-height: 34px;
  margin: 5px !important;
}
>>> .el-checkbox {
  padding: 0 10px !important;
  line-height: 34px;
  margin: 5px !important;
}
.box-card {
  margin-bottom: 16px;
}
.status1 {
  color: orange;
}
.status2 {
  color: green;
}
.status3 {
  color: red;
}
>>> .el-dialog__header {
  text-align: center;
  font-weight: bold;
}
.item-form-jjtz >>> .el-form-item__label {
  width: 100%;
}

>>> .el-form-item__label {
  display: flex !important;
}
>>> .el-form-item__label > span {
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  height: 36px;
}
.foem-item-pg {
  color: blue;
  border-bottom: 1px solid blue;
  cursor: pointer;
  position: relative;
  z-index: 9;
  margin-left: 5px;
  height: 28px !important;
}
.item-pg-disabled {
  color: #0000ff75;
  border-bottom: 1px solid #0000ff75;
  pointer-events: none;
}
.app-container {
  display: flex;
}
.app-container .div-left {
  width: 210px;
  flex-shrink: 0;
  border-right: 1px solid #d8d8d8;
}
.app-container .div-right {
  flex: 1;
  height: calc(100vh - 100px);
  overflow: scroll;
}
.div-border {
  border-bottom: 1px solid #d8d8d8;
}
.div-bot20 {
  margin-bottom: 20px;
}
.div-bot10 {
  margin-bottom: 10px;
}
.div-pad20 {
  padding-bottom: 20px;
}
.div-pad10 {
  padding-bottom: 10px;
}
.div-title1 {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dcdfe6;
}

.div-title2 {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 10px;
}
.div-title22 {
  font-size: 14px;
  color: #606266;
  vertical-align: middle;
  line-height: 40px;
  padding: 0 12px 0 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
.div-title3 {
  font-size: 18px;
  font-weight: bold;
  margin: 5px 0;
}

.span-but {
  display: inline-block;
  border-radius: 4px;
  border: 1px solid #dcdfe6;
  line-height: 32px;
  padding: 0 15px;
  margin: 5px;
  cursor: pointer;
}

.span-but-active {
  color: #70483e;
  border: 1px solid #70483e;
}

.human-body {
  display: flex;
  flex-wrap: wrap;
}

.human-body >>> .el-form-item {
  width: 32%;
  margin-right: 2%;
}

.human-body >>> .el-form-item:nth-of-type(3n) {
  margin-right: 0;
}

.formStep1 >>> .el-form-item__label {
}

.form-item-zd {
  width: 100%;
  text-align: left;
}

.form-item-age {
  display: flex;
  align-items: center;
}

.form-item-age span {
  margin: 0 10px;
}

.form-item-age >>> .el-input {
  width: 100px;
}

>>> .el-drawer.rtl {
  width: 50% !important;
}
.dialog-footer {
  margin-bottom: 20px;
  text-align: center;
}
</style>
