<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="病案号" prop="bahCode">
        <el-input
          v-model="queryParams.bahCode"
          placeholder="请输入病案号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="出生年份(换算年龄)" prop="birth">
        <el-input
          v-model="queryParams.birth"
          placeholder="请输入出生年份(换算年龄)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="性别" prop="sex">
        <el-select v-model="queryParams.sex" placeholder="请选择性别" clearable>
          <el-option
            v-for="dict in dict.type.sys_user_sex"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="地址" prop="address">
        <el-input
          v-model="queryParams.address"
          placeholder="请输入地址"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="既往健康" prop="baseJwjk">
        <el-input
          v-model="queryParams.baseJwjk"
          placeholder="请输入既往健康"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="心血管病变" prop="baseXxgbb">
        <el-input
          v-model="queryParams.baseXxgbb"
          placeholder="请输入心血管病变"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="自身免疫性疾病" prop="baseZsmyxjb">
        <el-input
          v-model="queryParams.baseZsmyxjb"
          placeholder="请输入自身免疫性疾病"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="器官移植" prop="baseQgyz">
        <el-input
          v-model="queryParams.baseQgyz"
          placeholder="请输入器官移植"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="造血/骨髓干细胞移植" prop="baseGxbyz">
        <el-input
          v-model="queryParams.baseGxbyz"
          placeholder="请输入造血/骨髓干细胞移植"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="COPD" prop="baseCopd">
        <el-input
          v-model="queryParams.baseCopd"
          placeholder="请输入COPD"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="脑炎/脑膜炎/脊髓炎" prop="baseJsy">
        <el-input
          v-model="queryParams.baseJsy"
          placeholder="请输入脑炎/脑膜炎/脊髓炎"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="恶性肿瘤" prop="baseExzl">
        <el-input
          v-model="queryParams.baseExzl"
          placeholder="请输入恶性肿瘤"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="HIV" prop="baseHiv">
        <el-input
          v-model="queryParams.baseHiv"
          placeholder="请输入HIV"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="恶性血液病" prop="baseExxyb">
        <el-input
          v-model="queryParams.baseExxyb"
          placeholder="请输入恶性血液病"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="糖尿病" prop="baseTnb">
        <el-input
          v-model="queryParams.baseTnb"
          placeholder="请输入糖尿病"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="其他" prop="baseOther">
        <el-input
          v-model="queryParams.baseOther"
          placeholder="请输入其他"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否入住ICU" prop="hospitalizedIcu">
        <el-input
          v-model="queryParams.hospitalizedIcu"
          placeholder="请输入是否入住ICU"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否伴有脓毒症" prop="hospitalizedNdz">
        <el-input
          v-model="queryParams.hospitalizedNdz"
          placeholder="请输入是否伴有脓毒症"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否机械通气" prop="hospitalizedJxtq">
        <el-input
          v-model="queryParams.hospitalizedJxtq"
          placeholder="请输入是否机械通气"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="咳嗽咳痰" prop="hospitalizedKskt">
        <el-input
          v-model="queryParams.hospitalizedKskt"
          placeholder="请输入咳嗽咳痰"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="发热" prop="hospitalizedFr">
        <el-input
          v-model="queryParams.hospitalizedFr"
          placeholder="请输入发热"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="腹泻" prop="hospitalizedFx">
        <el-input
          v-model="queryParams.hospitalizedFx"
          placeholder="请输入腹泻"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="呕吐" prop="hospitalizedHt">
        <el-input
          v-model="queryParams.hospitalizedHt"
          placeholder="请输入呕吐"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="胸痛" prop="hospitalizedXt">
        <el-input
          v-model="queryParams.hospitalizedXt"
          placeholder="请输入胸痛"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="咯血" prop="hospitalizedKx">
        <el-input
          v-model="queryParams.hospitalizedKx"
          placeholder="请输入咯血"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="肌肉酸痛" prop="hospitalizedJrst">
        <el-input
          v-model="queryParams.hospitalizedJrst"
          placeholder="请输入肌肉酸痛"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="胸闷、气急" prop="hospitalizedXm">
        <el-input
          v-model="queryParams.hospitalizedXm"
          placeholder="请输入胸闷、气急"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="头痛头晕" prop="hospitalizedTtty">
        <el-input
          v-model="queryParams.hospitalizedTtty"
          placeholder="请输入头痛头晕"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="其他" prop="hospitalizedOther">
        <el-input
          v-model="queryParams.hospitalizedOther"
          placeholder="请输入其他"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="WBC" prop="bloodWbc">
        <el-input
          v-model="queryParams.bloodWbc"
          placeholder="请输入WBC"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="NEUT(%)" prop="bloodNeut">
        <el-input
          v-model="queryParams.bloodNeut"
          placeholder="请输入NEUT(%)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="L" prop="bloodL">
        <el-input
          v-model="queryParams.bloodL"
          placeholder="请输入L"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="C-反应蛋白" prop="bloodFydb">
        <el-input
          v-model="queryParams.bloodFydb"
          placeholder="请输入C-反应蛋白"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="降钙素原" prop="bloodJgsy">
        <el-input
          v-model="queryParams.bloodJgsy"
          placeholder="请输入降钙素原"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="CD4计数" prop="bloodCd4">
        <el-input
          v-model="queryParams.bloodCd4"
          placeholder="请输入CD4计数"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="ALT" prop="liverAlt">
        <el-input
          v-model="queryParams.liverAlt"
          placeholder="请输入ALT"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="AST" prop="liverAst">
        <el-input
          v-model="queryParams.liverAst"
          placeholder="请输入AST"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="GGT" prop="liverGgt">
        <el-input
          v-model="queryParams.liverGgt"
          placeholder="请输入GGT"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="Tbil" prop="liverTbil">
        <el-input
          v-model="queryParams.liverTbil"
          placeholder="请输入Tbil"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="尿素" prop="kidneyNs">
        <el-input
          v-model="queryParams.kidneyNs"
          placeholder="请输入尿素"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="血肌酐" prop="kidneyXjg">
        <el-input
          v-model="queryParams.kidneyXjg"
          placeholder="请输入血肌酐"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="血β2-微球蛋白" prop="kidneyWqdb">
        <el-input
          v-model="queryParams.kidneyWqdb"
          placeholder="请输入血β2-微球蛋白"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="尿酸" prop="kidneyNs2">
        <el-input
          v-model="queryParams.kidneyNs2"
          placeholder="请输入尿酸"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="肺空洞" prop="lungsFkd">
        <el-input
          v-model="queryParams.lungsFkd"
          placeholder="请输入肺空洞"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="磨玻璃样影" prop="lungsMblyy">
        <el-input
          v-model="queryParams.lungsMblyy"
          placeholder="请输入磨玻璃样影"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="肺结节" prop="lungsFjj">
        <el-input
          v-model="queryParams.lungsFjj"
          placeholder="请输入肺结节"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="多发斑片实变影" prop="lungsDfbpsby">
        <el-input
          v-model="queryParams.lungsDfbpsby"
          placeholder="请输入多发斑片实变影"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="胸腔积液" prop="lungsXqjy">
        <el-input
          v-model="queryParams.lungsXqjy"
          placeholder="请输入胸腔积液"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="胸膜增厚" prop="lungsXmzh">
        <el-input
          v-model="queryParams.lungsXmzh"
          placeholder="请输入胸膜增厚"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="纵膈淋巴结增大" prop="lungsZglbjzd">
        <el-input
          v-model="queryParams.lungsZglbjzd"
          placeholder="请输入纵膈淋巴结增大"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="如不确定前面的分类，请将CT报告的完整描述贴到此栏" prop="lungsOther">
        <el-input
          v-model="queryParams.lungsOther"
          placeholder="请输入如不确定前面的分类，请将CT报告的完整描述贴到此栏"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="培养" prop="otherPy">
        <el-input
          v-model="queryParams.otherPy"
          placeholder="请输入培养"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="血清学" prop="otherXqx">
        <el-input
          v-model="queryParams.otherXqx"
          placeholder="请输入血清学"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="PCR" prop="otherPcr">
        <el-input
          v-model="queryParams.otherPcr"
          placeholder="请输入PCR"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="抗生素" prop="treatKss">
        <el-input
          v-model="queryParams.treatKss"
          placeholder="请输入抗生素"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="抗病毒药物" prop="treatKbdyw">
        <el-input
          v-model="queryParams.treatKbdyw"
          placeholder="请输入抗病毒药物"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="体液支持" prop="treatTyzc">
        <el-input
          v-model="queryParams.treatTyzc"
          placeholder="请输入体液支持"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="免疫球蛋白" prop="treatMyqdb">
        <el-input
          v-model="queryParams.treatMyqdb"
          placeholder="请输入免疫球蛋白"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="ECMO支持" prop="treatEcmo">
        <el-input
          v-model="queryParams.treatEcmo"
          placeholder="请输入ECMO支持"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="其他" prop="treatOther">
        <el-input
          v-model="queryParams.treatOther"
          placeholder="请输入其他"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="小于28天内死亡" prop="returnLt28death">
        <el-input
          v-model="queryParams.returnLt28death"
          placeholder="请输入小于28天内死亡"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="90天死亡" prop="return90death">
        <el-input
          v-model="queryParams.return90death"
          placeholder="请输入90天死亡"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="死亡距发病时间" prop="returnLg90death">
        <el-input
          v-model="queryParams.returnLg90death"
          placeholder="请输入死亡距发病时间"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="目前存活" prop="returnLive">
        <el-input
          v-model="queryParams.returnLive"
          placeholder="请输入目前存活"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['sample:samplePatient:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['sample:samplePatient:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['sample:samplePatient:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['sample:samplePatient:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="samplePatientList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="编号" align="center" prop="id" />
      <el-table-column label="病案号" align="center" prop="bahCode" />
      <el-table-column label="姓名" align="center" prop="name" />
      <el-table-column label="出生年份(换算年龄)" align="center" prop="birth" />
      <el-table-column label="性别" align="center" prop="sex">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex"/>
        </template>
      </el-table-column>
      <el-table-column label="地址" align="center" prop="address" />
      <el-table-column label="既往健康" align="center" prop="baseJwjk" />
      <el-table-column label="心血管病变" align="center" prop="baseXxgbb" />
      <el-table-column label="自身免疫性疾病" align="center" prop="baseZsmyxjb" />
      <el-table-column label="器官移植" align="center" prop="baseQgyz" />
      <el-table-column label="造血/骨髓干细胞移植" align="center" prop="baseGxbyz" />
      <el-table-column label="COPD" align="center" prop="baseCopd" />
      <el-table-column label="脑炎/脑膜炎/脊髓炎" align="center" prop="baseJsy" />
      <el-table-column label="恶性肿瘤" align="center" prop="baseExzl" />
      <el-table-column label="HIV" align="center" prop="baseHiv" />
      <el-table-column label="恶性血液病" align="center" prop="baseExxyb" />
      <el-table-column label="糖尿病" align="center" prop="baseTnb" />
      <el-table-column label="其他" align="center" prop="baseOther" />
      <el-table-column label="是否入住ICU" align="center" prop="hospitalizedIcu" />
      <el-table-column label="是否伴有脓毒症" align="center" prop="hospitalizedNdz" />
      <el-table-column label="是否机械通气" align="center" prop="hospitalizedJxtq" />
      <el-table-column label="咳嗽咳痰" align="center" prop="hospitalizedKskt" />
      <el-table-column label="发热" align="center" prop="hospitalizedFr" />
      <el-table-column label="腹泻" align="center" prop="hospitalizedFx" />
      <el-table-column label="呕吐" align="center" prop="hospitalizedHt" />
      <el-table-column label="胸痛" align="center" prop="hospitalizedXt" />
      <el-table-column label="咯血" align="center" prop="hospitalizedKx" />
      <el-table-column label="肌肉酸痛" align="center" prop="hospitalizedJrst" />
      <el-table-column label="胸闷、气急" align="center" prop="hospitalizedXm" />
      <el-table-column label="头痛头晕" align="center" prop="hospitalizedTtty" />
      <el-table-column label="其他" align="center" prop="hospitalizedOther" />
      <el-table-column label="WBC" align="center" prop="bloodWbc" />
      <el-table-column label="NEUT(%)" align="center" prop="bloodNeut" />
      <el-table-column label="L" align="center" prop="bloodL" />
      <el-table-column label="C-反应蛋白" align="center" prop="bloodFydb" />
      <el-table-column label="降钙素原" align="center" prop="bloodJgsy" />
      <el-table-column label="CD4计数" align="center" prop="bloodCd4" />
      <el-table-column label="ALT" align="center" prop="liverAlt" />
      <el-table-column label="AST" align="center" prop="liverAst" />
      <el-table-column label="GGT" align="center" prop="liverGgt" />
      <el-table-column label="Tbil" align="center" prop="liverTbil" />
      <el-table-column label="尿素" align="center" prop="kidneyNs" />
      <el-table-column label="血肌酐" align="center" prop="kidneyXjg" />
      <el-table-column label="血β2-微球蛋白" align="center" prop="kidneyWqdb" />
      <el-table-column label="尿酸" align="center" prop="kidneyNs2" />
      <el-table-column label="肺空洞" align="center" prop="lungsFkd" />
      <el-table-column label="磨玻璃样影" align="center" prop="lungsMblyy" />
      <el-table-column label="肺结节" align="center" prop="lungsFjj" />
      <el-table-column label="多发斑片实变影" align="center" prop="lungsDfbpsby" />
      <el-table-column label="胸腔积液" align="center" prop="lungsXqjy" />
      <el-table-column label="胸膜增厚" align="center" prop="lungsXmzh" />
      <el-table-column label="纵膈淋巴结增大" align="center" prop="lungsZglbjzd" />
      <el-table-column label="如不确定前面的分类，请将CT报告的完整描述贴到此栏" align="center" prop="lungsOther" />
      <el-table-column label="培养" align="center" prop="otherPy" />
      <el-table-column label="血清学" align="center" prop="otherXqx" />
      <el-table-column label="PCR" align="center" prop="otherPcr" />
      <el-table-column label="抗生素" align="center" prop="treatKss" />
      <el-table-column label="抗病毒药物" align="center" prop="treatKbdyw" />
      <el-table-column label="体液支持" align="center" prop="treatTyzc" />
      <el-table-column label="免疫球蛋白" align="center" prop="treatMyqdb" />
      <el-table-column label="ECMO支持" align="center" prop="treatEcmo" />
      <el-table-column label="其他" align="center" prop="treatOther" />
      <el-table-column label="小于28天内死亡" align="center" prop="returnLt28death" />
      <el-table-column label="90天死亡" align="center" prop="return90death" />
      <el-table-column label="死亡距发病时间" align="center" prop="returnLg90death" />
      <el-table-column label="目前存活" align="center" prop="returnLive" />
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['sample:samplePatient:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['sample:samplePatient:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改样品患者信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="病案号" prop="bahCode">
          <el-input v-model="form.bahCode" placeholder="请输入病案号" />
        </el-form-item>
        <el-form-item label="姓名" prop="name">
          <el-input v-model="form.name" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="出生年份(换算年龄)" prop="birth">
          <el-input v-model="form.birth" placeholder="请输入出生年份(换算年龄)" />
        </el-form-item>
        <el-form-item label="性别" prop="sex">
          <el-select v-model="form.sex" placeholder="请选择性别">
            <el-option
              v-for="dict in dict.type.sys_user_sex"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="地址" prop="address">
          <el-input v-model="form.address" placeholder="请输入地址" />
        </el-form-item>
        <el-form-item label="既往健康" prop="baseJwjk">
          <el-input v-model="form.baseJwjk" placeholder="请输入既往健康" />
        </el-form-item>
        <el-form-item label="心血管病变" prop="baseXxgbb">
          <el-input v-model="form.baseXxgbb" placeholder="请输入心血管病变" />
        </el-form-item>
        <el-form-item label="自身免疫性疾病" prop="baseZsmyxjb">
          <el-input v-model="form.baseZsmyxjb" placeholder="请输入自身免疫性疾病" />
        </el-form-item>
        <el-form-item label="器官移植" prop="baseQgyz">
          <el-input v-model="form.baseQgyz" placeholder="请输入器官移植" />
        </el-form-item>
        <el-form-item label="造血/骨髓干细胞移植" prop="baseGxbyz">
          <el-input v-model="form.baseGxbyz" placeholder="请输入造血/骨髓干细胞移植" />
        </el-form-item>
        <el-form-item label="COPD" prop="baseCopd">
          <el-input v-model="form.baseCopd" placeholder="请输入COPD" />
        </el-form-item>
        <el-form-item label="脑炎/脑膜炎/脊髓炎" prop="baseJsy">
          <el-input v-model="form.baseJsy" placeholder="请输入脑炎/脑膜炎/脊髓炎" />
        </el-form-item>
        <el-form-item label="恶性肿瘤" prop="baseExzl">
          <el-input v-model="form.baseExzl" placeholder="请输入恶性肿瘤" />
        </el-form-item>
        <el-form-item label="HIV" prop="baseHiv">
          <el-input v-model="form.baseHiv" placeholder="请输入HIV" />
        </el-form-item>
        <el-form-item label="恶性血液病" prop="baseExxyb">
          <el-input v-model="form.baseExxyb" placeholder="请输入恶性血液病" />
        </el-form-item>
        <el-form-item label="糖尿病" prop="baseTnb">
          <el-input v-model="form.baseTnb" placeholder="请输入糖尿病" />
        </el-form-item>
        <el-form-item label="其他" prop="baseOther">
          <el-input v-model="form.baseOther" placeholder="请输入其他" />
        </el-form-item>
        <el-form-item label="是否入住ICU" prop="hospitalizedIcu">
          <el-input v-model="form.hospitalizedIcu" placeholder="请输入是否入住ICU" />
        </el-form-item>
        <el-form-item label="是否伴有脓毒症" prop="hospitalizedNdz">
          <el-input v-model="form.hospitalizedNdz" placeholder="请输入是否伴有脓毒症" />
        </el-form-item>
        <el-form-item label="是否机械通气" prop="hospitalizedJxtq">
          <el-input v-model="form.hospitalizedJxtq" placeholder="请输入是否机械通气" />
        </el-form-item>
        <el-form-item label="咳嗽咳痰" prop="hospitalizedKskt">
          <el-input v-model="form.hospitalizedKskt" placeholder="请输入咳嗽咳痰" />
        </el-form-item>
        <el-form-item label="发热" prop="hospitalizedFr">
          <el-input v-model="form.hospitalizedFr" placeholder="请输入发热" />
        </el-form-item>
        <el-form-item label="腹泻" prop="hospitalizedFx">
          <el-input v-model="form.hospitalizedFx" placeholder="请输入腹泻" />
        </el-form-item>
        <el-form-item label="呕吐" prop="hospitalizedHt">
          <el-input v-model="form.hospitalizedHt" placeholder="请输入呕吐" />
        </el-form-item>
        <el-form-item label="胸痛" prop="hospitalizedXt">
          <el-input v-model="form.hospitalizedXt" placeholder="请输入胸痛" />
        </el-form-item>
        <el-form-item label="咯血" prop="hospitalizedKx">
          <el-input v-model="form.hospitalizedKx" placeholder="请输入咯血" />
        </el-form-item>
        <el-form-item label="肌肉酸痛" prop="hospitalizedJrst">
          <el-input v-model="form.hospitalizedJrst" placeholder="请输入肌肉酸痛" />
        </el-form-item>
        <el-form-item label="胸闷、气急" prop="hospitalizedXm">
          <el-input v-model="form.hospitalizedXm" placeholder="请输入胸闷、气急" />
        </el-form-item>
        <el-form-item label="头痛头晕" prop="hospitalizedTtty">
          <el-input v-model="form.hospitalizedTtty" placeholder="请输入头痛头晕" />
        </el-form-item>
        <el-form-item label="其他" prop="hospitalizedOther">
          <el-input v-model="form.hospitalizedOther" placeholder="请输入其他" />
        </el-form-item>
        <el-form-item label="WBC" prop="bloodWbc">
          <el-input v-model="form.bloodWbc" placeholder="请输入WBC" />
        </el-form-item>
        <el-form-item label="NEUT(%)" prop="bloodNeut">
          <el-input v-model="form.bloodNeut" placeholder="请输入NEUT(%)" />
        </el-form-item>
        <el-form-item label="L" prop="bloodL">
          <el-input v-model="form.bloodL" placeholder="请输入L" />
        </el-form-item>
        <el-form-item label="C-反应蛋白" prop="bloodFydb">
          <el-input v-model="form.bloodFydb" placeholder="请输入C-反应蛋白" />
        </el-form-item>
        <el-form-item label="降钙素原" prop="bloodJgsy">
          <el-input v-model="form.bloodJgsy" placeholder="请输入降钙素原" />
        </el-form-item>
        <el-form-item label="CD4计数" prop="bloodCd4">
          <el-input v-model="form.bloodCd4" placeholder="请输入CD4计数" />
        </el-form-item>
        <el-form-item label="ALT" prop="liverAlt">
          <el-input v-model="form.liverAlt" placeholder="请输入ALT" />
        </el-form-item>
        <el-form-item label="AST" prop="liverAst">
          <el-input v-model="form.liverAst" placeholder="请输入AST" />
        </el-form-item>
        <el-form-item label="GGT" prop="liverGgt">
          <el-input v-model="form.liverGgt" placeholder="请输入GGT" />
        </el-form-item>
        <el-form-item label="Tbil" prop="liverTbil">
          <el-input v-model="form.liverTbil" placeholder="请输入Tbil" />
        </el-form-item>
        <el-form-item label="尿素" prop="kidneyNs">
          <el-input v-model="form.kidneyNs" placeholder="请输入尿素" />
        </el-form-item>
        <el-form-item label="血肌酐" prop="kidneyXjg">
          <el-input v-model="form.kidneyXjg" placeholder="请输入血肌酐" />
        </el-form-item>
        <el-form-item label="血β2-微球蛋白" prop="kidneyWqdb">
          <el-input v-model="form.kidneyWqdb" placeholder="请输入血β2-微球蛋白" />
        </el-form-item>
        <el-form-item label="尿酸" prop="kidneyNs2">
          <el-input v-model="form.kidneyNs2" placeholder="请输入尿酸" />
        </el-form-item>
        <el-form-item label="肺空洞" prop="lungsFkd">
          <el-input v-model="form.lungsFkd" placeholder="请输入肺空洞" />
        </el-form-item>
        <el-form-item label="磨玻璃样影" prop="lungsMblyy">
          <el-input v-model="form.lungsMblyy" placeholder="请输入磨玻璃样影" />
        </el-form-item>
        <el-form-item label="肺结节" prop="lungsFjj">
          <el-input v-model="form.lungsFjj" placeholder="请输入肺结节" />
        </el-form-item>
        <el-form-item label="多发斑片实变影" prop="lungsDfbpsby">
          <el-input v-model="form.lungsDfbpsby" placeholder="请输入多发斑片实变影" />
        </el-form-item>
        <el-form-item label="胸腔积液" prop="lungsXqjy">
          <el-input v-model="form.lungsXqjy" placeholder="请输入胸腔积液" />
        </el-form-item>
        <el-form-item label="胸膜增厚" prop="lungsXmzh">
          <el-input v-model="form.lungsXmzh" placeholder="请输入胸膜增厚" />
        </el-form-item>
        <el-form-item label="纵膈淋巴结增大" prop="lungsZglbjzd">
          <el-input v-model="form.lungsZglbjzd" placeholder="请输入纵膈淋巴结增大" />
        </el-form-item>
        <el-form-item label="如不确定前面的分类，请将CT报告的完整描述贴到此栏" prop="lungsOther">
          <el-input v-model="form.lungsOther" placeholder="请输入如不确定前面的分类，请将CT报告的完整描述贴到此栏" />
        </el-form-item>
        <el-form-item label="培养" prop="otherPy">
          <el-input v-model="form.otherPy" placeholder="请输入培养" />
        </el-form-item>
        <el-form-item label="血清学" prop="otherXqx">
          <el-input v-model="form.otherXqx" placeholder="请输入血清学" />
        </el-form-item>
        <el-form-item label="PCR" prop="otherPcr">
          <el-input v-model="form.otherPcr" placeholder="请输入PCR" />
        </el-form-item>
        <el-form-item label="抗生素" prop="treatKss">
          <el-input v-model="form.treatKss" placeholder="请输入抗生素" />
        </el-form-item>
        <el-form-item label="抗病毒药物" prop="treatKbdyw">
          <el-input v-model="form.treatKbdyw" placeholder="请输入抗病毒药物" />
        </el-form-item>
        <el-form-item label="体液支持" prop="treatTyzc">
          <el-input v-model="form.treatTyzc" placeholder="请输入体液支持" />
        </el-form-item>
        <el-form-item label="免疫球蛋白" prop="treatMyqdb">
          <el-input v-model="form.treatMyqdb" placeholder="请输入免疫球蛋白" />
        </el-form-item>
        <el-form-item label="ECMO支持" prop="treatEcmo">
          <el-input v-model="form.treatEcmo" placeholder="请输入ECMO支持" />
        </el-form-item>
        <el-form-item label="其他" prop="treatOther">
          <el-input v-model="form.treatOther" placeholder="请输入其他" />
        </el-form-item>
        <el-form-item label="小于28天内死亡" prop="returnLt28death">
          <el-input v-model="form.returnLt28death" placeholder="请输入小于28天内死亡" />
        </el-form-item>
        <el-form-item label="90天死亡" prop="return90death">
          <el-input v-model="form.return90death" placeholder="请输入90天死亡" />
        </el-form-item>
        <el-form-item label="死亡距发病时间" prop="returnLg90death">
          <el-input v-model="form.returnLg90death" placeholder="请输入死亡距发病时间" />
        </el-form-item>
        <el-form-item label="目前存活" prop="returnLive">
          <el-input v-model="form.returnLive" placeholder="请输入目前存活" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listSamplePatient, getSamplePatient, delSamplePatient, addSamplePatient, updateSamplePatient } from "@/api/sample/samplePatient"

export default {
  name: "SamplePatient",
  dicts: ['sys_user_sex'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 样品患者信息表格数据
      samplePatientList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        bahCode: null,
        name: null,
        birth: null,
        sex: null,
        address: null,
        baseJwjk: null,
        baseXxgbb: null,
        baseZsmyxjb: null,
        baseQgyz: null,
        baseGxbyz: null,
        baseCopd: null,
        baseJsy: null,
        baseExzl: null,
        baseHiv: null,
        baseExxyb: null,
        baseTnb: null,
        baseOther: null,
        hospitalizedIcu: null,
        hospitalizedNdz: null,
        hospitalizedJxtq: null,
        hospitalizedKskt: null,
        hospitalizedFr: null,
        hospitalizedFx: null,
        hospitalizedHt: null,
        hospitalizedXt: null,
        hospitalizedKx: null,
        hospitalizedJrst: null,
        hospitalizedXm: null,
        hospitalizedTtty: null,
        hospitalizedOther: null,
        bloodWbc: null,
        bloodNeut: null,
        bloodL: null,
        bloodFydb: null,
        bloodJgsy: null,
        bloodCd4: null,
        liverAlt: null,
        liverAst: null,
        liverGgt: null,
        liverTbil: null,
        kidneyNs: null,
        kidneyXjg: null,
        kidneyWqdb: null,
        kidneyNs2: null,
        lungsFkd: null,
        lungsMblyy: null,
        lungsFjj: null,
        lungsDfbpsby: null,
        lungsXqjy: null,
        lungsXmzh: null,
        lungsZglbjzd: null,
        lungsOther: null,
        otherPy: null,
        otherXqx: null,
        otherPcr: null,
        treatKss: null,
        treatKbdyw: null,
        treatTyzc: null,
        treatMyqdb: null,
        treatEcmo: null,
        treatOther: null,
        returnLt28death: null,
        return90death: null,
        returnLg90death: null,
        returnLive: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询样品患者信息列表 */
    getList() {
      this.loading = true
      listSamplePatient(this.queryParams).then(response => {
        this.samplePatientList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        bahCode: null,
        name: null,
        birth: null,
        sex: null,
        address: null,
        baseJwjk: null,
        baseXxgbb: null,
        baseZsmyxjb: null,
        baseQgyz: null,
        baseGxbyz: null,
        baseCopd: null,
        baseJsy: null,
        baseExzl: null,
        baseHiv: null,
        baseExxyb: null,
        baseTnb: null,
        baseOther: null,
        hospitalizedIcu: null,
        hospitalizedNdz: null,
        hospitalizedJxtq: null,
        hospitalizedKskt: null,
        hospitalizedFr: null,
        hospitalizedFx: null,
        hospitalizedHt: null,
        hospitalizedXt: null,
        hospitalizedKx: null,
        hospitalizedJrst: null,
        hospitalizedXm: null,
        hospitalizedTtty: null,
        hospitalizedOther: null,
        bloodWbc: null,
        bloodNeut: null,
        bloodL: null,
        bloodFydb: null,
        bloodJgsy: null,
        bloodCd4: null,
        liverAlt: null,
        liverAst: null,
        liverGgt: null,
        liverTbil: null,
        kidneyNs: null,
        kidneyXjg: null,
        kidneyWqdb: null,
        kidneyNs2: null,
        lungsFkd: null,
        lungsMblyy: null,
        lungsFjj: null,
        lungsDfbpsby: null,
        lungsXqjy: null,
        lungsXmzh: null,
        lungsZglbjzd: null,
        lungsOther: null,
        otherPy: null,
        otherXqx: null,
        otherPcr: null,
        treatKss: null,
        treatKbdyw: null,
        treatTyzc: null,
        treatMyqdb: null,
        treatEcmo: null,
        treatOther: null,
        returnLt28death: null,
        return90death: null,
        returnLg90death: null,
        returnLive: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null
      }
      this.resetForm("form")
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm")
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = "添加样品患者信息"
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const id = row.id || this.ids
      getSamplePatient(id).then(response => {
        this.form = response.data
        this.open = true
        this.title = "修改样品患者信息"
      })
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateSamplePatient(this.form).then(response => {
              this.$modal.msgSuccess("修改成功")
              this.open = false
              this.getList()
            })
          } else {
            addSamplePatient(this.form).then(response => {
              this.$modal.msgSuccess("新增成功")
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids
      this.$modal.confirm('是否确认删除样品患者信息编号为"' + ids + '"的数据项？').then(function() {
        return delSamplePatient(ids)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess("删除成功")
      }).catch(() => {})
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('sample/samplePatient/export', {
        ...this.queryParams
      }, `samplePatient_${new Date().getTime()}.xlsx`)
    }
  }
}
</script>
