<template>
  <view class="page__view">
		<navbar title="体检报告" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />

    <view class="main" v-if="detail">
      <view class="section">
        <reportSummaryView :data="detail"></reportSummaryView>
      </view>

      <view class="section">
        <reportMainIndexView :list="detail.mainIndexList"></reportMainIndexView>
      </view>

      <view class="section">
        <reportAbnormalView :list="detail.abnormalList"></reportAbnormalView>
      </view>

      <view class="section">
        <reportCommonView :list="detail.commonlist"></reportCommonView>
      </view>

      <view class="section">
        <reportDetectView :data="detail"></reportDetectView>
      </view>

      <view class="section">
        <reportTableView :list="detail.tableList"></reportTableView>
      </view>
    </view>

    <view class="bottom">
      <button class="flex btn" @click="onDownload">下载PDF</button>
    </view>
  </view>
</template>

<script>
  import reportSummaryView from './reportSummaryView.vue'
  import reportMainIndexView from './reportMainIndexView.vue'
  import reportAbnormalView from './reportAbnormalView.vue'
  import reportCommonView from './reportCommonView.vue'
  import reportDetectView from './reportDetectView.vue'
  import reportTableView from './reportTableView.vue'

  export default {
		components: {
      reportSummaryView,
      reportMainIndexView,
      reportAbnormalView,
      reportCommonView,
      reportDetectView,
      reportTableView,
    },
    data() {
      return {
        id: null,
        detail: null,
      }
    },
    onLoad(arg) {
      this.id = arg.id

      this.getData()
    },
    methods: {
      getData() {
        this.detail = {
          score: 77,
          BMI: 20.3,
          BMIchange: -0.2,
          BMItag: '正常',
          height: 164,
          weight: 46,
          mainIndexList: [
            {
              id: '001',
              label: '心率',
              value: '75',
              unit: 'bpm（次/分钟）',
              standrad: '60-100bpm',
              status: 1,
            },
            {
              id: '002',
              label: '血氧',
              value: '99',
              unit: '%',
              standrad: '≥94%',
              status: 1,
            },
            {
              id: '003',
              label: '空腹血糖',
              value: '4.0',
              unit: 'mmol/L',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '004',
              label: '血压',
              value: '110/80',
              unit: 'mmHg',
              standrad: '140/90mmHg～90/60 mmHg',
              status: 1,
            },
          ],
          abnormalList: [
            {
              id: '001',
              title: '甲状腺结节（甲状腺结节或钙化）',
              desc: '建议进一步监测；常规测甲状腺功能全套，甲状腺。',
            },
            {
              id: '002',
              title: '甲状腺结节（甲状腺结节或钙化）',
              desc: '建议进一步监测；常规测甲状腺功能全套，甲状腺。',
            },
            {
              id: '003',
              title: '甲状腺结节（甲状腺结节或钙化）',
              desc: '建议进一步监测；常规测甲状腺功能全套，甲状腺。',
            },
            {
              id: '004',
              title: '甲状腺结节（甲状腺结节或钙化）',
              desc: '建议进一步监测；常规测甲状腺功能全套，甲状腺。',
            },
          ],
          commonlist: [
            {
              id: '001',
              label: '血小板',
              value: '5.2',
              standrad: '125~350×10^9/L',
              status: 1,
            },
            {
              id: '002',
              label: '血红蛋白',
              value: '4.8',
              standrad: '110 ~ 150g/L',
              status: 1,
            },
            {
              id: '003',
              label: '白细胞',
              value: '3.0',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '004',
              label: '转氨酶',
              value: '7.0',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '005',
              label: '胆红素',
              value: '17',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '006',
              label: '白蛋白',
              value: '15',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '007',
              label: '肌酐',
              value: '4',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '008',
              label: '尿酸',
              value: '556',
              standrad: '3.9-6.1mmol/L',
              status: 0,
            },
            {
              id: '009',
              label: '血压',
              value: '23',
              standrad: '3.9-6.1mmol/L',
              status: 0,
            },
            {
              id: '010',
              label: '甘油三酯',
              value: '56',
              standrad: '3.9-6.1mmol/L',
              status: 0,
            },
          ],
          chronicFoodAllergyList: [
            {
              id: '001',
              label: '血小板',
              value: '5.2',
              standrad: '125~350×10^9/L',
              status: 1,
            },
            {
              id: '002',
              label: '血红蛋白',
              value: '4.8',
              standrad: '110 ~ 150g/L',
              status: 1,
            },
            {
              id: '003',
              label: '白细胞',
              value: '3.0',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '004',
              label: '转氨酶',
              value: '7.0',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '005',
              label: '胆红素',
              value: '17',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '006',
              label: '白蛋白',
              value: '15',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '007',
              label: '肌酐',
              value: '4',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '008',
              label: '尿酸',
              value: '556',
              standrad: '3.9-6.1mmol/L',
              status: 0,
            },
            {
              id: '009',
              label: '血压',
              value: '23',
              standrad: '3.9-6.1mmol/L',
              status: 0,
            },
            {
              id: '010',
              label: '甘油三酯',
              value: '56',
              standrad: '3.9-6.1mmol/L',
              status: 0,
            },
          ],
          gutMicrobiomeList: [
            {
              id: '001',
              label: '血小板',
              value: '5.2',
              standrad: '125~350×10^9/L',
              status: 1,
            },
            {
              id: '002',
              label: '血红蛋白',
              value: '4.8',
              standrad: '110 ~ 150g/L',
              status: 1,
            },
            {
              id: '003',
              label: '白细胞',
              value: '3.0',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '004',
              label: '转氨酶',
              value: '7.0',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '005',
              label: '胆红素',
              value: '17',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '006',
              label: '白蛋白',
              value: '15',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '007',
              label: '肌酐',
              value: '4',
              standrad: '3.9-6.1mmol/L',
              status: 1,
            },
            {
              id: '008',
              label: '尿酸',
              value: '556',
              standrad: '3.9-6.1mmol/L',
              status: 0,
            },
            {
              id: '009',
              label: '血压',
              value: '23',
              standrad: '3.9-6.1mmol/L',
              status: 0,
            },
            {
              id: '010',
              label: '甘油三酯',
              value: '56',
              standrad: '3.9-6.1mmol/L',
              status: 0,
            },
          ],
          scoreList: [
            { id: '001', label: '饮食', value: 23 },
            { id: '002', label: '饮食', value: 23 },
            { id: '003', label: '作息', value: 44 },
            { id: '004', label: '作息', value: 44 },
            { id: '005', label: '运动', value: 88 },
            { id: '006', label: '运动', value: 88 },
            { id: '007', label: '体质', value: 56 },
            { id: '008', label: '体质', value: 56 },
            { id: '009', label: '心理', value: 78 },
            { id: '010', label: '心理', value: 100 },
          ],
          tableList: [
            {
              id: '001',
              name: '慢性食物过敏',
              significance: '评估个体对特定食物的免疫反应，主要检测IgG抗体水平。了解个体对不同食物的免疫反应程度，以帮助识别可能引起不适症状的食物，并指导个体的饮食调整和管理策略。辅助诊断和管理相关的消化问题和炎症疾病。',
              sampling: '指尖血',
              weight: 5,
              done: 1,
            },
            {
              id: '002',
              name: '肠道菌群基因测序',
              significance: '评估和分析个体肠道内微生物的组成和功能，以了解肠道健康状况和相关疾病的风险。以制定个性化的益生菌+ 营养策略和有害菌应对方案。',
              sampling: '指尖血',
              weight: 5,
              done: 1,
            },
            {
              id: '003',
              name: '营养与毒性元素',
              significance: '评估和分析个体肠道内微生物的组成和功能，以了解肠道健康状况和相关疾病的风险。以制定个性化的益生菌+ 营养策略和有害菌应对方案。',
              sampling: '指尖血',
              weight: 5,
              done: 1,
            },
            {
              id: '004',
              name: '精准基因',
              significance: '评估和分析个体肠道内微生物的组成和功能，以了解肠道健康状况和相关疾病的风险。以制定个性化的益生菌+ 营养策略和有害菌应对方案。',
              sampling: '指尖血',
              weight: 5,
              done: 1,
            },
            {
              id: '005',
              name: '新陈代谢',
              significance: '评估和分析个体肠道内微生物的组成和功能，以了解肠道健康状况和相关疾病的风险。以制定个性化的益生菌+ 营养策略和有害菌应对方案。',
              sampling: '指尖血',
              weight: 5,
              done: 1,
            },
            {
              id: '006',
              name: '女性荷尔蒙&抗缪',
              significance: '评估和分析个体肠道内微生物的组成和功能，以了解肠道健康状况和相关疾病的风险。以制定个性化的益生菌+ 营养策略和有害菌应对方案。',
              sampling: '指尖血',
              weight: 5,
              done: 1,
            },
            {
              id: '007',
              name: '环境荷尔蒙',
              significance: '评估和分析个体肠道内微生物的组成和功能，以了解肠道健康状况和相关疾病的风险。以制定个性化的益生菌+ 营养策略和有害菌应对方案。',
              sampling: '指尖血',
              weight: 5,
              done: 1,
            },
            {
              id: '008',
              name: '抗压力荷尔蒙评估',
              significance: '评估和分析个体肠道内微生物的组成和功能，以了解肠道健康状况和相关疾病的风险。以制定个性化的益生菌+ 营养策略和有害菌应对方案。',
              sampling: '指尖血',
              weight: 5,
              done: 1,
            },
            {
              id: '009',
              name: '慢病风险',
              significance: '评估和分析个体肠道内微生物的组成和功能，以了解肠道健康状况和相关疾病的风险。以制定个性化的益生菌+ 营养策略和有害菌应对方案。',
              sampling: '指尖血',
              weight: 5,
              done: 1,
            },
          ],
        }

        console.log('detail', this.detail)
      },
      jumpToNutritionProgram() {
        this.$utils.navigateTo(`/pages_order/report/nutritionProgram/index?id=${this.id}`)
      },
    },
  }
</script>

<style scoped lang="scss">
  .page__view {
    width: 100vw;
    min-height: 100vh;
    background-color: $uni-bg-color;
    position: relative;
    
    /deep/ .nav-bar__view {
      position: fixed;
      top: 0;
      left: 0;
    }
  }

  .main {
    padding: calc(var(--status-bar-height) + 168rpx) 32rpx 280rpx 32rpx;
  }

  .section {
    & + & {
      margin-top: 40rpx;
    }
  }

  .bottom {
    width: 100%;
    // height: 200rpx;
    position: fixed;
    left: 0;
    bottom: 0;
    padding: 24rpx 40rpx;
		padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
    box-sizing: border-box;
    background: #FFFFFF;

    .btn {
      padding: 16rpx 0;
      font-family: PingFang SC;
      font-size: 36rpx;
      font-weight: 500;
      line-height: 1;
      color: #FFFFFF;
      background-image: linear-gradient(to right, #4B348F, #845CFA);
      border-radius: 41rpx;
    }
  }

</style>