<template>
    <div class="app-container">
      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
        <el-form-item label="姓名" prop="patientName">
          <el-input
            v-model="queryParams.patientName"
            placeholder="请输入姓名"
            clearable
            style="width: 240px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="身份证号" prop="roleKey">
          <el-input
            v-model="queryParams.identity"
            placeholder="请输入身份证号"
            clearable
            style="width: 240px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="预约开始时间">
          <el-date-picker
            type="date"
            placeholder="选择开始时间"
            v-model="queryParams.applyStartDate"
            style="width: 100%"
            value-format="yyyy-MM-dd"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="预约结束时间">
          <el-date-picker
            type="date"
            placeholder="选择结束时间"
            v-model="queryParams.applyEndDate"
            style="width: 100%"
            value-format="yyyy-MM-dd"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="预约项目" prop="status">
          <el-select clearable v-model="queryParams.projectId" placeholder="请选择">
            <el-option
              v-for="item in optionsList"
              :key="item.projectId"
              :label="item.projectName"
              :value="item.projectId"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="预约机构" prop="status">
          <treeselect
            v-model="queryParams.deptId"
            :options="deptOptions"
            :normalizer="normalizer"
            placeholder="选择机构"
            style="width: 240px"
          />
          <!-- 根据权限方法进行禁用 disabled -->
        </el-form-item>
        <el-form-item label="预约状态" prop="exceedStatus">
          <el-select v-model="queryParams.exceedStatus" clearable style="width: 240px">
            <el-option label="生效中" value="0"></el-option>
            <el-option label="已过期" value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="登记状态" prop="screeningStatus">
          <el-select v-model="queryParams.registrationStatus" clearable style="width: 240px">
            <el-option label="全部" value></el-option>
            <el-option label="未登记" value="0"></el-option>
            <el-option label="已登记" value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="筛查结果" prop="status">
          <el-select v-model="queryParams.hasResult" clearable style="width: 240px">
            <el-option label="未生成" value="0"></el-option>
            <el-option label="已生成" value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="筛查类型" prop="status">
          <el-select v-model="queryParams.screeningType" clearable style="width: 240px">
            <el-option label="居民预约" value="1"></el-option>
            <el-option label="医生推送" value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="诊断状态" prop="status">
          <el-select v-model="queryParams.hasDiagnose" clearable style="width: 240px">
            <el-option label="未诊断" value="0"></el-option>
            <el-option label="已诊断" value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="扫码登记" prop="status">
          <el-input
            v-model="queryParams.applyCode"
            placeholder="请扫码"
            clearable
            style="width: 240px"
            @keyup.enter.native="handleQuery1"
          />
        </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="danger" plain icon="el-icon-edit" size="mini" @click="fxpg()"
            >风险评估</el-button
          >-->
          <!-- <el-button type="success" plain icon="el-icon-edit" size="mini" @click="nrsg">纳入专病患者管理</el-button> -->
          <!-- <el-button
          plain type="primary" icon="el-icon-s-marketing" size="mini" @click="sc()">筛查</el-button>-->
          <!-- <el-button plain type="success" icon="el-icon-s-marketing" size="mini" @click="handleDelete()">健康中心</el-button> -->
          <!-- <el-dropdown>
            <el-button type="primary" size="mini" plain style="margin-left: 3px; margin-right: 3px" :disabled="diabledyd">
              糖尿病-眼底病变筛查<i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item @click.native="ydbb()">
                糖尿病-眼底病变筛查</el-dropdown-item>
              <el-dropdown-item @click.native="ydbbck()">
                糖尿病-眼底病变筛查查看</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <el-dropdown>
            <el-button type="danger" size="mini" plain style="margin-left: 3px; margin-right: 3px" :disabled="diabledxs">
              糖尿病-血小板筛查<i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item @click.native="xxb()"> 糖尿病-血小板筛查</el-dropdown-item>
              <el-dropdown-item @click.native="xxbck()">
                糖尿病-血小板筛查查看</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>-->
          <!-- <el-button type="warning" plain icon="el-icon-edit" size="mini" @click="yydj">预约登记</el-button> -->
          <!-- <el-button type="primary" plain icon="el-icon-edit" size="mini" @click="jgck">结果查看</el-button>
          <el-button type="warning" plain icon="el-icon-edit" size="mini" @click="subscribeRegister">写诊断</el-button>-->
          <!-- <el-button plain type="primary" icon="el-icon-s-marketing" size="mini" @click="ydbb()" :disabled="diabledyd">糖尿病-眼底病变筛查</el-button> -->
          <!-- <el-button plain type="danger" icon="el-icon-s-marketing" size="mini" @click="xxb()" :disabled="diabledxs">糖尿病-血小板筛查</el-button> -->
          <!-- <el-button plain type="success" icon="el-icon-s-marketing" size="mini" @click="dpl()" :disabled="diableddpl">多普勒动脉粥样筛查</el-button> -->
          <!-- <el-button plain type="success" icon="el-icon-s-marketing" size="mini" @click="zmzwgl()">居民自我管理信息展示</el-button>
          <el-button plain type="primary" @click="jkcf()" size="mini" icon="el-icon-s-custom">居民健康处方展示</el-button>-->
  
          <!-- <el-button plain icon="el-icon-plus" type="primary" size="mini" @click="yth()"
            >一体化照护方案</el-button
          >
          <el-button type="danger" plain @click="sf()" size="mini" icon="el-icon-edit"
            >随访</el-button
          >-->
          <!-- <el-button
            @click="qx()"
            plain
            type="success"
            size="mini"
            icon="el-icon-edit"
            >签约</el-button
          >-->
          <!-- <el-button plain icon="el-icon-plus" type="primary" size="mini" @click="zzgl()"
            >终止管理</el-button
          >-->
        </el-col>
  
        <!-- <el-col :span="1.5" style="margin-left: 49%">
          <div>
            <div style="display: flex; justify-content: end; align-items: center">
              <div style="font-weight: 600">完成:</div>
              <div
                style="
                  border-radius: 50%;
                  background: rgb(68 234 75);
                  margin-left: 5px;
                  margin-right: 20px;
                  width: 20px;
                  height: 20px;
                "
              ></div>
              <div style="font-weight: 600">未完成:</div>
              <div
                style="
                  border-radius: 50%;
                  margin-left: 5px;
                  margin-right: 20px;
                  background: #ffeb3b;
                  width: 20px;
                  height: 20px;
                "
              ></div>
  
              <right-toolbar
                :showSearch.sync="showSearch"
                @queryTable="getList"
              ></right-toolbar>
            </div>
          </div>
        </el-col>-->
        <!-- <div style="font-weight: 600">高危:</div> -->
        <!-- <div style="
                  border-radius: 50%;
                  margin-left: 5px;
                  margin-right: 20px;
                  background: #f44141;
                  width: 20px;
                  height: 20px;
                "></div>
        <div style="font-weight: 600">未知:</div>-->
        <!-- <div style="margin-right: 20px">-</div> -->
      </el-row>
  
      <el-table ref="multipleTable" @row-click="singleElection" v-loading="loading" :data="postList">
        <!-- <el-table-column
        type="selection"
        width="55">
        </el-table-column>-->
        <!-- <el-table-column align="center" width="55">
        <template slot-scope="scope">-->
        <!-- <el-radio class="radio" v-model="templateSelection" :label="scope.row.screeningId">{{ a }}</el-radio> -->
        <!-- </template>
        </el-table-column>-->
        <el-table-column label="姓名" prop="patientName" align="center" />
        <el-table-column
          label="性别"
          prop="gender"
          :show-overflow-tooltip="true"
          align="center"
          width="60"
        >
          <template slot-scope="scope">
            <span v-if="scope.row.gender == 'MAIL'">男</span>
            <span v-if="scope.row.gender == 'FEMALE'">女</span>
          </template>
        </el-table-column>
        <el-table-column label="年龄" width="60" align="center" prop="age" />
        <el-table-column label="手机号码" prop="phone" align="center">
          <!-- <template slot-scope="scope">
              <el-switch
                v-model="scope.row.status"
                active-value="0"
                inactive-value="1"
                @change="handleStatusChange(scope.row)"
              ></el-switch>
          </template>-->
        </el-table-column>
        <el-table-column label="身份证号" prop="identity" :show-overflow-tooltip="true" align="center" />
        <el-table-column label="预约项目" prop="projectName" align="center" width="160" />
        <el-table-column label="预约机构" :show-overflow-tooltip="true" prop="hospitalName" align="center" />
        <!-- <el-table-column label="慢病" width="180" align="center">
          <template slot-scope="scope">
            <div style="display: flex;margin:0 auto">
              <div v-if="scope.row.disease">高血压,</div>
              <div v-if="scope.row.disease.indexOf(2) != -1">糖尿病,</div>
              <div v-if="scope.row.disease.indexOf(3) != -1">高血脂</div>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="糖尿病-眼底筛查完成状态" width="200" align="center">
          <template slot-scope="scope">
            <div style="display: flex;">
              <div
                v-if="scope.row.eyeStatus == 1"
                style="
                  border-radius: 50%;
                  background: rgb(68 234 75);
                  margin-left: 5px;
                  margin-right: 20px;
                  width: 20px;
                  height: 20px;
                  margin:0 auto
                "
              ></div>
  
              <div
                v-if="scope.row.eyeStatus == 0"
                style="
                  border-radius: 50%;
                  margin-left: 5px;
                  margin-right: 20px;
                  background: #ffeb3b;
                  width: 20px;
                  margin:0 auto
                  height: 20px;
                "
              ></div>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="糖尿病-血小板筛查完成状态" width="200">
          <template slot-scope="scope">
            <div style="display: flex">
              <div
                v-if="scope.row.plateletStatus == 1"
                style="
                  border-radius: 50%;
                  background: rgb(68 234 75);
                  margin-left: 5px;
                  margin-right: 20px;
                  width: 20px;
                  height: 20px;
                  margin:0 auto;
                "
              ></div>
  
              <div
                v-if="scope.row.plateletStatus == 0"
                style="
                  border-radius: 50%;
                  margin-left: 5px;
                  margin-right: 20px;
                  background: #ffeb3b;
                  width: 20px;
                  height: 20px;
                  margin:0 auto;
                "
              ></div>
            </div>
          </template>
        </el-table-column>-->
        <!-- <el-table-column label="高血压风险等级" prop="postId" :show-overflow-tooltip="true" width="150" /> -->
        <!-- <el-table-column label="慢病人群" align="center" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <span v-if="scope.row.diabetesFlag == 1">糖尿病 </span>
            <span v-if="scope.row.hyperlipemiaFlag == 1">高血压 </span>
            <span v-if="scope.row.hypertensionFlag == 1">高血脂 </span>
          </template>
        </el-table-column>
        <el-table-column label="高血压" align="center" prop="riskLevelHbp" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <div style="width: 20px; margin: 0 auto">
              <div v-if="scope.row.riskLevelHbp == '1'" style="
                  border-radius: 50%;
                  background: rgb(68 234 75);
                  width: 20px;
                  height: 20px;
                "></div>
              <div v-if="scope.row.riskLevelHbp == '2'" style="
                  border-radius: 50%;
                  background: rgb(255, 235, 59);
                  width: 20px;
                  height: 20px;
                "></div>
              <div v-if="scope.row.riskLevelHbp == '3'" style="
                  border-radius: 50%;
                  background: #f44141;
                  width: 20px;
  
                  height: 20px;
                "></div>
              <div v-if="scope.row.riskLevelHbp == '极高危'" style="
                  border-radius: 50%;
                  background: #b42fa9;
                  width: 20px;
                  height: 20px;
                "></div>
              <div v-if="scope.row.riskLevelHbp == '0' || !scope.row.riskLevelAscvd">-</div>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="糖尿病" align="center" prop="riskLevelDm">
          <template slot-scope="scope">
            <div style="width: 20px; margin: 0 auto">
              <div v-if="scope.row.riskLevelDm == '1'" style="
                  border-radius: 50%;
                  background: rgb(68 234 75);
                  width: 20px;
                  height: 20px;
                "></div>
              <div v-if="scope.row.riskLevelDm == '2'" style="
                  border-radius: 50%;
  
                  background: rgb(255, 235, 59);
                  width: 20px;
                  height: 20px;
                "></div>
              <div v-if="scope.row.riskLevelDm == '3'" style="
                  border-radius: 50%;
  
                  background: #f44141;
                  width: 20px;
                  height: 20px;
                "></div>
              <div v-if="scope.row.riskLevelDm == '极高危'" style="
                  border-radius: 50%;
                  background: #b42fa9;
  
                  width: 20px;
                  height: 20px;
                "></div>
              <div v-if="scope.row.riskLevelDm == '0' || !scope.row.riskLevelAscvd">-</div>
            </div>
          </template>
  
  
        </el-table-column>
        <el-table-column label="高血脂" prop="riskLevelHpd" align="center" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <div style="width: 20px; margin: 0 auto">
              <div v-if="scope.row.riskLevelHpd == '1'" style="
                  border-radius: 50%;
                  background: rgb(68 234 75);
                  width: 20px;
                  height: 20px;
                "></div>
              <div v-if="scope.row.riskLevelHpd == '2'" style="
                  border-radius: 50%;
                  background: rgb(255, 235, 59);
                  width: 20px;
                  height: 20px;
                "></div>
              <div v-if="scope.row.riskLevelHpd == '3'"
                style="border-radius: 50%; background: #f44141; width: 20px; height: 20px"></div>
              <div v-if="scope.row.riskLevelHpd == '极高危'"
                style="border-radius: 50%; background: #b42fa9; width: 20px; height: 20px"></div>
              <div v-if="scope.row.riskLevelHpd == '0' || !scope.row.riskLevelAscvd">-</div>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="ASCVD" prop="riskLevelAscvd" align="center" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <div style="width: 20px; margin: 0 auto">
              <div v-if="scope.row.riskLevelAscvd == '1'" style="
                  border-radius: 50%;
                  background: rgb(68 234 75);
                  width: 20px;
                  height: 20px;
                "></div>
              <div v-if="scope.row.riskLevelAscvd == '2'" style="
                  border-radius: 50%;
                  background: rgb(255, 235, 59);
                  width: 20px;
                  height: 20px;
                "></div>
              <div v-if="scope.row.riskLevelAscvd == '3'"
                style="border-radius: 50%; background: #f44141; width: 20px; height: 20px"></div>
  
              <div v-if="scope.row.riskLevelAscvd == '极高危'"
                style="border-radius: 50%; background: #b42fa9; width: 20px; height: 20px"></div>
              <div v-if="scope.row.riskLevelAscvd == '0' || !scope.row.riskLevelAscvd">-</div>
            </div>
          </template>
        </el-table-column>-->
        <!-- <el-table-column label="纳入时间" align="center" prop="postId">
          <template slot-scope="scope">
            <span>{{ scope.row.manageTime }}</span>
          </template>
        </el-table-column>-->
        <el-table-column
          label="预约开始时间"
          prop="applyStartTime"
          :show-overflow-tooltip="true"
          align="center"
          width="150"
        ></el-table-column>
        <el-table-column
          label="预约结束时间"
          prop="applyEndTime"
          :show-overflow-tooltip="true"
          align="center"
          width="150"
        />
        <!-- <template slot-scope="scope">
            <span v-if="scope.row.manageStatus == 1">在管</span>
            <span v-if="scope.row.manageStatus == 0">终止</span>
        </template>-->
        <el-table-column
          label="预约状态"
          prop="exceedStatus"
          :show-overflow-tooltip="true"
          align="center"
        >
          <template slot-scope="scope">
            <span v-if="scope.row.exceedStatus == 0">生效中</span>
            <span v-if="scope.row.exceedStatus == 1">已过期</span>
          </template>
        </el-table-column>
  
        <el-table-column
          label="登记状态"
          prop="registrationStatus"
          :show-overflow-tooltip="true"
          align="center"
        >
          <template slot-scope="scope">
            <span v-if="scope.row.screeningStatus > 2">已登记</span>
            <span v-if="scope.row.screeningStatus < 2">未登记</span>
          </template>
        </el-table-column>
        <el-table-column
          label="登记时间"
          align="center"
          prop="registrationDate"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="登记条码号"
          align="center"
          width="100px"
          prop="registrationCode"
          :show-overflow-tooltip="true"
        />
        <el-table-column label="筛查结果" prop="hasResult" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.hasResult == 0">未生成</span>
            <span v-if="scope.row.hasResult == 1">已生成</span>
          </template>
        </el-table-column>
        <el-table-column label="筛查类型" prop="screeningType" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.screeningType == 1">居民预约</span>
            <span v-if="scope.row.screeningType == 2">医生推送</span>
          </template>
        </el-table-column>
        <el-table-column label="诊断状态" prop="hasDiagnose" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.hasDiagnose == 0">未诊断</span>
            <span v-if="scope.row.hasDiagnose == 1">已诊断</span>
          </template>
        </el-table-column>
        <el-table-column
          label="推送日期"
          align="center"
          width="100px"
          prop="pushDate"
          :show-overflow-tooltip="true"
        />
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button
              v-if="scope.row.hasDiagnose == 1"
              size="mini"
              type="text"
              @click="goToPerformanceDetailxxb(scope.row)"
              >查看结果</el-button
            >
            <el-button
              size="mini"
              type="text"
              v-if="role == 'sdCommon' && scope.row.hasDiagnose == 0"
              @click="ydbb(scope.row)"
            >写诊断</el-button>
            <!-- scope.row.screeningType == 1 只有等于居民预约的时候才会显示该按钮  1 == 居民预约  2 == 医生推送 -->
            <el-button
              size="mini"
              type="text"
              v-if="role == 'sdCommon' && scope.row.screeningStatus < 2 && scope.row.screeningType == 1"
              @click="yydj(scope.row)"
            >登记</el-button>
            <!-- <el-button size="mini" type="text"
            v-if="role == 'staff' && scope.row.manageStatus == 0" @click="nrsg(scope.row)">纳入专病管理</el-button>-->
          </template>
        </el-table-column>
  
        <!-- <el-table-column
          label="家庭地址"
          align="center"
          prop="address"
          :show-overflow-tooltip="true"
        />-->
        <!-- <el-table-column label="所属机构" align="center" prop="orgName" :show-overflow-tooltip="true" />
        <el-table-column label="管理机构" align="center" prop="manageOrgName" :show-overflow-tooltip="true" />
        <el-table-column label="管理医生" align="center" prop="doctorName" :show-overflow-tooltip="true" />-->
      </el-table>
  
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        :page-sizes="[15, 30, 45, 60]"
        @pagination="getList"
      />
      <el-dialog :title="title" :visible.sync="ydbbopen" width="60%" append-to-body>
        <div style="display: flex; justify-content: space-around" v-if="title == '糖尿病-眼底病变筛查'">
          <div>
            <el-upload
              ref="upload"
              :action="url"
              list-type="picture-card"
              :headers="headers"
              :data="type"
              :file-list="fileList"
              :on-success="
                (res, file) => {
                  handleAvatarSuccess(item, res, file);
                }
              "
              :auto-upload="true"
              :on-change="onExceed1"
            >
              <i slot="default" class="el-icon-plus"></i>
              <div slot="file" slot-scope="{ file }">
                <img class="el-upload-list__item-thumbnail" :src="file.url" alt />
                <span class="el-upload-list__item-actions">
                  <span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
                    <i class="el-icon-zoom-in"></i>
                  </span>
                  <!-- <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleDownload(file)">
                    <i class="el-icon-download"></i>
                  </span>
                  <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleRemove(file)">
                    <i class="el-icon-delete"></i>
                  </span>-->
                </span>
              </div>
            </el-upload>
            <div style="margin-top: 20px; margin-bottom: 20px">左眼图片</div>
          </div>
          <div>
            <el-upload
              ref="upload1"
              :action="url"
              list-type="picture-card"
              :headers="headers"
              :data="typeyy"
              :on-success="
                (res, file) => {
                  handleAvatarSuccessyy(item, res, file);
                }
              "
              :auto-upload="true"
              :on-exceed="handleExceed"
              :file-list="fileList1"
              :on-change="onExceed"
            >
              <i slot="default" class="el-icon-plus"></i>
              <div slot="file" slot-scope="{ file }">
                <img class="el-upload-list__item-thumbnail" :src="file.url" alt />
                <span class="el-upload-list__item-actions">
                  <span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
                    <i class="el-icon-zoom-in"></i>
                  </span>
                  <!-- <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleDownload(file)">
                    <i class="el-icon-download"></i>
                  </span>
                  <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleRemove(file)">
                    <i class="el-icon-delete"></i>
                  </span>-->
                </span>
              </div>
            </el-upload>
            <div style="margin-top: 20px; margin-bottom: 20px">右眼图片</div>
          </div>
        </div>
  
        <el-form
          :model="ruleForm"
          :rules="rules"
          ref="ruleForm"
          label-width="100px"
          class="demo-ruleForm"
          v-if="title == '血小板筛查'"
        >
          <el-upload
            ref="upload3"
            :action="url"
            list-type="picture-card"
            :headers="headers"
            :data="typexxb"
            style="margin: 30px; margin-left: 10px"
            :on-success="
              (res, file) => {
                handleAvatarSuccessxxb(res, file);
              }
            "
            :auto-upload="true"
            :file-list="fileList2"
            :on-change="onExceed"
          >
            <i slot="default" class="el-icon-plus"></i>
            <div slot="file" slot-scope="{ file }">
              <img class="el-upload-list__item-thumbnail" :src="file.url" alt />
              <span class="el-upload-list__item-actions">
                <span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
                  <i class="el-icon-zoom-in"></i>
                </span>
                <!-- <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleDownload(file)">
                    <i class="el-icon-download"></i>
                  </span>
                  <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleRemove(file)">
                    <i class="el-icon-delete"></i>
                </span>-->
              </span>
            </div>
          </el-upload>
          <el-form-item label="诊断结果" prop="desc">
            <el-input type="textarea" v-model="ruleForm.descdxxb"></el-input>
          </el-form-item>
        </el-form>
        <el-form
          :model="ruleForm"
          :rules="rules"
          ref="ruleForm"
          label-width="100px"
          class="demo-ruleForm"
          v-if="title == '阿尔兹海默症筛查'"
        >
          <el-upload
            :auto-upload="true"
            class="upload-demo"
            :action="url"
            :headers="headers"
            :data="typexamz"
            :file-list="fileList3"
            :on-change="onExceed"
            :on-preview="onFileitem"
            :before-upload="beforeAvatarUpload"
            accept=".doc, .docx"
            :on-success="
              (res, file) => {
                handleAvatarSuccessamz(res, file);
              }
            "
          >
            <el-button size="small" type="primary" v-if="isflas == true">点击上传</el-button>
            <div slot="tip" class="el-upload__tip"  v-if="isflas == true">只能上传docx/doc文件</div>
          </el-upload>
          <el-form-item label="诊断结果" prop="desc" style="margin-top:60px"  v-if="isflas == true">
            <el-input type="textarea" v-model="ruleForm.descdxxb" ></el-input>
          </el-form-item>
          <el-form-item label="诊断结果" prop="desc" style="margin-top:60px" else>
            <el-input type="textarea" v-model="ydmb.diagnosticResult" ></el-input>
          </el-form-item>
        </el-form>
        <ul style="list-style: none;" ref="LDQZOne" v-show="false"></ul>
        <el-form
          :model="ruleForm"
          :rules="rules"
          ref="ruleForm"
          label-width="100px"
          class="demo-ruleForm"
          v-if="title == '糖尿病-眼底病变筛查'"
        >
          <el-form-item label="眼底诊断结果" prop="desc">
            <el-input type="textarea" v-model="ruleForm.descyd"></el-input>
          </el-form-item>
        </el-form>
        <div style="width: 100%" v-if="title == '健康处方'">
          <table
            border="1"
            width="1100"
            style="
              border: 1px dashed #a1a1a1;
              margin-bottom: 20px;
              border-radius: 10px;
            "
            height="100"
            cellspacing="0"
          >
            <tr>
              <td
                colspan="1"
                style="
                  display: flex;
                  justify-content: center;
                  align-items: center;
                  border: 1px dashed #a1a1a1;
                "
              >
                <h3 style="color: #4192f4">健康教育处方：</h3>
              </td>
              <td
                style="border: 1px dashed #a1a1a1; width: 900px"
              >{{ prescriptionData.healthEducation }}</td>
            </tr>
            <tr>
              <td
                colspan="1"
                style="
                  display: flex;
                  justify-content: center;
                  align-items: center;
                  border: 0px dashed #a1a1a1;
                "
              >
                <h3 style="color: #4192f4">用药调整处方：</h3>
              </td>
              <td style="border: 1px dashed #a1a1a1; width: 900px">{{ prescriptionData.nutritional }}</td>
            </tr>
            <tr>
              <td
                colspan="1"
                style="
                  display: flex;
                  justify-content: center;
                  align-items: center;
                  border: 1px dashed #a1a1a1;
                "
              >
                <h3 style="color: #4192f4">运动治疗处方：</h3>
              </td>
              <td style="border: 1px dashed #a1a1a1; width: 900px">{{ prescriptionData.exercise }}</td>
            </tr>
            <tr>
              <td
                colspan="1"
                style="
                  display: flex;
                  justify-content: center;
                  align-items: center;
                  border: 0px dashed #a1a1a1;
                "
              >
                <h3 style="color: #4192f4">营养治疗处方：</h3>
              </td>
              <td style="border: 1px dashed #a1a1a1; width: 900px">{{ prescriptionData.nutritional }}</td>
            </tr>
          </table>
        </div>
        <el-form :inline="true" ref="myManagemenForm" :model="zwglForm" v-if="title == '自我管理'">
          <div style="border: 1px solid #dcdfe6; padding: 10px; margin-bottom: 20px">
            <div
              style="
                display: flex;
                align-items: center;
                margin-bottom: 20px;
                justify-content: center;
              "
            >
              <div style="font-size: 17px; font-weight: 900">体征</div>
            </div>
            <el-divider></el-divider>
            <div style="display: flex; margin-bottom: 20px; flex-flow: wrap">
              <el-form-item label="体重">
                <div style="display: flex; align-items: center">
                  <div>
                    <el-input v-model="boxlook.weight" disabled></el-input>
                  </div>
                  <div style="margin-left: 10px">(Kg)</div>
                </div>
              </el-form-item>
              <el-form-item label="指导体重">
                <div style="display: flex; align-items: center">
                  <div>
                    <el-input disabled v-model="boxlook.targetWeight"></el-input>
                  </div>
                  <div style="margin-left: 10px">(Kg)</div>
                </div>
              </el-form-item>
              <el-form-item label="身高:">
                <div style="display: flex; align-items: center">
                  <div>
                    <el-input v-model="boxlook.height" disabled></el-input>
                  </div>
                  <div style="margin-left: 10px">(CM)</div>
                </div>
              </el-form-item>
              <el-form-item label="腰围:">
                <div style="display: flex; align-items: center">
                  <div>
                    <el-input v-model="boxlook.waist" disabled></el-input>
                  </div>
                  <div style="margin-left: 10px">(CM)</div>
                </div>
              </el-form-item>
  
              <el-form-item label="目标腰围:">
                <div style="display: flex; align-items: center">
                  <div style="width: 120px">
                    <el-input v-model="boxlook.targetWaist" disabled></el-input>
                  </div>
                  <div style="margin-left: 10px">(CM)</div>
                </div>
              </el-form-item>
              <el-form-item label="血压:">
                <div style="display: flex; align-items: center">
                  <div>
                    <el-form-item>
                      <el-input
                        v-model="boxlook.bpDbp"
                        style="width: 120px"
                        disabled
                        placeholder="舒张压"
                      ></el-input>
                    </el-form-item>
                  </div>
                  <div>-</div>
                  <div>
                    <el-form-item style="margin-left: 10px">
                      <el-input
                        v-model="boxlook.bpSbp"
                        style="width: 120px"
                        disabled
                        placeholder="收缩压"
                      ></el-input>
                    </el-form-item>
                  </div>
                </div>
              </el-form-item>
              <el-form-item label="血压测量时间:">
                <el-date-picker
                  type="datetime"
                  placeholder="血压测量时间"
                  disabled
                  v-model="boxlook.bpMeasuringTime"
                  style="width: 100%"
                  value-format="yyyy-MM-dd HH:mm:ss"
                ></el-date-picker>
              </el-form-item>
              <el-form-item label="目标血压:">
                <div style="display: flex; align-items: center">
                  <div>
                    <el-form-item>
                      <el-input
                        disabled
                        v-model="boxlook.targetBpDbp"
                        style="width: 120px"
                        placeholder="舒张压"
                      ></el-input>
                    </el-form-item>
                  </div>
                  <div>-</div>
                  <div>
                    <el-form-item style="margin-left: 10px">
                      <el-input
                        disabled
                        v-model="boxlook.targetBpSbp"
                        style="width: 120px"
                        placeholder="收缩压"
                      ></el-input>
                    </el-form-item>
                  </div>
                </div>
              </el-form-item>
              <el-form-item label="心率:">
                <div style="display: flex; align-items: center">
                  <div>
                    <el-input disabled v-model="boxlook.heartRate"></el-input>
                  </div>
                  <div style="margin-left: 10px">(次/分)</div>
                </div>
              </el-form-item>
              <el-form-item label="血糖:">
                <div style="display: flex; align-items: center">
                  <div>
                    <el-input v-model="boxlook.bg" disabled></el-input>
                  </div>
                  <div style="margin-left: 10px">(mmol/L)</div>
                </div>
              </el-form-item>
              <el-form-item label="血糖测量时间:">
                <el-date-picker
                  type="datetime"
                  disabled
                  placeholder="血糖测量时间"
                  v-model="boxlook.bgMeasuringTime"
                  style="width: 100%"
                  value-format="yyyy-MM-dd HH:mm:ss"
                ></el-date-picker>
              </el-form-item>
              <el-form-item label="目标血糖:">
                <el-input v-model="boxlook.targetBg" disabled></el-input>
              </el-form-item>
              <el-form-item label="吸烟:">
                <div style="display: flex; align-items: center">
                  <div>
                    <el-input disabled style="width: 150px" v-model="boxlook.smoking"></el-input>
                  </div>
                  <div style="margin-left: 10px">(支)</div>
                </div>
              </el-form-item>
              <el-form-item label="饮酒:">
                <div style="display: flex; align-items: center">
                  <div>
                    <el-input disabled style="width: 150px" v-model="boxlook.drinking"></el-input>
                  </div>
                  <div style="margin-left: 10px">(两/瓶)</div>
                </div>
              </el-form-item>
            </div>
          </div>
          <div style="display: flex; justify-content: space-between">
            <div style="border: 1px solid #dcdfe6; width: 30%; padding: 20px">
              <div
                style="
                  display: flex;
                  align-items: center;
                  margin-bottom: 20px;
                  justify-content: center;
                "
              >
                <div style="font-size: 17px; font-weight: 900">饮食</div>
              </div>
              <div
                style="
                  display: flex;
                  align-items: center;
                  margin-bottom: 20px;
                  justify-content: center;
                  font-size: 18px;
                "
              >最新更新日期：{{ boxlook.manageDate }}</div>
              <el-divider></el-divider>
              <div>
                <div style="padding: 10px">
                  <span style="color: #8495ff">早餐:</span>
                  <span style="margin-left: 20px">
                    {{
                    boxlook.breakfastMain
                    }}
                  </span>
                </div>
                <div style="padding: 10px">
                  <span style="color: #8495ff">午餐:</span>
                  <span style="margin-left: 20px">{{ boxlook.lunchMain }}</span>
                </div>
                <div style="padding: 10px">
                  <span style="color: #8495ff">晚餐:</span>
                  <span style="margin-left: 20px">{{ boxlook.supperMain }}</span>
                </div>
              </div>
              <el-divider></el-divider>
              <div style="padding: 10px">
                {{ boxlook.breakfastSide }},{{ boxlook.lunchSide }},{{
                boxlook.supperSide
                }}
              </div>
            </div>
  
            <div style="border: 1px solid #dcdfe6; padding: 10px; width: 35%">
              <div
                style="
                  display: flex;
                  align-items: center;
                  justify-content: center;
                  margin-bottom: 20px;
                "
              >
                <div style="font-size: 17px; font-weight: 900">运动</div>
              </div>
              <div
                style="
                  display: flex;
                  align-items: center;
                  margin-bottom: 20px;
                  justify-content: center;
                  font-size: 18px;
                "
              >最新更新日期：{{ boxlook.manageDate }}</div>
              <el-divider></el-divider>
              <div style="display: flex; justify-content: start">
                <div
                  v-if="
                    boxlook.dailyExerciseWay1 &&
                    !boxlook.dailyExerciseWay2 &&
                    !boxlook.dailyExerciseWay3
                  "
                >
                  <div style="color: #8495ff; font-size: 20px">{{ boxlook.dailyExerciseWay1 }}</div>
                  <div
                    style="margin-top: 40px; margin-bottom: 40px; font-size: 14px"
                  >运动时间：{{ boxlook.dailyExerciseStart1 }}</div>
                  <div style="font-size: 17px">运动时长：{{ boxlook.dailyExerciseDuration1 }}分钟</div>
                </div>
                <div v-if="boxlook.dailyExerciseWay2 && !boxlook.dailyExerciseWay3">
                  <div style="color: #8495ff; font-size: 20px">{{ boxlook.dailyExerciseWay2 }}</div>
                  <div
                    style="margin-top: 40px; margin-bottom: 40px; font-size: 14px"
                  >运动时间：{{ boxlook.dailyExerciseStart2 }}</div>
                  <div style="font-size: 17px">运动时长：{{ boxlook.dailyExerciseDuration2 }}分钟</div>
                </div>
                <div v-if="boxlook.dailyExerciseWay3">
                  <div style="color: #8495ff; font-size: 20px">{{ boxlook.dailyExerciseWay3 }}</div>
                  <div
                    style="margin-top: 40px; margin-bottom: 40px; font-size: 14px"
                  >运动时间：{{ boxlook.dailyExerciseStart3 }}</div>
                  <div style="font-size: 17px">运动时长：{{ boxlook.dailyExerciseDuration3 }}分钟</div>
                </div>
              </div>
            </div>
            <div style="border: 1px solid #dcdfe6; width: 30%; padding: 20px">
              <div
                style="
                  display: flex;
                  justify-content: center;
                  margin-bottom: 20px;
                "
              >
                <div style="font-size: 17px; font-weight: 900">用药</div>
              </div>
              <div
                style="
                  display: flex;
                  align-items: center;
                  margin-bottom: 20px;
                  justify-content: center;
                  font-size: 18px;
                "
              >最新更新日期：{{ boxlook.manageDate }}</div>
              <el-divider></el-divider>
              <div style="color: #8495ff">{{ yyArrData.drugName }}</div>
              <div style="margin-top: 20px; margin-bottom: 20px">剂量：{{ yyArrData.drugSpec }}</div>
              <div>频次：{{ yyArrData.drugFreq }}</div>
              <el-divider></el-divider>
  
              <el-row>
                <el-form-item label="服药依从性:">
                  <el-radio-group v-model="boxlook.compliance">
                    <el-radio
                      disabled
                      v-for="(item, index) in complianceList"
                      :key="index"
                      :label="item.value"
                    >{{ item.label }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-row>
  
              <el-form-item label="不良反应:">
                <el-radio-group v-model="boxlook.adr">
                  <el-radio
                    disabled
                    v-for="(item, index) in adrList"
                    :key="index"
                    :label="item.value"
                  >{{ item.label }}</el-radio>
                </el-radio-group>
              </el-form-item>
            </div>
          </div>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="saveallisflas" v-if="isflas == false">确 定</el-button>

          <el-button type="primary" @click="saveall" v-else>确 定</el-button>
          <el-button @click="ydbbopen = false">取 消</el-button>
        </div>
      </el-dialog>
      <el-dialog
        :title="title"
        :visible.sync="xxbopen"
        width="70%"
        append-to-body
        @close="ydbbckopen = false"
      >
        <div
          style="
            display: flex;
            height: 600px;
            overflow-y: auto;
            padding-left: 100px;
          "
        >
          <!-- <div id="time" @click="time" v-if="isCollapse"></div>
          <div id="time1" @click="time" v-if="!isCollapse"></div>-->
          <div style="width: 100%; height: 790px; overflow-y: auto">
            <div style="display: flex; justify-content: space-around">
              <div>
                <el-image
                  :src="urlimg + attachment"
                  :preview-src-list="srcList"
                  style="width: 300px; height: 300px"
                ></el-image>
              </div>
            </div>
            <el-form style="padding-left: 200px">
              <el-form-item label="诊断结果" prop="desc">
                <el-input type="textarea" v-model="ydmb.diagnosticResult"></el-input>
              </el-form-item>
            </el-form>
          </div>
        </div>
      </el-dialog>
      <!-- 添加或修改角色配置对话框 -->
      <el-dialog
        :title="title"
        :visible.sync="ydbbckopen"
        width="70%"
        append-to-body
        @close="ydbbckopen = false"
      >
        <div style="display: flex; height: 600px; justify-content: center">
          <!-- <div id="time" @click="time" v-if="isCollapse"></div>
          <div id="time1" @click="time" v-if="!isCollapse"></div>-->
          <div style="width: 100%; height: 790px; overflow-y: auto">
            <div style="display: flex; justify-content: space-around">
              <div>
                <div>
                  <el-image
                    :src="urlimg + attachment"
                    style="width: 120px; height: 130px; margin-left: 10px"
                  ></el-image>
                  <div
                    style="
                      margin-top: 20px;
                      margin-bottom: 20px;
                      margin-left: 40px;
                    "
                  >左眼图片</div>
                </div>
              </div>
              <div>
                <el-image
                  :src="urlimg + attachmentTwo"
                  style="width: 120px; height: 130px; margin-left: 10px"
                ></el-image>
                <div style="margin-top: 20px; margin-bottom: 20px; margin-left: 40px">右眼图片</div>
              </div>
            </div>
            <el-form style="padding-left: 200px">
              <el-form-item label="诊断结果" prop="desc">
                <el-input type="textarea" v-model="ydmb.diagnosticResult"></el-input>
              </el-form-item>
            </el-form>
          </div>
        </div>
      </el-dialog>
      <!-- 分配角色数据权限对话框 -->
      <el-dialog
        title="风险评估"
        :visible.sync="openDataScope"
        append-to-body
        :close-on-click-modal="false"
      >
        <div style="height: 500px; overflow-y: auto">
          <!-- <ping-gu :rowData="query"></ping-gu> -->
          <div v-for="(item, inxe) in gw" :key="inxe" style="margin-top: 10px">
            <div style="display: flex">
              <h3 style="margin-right: 10px; min-width: 20px; line-height: 7px">{{ item.id }}</h3>
              <div v-if="item.id < 12">
                <el-button
                  type="success"
                  style="background: #ebf9f9; color: #18bebe; border: #18bebe"
                >{{ item.assessItem }}</el-button>
              </div>
              <div v-if="item.id >= 12 && item.id < 17">
                <el-button
                  type="success"
                  style="background: #fff9eb; color: #fadd14"
                >{{ item.assessItem }}</el-button>
              </div>
              <div v-if="item.id >= 17 && item.id < 23">
                <el-button
                  type="success"
                  style="background: #ebf9f9; color: #18bebe; border: #18bebe"
                >{{ item.assessItem }}</el-button>
              </div>
              <div v-if="item.id >= 23 && item.id < 31">
                <el-button
                  type="success"
                  style="background: #fff2eb; color: #eb5e12; border: #18bebe"
                >{{ item.assessItem }}</el-button>
              </div>
              <div v-if="item.id >= 31">
                <el-button
                  type="success"
                  style="background: #ffebff; color: #c714fa; border: #c714fa"
                >{{ item.assessItem }}</el-button>
              </div>
  
              <div
                style="font-weight: 600; margin-left: 20px; line-height: 29px"
              >{{ item.assessContent }}</div>
            </div>
            <!-- <div
              v-if="item.pageTag == 0 && item.assessResult.indexOf('是;否') != -1"
            >
              <el-radio-group
                style="margin-top: 10px"
                v-model="item[`${item.itemTag}`]"
              >
                <el-radio label="是" value="1"></el-radio>
                <el-radio label="否" value="2"></el-radio>
              </el-radio-group>
            </div>-->
            <div v-if="item.pageTag == 0">
              <el-radio-group v-model="item.result" style="margin-top: 10px">
                <el-radio
                  v-for="(item, index2) in item.assessResult.split(';')"
                  :key="index2"
                  :label="index2 + 1"
                >{{ item }}</el-radio>
              </el-radio-group>
            </div>
            <div v-if="item.pageTag == 1 && item.editable == 1">
              <el-input style="width: 300px; margin-top: 10px" v-model="item.result"></el-input>
            </div>
            <div v-if="item.pageTag == 1 && item.editable == 0">
              <el-input style="width: 300px; margin-top: 10px" disabled v-model="item.result"></el-input>
            </div>
            <div
              style="
                background-color: #f7f7f7;
                color: #666666;
                height: 30px;
                line-height: 30px;
                margin-top: 20px;
              "
            >无最新消息，请参考健康档案</div>
            <el-divider></el-divider>
          </div>
          <table
            border="1"
            width="800"
            height="100"
            cellspacing="0"
            style="border-radius: 10px; width: 100%"
          >
            <tr>
              <td
                colspan="4"
                style="width: 100%; height:40px;background:#f7f7f7;font-weight: 600;padding-left 50px;height: 60px;border-radius:10px; line-height: 60px;border:1px solid rgb(245, 247, 248);"
              >
                <div style="display: flex">
                  风险评估结果
                  <div style="margin-left: 50px">
                    <el-popover placement="top-start" trigger="hover">
                      <div style="display: flex">
                        <div
                          style="
                            width: 500px;
                            display: flex;
                            flex-direction: column;
                            justify-content: center;
                          "
                        >
                          <div style="margin: 10px 0; text-align: center">
                            <h2>高血压心血管病风险分层规则</h2>
                          </div>
                          <el-table
                            :data="gridData1"
                            border
                            :header-cell-style="{
                              background: '#eef1f6',
                            }"
                          >
                            <el-table-column property="date" label="其他危险因素和病史" width="190"></el-table-column>
                            <el-table-column property="name" label="1级高血压"></el-table-column>
                            <el-table-column property="name2" label="2级高血压"></el-table-column>
                            <el-table-column property="name3" label="3级高血压"></el-table-column>
                          </el-table>
                          <div
                            style="
                              width: 500px;
                              display: flex;
                              flex-direction: column;
                              justify-content: center;
                            "
                          >
                            <div style="margin: 10px 0; text-align: center">
                              <h2>高血脂心血管病风险分层规则</h2>
                            </div>
                            <el-table
                              :data="gridData4"
                              border
                              :header-cell-style="{
                                background: '#eef1f6',
                              }"
                            >
                              <el-table-column width="150" property="date" label="危险分层"></el-table-column>
                              <el-table-column
                                property="name"
                                label="TC:5.2~6.2mmol/L(200~ 240mg/dI)或LDL-C:3.4~4.1mmol/L(130~ 160mg/dI)"
                              ></el-table-column>
                              <el-table-column
                                property="name2"
                                label="TC≥ 6.2mmol/L(240mg/dI)或LDL C≥4.1mmol/L(130~ 160mg/dI)"
                              ></el-table-column>
                            </el-table>
                          </div>
                        </div>
                        <div
                          style="
                            width: 500px;
                            margin-left: 40px;
                            display: flex;
                            flex-direction: column;
                            justify-content: center;
                          "
                        >
                          <div style="margin: 10px 0; text-align: center">
                            <h2>糖尿病心血管病风险分层规则</h2>
                          </div>
                          <el-table
                            :data="gridData3"
                            border
                            :header-cell-style="{
                              background: '#eef1f6',
                            }"
                          >
                            <el-table-column width="100" property="date" label="分层"></el-table-column>
                            <el-table-column property="name" label="主要内容"></el-table-column>
                          </el-table>
  
                          <div
                            style="
                              width: 500px;
                              display: flex;
                              flex-direction: column;
                              justify-content: center;
                            "
                          >
                            <div style="margin: 10px 0; text-align: center">
                              <h2>ASCVD风险分层规则</h2>
                            </div>
                            <el-table
                              :data="gridData5"
                              border
                              :header-cell-style="{
                                background: '#eef1f6',
                              }"
                            >
                              <el-table-column width="150" property="date" label="危险因素个数"></el-table-column>
                              <el-table-column property="name" label="3.1≤TC<4.1(或)1.8≤LDL-C<2.6"></el-table-column>
                              <el-table-column property="name2" label="4.1≤TC<5.2(或)2.6≤LDL-C<3.4"></el-table-column>
                              <el-table-column property="name3" label="5.2≤TC<7.2(或)3.4≤LDL-C<4.9"></el-table-column>
                            </el-table>
                          </div>
                        </div>
                      </div>
                      <el-button round type="primary" slot="reference">分层规则</el-button>
                    </el-popover>
                  </div>
                  <div style="margin-left: 50px">
                    <el-button
                      round
                      @click="zdfc"
                      v-loading.fullscreen.lock="fullscreenLoading"
                      element-loading-text="加载中"
                    >自动分层</el-button>
                  </div>
                </div>
              </td>
            </tr>
            <tr>
              <td colspan="1" style="display: flex; justify-content: center">
                <h3 style="color: #4192f4">高血压风险分层结果:</h3>
              </td>
              <td>
                <el-radio-group style="margin-top: 10px" v-model="form.a">
                  <el-radio label="0">未评估</el-radio>
                  <el-radio label="1">低危</el-radio>
                  <el-radio label="2">中危</el-radio>
                  <el-radio label="3">高危</el-radio>
                  <!-- <el-radio label="未知" value="3"></el-radio> -->
                </el-radio-group>
              </td>
            </tr>
            <tr>
              <td colspan="1" style="display: flex; justify-content: center">
                <h3 style="color: #4192f4">高血糖风险分层结果:</h3>
              </td>
              <td>
                <el-radio-group style="margin-top: 10px" v-model="form.b">
                  <el-radio label="0">未评估</el-radio>
                  <el-radio label="1">低危</el-radio>
                  <el-radio label="2">中危</el-radio>
                  <el-radio label="3">高危</el-radio>
                </el-radio-group>
              </td>
            </tr>
            <tr>
              <td colspan="1" style="display: flex; justify-content: center">
                <h3 style="color: #4192f4">高血脂风险分层结果:</h3>
              </td>
              <td>
                <el-radio-group style="margin-top: 10px" v-model="form.c">
                  <el-radio label="0">未评估</el-radio>
                  <el-radio label="1">低危</el-radio>
                  <el-radio label="2">中危</el-radio>
                  <el-radio label="3">高危</el-radio>
                  <!-- <el-radio label="未知" value="3"></el-radio -->
                  >
                </el-radio-group>
              </td>
            </tr>
            <tr>
              <td colspan="1" style="display: flex; justify-content: center">
                <h3 style="color: #4192f4">ASCVD风险评估结果:</h3>
              </td>
              <td>
                <el-radio-group style="margin-top: 10px" v-model="form.d">
                  <el-radio label="0">未评估</el-radio>
                  <el-radio label="1">低危(&lt;5%)</el-radio>
                  <el-radio label="2">中危(5%~9%)</el-radio>
                  <el-radio label="3">高危(≥10%)</el-radio>
                  <!-- <el-radio label="未知" value="3"></el-radio> -->
                </el-radio-group>
              </td>
            </tr>
          </table>
        </div>
  
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="submitDataScope">确 定</el-button>
          <el-button @click="cancelDataScope">取 消</el-button>
        </div>
      </el-dialog>
      <el-dialog title="筛查" :visible.sync="open" width="900px" append-to-body>
        <el-table :data="tableData" border style="width: 100%">
          <el-table-column fixed prop="date" label="日期"></el-table-column>
          <el-table-column prop="name" label="姓名"></el-table-column>
          <el-table-column prop="province" label="省份"></el-table-column>
          <el-table-column prop="city" label="市区"></el-table-column>
  
          <el-table-column fixed="right" label="操作" width="100">
            <template slot-scope="scope">
              <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
              <el-button type="text" size="small">编辑</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-dialog>
    </div>
  </template>
  
  <script>
  import {
    getRole,
    delRole,
    addRole,
    updateRole,
    dataScope,
    changeRoleStatus,
    deptTreeSelect,
    receivescreening,
  } from "@/api/system/Specializedlist";
  import Treeselect from "@riophae/vue-treeselect";
  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
//   import { receivescreening } from "@/api/system/Specializedlist";
  
  import {
    treeselect as menuTreeselect,
    roleMenuTreeselect,
  } from "@/api/system/menu";
//   import PingGu from "./components/pinggu.vue";
  import store from "../../../store";
  import {
    business,
    qx,
    thList,
    zzg,
    timelineList,
    saveRate,
    lastProjectRecord,
    projectRecordypdata,
    screening,
    projecttList,
    viewfiled,
    getOrgnList
  } from "@/api/system/Specializedlist";
//   import { getOrgnList } from "@/api/analysis/analysis";
//   import { getCurrentAgeByBirthDate } from "@/utils/conversion";
//   import { config } from "@/utils/url";

  import Cookies from "js-cookie";
  export default {
    name: "Role",
    dicts: ["sys_normal_disable"],
    components: {
      Treeselect,
 
    },
    data() {
      return {
        baseurl: process.env.VUE_APP_BASE_API,
        projectName:'',
        isflas:false,
        // 项目下拉
        optionsList: [],
        // 机构下拉
        deptOptions: "",
        attachment: "",
        open: false,
        checkedCities: [],
        url: "",
        
        type: { type: "leftEyePitureUrl" },
        typeyy: { type: "rightEyePitureUrl" },
        typexxb: { type: "plateletPitureUrl" },
        typexamz: { type: "alzheimerFileUrl" },
        typedpl: { code: "2004" },
        boxlook: {},
        attachmentdpl: "",
        cities: [
          { text: "高血压", value: "1" },
          { text: "高血糖", value: "2" },
          { text: "高血脂", value: "3" }
        ],
        ydbbopen: false,
        idyd: "",
        idxs: "",
        iddm: "",
        a: "",
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 角色表格数据
        roleList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 是否显示弹出层（数据权限）
        openDataScope: false,
        menuExpand: false,
        attachmentzy: "",
        attachmentyy: "",
        attachmentxxb: "",
        attachmentamz:'',
        menuNodeAll: false,
        deptExpand: true,
        deptNodeAll: false,
        rate: {},
        disabled: false,
        fullscreenLoading: false,
        // 日期范围
        dateRange: [],
        fileList1: [],
        query: "",
        // 数据范围选项
        dataScopeOptions: [
          {
            value: "1",
            label: "全部数据权限"
          },
          {
            value: "2",
            label: "自定数据权限"
          },
          {
            value: "3",
            label: "本部门数据权限"
          },
          {
            value: "4",
            label: "本部门及以下数据权限"
          },
          {
            value: "5",
            label: "仅本人数据权限"
          }
        ],
        tableData: [],
        ydbbckopen: false,
        xxbopen: false,
        screeningId: "",
        yyArrData: {},
        title: "",
        diabledyd: true,
        srcList: [],
        diableddpl: true,
        diabledxs: true,
        ruleForm: {},
        gw: null,
        postList: [],
        fileList: [],
        fileList2: [],
        fileList3:[],
        // 菜单列表
        menuOptions: [],
        // 部门列表
        deptOptions: [],
        activeNames: ["0"],
        queryParams: {
          pageNum: 1,
          pageSize: 15,
          name: null,
          identity: null,
          archivingStatus: null,
          hasDiagnose: null,
          exceedStatus: null,
          hasResult: null,
          residentName: null,
          applyStartDate: null,
          applyEndDate: null,
          chronicGroup: null,
          deptId: null,
          registrationStatus: null
        },
        templateSelection: "",
        // 表单参数
        form: {},
        defaultProps: {
          children: "children",
          label: "label"
        },
        gridData: [
          {
            date: "低危",
            name: "高血压1级且无其他危险因素"
          },
          {
            date: "中危",
            name:
              "(1)高血压2级，无危险因素或伴 1~2 个危险因素;(2)高血压1级，并伴危险因素 1~2个"
          },
          {
            date: "高危",
            name:
              "(1)高血压3级;(2)高血压1或2级，伴危险因素≥3个或靶器官损害;(3)高血压(任何级别)伴任何一项靶器官损害(左室肥厚、颈动脉内膜增厚、血肌酐轻度升高)(4)高血压(任何级别)并存任何一项临床疾患(心脏病、脑血管病、肾脏病、周围血管病、糖尿病等)"
          }
        ],
        elink: document.createElement("a"),
        gridData1: [
          {
            date: "无",
            name: "低危",
            name2: "中危",
            name3: "高危"
          },
          {
            date: "1~2个其他危险因素",
            name: "中危",
            name2: "中危",
            name3: "高危"
          },
          {
            date: "≥3个其他危险因素，靶器官损害，并存的临床疾患",
            name: "高危",
            name2: "高危",
            name3: "高危"
          }
        ],
        prescriptionData: {},
        gridData2: [
          {
            date: "靶器官损害",
            name:
              "蛋白尿、肾脏损害[eGFR≤30ml/(min·1.73m)]左心室肥厚、心房颤动、视网膜病变等"
          },
          {
            date: "心血管病危险因素",
            name:
              "心血管病既往史、早发心血管病家族史(一级亲属发病年龄<50岁)、年龄(>40岁)、高血压、血脂异常、吸烟、肥胖(BMI≥28kg/m2)、腹型肥胖(男性腰围≥90cm，女性腰围≥85cm)、代谢综合征、高尿酸血症、高同型半胱酸(≥10μmol/L)等"
          }
        ],
        gridData3: [
          {
            date: "中危",
            name:
              "年轻患者（1型糖尿病<35岁或2型糖尿病<50岁）且糖尿病病程<10年，不伴有其他危险因素"
          },
          {
            date: "高危",
            name: "糖尿病不伴有靶器官损害，且病程≥10年或合并任意1个及以上危险因素"
          },
          {
            date: "极高危",
            name:
              "糖尿病合并已确诊的心血管疾病，或其他靶器官损害，或≥3个主要危险因素，或早发1型糖尿病且病程大于20年"
          }
        ],
        gridData4: [
          {
            date: "无高血压且其他危险因素<3",
            name: "低危",
            name2: "低危"
          },
          {
            date: "高血压或其他危险因素≥3",
            name: "低危",
            name2: "中危"
          },
          {
            date: "高血压且其他危险因素≥1",
            name: "中危",
            name2: "高危"
          },
          {
            date: "冠心病及其等危症",
            name: "高危",
            name2: "高危"
          }
        ],
        role: "",
        ydmb: {
            diagnosticResult:'',
        },
        isCollapse: true,
        urlimg: "",
        registerId: "",
        gridData5: [
          {
            date: "无高血压  0~1个",
            name: "低危（<5%）",
            name2: "低危（<5%）",
            name3: "低危（<5%）"
          },
          {
            date: "无高血压  2个",
            name: "低危（<5%）",
            name2: "低危（<5%）",
            name3: "中危（5%~9%）"
          },
          {
            date: "无高血压  3个",
            name: "低危（<5%）",
            name2: "中危（5%~9%）",
            name3: "中危（5%~9%）"
          },
          {
            date: "有高血压  0个",
            name: "低危（<5%）",
            name2: "低危（<5%）",
            name3: "低危（<5%）"
          },
          {
            date: "有高血压  1个",
            name: "低危（<5%）",
            name2: "中危（5%~9%）",
            name3: "中危（5%~9%）"
          },
          {
            date: "有高血压  2个",
            name: "中危（5%~9%）",
            name2: "高危（≥10%）",
            name3: "高危（≥10%）"
          },
          {
            date: "有高血压  3个",
            name: "高危（≥10%）",
            name2: "高危（≥10%）",
            name3: "高危（≥10%）"
          }
        ],
        performanceTimer: [],
        attachmentTwo: "",
        // 表单校验
        rules: {
          roleName: [
            { required: true, message: "角色名称不能为空", trigger: "blur" }
          ],
          roleKey: [
            { required: true, message: "权限字符不能为空", trigger: "blur" }
          ],
          roleSort: [
            { required: true, message: "角色顺序不能为空", trigger: "blur" }
          ]
        }
      };
    },
    created() {
        console.log(this.baseurl)

      this.getList();
      this.url = this.baseurl + "/system/station/updateNurseStationHeads";
      this.isCollapse = true;
      this.urlimg = this.baseurl;
      getOrgnList().then(response => {
        this.deptOptions = response.data;
      });
      let data = {
        projectType: 1,
        status: 0
      };
      store.dispatch("GetInfo").then(res => {
        if (res.user.roles[0]) {
          this.role = res.user.roles[0].roleKey;
        }
      });
    //   subscribeProjectList(data).then(res => {
    //     this.optionsList = res.data;
    //   });
      projecttList(data).then((res) => {
        this.optionsList = res.data;
      });
    },
    computed: {
      headers() {
        return {
          Authorization: Cookies.get("Admin-Token")
        };
      }
    },
    methods: {
      normalizer(node) {
        if (node.children && !node.children.length) {
          delete node.children;
        }
        return {
          id: node.id,
          label: node.hospitalName,
          children: node.children
        };
      },
      //结果查看
      jgck() {
        if (!this.templateSelection) {
          this.$modal.msgError("请选择该一条数据");
        }
      },
      // 预约登记
      subscribeRegister() {
        if (!this.templateSelection) {
          this.$modal.msgError("请选择该一条数据");
        } else {
        }
      },
      // 查看结果
      lookResult() {},
      // 写诊断
      writeDiagnose() {},
      // 登记
      registerFun() {},
      goToPerformanceDetailxxb(item) {
        // this.screeningId=
        if (item.projectName == "糖尿病-眼底病变筛查") {
          this.ydbbckopen = true;
        } else if (item.projectName == "血小板筛查") {
          this.xxbopen = true;
        }
        if (item.projectName == "阿尔兹海默症筛查") {
          this.ydbbopen = true;
          this.isflas=false;
          this.attachment = "";
          // this.ruleForm.descdxxb=''
          this.fileList3 = [];
          this.registerId = item.registerId;
          this.screeningId = item.screeningId;
          this.title = "阿尔兹海默症筛查";
          screening(item.screeningId).then(res => {

            this.ydmb = res.data;

            // this.srcList = this.urlimg + res.data[0].attachment;
            if (res.data.attachment) {
              this.attachmentamz = res.data.attachment;
              this.fileList3.push({
                name: "阿尔兹海默症筛查诊断文件",
                url: this.baseurl + res.data.attachment
              });
            }
          });
        }
        this.attachmentTwo = "";
        this.attachment = "";
        this.title = item.projectName;
        screening(item.screeningId).then(res => {
          this.ydmb = res.data;
          // this.srcList = this.urlimg + res.data[0].attachment;
          this.attachment = res.data.attachment;
          if (res.data.attachmentTwo) {
            this.attachmentTwo = res.data.attachmentTwo;
          }
        });
      },
      // goToPerformanceDetail(item) {
      //   screening({ screeningId: item.value, projectName: "眼底" }).then((res) => {
      //     this.ydmb = res.data;
      //     this.attachmentTwo = res.data[0].attachmentTwo;
      //     this.attachment = res.data[0].attachment;
      //   });
      // },
      handleExceed() {
        this.$message.warning(`只能上传1张图片`);
      },

      saveallisflas(){
        this.ydbbopen = false;


      },
      saveall() {
        if (this.title == "糖尿病-眼底病变筛查") {
          projectRecordypdata({
            attachment: this.attachmentzy,
            attachmentTwo: this.attachmentyy,
            screeningId: this.screeningId,
            // recordId: this.idyd,
            registerId: this.registerId,
            diagnosticResult: this.ruleForm.descyd
          }).then(res => {
            this.$modal.msgSuccess("保存成功");
            this.ydbbopen = false;
          });
        }
        if (this.title == "血小板筛查") {
          projectRecordypdata({
            attachment: this.attachmentxxb,
            // recordId: this.idxs,
            registerId: this.registerId,
            diagnosticResult: this.ruleForm.descdxxb,
            screeningId: this.screeningId
          }).then(res => {
            this.$modal.msgSuccess("保存成功");
            this.ydbbopen = false;
          });
        }
        if (this.title == "阿尔兹海默症筛查") {
          projectRecordypdata({
            attachment: this.attachmentamz,
            registerId: this.registerId,
            diagnosticResult: this.ruleForm.descdxxb,
            screeningId: this.screeningId
          }).then(res => {
            this.$modal.msgSuccess("保存成功");
            this.ydbbopen = false;
          });
        }
        this.resetQuery();
        // if(this.title=='多普勒动脉粥样筛查'){
        //   projectRecordypdata({attachment:this.attachmentdpl,recordId:this.iddm,diagnosticResult:this.ruleForm.descdpl,screeningId:this.screeningId}).then((res)=>{
        //     this.$modal.msgSuccess("保存成功");
        //     this.ydbbopen=false
        //   })
        // }
      },
      sc() {
        if (!this.templateSelection) {
          this.$modal.msgError("请选择该一条数据");
        } else {
          let that = this;
  
          that.open = true;
        }
      },
      //预约登记
      yydj(item) {
        this.$confirm("您确定要登记?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            receivescreening(item.screeningId).then(res => {
              this.$message({
                type: "success",
                message: res.data
              });
              this.getList();
            });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消删除"
            });
          });
      },
      nrsg(row) {
        this.$confirm("您确定要纳入?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            saveRate({ registerId: row.registerId, manageStatus: 1 }).then(
              res => {
                this.$modal.msgSuccess("已纳入");
                this.getList();
              }
            );
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消删除"
            });
          });
      },
      jkcf() {
        this.ydbbopen = true;
        this.title = "健康处方";
      },
      zmzwgl() {
        this.ydbbopen = true;
        this.title = "自我管理";
      },
      dpl() {
        if (!this.query) {
          this.$modal.msgError("请选择该一条数据");
        } else {
          this.ydbbopen = true;
          this.title = "多普勒动脉粥样筛查";
        }
      },
      xxb() {
        this.ydbbopen = true;
        this.title = "血小板筛查";
      },
      ydbbck() {
        this.ydbbckopen = true;
        this.ydmb = [];
        this.attachment = "";
        this.attachmentTwo = "";
        timelineList(this.query.registerId).then(res => {
          this.performanceTimer = res.data;
          this.goToPerformanceDetail(res.data[0].children[0]);
        });
        this.title = "眼底病变筛查";
      },
      xxbck() {
        this.xxbopen = true;
        this.attachment = "";
        this.attachmentTwo = "";
        this.ydmb = [];
        timelineList(this.query.registerId).then(res => {
          this.performanceTimer = res.data;
          this.goToPerformanceDetailxxb(res.data[0].children[0]);
        });
        this.title = "血小板筛查";
      },
      ydbb(item) {
        this.isflas=true;
        if (item.projectName == "糖尿病-眼底病变筛查") {
          this.attachment = "";
          this.attachmentTwo = "";
          this.fileList = [];
          this.fileList1 = [];
          this.ydbbopen = true;
          this.registerId = item.registerId;
          this.screeningId = item.screeningId;
          this.title = "糖尿病-眼底病变筛查";
          // this.ruleForm.descyd=''
          // this.$refs.upload.clearFiles()
          //     this.$refs.upload1.clearFiles()
          screening(item.screeningId).then(res => {
            this.ydmb= res.data;
            this.ruleForm.descyd=this.ydmb.diagnosticResult
            console.log(this.ydmb)
            // this.srcList = this.urlimg + res.data[0].attachment;
            if (res.data.attachment) {
              this.attachmentzy = res.data.attachment;
              this.fileList.push({
                name: "1",
                url: this.baseurl + res.data.attachment
              });
            }
            if (res.data.attachmentTwo) {
              this.attachmentyy = res.data.attachmentTwo;
              this.fileList1.push({ url: this.baseurl + res.data.attachmentTwo });
            }
          });
        }
        if (item.projectName == "血小板筛查") {
          this.ydbbopen = true;
          this.attachment = "";
          // this.ruleForm.descdxxb=''
          this.fileList2 = [];
          this.registerId = item.registerId;
          this.screeningId = item.screeningId;
          this.title = "血小板筛查";
          screening(item.screeningId).then(res => {
            this.ydmb = res.data;
            // this.srcList = this.urlimg + res.data[0].attachment;
            if (res.data.attachment) {
              this.attachmentxxb = res.data.attachment;
              this.fileList2.push({
                name: "1",
                url: this.urlimg + res.data.attachment
              });
            }
            // if(res.data.attachmentTwo){
            //   this.fileList1.push({url:this.urlimg+res.data.attachmentTwo})
            // }
          });
          // this.$refs.upload3.clearFiles()
        }
        if (item.projectName == "阿尔兹海默症筛查") {
          this.ydbbopen = true;
          this.attachment = "";
          // this.ruleForm.descdxxb=''
          this.fileList3 = [];
          this.registerId = item.registerId;
          this.screeningId = item.screeningId;
          this.title = "阿尔兹海默症筛查";
          
          screening(item.screeningId).then(res => {
            this.ydmb = res.data;
      
            this.ruleForm.descdxxb=this.ydmb.diagnosticResult
            // this.srcList = this.urlimg + res.data[0].attachment;
            if (res.data.attachment) {
              this.attachmentamz = res.data.attachment;
              this.fileList3.push({
                name: "阿尔兹海默症筛查诊断文件",
                url: this.urlimg + res.data.attachment
              });
            }
            // if(res.data.attachmentTwo){
            //   this.fileList1.push({url:this.urlimg+res.data.attachmentTwo})
            // }
          });
          // this.$refs.upload3.clearFiles()
        }
      },
      zdfc() {
        this.fullscreenLoading = true;
        let wxysCount = 0;
        let bqgCount = 0;
        let xxgbCount = 0;
        let lcCount = 0;
        let dmGrade = "";
        let dmCourse = "";
        let tc = "";
        let ldl = "";
        let hypertension = "";
        let gxyfj = "";
        for (let item of this.gw) {
          if (item.assessItem == "危险因素" && item.result == 1) {
            wxysCount++;
          }
          if (item.assessItem == "靶器官损害" && item.result == 1) {
            bqgCount++;
          }
          if (item.assessItem == "心血管病危险因素" && item.result == 1) {
            xxgbCount++;
          }
          if (item.assessItem == "伴临床疾患" && item.result == 1) {
            lcCount++;
          }
          if (item.assessContent == "糖尿病分级") {
            dmGrade = item.result;
          }
          if (item.assessContent == "糖尿病病程") {
            dmCourse = item.result;
          }
          if (item.assessContent == "TC") {
            tc = item.result;
          }
          if (item.assessContent == "LDL-C") {
            ldl = item.result;
          }
          if (item.assessContent == "高血压") {
            hypertension = item.result;
          }
          if (item.assessContent == "高血压分级") {
            gxyfj = item.result;
          }
        }
        // 病史
        const bs = [
          this.rate.history,
          this.rate.pastHistory,
          this.rate.earlyHistory,
          this.rate.icvd
        ];
        let bsCount = 0;
  
        for (let item of bs) {
          if (item == "是") {
            bsCount++;
          }
        }
  
        // 高血压分层
        this.gxyfc(bsCount, wxysCount, bqgCount, lcCount, gxyfj);
        // 糖尿病分层
        this.tnbfc(wxysCount, bqgCount, xxgbCount, dmGrade, dmCourse);
        // 高血脂分层
        this.gxzfc(wxysCount, tc, ldl, hypertension);
        // ASCVD分层
        this.ASCVDfc(wxysCount, tc, ldl, hypertension);
  
        this.fullscreenLoading = false;
      },
      beforeAvatarUpload(file) {
        const fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
        const whiteList = ["doc", "docx"];
        if (whiteList.indexOf(fileSuffix) === -1) {
          this.$message.error('上传文件只能是doc、docx格式');
          return false;
        }
      },
      qx() {
        if (!this.templateSelection) {
          this.$modal.msgError("请选择该一条数据");
        } else {
          window.open(
            "http://172.19.112.83:8009/fd/his/sign?sysKey=6b24d9aefc754c3c9e65dfbfbf9ba47a&userKey=562bc8c4d1c149b0ad5ce63c67674825&timestamp=1662097367&sign=d87548283e05ae689b0aca2e7dcb5c58&" +
              "identity=" +
              this.query.identity
          );
        }
      },
      time() {
        this.isCollapse = !this.isCollapse;
      },
      yth() {
        if (!this.templateSelection) {
          this.$modal.msgError("请选择该一条数据");
        } else {
          let a = [];
          if (this.query.hyperlipemiaFlag == "1") {
            a.push("1");
          }
          if (this.query.diabetesFlag == "1") {
            a.push("2");
          }
          if (this.query.hyperlipemiaFlag == "1") {
            a.push("3");
          }
          let routeData = this.$router.resolve({
            path: "/yth",
            query: {
              indent: this.query.identity,
              patientId: this.query.patientId,
              ehrId: this.query.ehrId,
              rq: a.join(","),
              residentName: this.query.name
              //   indent: aa.identity,
              //   signNo: aa.signNo,
              //   teamNo: aa.teamNo,
              //   teamName: aa.teamName,
              //   familyNo: aa.familyNo,
              //   orgNo: aa.orgNo,
              //   residentName: aa.residentName,
              //   focusGroups: aa.focusGroups,
              //   userNo:aa.userNo,
            }
          });
          window.open(routeData.href, "_blank");
        }
      },
      singleElection(row) {
        //   // this.templateSelection = this.postList.indexOf(row);
        //   // this.templateRadio = row.id;
        //   this.templateSelection = row;
        //   this.diabledyd = true;
        //   this.diableddpl = true;
        //   this.diabledxs = true;
        //   lastProjectRecord(row.registerId).then((res) => {
        //     row.scxm = res.data;
        //     this.query = row;
        //     for (let i = 0; i < row.scxm.length; i++) {
        //       if (row.scxm[i].projectName == "糖尿病-眼底病变筛查") {
        //         this.diabledyd = false;
        //         this.idyd = row.scxm[i].recordId;
        //         this.screeningId = row.scxm[i].screeningId;
        //       }
        //       if (row.scxm[i].projectName == "糖尿病-血小板筛查") {
        //         this.diabledxs = false;
        //         this.idxs = row.scxm[i].recordId;
        //         this.screeningId = row.scxm[i].screeningId;
        //       }
        //     }
        //   });
      },
      zzgl() {
        if (!this.templateSelection) {
          this.$modal.msgError("请选择该一条数据");
        } else {
          this.$confirm("您确定要终止?", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          })
            .then(() => {
              zzg({ patientIds: this.query.patientId }).then(res => {
                this.$modal.msgSuccess("已终止");
                this.getList();
              });
            })
            .catch(() => {
              this.$message({
                type: "info",
                message: "已取消"
              });
            });
        }
        // let data={
        //   ids:rew.id,
        //   terminaDoctorId:rew.terminaDoctorId,
        //   terminaDoctorName:rew.terminaDoctorName,
        //   terminaReason:rew.terminaReason
  
        // }
      },
      fxpg() {
        this.form = {};
        let that = this;
        if (!this.templateSelection) {
          this.$modal.msgError("请选择该一条数据");
        } else {
          this.openDataScope = true;
          this.fullscreenLoading = true;
          this.rate.age = getCurrentAgeByBirthDate(this.query.birthday);
          business().then(e => {
            that.gw = e.data;
            this.fullscreenLoading = false;
            let sex = this.gw.find(item => item.assessContent == "性别");
            if (this.query.gender == "1") {
              this.rate.gender = "男";
              sex.result = "男";
            } else {
              this.rate.gender = "女";
              sex.result = "女";
            }
            let age = this.gw.find(item => item.assessContent == "年龄");
            age.result = getCurrentAgeByBirthDate(this.query.birthday);
          });
        }
      },
      /** 查询角色列表 */
      getList() {
        // this.postList =
        //   [{
        //     identity: '371481194506202812',
        //     name: '王明',
        //     gender: '2'
        //   }]
  
        // this.loading = false;
        this.loading = true;
        thList(this.queryParams).then(response => {
          this.postList = response.rows;
          this.total = response.total;
          this.loading = false;
          for (let i = 0; i < this.postList.length; i++) {
            //赋值给上方tableItem绑定的age     // 传入接口赋值后列表里面的出生年月
            this.postList[i].age = this.getage(this.postList[i].birthday);
          }
        });
      },
      getage(value) {
        var birthdays = new Date(value.replace(/-/g, "/")); //value 是this.getage(this.userList[i].birthday)传入的值
        var d = new Date(); //当前时间
        var age =
          d.getFullYear() -
          birthdays.getFullYear() -
          (d.getMonth() < birthdays.getMonth() ||
          (d.getMonth() == birthdays.getMonth() &&
            d.getDate() < birthdays.getDate())
            ? 1
            : 0);
        return age;
      },
      /** 查询菜单树结构 */
      getMenuTreeselect() {
        menuTreeselect().then(response => {
          this.menuOptions = response.data;
        });
      },
      // 所有菜单节点数据
      getMenuAllCheckedKeys() {
        // 目前被选中的菜单节点
        let checkedKeys = this.$refs.menu.getCheckedKeys();
        // 半选中的菜单节点
        let halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys();
        checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
        return checkedKeys;
      },
      // 所有部门节点数据
      getDeptAllCheckedKeys() {
        // 目前被选中的部门节点
        let checkedKeys = this.$refs.dept.getCheckedKeys();
        // 半选中的部门节点
        let halfCheckedKeys = this.$refs.dept.getHalfCheckedKeys();
        checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
        return checkedKeys;
      },
      /** 根据角色ID查询菜单树结构 */
      getRoleMenuTreeselect(roleId) {
        return roleMenuTreeselect(roleId).then(response => {
          this.menuOptions = response.menus;
          return response;
        });
      },
      /** 根据角色ID查询部门树结构 */
      getDeptTree(roleId) {
        return deptTreeSelect(roleId).then(response => {
          this.deptOptions = response.depts;
          return response;
        });
      },
      // 角色状态修改
      handleStatusChange(row) {
        let text = row.status === "0" ? "启用" : "停用";
        this.$modal
          .confirm('确认要"' + text + '""' + row.roleName + '"角色吗？')
          .then(function() {
            return changeRoleStatus(row.roleId, row.status);
          })
          .then(() => {
            this.$modal.msgSuccess(text + "成功");
          })
          .catch(function() {
            row.status = row.status === "0" ? "1" : "0";
          });
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      // 取消按钮（数据权限）
      cancelDataScope() {
        this.openDataScope = false;
        this.reset();
      },
      // 表单重置
      reset() {
        if (this.$refs.menu != undefined) {
          this.$refs.menu.setCheckedKeys([]);
        }
        this.menuExpand = false;
        this.menuNodeAll = false;
        this.deptExpand = true;
        this.deptNodeAll = false;
        this.form = {
          roleId: undefined,
          roleName: undefined,
          roleKey: undefined,
          roleSort: 0,
          status: "0",
          menuIds: [],
          deptIds: [],
          menuCheckStrictly: true,
          deptCheckStrictly: true,
          remark: undefined
        };
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.templateSelection = "";
        this.diabledxs = true;
        this.diabledyd = true;
        this.getList();
      },
      handleQuery1() {
        this.queryParams.pageNum = 1;
        this.templateSelection = "";
        this.diabledxs = true;
        this.diabledyd = true;
        this.getList();
        if (this.postList.length == 1) {
          this.yydj(this.postList[0]);
        }
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.dateRange = [];
        this.queryParams = {
          pageNum: 1,
          pageSize: 15,
          name: null,
          identity: null,
          archivingStatus: null,
          hasDiagnose: null,
          exceedStatus: null,
          hasResult: null,
          residentName: null,
          applyStartDate: null,
          applyEndDate: null,
          chronicGroup: null,
          deptId: null,
          registrationStatus: null
        };
        this.handleQuery();
      },
      // 多选框选中数据
  
      // 履约
      handleCommand(command, row) {
        let routeData = this.$router.resolve({
          path: "/personal",
          query: {
            //   indent: aa.identity,
            //   signNo: aa.signNo,
            //   teamNo: aa.teamNo,
            //   teamName: aa.teamName,
            //   familyNo: aa.familyNo,
            //   orgNo: aa.orgNo,
            //   residentName: aa.residentName,
            //   focusGroups: aa.focusGroups,
            //   userNo:aa.userNo,
          }
        });
        window.open(routeData.href, "_blank");
      },
      // 树权限（展开/折叠）
      handleCheckedTreeExpand(value, type) {
        if (type == "menu") {
          let treeList = this.menuOptions;
          for (let i = 0; i < treeList.length; i++) {
            this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value;
          }
        } else if (type == "dept") {
          let treeList = this.deptOptions;
          for (let i = 0; i < treeList.length; i++) {
            this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value;
          }
        }
      },
      // 树权限（全选/全不选）
      handleCheckedTreeNodeAll(value, type) {
        if (type == "menu") {
          this.$refs.menu.setCheckedNodes(value ? this.menuOptions : []);
        } else if (type == "dept") {
          this.$refs.dept.setCheckedNodes(value ? this.deptOptions : []);
        }
      },
      onExceed(file, fileList) {
        if (fileList.length > 1) {
          fileList.splice(0, 1);
        }
      },
      onExceed1(file, fileList) {
        if (fileList.length > 1) {
          fileList.splice(0, 1);
        }
      },
      // 树权限（父子联动）
      handleCheckedTreeConnect(value, type) {
        if (type == "menu") {
          this.form.menuCheckStrictly = value ? true : false;
        } else if (type == "dept") {
          this.form.deptCheckStrictly = value ? true : false;
        }
      },
      /** 新增按钮操作 */
      handleAdd() {
        this.reset();
        this.getMenuTreeselect();
        this.open = true;
        this.title = "添加角色";
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        this.reset();
        const roleId = row.roleId || this.ids;
        const roleMenu = this.getRoleMenuTreeselect(roleId);
        getRole(roleId).then(response => {
          this.form = response.data;
          this.open = true;
          this.$nextTick(() => {
            roleMenu.then(res => {
              let checkedKeys = res.checkedKeys;
              checkedKeys.forEach(v => {
                this.$nextTick(() => {
                  this.$refs.menu.setChecked(v, true, false);
                });
              });
            });
          });
          this.title = "修改角色";
        });
      },
      /** 选择角色权限范围触发 */
      dataScopeSelectChange(value) {
        if (value !== "2") {
          this.$refs.dept.setCheckedKeys([]);
        }
      },
      // <span v-if="scope.row.diabetesFlag == 1">糖尿病 </span>
      //       <span v-if="scope.row.hyperlipemiaFlag == 1">高血压 </span>
      //       <span v-if="scope.row.hypertensionFlag == 1">高血脂 </span>
      sf() {
        if (!this.templateSelection) {
          this.$modal.msgError("请选择该一条数据");
        } else {
          let a = [];
          if (this.query.hyperlipemiaFlag == "1") {
            a.push("1");
          }
          if (this.query.diabetesFlag == "1") {
            a.push("2");
          }
          if (this.query.hypertensionFlag == "1") {
            a.push("3");
          }
          let routeData = this.$router.resolve({
            path: "/fllowup",
            query: {
              indent: this.query.identity,
              patientId: this.query.patientId,
              rq: a.join(","),
              //   signNo: aa.signNo,
              //   teamNo: aa.teamNo,
              //   teamName: aa.teamName,
              //   familyNo: aa.familyNo,
              //   orgNo: aa.orgNo,
              residentName: this.query.name
  
              //   focusGroups: aa.focusGroups,
              //   userNo:aa.userNo,
            }
          });
          window.open(routeData.href, "_blank");
        }
      },
      /** 履约 */
      handleDataScope() {
        let routeData = this.$router.resolve({
          path: "/agreement",
          query: {
            //   indent: aa.identity,
            //   signNo: aa.signNo,
            //   teamNo: aa.teamNo,
            //   teamName: aa.teamName,
            //   familyNo: aa.familyNo,
            //   orgNo: aa.orgNo,
            //   residentName: aa.residentName,
            //   focusGroups: aa.focusGroups,
            //   userNo:aa.userNo,
          }
        });
        window.open(routeData.href, "_blank");
        // this.reset();
        // const deptTreeSelect = this.getDeptTree(row.roleId);
        // getRole(row.roleId).then(response => {
        //   this.form = response.data;
        //   this.openDataScope = true;
        //   this.$nextTick(() => {
        //     deptTreeSelect.then(res => {
        //       this.$refs.dept.setCheckedKeys(res.checkedKeys);
        //     });
        //   });
        //   this.title = "分配数据权限";
        // });
      },
      /** 分配用户操作 */
      handleAuthUser: function(row) {
        const roleId = row.roleId;
        this.$router.push("/system/role-auth/user/" + roleId);
      },
      /** 提交按钮 */
      submitForm: function() {
        let data = {
          patientIds: this.query.patientId,
          // diabetesFlag:this.diabetesFlag,
          // hyperlipemiaFlag:this.hyperlipemiaFlag,
          // hypertensionFlag:this.hypertensionFlag,
          threeHighType: this.checkedCities
        };
        bringIntoManage(data).then(() => {
          this.$modal.msgSuccess("修改成功");
          this.open = false;
          this.getList();
        });
      },
      /** 提交按钮（数据权限） */
      submitDataScope() {
        if (!this.form.a || !this.form.b || !this.form.c || !this.form.d) {
          this.$confirm("请先自动分层后再进行保存?", "提示", {
            confirmButtonText: "确定",
            type: "warning"
          });
          return;
        }
        let count = 0;
        for (let item of this.gw) {
          if (item.result == 1) {
            count++;
          }
        }
        this.fullscreenLoading = true;
        this.query.riskLevelAscvd = this.form.d;
        this.query.riskLevelDm = this.form.b;
        this.query.riskLevelHbp = this.form.a;
        this.query.riskLevelHpd = this.form.c;
        this.query.abnormalCount = count;
        let data = {
          resultList: this.gw,
          riskAssessRecord: this.query
        };
        saveRate(data).then(res => {
          this.fullscreenLoading = false;
          if (res.code == 200) {
            this.openDataScope = false;
            this.$modal.msgSuccess("保存成功");
            this.getList();
          }
        });
      },
      /** 健康中心 */
      handleDelete() {
        if (!this.query) {
          this.$modal.msgError("请选择该一条数据");
        } else {
          let routeData = this.$router.resolve({
            path: "/personal",
            query: {
              ehrId: this.query.ehrId,
              name: this.query.residentName,
              phone: this.query.phone,
              address: this.query.address,
              identity: this.query.identity,
              orgName: this.query.orgName,
              manageOrgName: this.query.manageOrgName,
              patientId: this.query.registerId
              //   indent: aa.identity,
              //   signNo: aa.signNo,
              //   teamNo: aa.teamNo,
              //   teamName: aa.teamName,
              //   familyNo: aa.familyNo,
              //   orgNo: aa.orgNo,
              //   residentName: aa.residentName,
              //   focusGroups: aa.focusGroups,
              //   userNo:aa.userNo,
            }
          });
          window.open(routeData.href, "_blank");
        }
      },
      /** 导出按钮操作 */
      handleExport() {
        this.download(
          "system/role/export",
          {
            ...this.queryParams
          },
          `role_${new Date().getTime()}.xlsx`
        );
      },
      handleAvatarSuccess(res, file) {
        // this.form.attachment = file.data
        this.attachmentzy = file.imgUrl;
      },
      handleAvatarSuccessdpl(res, file) {
        // this.form.attachment = file.data
        this.attachmentdpl = file.imgUrl;
      },
      handleAvatarSuccessyy(res, file) {
        // this.form.attachment = file.data
        this.attachmentyy = file.imgUrl;
      },
      handleAvatarSuccessxxb(res, file) {
        // this.form.attachment = file.data
        this.attachmentxxb = res.imgUrl;
      },
      handleAvatarSuccessamz(res, file) {
        console.log(res,'000')
        // this.form.attachment = file.data
        this.attachmentamz = res.imgUrl;
      },
      onFileitem(file) {
        console.log(file)

        if (file.response) {
          var fileurl = file.response.data;
        } else {
          var fileurls = file.url.split("/");
          var fileurl = fileurls[fileurls.length - 1];
        }
        viewfiled(this.attachmentamz).then(res => {
          let content = res;
          const blob = new Blob([content], { type: "application/msword" }); //重点重点，，，
          const fileName = file.name + ".docx"; //这个为文件名，可以自定义
          this.elink.download = fileName;
          this.elink.style.display = "none";
          this.elink.href = URL.createObjectURL(blob);
          this.$refs.LDQZOne.appendChild(this.elink);
          this.elink.click(); //触发点击事件，实现文档下载
          URL.revokeObjectURL(this.elink.href); // 释放URL 对象
          this.$refs.LDQZOne.removeChild(this.elink); //下载完成，移除新建的a标签
        });
      },
      // 糖尿病自动分层
      tnbfc(wxysCount, bqgCount, xxgbCount, dmGrade, dmCourse) {
        if (this.query.diabetesFlag == 1) {
          if (
            ((dmGrade == "1" && this.rate.gender < 35) ||
              (dmGrade == "2" && this.rate.gender < 50)) &&
            dmCourse < 10 &&
            wxysCount == 0
          ) {
            this.form.b = "1";
          }
          if (bqgCount == 0 && (dmCourse >= 10 || wxysCount >= 1)) {
            this.form.b = "2";
          }
          if (
            xxgbCount >= 1 ||
            wxysCount >= 3 ||
            bqgCount >= 1 ||
            (dmGrade == "1" && dmCourse >= 20)
          ) {
            this.form.b = "3";
          }
          if (!this.form.b) {
            this.form.b = "0";
          }
        } else {
          this.form.b = "0";
        }
      },
      // 高血压自动分层
      gxyfc(bsCount, wxysCount, bqgCount, lcCount, gxyfj) {
        if (this.query.hyperlipemiaFlag == 1) {
          if (gxyfj == 2) {
            if (bsCount == 0 && wxysCount == 0 && bqgCount == 0 && lcCount == 0) {
              this.form.a = "1";
            }
            if (wxysCount >= 1 && wxysCount <= 2) {
              this.form.a = "2";
            }
            if ((wxysCount >= 3 || bqgCount >= 1) && lcCount >= 1) {
              this.form.a = "3";
            }
          }
          if (gxyfj == 3) {
            if (bsCount == 0 && wxysCount == 0 && bqgCount == 0 && lcCount == 0) {
              this.form.a = "2";
            }
            if (wxysCount >= 1 && wxysCount <= 2) {
              this.form.a = "2";
            }
            if ((wxysCount >= 3 || bqgCount >= 1) && lcCount >= 1) {
              this.form.a = "3";
            }
          }
          if (gxyfj == 4) {
            if (bsCount == 0 && wxysCount == 0 && bqgCount == 0 && lcCount == 0) {
              this.form.a = "3";
            }
            if (wxysCount >= 1 && wxysCount <= 2) {
              this.form.a = "3";
            }
            if ((wxysCount >= 3 || bqgCount >= 1) && lcCount >= 1) {
              this.form.a = "3";
            }
          }
          if (!this.form.a) {
            this.form.a = "0";
          }
        } else {
          this.form.a = "0";
        }
      },
      // 高血脂分层
      gxzfc(wxysCount, tc, ldl, hypertension) {
        if (this.query.hypertensionFlag == 1) {
          if ((tc >= 5.2 && tc <= 6.2) || (ldl >= 3.4 && ldl <= 4.1)) {
            if (hypertension == "2" && wxysCount <= 3) {
              this.form.c = "1";
            }
            if (hypertension == "1" || wxysCount >= 3) {
              this.form.c = "1";
            }
            if (hypertension == "1" && wxysCount >= 1) {
              this.form.c = "2";
            }
          }
          if (tc >= 6.2 || ldl >= 4.1) {
            if (hypertension == "2" && wxysCount <= 3) {
              this.form.c = "1";
            }
            if (hypertension == "1" || wxysCount >= 3) {
              this.form.c = "2";
            }
            if (hypertension == "1" && wxysCount >= 1) {
              this.form.c = "3";
            }
          }
          if (!this.form.c) {
            this.form.c = "0";
          }
        } else {
          this.form.c = "0";
        }
      },
      // ASCVD分层
      ASCVDfc(wxysCount, tc, ldl, hypertension) {
        if ((tc >= 3.1 && tc < 4.1) || (ldl >= 1.8 && ldl < 2.6)) {
          if (hypertension == "2" && wxysCount <= 3) {
            this.form.d = "1";
          }
          if (hypertension == "1" && wxysCount <= 1) {
            this.form.d = "1";
          }
          if (hypertension == "1" && wxysCount == 2) {
            this.form.d = "2";
          }
          if (hypertension == "1" && wxysCount >= 3) {
            this.form.d = "3";
          }
        }
        if ((tc >= 4.1 && tc < 5.2) || (ldl >= 2.6 && ldl < 3.4)) {
          if (hypertension == "2" && wxysCount <= 2) {
            this.form.d = "1";
          }
          if (hypertension == "2" && wxysCount == 3) {
            this.form.d = "2";
          }
          if (hypertension == "1" && wxysCount == 0) {
            this.form.d = "1";
          }
          if (hypertension == "1" && wxysCount == 1) {
            this.form.d = "2";
          }
          if (hypertension == "1" && wxysCount >= 2) {
            this.form.d = "3";
          }
        }
        if ((tc >= 5.2 && tc < 7.2) || (ldl >= 3.4 && ldl < 4.9)) {
          if (hypertension == "2" && wxysCount <= 1) {
            this.form.d = "1";
          }
          if (hypertension == "2" && wxysCount >= 2) {
            this.form.d = "2";
          }
          if (hypertension == "1" && wxysCount == 0) {
            this.form.d = "1";
          }
          if (hypertension == "1" && wxysCount == 1) {
            this.form.d = "2";
          }
          if (hypertension == "1" && wxysCount >= 2) {
            this.form.d = "3";
          }
        }
        if (!this.form.d) {
          this.form.d = "0";
        }
      }
    }
  };
  </script>
  <style scoped>
  .el-collapse-item__wrap {
    border-top: 1px solid #e6ebf5 !important;
  }
  
  .el-collapse-item__content {
    padding: 0px;
  }
  </style>
  <style scoped>
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    background-color: rgba(240, 240, 240, 1);
  }
  
  /*定义滚动条轨道 内阴影+圆角*/
  ::-webkit-scrollbar-track {
    box-shadow: inset 0 0 0px rgba(240, 240, 240, 0.5);
    border-radius: 10px;
    background-color: rgba(240, 240, 240, 0.5);
  }
  
  /*定义滑块 内阴影+圆角*/
  ::-webkit-scrollbar-thumb {
    border-radius: 10px;
    box-shadow: inset 0 0 0px rgba(240, 240, 240, 0.5);
    background-color: rgba(240, 240, 240, 0.5);
  }
  
  .el-collapse-item__header {
    font-size: 40px !important;
    font-weight: 700;
  }
  
  .link-item-hover {
    background-color: #f5f7fa;
    color: #1890ff;
    font-weight: 600;
    width: 200px;
  }
  
  .link-item-active {
    color: #fff;
    background-color: #00c4c2;
  }
  
  .el-tooltip__popper {
    max-width: 200px;
  }
  
  .el-menu {
    border: 0px;
  }
  
  .mb8 {
    margin-bottom: 20px;
  }
  ::v-deep .el-table td.el-table__cell {
    border-bottom: 1px solid #eef1f5;
    height: 55px;
  }
  ::v-deep .el-table__body tr.current-row > td {
    background: #d0f1f6 !important;
    border-bottom: 1px solid #edf1f5;
  }
  ::v-deep .el-table .el-table__header-wrapper th,
  .el-table .el-table__fixed-header-wrapper th {
    background: #08a4bb !important;
    color: #fff !important;
    height: 60px !important;
    font-size: 16px;
  }
  ::v-deep .el-table th.el-table__cell {
    background: #08a4bb !important;
    color: #fff !important;
    height: 60px !important;
    font-size: 16px;
  }
  ::v-deep .el-table th.el-table__cell:nth-of-type(1) {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
  }
  ::v-deep .el-table th.el-table__cell:nth-of-type(18) {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
  }
  ::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active {
    background-color: #08a4bb !important;
  }
  ::v-deep .el-form-item__label {
    font-weight: 300 !important;
    color: #000;
  }
  </style>
  