<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="`#${index}`">{{ item }}</a>
          </div>
        </el-step>
      </el-steps>
    </div>
    <div class="div-right" style="padding: 0 16px">
      <a name="0"></a>
      <div class="div-title1">基本信息</div>
      <div class="div-border div-bot20">
        <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="年龄">
            {{ form.age }}
          </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.visitTime }}
          </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>
      </div>

      <!-- 档案详情-->
      <el-form ref="detailsForm" :model="detailsForm" class="formStep">
        <a name="1"></a>
        <div class="div-title1">主要诊断</div>
        <el-form-item
          class="form-item-zd div-border div-pad20"
          prop="JBXX_ZYZD"
        >
          <el-checkbox-group v-model="detailsForm['JBXX_ZYZD']">
            <el-checkbox v-for="(item, index) in medicalHistory" :label="item">
            </el-checkbox>
          </el-checkbox-group>
          <el-input v-model="detailsForm['JBXX_ZYZD_QT']" placeholder="其他" />
        </el-form-item>
        <div>
          <a name="2"></a>
          <div class="div-title1">评估信息</div>
          <div class="div-title2" id="#2">人体成分（基本参数）</div>
        </div>
        <div class="human-body div-border div-bot20">
          <el-form-item label="体重" prop="PG_RTCF_TZ">
            <el-input
              v-model="detailsForm['PG_RTCF_TZ']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="去脂体重" prop="PG_RTCF_QZTZ">
            <el-input
              v-model="detailsForm['PG_RTCF_QZTZ']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="肌肉量" prop="PG_RTCF_JRL">
            <el-input
              v-model="detailsForm['PG_RTCF_JRL']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="总水分（TBW）" prop="PG_RTCF_TBW">
            <el-input
              v-model="detailsForm['PG_RTCF_TBW']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="蛋白质" prop="PG_RTCF_DBZ">
            <el-input
              v-model="detailsForm['PG_RTCF_DBZ']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="蛋白质" prop="PG_RTCF_GZ">
            <el-input
              v-model="detailsForm['PG_RTCF_GZ']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="脂肪" prop="PG_RTCF_ZF">
            <el-input
              v-model="detailsForm['PG_RTCF_ZF']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="体脂百分比（PBF）" prop="PG_RTCF_PBF">
            <el-input
              v-model="detailsForm['PG_RTCF_PBF']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="骨骼肌" prop="PG_RTCF_GGJ">
            <el-input
              v-model="detailsForm['PG_RTCF_GGJ']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="体质指数（BMI）" prop="PG_RTCF_BMI">
            <el-input
              v-model="detailsForm['PG_RTCF_BMI']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="腰臀比（WHR）" prop="PG_RTCF_WHR">
            <el-input
              v-model="detailsForm['PG_RTCF_WHR']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="内脏脂肪水平" prop="PG_RTCF_NZZFSP">
            <el-input
              v-model="detailsForm['PG_RTCF_NZZFSP']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="身体各成分百分比" prop="PG_RTCF_STGCFBFB">
            <el-input
              v-model="detailsForm['PG_RTCF_STGCFBFB']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="体型类型" prop="PG_RTCF_TXLX">
            <el-select
              v-model="detailsForm['PG_RTCF_TXLX']"
              multiple
              collapse-tags
              placeholder="请选择"
            >
              <el-option
                v-for="(item, index) in systemType"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="身体年龄" prop="PG_RTCF_STNL">
            <el-input
              v-model="detailsForm['PG_RTCF_STNL']"
              placeholder="请输入"
            />
          </el-form-item>
          <el-form-item label="健康评分" prop="PG_RTCF_JKPF">
            <el-input
              v-model="detailsForm['PG_RTCF_JKPF']"
              placeholder="请输入"
            />
          </el-form-item>
        </div>
        <a name="3"></a>
        <div class="div-title1">中医体质辨识</div>
        <div class="div-title2">主要体质</div>
        <div class="div-border div-bot20">
          <el-form-item prop="PG_TZBS_ZYTZ">
            <el-radio-group 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>
          <div class="div-title2">兼夹体质</div>
          <el-form-item class="form-item-zd" prop="PG_TZBS_JJTZ">
            <el-checkbox-group v-model="detailsForm['PG_TZBS_JJTZ']">
              <el-checkbox
                v-for="(item, index) in habitus"
                :key="index"
                :label="item"
              >
              </el-checkbox>
            </el-checkbox-group>
          </el-form-item>
        </div>
        <!-- 体态评估 -->
        <a name="4"></a>
        <div class="div-border div-bot20">
          <div class="div-title2">体态评估</div>
          <div class="human-body">
            <el-form-item
              label="TAPS体态自觉评估得分(3-15分)"
              prop="PG_TT_TAPS_DF"
            >
              <el-input
                v-model="detailsForm['PG_TT_TAPS_DF']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item
              label="TRACE体态临床评估得分(0-12分)"
              prop="PG_TT_TRACE_DF"
            >
              <el-input
                v-model="detailsForm['PG_TT_TRACE_DF']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item
              label="SRS-22问卷评估得分(1~5分)"
              prop="PG_TT_SRS22_DF"
            >
              <el-input
                v-model="detailsForm['PG_TT_SRS22_DF']"
                placeholder="请输入"
              />
            </el-form-item>
          </div>
          <div class="div-title2">失眠评估</div>
          <div class="human-body">
            <el-form-item
              label="患者健康问卷（PHQ-9）评估得分(0-27分)"
              prop="PG_SM_PHQ-9_DF"
            >
              <el-input
                v-model="detailsForm['PG_SM_PHQ-9_DF']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item
              label="Epworth嗜睡评估得分(0-24分)"
              prop="PG_SM_EPSW_DF"
            >
              <el-input
                v-model="detailsForm['PG_SM_EPSW_DF']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item
              label="匹兹堡睡眠质量指数（PSQI）评估得分(0~21分)"
              prop="PG_SM_PSQI_DF"
            >
              <el-input
                v-model="detailsForm['PG_SM_PSQI_DF']"
                placeholder="请输入"
              />
            </el-form-item>
          </div>
          <div class="div-title2">焦虑评估</div>
          <div class="human-body">
            <el-form-item
              label="汉密尔顿抑郁评估（HAMD-24）得分(0-96分)"
              prop="PG_JL_HAMD-24_DF"
            >
              <el-input
                v-model="detailsForm['PG_JL_HAMD-24_DF']"
                placeholder="请输入"
              />
            </el-form-item>
            <el-form-item
              label="焦虑自评（SAS）得分(0-100分)"
              prop="PG_JL_SAS_DF"
            >
              <el-input
                v-model="detailsForm['PG_JL_SAS_DF']"
                placeholder="请输入"
              />
            </el-form-item>
          </div>
        </div>
        <a name="5"></a>
        <div class="div-title1">治疗类型</div>
        <el-form-item prop="ZLFA_ZLLX" class="div-border div-pad10">
          <el-radio-group v-model="detailsForm['ZLFA_ZLLX']">
            <el-radio label="中西医结合治疗"> </el-radio>
            <el-radio label="单纯中医治疗"> </el-radio>
          </el-radio-group>
        </el-form-item>
        <a name="6"></a>
        <div style="font-size: 22px; margin-bottom: 14px" class="div-title1">
          诊疗方法
        </div>
        <div
          class="div-border"
          style="margin-bottom: 14px"
          v-for="(i, ind) in healType"
          :key="ind"
        >
          <div class="div-title2">{{ i.title }}</div>
          <div v-for="(j, jnd) in i.list" :key="jnd">
            <div v-if="j.title != '针灸疗法'">
              <div class="div-title3">{{ j.title }}</div>
              <span
                v-if="k.type == 'but'"
                @click="handleButClick(j, k)"
                class="span-but"
                :class="{
                  'span-but-active':
                    detailsForm[j.valueCode] == (k.value || k.title),
                }"
                v-for="(k, knd) in j.list"
                :key="knd"
              >
                {{ k.value || k.title }}
              </span>
              <div v-else class="human-body">
                <el-form-item prop="ZLFA_ZJ_XW_QT">
                  <el-input v-model="detailsForm[j.valueCode]"></el-input>
                </el-form-item>
              </div>
            </div>
            <div v-else>
              <div class="div-title3">{{ j.title }}</div>
              <div style="" v-for="(k, knd) in j.list" :key="knd">
                <div class="div-title4" style="margin: 5px 0">
                  {{ k.title }}
                </div>
                <span
                  v-if="l.type == 'but'"
                  @click="handleButClick(k, l)"
                  class="span-but"
                  :class="{
                    'span-but-active':
                      detailsForm[k.valueCode] == (l.value || l.title),
                  }"
                  v-for="(l, lnd) in k.list"
                  :key="lnd"
                >
                  {{ l.value || l.title }}
                </span>
                <div v-else class="human-body">
                  <el-form-item prop="ZLFA_YW_QT">
                    <el-input v-model="detailsForm[k.valueCode]"></el-input>
                  </el-form-item>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!--  -->
        <div class="human-body"></div>
        <a name="7"></a>
        <div class="div-title1">治疗类型</div>
        <div class="div-border div-bot20">
          <el-form-item prop="ZLFA_ZLXG" class="div-border div-pad10">
            <el-radio-group 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>
          <a name="8"></a>
          <div class="div-title2">诊疗费用</div>
          <el-form-item label="总体费用按照区间进行选择" prop="ZLFA_ZTFY">
            <el-radio-group 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">
            <el-radio-group 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">
            <el-radio-group 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">
            <el-radio-group 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>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button
          style="width: 140px"
          type="primary"
          @click="submitDetailsForm"
          >确 定</el-button
        >
      </div>
    </div>
  </div>
</template>

<script>
import { queryRecord, saveAidRecord } from "@/api/medicalFile";
export default {
  name: "Notice",
  data() {
    return {
      stepActive: 0,
      stepArr: [
        "基本信息",
        "主要诊断",
        "人体成分（基本参数）",
        "中医体质辨识",
        "评估",
        "治疗类型",
        "诊疗方法",
        "治疗类型",
        "诊疗费用",
      ],
      // 现病史
      medicalHistory: [
        "肥胖症",
        "失眠病",
        "中风病",
        "面瘫病",
        "项痹病",
        "腰痛病",
        "痉挛性斜颈",
      ],
      // 体型类型
      systemType: [
        "隐形肥胖型",
        "脂肪过多型",
        "肥胖型",
        "肌肉不足型",
        "健康匀称型",
        "超重肌肉型",
        "消瘦型",
        "低脂肪型",
        "运动员型",
      ],
      // 体质辨识
      habitus: [
        "平和质",
        "气虚质",
        " 阳虚质",
        "阴虚质",
        "痰湿质",
        " 湿热质",
        "血瘀质",
        "气郁质",
        "特禀质",
      ],
      // 治疗类型
      healType: [
        {
          title: "肥胖症",
          list: [
            {
              title: "行为心理干预",
              valueCode: "ZLFA_XWXLGY",
              list: [
                {
                  title:
                    "行为技能训练：辅导有效的应对压力技巧，避免因情绪波动导致过度进食，训练正念饮食，提高对饥饿和饱足感的感知能力",
                  value: "行为技能训练",
                  type: "but",
                },
                {
                  title:
                    "目标设定与追踪：与患者共同设立短期和长期减重目标，定期进行进度评估，强化正面反馈，提高自我管理能力",
                  value: "目标设定与追踪",
                  type: "but",
                },
              ],
            },
            {
              title: "运动干预",
              valueCode: "ZLFA_YDGY",
              list: [
                {
                  title:
                    "有氧运动：如快走、慢跑、游泳等，建议每周至少进行150分钟中等强度的有氧运动",
                  value: "有氧运动",
                  type: "but",
                },
                {
                  title:
                    "抗阻运动：如举重、俯卧撑等，建议每周进行2-3次抗阻运动",
                  value: "抗阻运动",
                  type: "but",
                },
              ],
            },
            {
              title: "临床营养治疗",
              valueCode: "ZLFA_LCYYZL",
              list: [
                {
                  title:
                    "限能量饮食：在限制能量摄入（日常饮食能量减去30%）的基础上，营养素比例符合平衡膳食的要求",
                  value: "限能量饮食",
                  type: "but",
                },
                {
                  title: "高蛋白饮食：每日蛋白质摄入量超过20%，但一般不高于35%",
                  value: "高蛋白饮食",
                  type: "but",
                },
                {
                  title: "低碳水化合物饮食：碳水化合物供能比一般在20%-40%",
                  value: "低碳水化合物饮食",
                  type: "but",
                },
                {
                  title:
                    "断食：如5+2模式，1周中5天相对正常进食，其他2天摄取平常的1/4能量",
                  value: "断食",
                  type: "but",
                },
              ],
            },
            {
              title: "针灸疗法",
              list: [
                {
                  title: "疗法",
                  valueCode: "ZLFA_ZJ_LF",
                  list: [
                    {
                      title: "毫针/电针疗法",
                      type: "but",
                    },
                    {
                      title: "温针疗法",
                      type: "but",
                    },
                    {
                      title: "耳穴贴压疗法",
                      type: "but",
                    },
                    {
                      title: "穴位埋针法",
                      type: "but",
                    },
                    {
                      title: "穴位埋线法",
                      type: "but",
                    },
                  ],
                },
                {
                  title: "穴位",
                  valueCode: "ZLFA_ZJ_XW",
                  list: [
                    {
                      title: "神门：安神定志，改善睡眠质量",
                      value: "神门",
                      type: "but",
                    },
                    {
                      title: "三阴交：调理脾胃，养血安神",
                      value: "三阴交",
                      type: "but",
                    },
                    {
                      title: "百会：调节大脑功能，促进睡眠",
                      value: "百会",
                      type: "but",
                    },
                    {
                      title: "安眠：直接作用于睡眠中枢，帮助入睡",
                      value: "安眠",
                      type: "but",
                    },
                  ],
                },
              ],
            },
            {
              title: "药物治疗",
              valueCode: "ZLFA_YW",
              list: [
                {
                  title: "奥利司他：通过抑制胃肠道脂肪酶，减少脂肪吸收",
                  value: "奥利司他",
                  type: "but",
                },
                {
                  title: "利拉鲁肽：GLP-1受体激动剂，延缓胃排空，增加饱腹感",
                  value: "利拉鲁肽",
                  type: "but",
                },
                {
                  title: "贝那鲁肽：GLP-1受体激动剂，作用机制与利拉鲁肽类似",
                  value: "贝那鲁肽",
                  type: "but",
                },
                {
                  title:
                    "司美格鲁肽：GLP-1受体激动剂，每周一次给药，减重效果显著",
                  value: "司美格鲁肽",
                  type: "but",
                },
                {
                  title: "替尔泊肽：GLP-1受体激动剂，适用于肥胖症治疗",
                  value: "替尔泊肽",
                  type: "but",
                },
              ],
            },
          ],
        },
        {
          title: "失眠症",
          list: [
            {
              title: "生活习惯",
              valueCode: "ZLFA_SHXG",
              list: [
                {
                  title:
                    "科学膳食：避免午后摄入咖啡、茶、酒精等刺激性饮品，以及睡前过度进食",
                  value: "科学膳食",
                  type: "but",
                },
                {
                  title:
                    "充足日照：增加日间自然光照，减少夜间人工光源，特别是电子产品的使用",
                  value: "充足日照",
                  type: "but",
                },
                {
                  title:
                    "合理运动：推荐瑜伽、太极拳、八段锦等传统运动，有助于改善睡眠质量",
                  value: "合理运动",
                  type: "but",
                },
              ],
            },
            {
              title: "心理调适",
              valueCode: "ZLFA_XLTS",
              list: [
                {
                  title:
                    "放松训练：包括渐进式肌肉放松训练、腹式呼吸、冥想等，可降低紧张与过度警觉，提高睡眠质量",
                  value: "放松训练",
                  type: "but",
                },
                {
                  title:
                    "音乐疗法：轻柔舒缓的音乐可以降低神经系统兴奋性，减轻焦虑情绪从而改善睡眠",
                  value: "音乐疗法",
                  type: "but",
                },
                {
                  title:
                    "认知调整：不灾难化和过分关注失眠，不因偶尔失眠而产生挫败感，培养失眠的耐受性",
                  value: "认知调整",
                  type: "but",
                },
              ],
            },
            {
              title: "针灸疗法",
              list: [
                {
                  title: "疗法",
                  valueCode: "ZLFA_ZJ_LF_SMZ",
                  list: [
                    {
                      title: "毫针/电针疗法",
                      type: "but",
                    },
                    {
                      title: "温针疗法",
                      type: "but",
                    },
                    {
                      title: "耳穴贴压疗法",
                      type: "but",
                    },
                    {
                      title: "穴位埋针法",
                      type: "but",
                    },
                    {
                      title: "穴位埋线法",
                      type: "but",
                    },
                  ],
                },
                {
                  title: "穴位",
                  valueCode: "ZLFA_ZJ_XW_SMZ",
                  list: [
                    {
                      title: "神门：安神定志，改善睡眠质量",
                      value: "神门",
                      type: "but",
                    },
                    {
                      title: "三阴交：调理脾胃，养血安神",
                      value: "三阴交",
                      type: "but",
                    },
                    {
                      title: "百会：调节大脑功能，促进睡眠",
                      value: "百会",
                      type: "but",
                    },
                    {
                      title: "安眠：直接作用于睡眠中枢，帮助入睡",
                      value: "安眠",
                      type: "but",
                    },
                  ],
                },
              ],
            },
            {
              title: "药物治疗",
              valueCode: "ZLFA_YW_SMZ",
              list: [
                {
                  title:
                    "苯二氮䓬受体激动剂（BZRAs）：艾司唑仑、阿普唑仑、劳拉西泮等",
                  value: "苯二氮䓬受体激动剂（BZRAs）",
                  type: "but",
                },
                {
                  title:
                    "非苯二氮䓬类药物（non-BZDs）：唑吡坦、扎来普隆、右佐匹克隆、佐匹克隆",
                  value: "非苯二氮䓬类药物（non-BZDs）",
                  type: "but",
                },
                {
                  title: "褪黑素和褪黑素受体激动剂：调节生物钟，改善睡眠",
                  value: "褪黑素和褪黑素受体激动剂",
                  type: "but",
                },
                {
                  title:
                    "抗抑郁药物：具有镇静作用的抗抑郁药物，如曲唑酮、米氮平等，可用于失眠伴抑郁症状的患者",
                  value: "抗抑郁药物",
                  type: "but",
                },
                {
                  title:
                    "其他药物：选择性食欲素受体拮抗剂苏沃雷生，可用于改善睡眠质量",
                  value: "其他药物",
                  type: "but",
                },
              ],
            },
          ],
        },
        {
          title: "其他",
          list: [
            {
              title: "针灸疗法",
              list: [
                {
                  title: "疗法",
                  valueCode: "ZLFA_ZJ_LF_QT",
                  list: [
                    {
                      title: "毫针/电针疗法",
                      type: "but",
                    },
                    {
                      title: "温针疗法",
                      type: "but",
                    },
                    {
                      title: "耳穴贴压疗法",
                      type: "but",
                    },
                    {
                      title: "穴位埋针法",
                      type: "but",
                    },
                    {
                      title: "穴位埋线法",
                      type: "but",
                    },
                  ],
                },
                {
                  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_ZJ_LF_QT: "", // 其他-针灸疗法-疗法
        ZLFA_ZJ_XW_QT: "", // 其他-针灸疗法-穴位
        ZLFA_YW_QT: "", // 其他-药物治疗
      }, // 档案详情表单
    };
  },
  created() {
    this.form = JSON.parse(this.$route.query.data);
    let treatmentId = this.$route.query.treatmentId;
    this.treatmentId = treatmentId;
    this.handleDetails(treatmentId);
  },
  methods: {
    /** 详情按钮操作 */
    handleDetails(treatmentId) {
      this.getDetailsForm(); //重置详情表单
      // this.form = JSON.parse(JSON.stringify(row));
      queryRecord({
        treatmentId: treatmentId,
      }).then((res) => {
        let arrList = ["JBXX_ZYZD", "PG_RTCF_TXLX", "PG_TZBS_JJTZ"];
        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 = "诊疗档案详情";
      });
    },

    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_ZJ_LF_QT: "", // 其他-针灸疗法-疗法
        ZLFA_ZJ_XW_QT: "", // 其他-针灸疗法-穴位
        ZLFA_YW_QT: "", // 其他-药物治疗
      };
    },

    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.$modal.msgSuccess("保存成功");
            this.drawer = false;
            this.getList();
          });
        }
      });
    },
  },
};
</script>
<style scoped src="@/assets/styles/common.css"></style>

<style scoped>
.app-container {
  display: flex;
}
.app-container .div-left {
  width: 210px;
  margin-right: 20px;
  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;
}

.div-title2 {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 10px;
}

.div-title3 {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
}

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

.span-but-active {
  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 {
  text-align: center;
}
</style>
