qx
qx
2025-06-06 38a8b888a9ec2812ad3553c8a71eaff018750927
src/views/doctor/checkAll/index.vue
@@ -1,6 +1,7 @@
<template>
  <div class="mainbox">
    <el-form :model="queryParams" ref="tableList" :inline="true" label-width="76px" style="margin-top: 10px">
    <el-form :model="queryParams" ref="tableList" :inline="true" label-width="76px" style="margin-top: 10px"
      v-if="tjStatus == 0">
      <el-form-item label="姓名" prop="name">
        <el-input v-model="queryParams.name" style="width: 120px" placeholder="请输入姓名" clearable
          @keyup.enter.native="submitForm"></el-input>
@@ -21,10 +22,68 @@
          <el-option v-for="dict in CompanyList" :key="dict.drugManufacturerId" :label="dict.cnName" :value="dict" />
        </el-select>
      </el-form-item>
      <el-form-item label="体检类别">
        <el-select style="width: 200px" v-model="queryParams.tjCategory" placeholder="请选择体检类别">
          <el-option v-for="dict in dict.type.dict_tjtype" :key="dict.value" :label="dict.label"
            :value="dict.value"></el-option>
        </el-select>
        <!-- <el-input v-model="form.category" placeholder="请输入体检类别" /> -->
      </el-form-item>
      <el-form-item>
        <el-button type="primary" size="mini" @click="submitForm" style="margin-right: 15px">搜索</el-button>
        <el-button size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-form :model="queryParams" ref="tableList" :inline="true" label-width="76px" style="margin-top: 10px"
      v-if="tjStatus == 1">
      <el-form-item label="姓名" prop="name">
        <el-input v-model="queryParams.name" style="width: 120px" placeholder="请输入姓名" clearable
          @keyup.enter.native="submitForm"></el-input>
      </el-form-item>
      <el-form-item label="体检号" prop="tjNumber">
        <el-input ref="inputName" v-model="queryParams.tjNumber" style="width: 180px" placeholder="请输入体检号" clearable
          @keyup.enter.native="submitForm" @blur="hb"></el-input>
      </el-form-item>
      <el-form-item label="单位名称" prop="tjCompName" style="margin-left: 20px">
        <el-select :remote-method="getRemoteData" v-model="queryParams.tjCompName" value-key="drugManufacturerId"
          style="width: 180px" remote filterable placeholder="请选择单位名称" clearable @change="searchSelect">
          <el-option v-for="dict in CompanyList" :key="dict.drugManufacturerId" :label="dict.cnName" :value="dict" />
        </el-select>
      </el-form-item>
      <el-form-item label="审核医师" prop="shys">
        <el-input ref="inputName" v-model="queryParams.shys" style="width: 180px" placeholder="请输入审核医师" clearable
          @keyup.enter.native="submitForm"></el-input>
      </el-form-item>
      <el-form-item label="体检类别">
        <el-select style="width: 200px" v-model="queryParams.tjCategory" placeholder="请选择体检类别">
          <el-option v-for="dict in dict.type.dict_tjtype" :key="dict.value" :label="dict.label"
            :value="dict.value"></el-option>
        </el-select>
        <!-- <el-input v-model="form.category" placeholder="请输入体检类别" /> -->
      </el-form-item>
      <el-form-item>
        <el-button type="primary" size="mini" @click="submitForm" style="margin-right: 15px">搜索</el-button>
        <el-button size="mini" @click="resetQuery">重置</el-button>
        <el-button type="primary" size="mini" @click="toggleCollapse" style="margin-right: 15px"
          v-show="isCollapsed == 0">高级搜索</el-button>
        <el-button type="primary" size="mini" @click="toggleCollapse3" style="margin-right: 15px"
          v-show="isCollapsed == 1">高级搜索</el-button>
      </el-form-item>
      <el-row v-show="isCollapsed == 1" :gutter="20">
        <el-col :span="8">
          <el-form-item label="体检时间" prop="tjTime">
            <el-date-picker v-model="startTime" type="datetimerange" align="right" :picker-options="pickerOptions"
              style="width: 310px" start-placeholder="开始日期" end-placeholder="结束日期"
              :default-time="['00:00:00', '23:00:00']" format="yyyy-MM-dd HH:mm" value-format="yyyy-MM-dd HH:mm"
              @change="dateChangebirthday1">
            </el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-radio-group v-model="tjStatus" @input="radioChange" style="margin-left: 20px">
@@ -35,12 +94,10 @@
    <template>
      <el-table v-loading="loading" :data="checkList" ref="table" border style="margin: 20px; width: 98%"
        @current-change="handleCurrentChange">
        <!-- <template slot="empty">数据正在加载中</template> -->
        <el-table-column label="体检号" align="center" prop="tjNumber" :show-overflow-tooltip="true" width="160px"
          fixed="left" />
        <el-table-column label="姓名" align="center" prop="cusName" :show-overflow-tooltip="true" width="100px"
          fixed="left" />
        <el-table-column label="性别" align="center" prop="cusSex" :show-overflow-tooltip="true" width="55px">
          <template slot-scope="scope">
            <span v-if="scope.row.cusSex == '0'">男</span>
@@ -51,21 +108,15 @@
        </el-table-column>
        <el-table-column label="出生日期" align="center" prop="cusBrithday" :show-overflow-tooltip="true" width="110px" />
        <el-table-column label="电话" align="center" prop="cusPhone" :show-overflow-tooltip="true" width="130px" />
        <!-- <el-table-column
          label="体检时间"
          align="center"
          prop="tjTime"
          :show-overflow-tooltip="true"
          width="110px"
        /> -->
        <el-table-column label="审核时间" align="center" prop="shsj" :show-overflow-tooltip="true" width="180px" />
        <el-table-column label="完成时间" align="center" prop="finishTime" :show-overflow-tooltip="true" width="160px" />
        <el-table-column label="状态" align="center" prop="tjStatus" :show-overflow-tooltip="true" width="120px">
          <template slot-scope="scope">
        <el-table-column label="状态" align="center" prop="tjStatus" :show-overflow-tooltip="true" width="120px"
          v-if="tjStatus == 0">
          <template slot-scope="scope" v-if="tjStatus == 0">
            <span>{{ scope.row.tjStatus == "1" ? "已审核" : "未审核" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="审核医师" align="center" prop="shys" width="120px" v-if="tjStatus == 1" />
        <el-table-column label="单位名称" align="center" prop="tjCompName" :show-overflow-tooltip="true" />
        <el-table-column label="体检类别" align="center" prop="tjCategory">
          <template slot-scope="scope">
@@ -78,7 +129,6 @@
              icon="el-icon-edit-outline"></el-button>
            <el-button fixed="right" title="详情" type="text" size="mini" @click.stop="handleClick(scope.row)"
              icon="el-icon-document-copy"></el-button>
            <!-- <el-button type="text" size="mini" @click="generate(scope.row)" v-if="scope.row.tjStatus=='1'">生成</el-button> -->
            <el-button type="text" size="mini" @click.stop="viewReport(scope.row)" v-if="scope.row.tjStatus == '1'"
              title="预览" icon="el-icon-view"></el-button>
            <el-button type="text" size="mini" v-if="scope.row.tjStatus == '1'" title="撤销"
@@ -98,615 +148,551 @@
    <!-- 点击弹出框 -->
    <el-drawer custom-class="tanchu" :visible.sync="drawer" :before-close="handleClose" :with-header="false" size="100%"
      :show-close="true">
      <div class="top">
        <table style="width: 100%; margin: 10px 10px; border: 1px solid #dfe6ec; border-collapse: collapse;"
          cellspacing="4">
          <caption style="background-color: #f8f8f9; font-size: 18px">
            {{ tableAll.cusName }}的体检资料
          </caption>
          <tr style="
              border: 1px solid #dfe6ec;
              border-collapse: collapse;
              height: 36px;
            ">
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              姓名:
            </td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              {{ tableAll.cusName }}
            </td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              性别:
            </td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              {{
                tableAll.cusSex == 0
                  ? "男"
                  : tableAll.cusSex == 1
                    ? "女"
                    : "未知"
              }}
            </td>
          </tr>
          <tr style="
              border: 1px solid #dfe6ec;
              border-collapse: collapse;
              height: 36px;
            ">
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              体检单号:
            </td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              {{ tableAll.tjNumber }}
            </td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              体检时间:
            </td>
            <td style="border: 1px solid #dfe6ec; border-collapse: collapse">
              {{ tableAll.tjTime }}
            </td>
          </tr>
        </table>
        <i class="el-icon-close" @click="guanbi"></i>
      </div>
      <div style="margin-right: 10px; display: flex" class="btnbox">
        <div class="btn1" v-if="msgtuwen == 'y' || msgtuwen == 'Y'">
          <el-button @click="Graphicreport()" type="primary">
            <span class="vertical-text">图文报告</span>
          </el-button>
        </div>
        <div class="btn1">
          <el-button @click="historicalreport()" type="primary"><span class="vertical-text">历史报告</span></el-button>
        </div>
        <div v-if="tableAll.tjCategory == '02'" class="btn1">
          <el-button @click="medicalhistory()" type="primary"><span class="vertical-text">职业病史</span></el-button>
        </div>
        <div class="btn1" v-if="msgjianqian == 'y' || msgjianqian == 'Y'">
          <el-button @click="jianqian()" type="primary"><span class="vertical-text">检前问诊</span></el-button>
      <div v-loading="isLoading" element-loading-text="正在加载数据,请稍候..." element-loading-spinner="el-icon-loading"
        element-loading-background="rgba(255, 255, 255, 0.8)" style="height: 100%; padding: 20px; position: relative;">
        <div class="top">
          <table style="width: 100%; margin: 10px 10px; border: 1px solid #dfe6ec; border-collapse: collapse;"
            cellspacing="4">
            <caption style="background-color: #f8f8f9; font-size: 18px">
              {{ tableAll.cusName }}的体检资料
            </caption>
            <tr style="border: 1px solid #dfe6ec; border-collapse: collapse; height: 36px;">
              <td style="border: 1px solid #dfe6ec; border-collapse: collapse">姓名:</td>
              <td style="border: 1px solid #dfe6ec; border-collapse: collapse">{{ tableAll.cusName }}</td>
              <td style="border: 1px solid #dfe6ec; border-collapse: collapse">性别:{{ tableAll.cusSex == 0 ? "男" :
                tableAll.cusSex == 1 ? "女" : "未知" }}</td>
              <td style="border: 1px solid #dfe6ec; border-collapse: collapse">年龄:{{ tableAll.age }}</td>
            </tr>
            <tr style="border: 1px solid #dfe6ec; border-collapse: collapse; height: 36px;">
              <td style="border: 1px solid #dfe6ec; border-collapse: collapse">体检单号:</td>
              <td style="border: 1px solid #dfe6ec; border-collapse: collapse">{{ tableAll.tjNumber }}</td>
              <td style="border: 1px solid #dfe6ec; border-collapse: collapse">体检时间:</td>
              <td style="border: 1px solid #dfe6ec; border-collapse: collapse">{{ tableAll.tjTime }}</td>
            </tr>
          </table>
          <i class="el-icon-close" @click="guanbi"></i>
        </div>
        <div class="btn1">
          <el-button @click="xiangmuqingkuang()" type="primary"><span class="vertical-text">项目情况</span></el-button>
        </div>
        <div class="btn1">
          <el-button @click="yichangjieguo()" type="primary"><span class="vertical-text">异常结果</span></el-button>
        </div>
      </div>
      <div class="box">
        <div class="left-container">
          <div class="left">
            <div v-for="(item, index) in changedate" :key="index">
              <div style="
                  text-align: center;
                  background-color: #aad8df;
                  margin-top: 10px;
                ">
                {{ item.parent || "" }}
              </div>
              <div v-if="item.xmlb == '0'">
                <el-table :data="item.sons" border style="width: 100%" :row-style="changRed"
                  :header-cell-style="{ background: '#aad8df' }">
                  <el-table-column align="center" label="检测项目" width="464">
                    <template slot-scope="scope">
                      <div>{{ scope.row.proName }}</div>
                    </template>
                  </el-table-column>
                  <el-table-column align="center" prop="proResult" label="检测结果" width="180">
                  </el-table-column>
                  <el-table-column align="center" prop="" label="单位">
                    <template slot-scope="scope">
                      <div v-if="scope.row.project != null">
                        {{ scope.row.standard.company || "" }}
                      </div>
                      <div v-else>{{ scope.row.proAdvice }}</div>
                    </template>
                  </el-table-column>
                  <el-table-column align="center" prop="conclusion" label="异常" width="180"></el-table-column>
                  <el-table-column align="center" prop="" label=" 参考范围">
                    <template slot-scope="scope">
                      <div v-if="scope.row.project != null">
                        {{
                          scope.row.standard.tjStandardGtValue ||
                          "/" + "-" + scope.row.standard.tjStandardLtValue ||
                          "/"
                        }}
                      </div>
                      <div v-else>{{ scope.row.stanId || "/" }}</div>
                    </template>
                  </el-table-column>
                </el-table>
                <table style="width: 100%" v-if="tjproject != '1'">
                  <tr style="border: 1px solid #dfe6ec; border-collapse: collapse">
                    <td style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 7%;
                      ">
                      小结:
                    </td>
                    <td style="border: 1px solid #dfe6ec; width: 45%">
                      <el-input v-model="item.remark" disabled></el-input>
                    </td>
                    <td style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 15%;
                      ">
                      主检医师:
                    </td>
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse" colspan="2">
                      {{ item.doctorName }}
                    </td>
                  </tr>
                  <tr style="
                      border: 1px solid #dfe6ec;
                      border-collapse: collapse;
                      width: 200px;
                    ">
                    <td style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 240px;
                      ">
                      备注:
                    </td>
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse" colspan="3">
                      <el-input type="textarea" autosize placeholder="请输入内容" v-model="changedate[index].remark"
                        v-on:input="change" style="width: 100%">
                      </el-input>
                      <!-- <textarea
                        placeholder="请输入内容"
                        :autosize="{ minRows: 2 }"
                        style="width: 100%; height: 240px; resize: none"
                        v-model="changedate[index].remark"
                        v-on:input="change"
                      ></textarea> -->
                    </td>
                  </tr>
                </table>
              </div>
              <div v-else>
                <table style="width: 100%" v-if="tjproject != '1'">
                  <tr style="border: 1px solid #dfe6ec">
                    <td style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 15%;
                        height: auto;
                      ">
                      检查所见:
                    </td>
                    <td style="border: 1px solid #dfe6ec; height: auto" colspan="2">
                      <el-input type="textarea" autosize placeholder="请输入内容" v-model="item.jgbx" style="width: 100%">
                      </el-input>
                      <!-- <textarea
                        placeholder="请输入内容"
                        :autosize="{ minRows: 3}"
                        style="width: 100%; height: auto; resize: none"
                        v-model="item.jgbx"
                      ></textarea> -->
                    </td>
                  </tr>
                  <tr style="border: 1px solid #dfe6ec; border-collapse: collapse">
                    <td style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 15%;
                      ">
                      检查提示:
                    </td>
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse" colspan="2">
                      <el-input type="textarea" autosize placeholder="请输入内容" v-model="item.remark" style="width: 100%">
                      </el-input>
                      <!-- <textarea
                        placeholder="请输入内容"
                        style="width: 100%;  resize: none"
                        v-model="item.remark"
                      ></textarea> -->
                    </td>
                  </tr>
                  <tr style="
                      border: 1px solid #dfe6ec;
                      border-collapse: collapse;
                      width: 200px;
                    ">
                    <td style="
                        border: 1px solid #dfe6ec;
                        border-collapse: collapse;
                        width: 15%;
                      ">
                      主检医师:
                    </td>
                    <td style="border: 1px solid #dfe6ec; border-collapse: collapse" colspan="2">
                      {{ item.doctorName }}
                    </td>
                  </tr>
                </table>
              </div>
            </div>
            <div style="margin: 0 0px 10px 15px" v-if="tjproject != '1'">
              <el-button type="primary" @click="propoChange">快捷建议</el-button>
              <el-button type="primary" @click="proposalChange">生成建议</el-button>
            </div>
            <el-form ref="numberValidateForm" label-width="80px" class="demo-ruleForm" v-if="tjproject != '1'">
              <el-form-item label="总检建议">
                <el-input type="textarea" placeholder="请输入内容" v-model="textarea1" :rows="3" style="width: 96%">
                </el-input>
              </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footers">
              <el-button type="primary" @click.stop="guanbi">取消</el-button>
              <el-button v-if="tjproject == '0' && (msgkcf == 'y' || msgkcf == 'Y')" type="primary"
                @click.stop="rowClick" icon="el-icon-edit-outline">开处方</el-button>
              <div v-if="tjproject == '0'">
                <el-button type="primary" @click="determine" :disabled="isdisabled">提交并生成报告</el-button>
              </div>
            </div>
        <div style="margin-right: 10px; display: flex" class="btnbox">
          <div class="btn1" v-if="msgtuwen == 'y' || msgtuwen == 'Y'">
            <el-button @click="Graphicreport()" type="primary">
              <span class="vertical-text">图文报告</span>
            </el-button>
          </div>
          <div class="btn1">
            <el-button @click="historicalreport()" type="primary"><span class="vertical-text">历史报告</span></el-button>
          </div>
          <div v-if="tableAll.tjCategory == '02'" class="btn1">
            <el-button @click="medicalhistory()" type="primary"><span class="vertical-text">职业病史</span></el-button>
          </div>
          <div class="btn1" v-if="msgjianqian == 'y' || msgjianqian == 'Y'">
            <el-button @click="jianqian()" type="primary"><span class="vertical-text">检前问诊</span></el-button>
          </div>
          <div class="btn1">
            <el-button @click="xiangmuqingkuang()" type="primary"><span class="vertical-text">项目情况</span></el-button>
          </div>
          <div class="btn1">
            <el-button @click="yichangjieguo()" type="primary"><span class="vertical-text">异常结果</span></el-button>
          </div>
          <div class="btn1">
            <el-button @click="fuchaxiangmu()" type="primary"><span class="vertical-text">复查项目</span></el-button>
          </div>
        </div>
        <div class="rightbox">
          <div class="right">
            <template v-if="status1 == 0">
              <div v-for="(item, index) in yichangList" :key="index">
                <div style="
                    text-align: center;
                    background-color: #67c23a;
                    margin-top: 10px;
                  ">
                  {{ item.proName || "" }}
        <div class="box">
          <div class="left-container">
            <div class="left">
              <div v-for="(item, index) in changedate" :key="index">
                <div style="text-align: center; background-color: #aad8df; margin-top: 10px;">
                  {{ item.parent || "" }}
                </div>
                <template v-if="item.jyjc == '0'">
                  <el-table :stripe="true" :row-style="red" :data="item.sone" border style="width: 100%"
                    :header-cell-style="{ background: '#67C23A' }" :expand-row-keys="expends" :row-key="getRowKeys">
                    <el-table-column type="expand">
                      <template slot-scope="props">
                        <div style="padding: 10px;">
                          <!-- 内容区域 -->
                          <div v-if="props.row.advices && props.row.advices.length > 0">
                            <div v-for="(jianyi, index1) in props.row.advices" :key="index1"
                              style="margin-bottom: 10px">
                              <div>
                                标题:
                                <el-input v-model="jianyi.bt" size="small" type="textarea" autosize
                                  @blur="handleAdviceBlur(props.row, index1)"></el-input>
                              </div>
                              <div>
                                内容:
                                <el-input v-model="jianyi.nr" size="small" type="textarea" autosize
                                  @blur="handleAdviceBlur(props.row, index1)"></el-input>
                              </div>
                            </div>
                          </div>
                          <!-- 如果 advices 为空时,渲染空的输入框 -->
                          <div v-else>
                            <div>
                              标题:
                              <el-input v-model="emptyAdvice.bt" size="small" type="textarea" autosize
                                @blur="handleAdviceBlur(props.row, -1)"></el-input>
                            </div>
                            <div>
                              内容:
                              <el-input v-model="emptyAdvice.nr" size="small" type="textarea" autosize
                                @blur="handleAdviceBlur(props.row, -1)"></el-input>
                            </div>
                          </div>
                          <div style="margin-top: 10px;">
                            <el-button @click="shanchu(props.row)" type="danger" size="small">删除</el-button>
                          </div>
                        </div>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" label="检测项目" :show-overflow-tooltip="true" width="353">
                <div v-if="item.xmlb == '0'">
                  <el-table :data="item.sons" border style="width: 100%" :row-style="changRed"
                    :header-cell-style="{ background: '#aad8df' }">
                    <el-table-column align="center" label="检测项目" width="464">
                      <template slot-scope="scope">
                        <div>{{ scope.row.proName }}</div>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" prop="proResult" label="检测结果" width="85">
                    <el-table-column align="center" prop="proResult" label="检测结果" width="180"></el-table-column>
                    <el-table-column align="center" prop="" label="单位">
                      <template slot-scope="scope">
                        <div v-if="scope.row.project != null">{{ scope.row.standard.company || "" }}</div>
                        <div v-else>{{ scope.row.proAdvice }}</div>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" prop="stanId" label=" 参考范围" width="117">
                    <el-table-column align="center" prop="conclusion" label="异常" width="180"></el-table-column>
                    <el-table-column align="center" prop="" label=" 参考范围">
                      <template slot-scope="scope">
                        <div v-if="scope.row.project != null">
                          {{ scope.row.standard.tjStandardGtValue || "/" + "-" + scope.row.standard.tjStandardLtValue ||
                            "/" }}
                        </div>
                        <div v-else>{{ scope.row.stanId || "/" }}</div>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" prop="proAdvice" label="单位" width="78">
                    </el-table-column>
                  </el-table>
                </template>
                <template v-if="item.jyjc == '1'">
                  <el-table :stripe="true" :row-style="red" :data="item.sone" border style="width: 100%"
                    :header-cell-style="{ background: '#67C23A' }" :expand-row-keys="expends" :row-key="getRowKeys">
                    <el-table-column type="expand">
                      <template slot-scope="props">
                        <div style="padding: 10px;">
                          <!-- 内容区域 -->
                          <div v-if="props.row.advices && props.row.advices.length > 0">
                            <div v-for="(jianyi, index1) in props.row.advices" :key="index1"
                              style="margin-bottom: 10px">
                  <table style="width: 100%" v-if="tjproject != '1'">
                    <tr style="border: 1px solid #dfe6ec; border-collapse: collapse">
                      <td style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 7%;">
                        小结:
                      </td>
                      <td style="border: 1px solid #dfe6ec; width: 45%">
                        <el-input v-model="item.remark" disabled></el-input>
                      </td>
                      <td style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 15%;">
                        主检医师:
                      </td>
                      <td style="border: 1px solid #dfe6ec; border-collapse: collapse" colspan="2">
                        {{ item.doctorName }}
                      </td>
                    </tr>
                    <tr style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 200px;">
                      <td style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 240px;">
                        备注:
                      </td>
                      <td style="border: 1px solid #dfe6ec; border-collapse: collapse" colspan="3">
                        <el-input type="textarea" autosize placeholder="请输入内容" v-model="changedate[index].remark"
                          v-on:input="change" style="width: 100%"></el-input>
                      </td>
                    </tr>
                  </table>
                </div>
                <div v-else>
                  <table style="width: 100%" v-if="tjproject != '1'">
                    <tr style="border: 1px solid #dfe6ec">
                      <td style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 15%; height: auto;">
                        检查所见:
                      </td>
                      <td style="border: 1px solid #dfe6ec; height: auto" colspan="2">
                        <el-input type="textarea" autosize placeholder="请输入内容" v-model="item.jgbx"
                          style="width: 100%"></el-input>
                      </td>
                    </tr>
                    <tr style="border: 1px solid #dfe6ec; border-collapse: collapse">
                      <td style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 15%;">
                        检查提示:
                      </td>
                      <td style="border: 1px solid #dfe6ec; border-collapse: collapse" colspan="2">
                        <el-input type="textarea" autosize placeholder="请输入内容" v-model="item.remark"
                          style="width: 100%"></el-input>
                      </td>
                    </tr>
                    <tr style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 200px;">
                      <td style="border: 1px solid #dfe6ec; border-collapse: collapse; width: 15%;">
                        主检医师:
                      </td>
                      <td style="border: 1px solid #dfe6ec; border-collapse: collapse" colspan="2">
                        {{ item.doctorName }}
                      </td>
                    </tr>
                  </table>
                </div>
              </div>
              <div v-if="tableAll && tableAll.tjCategory === '02'" class="section-title">职业病总检</div>
              <el-form v-if="tableAll && tableAll.tjCategory === '02'" ref="numberValidateForm" label-width="80px"
                class="demo-ruleForm">
                <el-form-item label="检查结论">
                  <el-input type="textarea" placeholder="请输入内容" v-model="zhiyeJl" :rows="3"
                    style="width: 96%"></el-input>
                </el-form-item>
                <el-form-item label="体检结果">
                  <el-input type="textarea" placeholder="请输入内容" v-model="zhiyeJg" :rows="3"
                    style="width: 96%"></el-input>
                </el-form-item>
              </el-form>
              <div style="margin: 0 0px 10px 15px" v-if="tjproject != '1'">
                <el-button type="primary" @click="propoChange">快捷建议</el-button>
                <el-button type="primary" @click="proposalChange">生成建议</el-button>
              </div>
              <el-form ref="numberValidateForm" label-width="80px" class="demo-ruleForm" v-if="tjproject != '1'">
                <el-form-item label="总检建议">
                  <el-input type="textarea" placeholder="请输入内容" v-model="textarea1" :rows="3"
                    style="width: 96%"></el-input>
                </el-form-item>
              </el-form>
              <div slot="footer" class="dialog-footers">
                <el-button type="primary" @click.stop="guanbi">取消</el-button>
                <el-button v-if="tjproject == '0' && (msgkcf == 'y' || msgkcf == 'Y')" type="primary"
                  @click.stop="rowClick" icon="el-icon-edit-outline">开处方</el-button>
                <div v-if="tjproject == '0'">
                  <el-button type="primary" @click="determine" :disabled="isdisabled">提交并生成报告</el-button>
                </div>
              </div>
            </div>
          </div>
          <div class="rightbox">
            <div class="right">
              <template v-if="status1 == 0">
                <div v-for="(item, index) in yichangList" :key="index">
                  <div style="text-align: center; background-color: #67c23a; margin-top: 10px;">
                    {{ item.proName || "" }}
                  </div>
                  <template v-if="item.jyjc == '0'">
                    <el-table :stripe="true" :row-style="red" :data="item.sone" border style="width: 100%"
                      :header-cell-style="{ background: '#67C23A' }" :expand-row-keys="expends" :row-key="getRowKeys"
                      v-loading="loading">
                      <el-table-column type="expand">
                        <template slot-scope="props">
                          <div style="padding: 10px;">
                            <!-- 内容区域 -->
                            <div v-if="props.row.advices && props.row.advices.length > 0">
                              <div v-for="(jianyi, index1) in props.row.advices" :key="index1"
                                style="margin-bottom: 10px">
                                <div>
                                  标题:
                                  <el-input v-model="jianyi.bt" size="small" type="textarea" autosize
                                    @blur="handleAdviceBlur(props.row, index1)"></el-input>
                                </div>
                                <div>
                                  内容:
                                  <el-input v-model="jianyi.nr" size="small" type="textarea" autosize
                                    @blur="handleAdviceBlur(props.row, index1)"></el-input>
                                </div>
                              </div>
                            </div>
                            <!-- 如果 advices 为空时,渲染空的输入框 -->
                            <div v-else>
                              <div>
                                标题:
                                <el-input v-model="jianyi.bt" size="small" type="textarea" autosize
                                  @blur="handleAdviceBlur(props.row, index1)"></el-input>
                                <el-input v-model="emptyAdvice.bt" size="small" type="textarea" autosize
                                  @blur="handleAdviceBlur(props.row, -1)"></el-input>
                              </div>
                              <div>
                                内容:
                                <el-input v-model="jianyi.nr" size="small" type="textarea" autosize
                                  @blur="handleAdviceBlur(props.row, index1)"></el-input>
                                <el-input v-model="emptyAdvice.nr" size="small" type="textarea" autosize
                                  @blur="handleAdviceBlur(props.row, -1)"></el-input>
                              </div>
                            </div>
                          </div>
                          <!-- 如果 advices 为空时,渲染空的输入框 -->
                          <div v-else>
                            <div>
                              标题:
                              <el-input v-model="emptyAdvice.bt" size="small" type="textarea" autosize
                                @blur="handleAdviceBlur(props.row, -1)"></el-input>
                            </div>
                            <div>
                              内容:
                              <el-input v-model="emptyAdvice.nr" size="small" type="textarea" autosize
                                @blur="handleAdviceBlur(props.row, -1)"></el-input>
                            <div style="margin-top: 10px;">
                              <el-button @click="shanchu(props.row)" type="danger" size="small">删除</el-button>
                            </div>
                          </div>
                          <div style="margin-top: 10px;">
                            <el-button @click="shanchu(props.row)" type="danger" size="small">删除</el-button>
                        </template>
                      </el-table-column>
                      <el-table-column align="center" label="检测项目" :show-overflow-tooltip="true" width="353">
                        <template slot-scope="scope">
                          <div>{{ scope.row.proName }}</div>
                        </template>
                      </el-table-column>
                      <el-table-column align="center" prop="proResult" label="检测结果" width="85"></el-table-column>
                      <el-table-column align="center" prop="stanId" label=" 参考范围" width="117"></el-table-column>
                      <el-table-column align="center" prop="proAdvice" label="单位" width="78"></el-table-column>
                    </el-table>
                  </template>
                  <template v-if="item.jyjc == '1'">
                    <el-table :stripe="true" :row-style="red" :data="item.sone" border style="width: 100%"
                      :header-cell-style="{ background: '#67C23A' }" :expand-row-keys="expends" :row-key="getRowKeys">
                      <el-table-column type="expand">
                        <template slot-scope="props">
                          <div style="padding: 10px;">
                            <!-- 内容区域 -->
                            <div v-if="props.row.advices && props.row.advices.length > 0">
                              <div v-for="(jianyi, index1) in props.row.advices" :key="index1"
                                style="margin-bottom: 10px">
                                <div>
                                  标题:
                                  <el-input v-model="jianyi.bt" size="small" type="textarea" autosize
                                    @blur="handleAdviceBlur(props.row, index1)"></el-input>
                                </div>
                                <div>
                                  内容:
                                  <el-input v-model="jianyi.nr" size="small" type="textarea" autosize
                                    @blur="handleAdviceBlur(props.row, index1)"></el-input>
                                </div>
                              </div>
                            </div>
                            <!-- 如果 advices 为空时,渲染空的输入框 -->
                            <div v-else>
                              <div>
                                标题:
                                <el-input v-model="emptyAdvice.bt" size="small" type="textarea" autosize
                                  @blur="handleAdviceBlur(props.row, -1)"></el-input>
                              </div>
                              <div>
                                内容:
                                <el-input v-model="emptyAdvice.nr" size="small" type="textarea" autosize
                                  @blur="handleAdviceBlur(props.row, -1)"></el-input>
                              </div>
                            </div>
                            <div style="margin-top: 10px;">
                              <el-button @click="shanchu(props.row)" type="danger" size="small">删除</el-button>
                            </div>
                          </div>
                        </div>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" label="检测项目" width="232" :show-overflow-tooltip="true">
                        </template>
                      </el-table-column>
                      <el-table-column align="center" label="检测项目" width="232" :show-overflow-tooltip="true">
                        <template slot-scope="scope">
                          <div>{{ scope.row.proName }}</div>
                        </template>
                      </el-table-column>
                      <el-table-column align="center" prop="proResult" label="检测结果" width="403"></el-table-column>
                    </el-table>
                  </template>
                </div>
              </template>
              <template v-if="status1 == 1">
                <div>
                  <div style="text-align: center; background-color: #e6a23c; margin-top: 10px;">
                    项目检查情况
                  </div>
                  <el-table :row-style="redxiangmu" :data="statusList" style="width: 100%"
                    :header-cell-style="{ background: '#e6a23c' }">
                    <el-table-column align="center" label="部门" width="144" prop="deptName"></el-table-column>
                    <el-table-column align="center" prop="proName" label="项目" width="260"></el-table-column>
                    <el-table-column label="状态" align="center" prop="type" :show-overflow-tooltip="true" width="120">
                      <template slot-scope="scope">
                        <div>{{ scope.row.proName }}</div>
                        <span v-if="scope.row.type == '0'">未审核</span>
                        <span v-if="scope.row.type == '1'">已审核</span>
                        <span v-if="scope.row.type == '2'">弃检</span>
                        <span v-if="scope.row.type == '3'">延期</span>
                      </template>
                    </el-table-column>
                    <el-table-column align="center" prop="proResult" label="检测结果" width="403">
                    <el-table-column label="检查时间" align="center" prop="bcupdateTime" width="160" />
                  </el-table>
                </div>
              </template>
              <template v-if="status1 == 2">
                <div>
                  <div style="text-align: center; margin-top: 10px;">
                    复查项目
                  </div>
                  <div style="display: flex;margin:15px ;">
                    <span slot="label" style="display: inline-block; border-bottom: 2px solid blue;font-size: 0.8vw;"
                      @click="handleQuery">
                      项目选择
                    </span>
                    <div v-if="xmChange.length > 0" style="display: flex;">
                      <div style="margin:0 40px;font-size: 0.8vw;">项目名称:{{ xmChange[0].proName || "" }}</div>
                      <div style="margin:0 80px ;font-size: 0.8vw;">价格:{{ xmChange[0].price || "" }}</div>
                    </div>
                    <div v-else style="display: flex;">
                      <div style="margin:0 40px;font-size: 0.8vw;">项目名称:{{ }}</div>
                      <div style="margin:0 80px ;font-size: 0.8vw;">价格:{{ }}</div>
                    </div>
                    <el-button type="primary" size="mini" @click="handleaddClick()">添加</el-button>
                  </div>
                  <el-table :row-style="redxiangmu" :data="fcList" style="width: 100%" border>
                    <el-table-column type="selection" width="40" align="center" />
                    <el-table-column label="序号" align="center" prop="newID" />
                    <el-table-column label="名称" align="center" prop="proName" width="100px" />
                    <el-table-column label="价格" align="center" prop="price" />
                    <el-table-column label="科室" align="center" prop="deptName" />
                    <el-table-column label="操作" align="center" width="130px">
                      <template slot-scope="scope">
                        <el-button type="primary" size="mini" @click="handledeleteClick(scope.row)">删除</el-button>
                      </template>
                    </el-table-column>
                  </el-table>
                </template>
              </div>
            </template>
            <template v-if="status1 == 1">
              <div>
                <div style="
                    text-align: center;
                    background-color: #e6a23c;
                    margin-top: 10px;
                  ">
                  项目检查情况
                </div>
                <el-table :row-style="redxiangmu" :data="statusList" style="width: 100%"
                  :header-cell-style="{ background: '#e6a23c' }">
                  <el-table-column align="center" label="部门" width="144" prop="deptName">
                  </el-table-column>
                  <el-table-column align="center" prop="proName" label="项目" width="260">
                  </el-table-column>
                  <el-table-column label="状态" align="center" prop="type" :show-overflow-tooltip="true" width="120">
                    <template slot-scope="scope">
                      <span v-if="scope.row.type == '0'">未审核</span>
                      <span v-if="scope.row.type == '1'">已审核</span>
                      <span v-if="scope.row.type == '2'">弃检</span>
                      <span v-if="scope.row.type == '3'">延期</span>
                    </template>
                  </el-table-column>
                  <el-table-column label="检查时间" align="center" prop="bcupdateTime" width="160" />
                </el-table>
              </div>
            </template>
            <el-button type="primary" @click="addnew" :disabled="isdisabled">新增</el-button>
              </template>
              <template v-if="status1 == 3">
                <div class="hist3">
                  <span class="txt">问诊信息</span>
                  <el-form ref="form" :model="formobj" label-width="100px" :inline="true" size="mini">
                    <el-collapse class="coll" v-model="activeName" accordion>
                      <el-collapse-item class="coll" title="基本信息" name="1" style="width: 100%; font-weight: 600">
                        <div style="width: 100%">
                          <el-form-item label="姓名" prop="cusName">
                            <el-input disabled v-model="formobj.cusName" placeholder="请输入姓名" />
                          </el-form-item>
                          <el-form-item label="职业" prop="work">
                            <el-select filterable v-model="formobj.work" placeholder="请选择职业" clearable
                              style="width: 150px" disabled>
                              <el-option v-for="dict in dict.type.tj_work" :key="dict.value" :label="dict.label"
                                :value="dict.value" />
                            </el-select>
                          </el-form-item>
                          <el-form-item label="工作状态" prop="workStatus">
                            <el-select disabled filterable v-model="formobj.workStatus" placeholder="请选择工作状态" clearable
                              style="width: 150px">
                              <el-option v-for="dict in dict.type.tj_work_status" :key="dict.value" :label="dict.label"
                                :value="dict.value" />
                            </el-select>
                          </el-form-item>
                          <el-form-item label="接触毒物" prop="contactPoison">
                            <el-input disabled type="textarea" rows="4" v-model="formobj.contactPoison"
                              placeholder="请输入接触毒物" style="width: 700px" />
                          </el-form-item>
                          <el-form-item label="既往病史" prop="medicalHistory">
                            <el-input disabled type="textarea" rows="4" v-model="formobj.medicalHistory"
                              placeholder="请输入既往病史" style="width: 700px" />
                          </el-form-item>
                        </div>
                      </el-collapse-item>
                      <el-collapse-item title="月经史" name="2" v-show="sex">
                        <div style="width: 100%">
                          <el-form-item label="初潮(岁)" prop="chuchao">
                            <el-input v-model="formobj.chuchao" style="width: 70px" disabled />
                          </el-form-item>
                          <el-form-item label="经期" prop="jingqi">
                            <el-input v-model="formobj.jingqi" disabled style="width: 70px" />天
                          </el-form-item>
                          <el-form-item label="周期" prop="zhouqi">
                            <el-input v-model="formobj.zhouqi" disabled style="width: 70px" />天
                          </el-form-item>
                          <el-form-item label="末次月经" prop="mociage">
                            <el-input v-model="formobj.mociage" disabled style="width: 100px" />
                          </el-form-item>
                        </div>
                      </el-collapse-item>
                      <el-collapse-item title="生育史" name="3" v-show="sex">
                        <div style="width: 100%">
                          <el-form-item label="现有子女(人)" prop="zinv">
                            <el-input v-model="formobj.zinv" style="width: 70px" disabled />
                          </el-form-item>
                          <el-form-item label="流产(次)" prop="liuchan">
                            <el-input v-model="formobj.liuchan" style="width: 70px" disabled />
                          </el-form-item>
                          <el-form-item label="早产(次)" prop="zaochan">
                            <el-input v-model="formobj.zaochan" style="width: 70px" disabled />
                          </el-form-item>
                          <el-form-item label="死产(次)" prop="sichan">
                            <el-input v-model="formobj.sichan" style="width: 70px" disabled />
                          </el-form-item>
                          <el-form-item label="异常胎(次)" prop="yichangtai">
                            <el-input v-model="formobj.yichangtai" style="width: 70px" disabled />
                          </el-form-item>
                        </div>
                      </el-collapse-item>
                      <el-collapse-item title="烟酒史" name="4">
                        <div style="width: 100%">
                          <el-form-item label="是否吸烟" prop="xiyan">
                            <el-select disabled filterable v-model="formobj.xiyan" placeholder="请选择是否吸烟" clearable
                              style="width: 150px">
                              <el-option v-for="dict in dict.type.tj_smoking_pinlv" :key="dict.value"
                                :label="dict.label" :value="dict.value" />
                            </el-select>
                          </el-form-item>
                          <el-form-item label="吸烟频率" prop="xiyanpinlv">
                            <el-input v-model="formobj.xiyanpinlv" disabled style="width: 70px" />支/天
                          </el-form-item>
                          <el-form-item label="吸烟时间" prop="xiyanyear">
                            <el-input v-model="formobj.xiyanyear" disabled style="width: 70px" />年
                          </el-form-item><br />
                          <el-form-item label="是否饮酒" prop="yinjiu">
                            <el-select filterable v-model="formobj.yinjiu" disabled placeholder="请选择是否饮酒" clearable
                              style="width: 150px">
                              <el-option v-for="dict in dict.type.tj_smoking_pinlv" :key="dict.value"
                                :label="dict.label" :value="dict.value" />
                            </el-select>
                          </el-form-item>
                          <el-form-item label="饮酒频率" prop="yinjiupinlv">
                            <el-input v-model="formobj.yinjiupinlv" disabled style="width: 70px" />ml/天
                          </el-form-item>
                          <el-form-item label="饮酒时间" prop="yinjiuyear">
                            <el-input v-model="formobj.yinjiuyear" disabled style="width: 70px" />年
                          </el-form-item>
                          <el-form-item label="其他" prop="qita">
                            <el-input v-model="formobj.qita" placeholder="请输入其他" disabled type="textarea"
                              style="width: 600px" rows="2" />
                          </el-form-item>
                        </div>
                      </el-collapse-item>
                      <el-collapse-item title="急慢性职业病史信息" name="5">
                        <div style="width: 100%">
                          <el-table border :data="formobj.tjAskHistorysList" ref="tjAskHistorys" style="width: 98%">
                            <el-table-column type="selection" width="40" align="center" />
                            <el-table-column label="疾病名称" prop="diseaseName">
                              <template slot-scope="scope">
                                <el-input size="mini" disabled v-model="scope.row.diseaseName" placeholder="请输入疾病名称" />
                              </template>
                            </el-table-column>
                            <el-table-column label="诊断日期" prop="diseaseData">
                              <template slot-scope="scope">
                                <el-date-picker size="mini" v-model="scope.row.diseaseData" align="right" type="date"
                                  placeholder="选择日期" :picker-options="pickerOptions" style="width: 130px"
                                  value-format="yyyy-MM-dd">
                                </el-date-picker>
                              </template>
                            </el-table-column>
                            <el-table-column label="诊断单位" prop="diseaseCompany">
                              <template slot-scope="scope">
                                <el-input size="mini" disabled v-model="scope.row.diseaseCompany"
                                  placeholder="请输入诊断单位" />
                              </template>
                            </el-table-column>
                            <el-table-column label="是否痊愈" prop="isOk">
                              <template slot-scope="scope">
                                <el-select disabled filterable size="mini" v-model="scope.row.isOk"
                                  placeholder="请选择是否痊愈" clearable>
                                  <el-option v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.label"
                                    :value="dict.value" />
                                </el-select>
                              </template>
                            </el-table-column>
                            <el-table-column label="备注" prop="remark">
                              <template slot-scope="scope">
                                <el-input disabled size="mini" v-model="scope.row.remark" placeholder="请输入备注" />
                              </template>
                            </el-table-column>
                          </el-table>
                        </div>
                      </el-collapse-item>
                      <el-collapse-item title="职业史" name="7">
                        <div style="width: 100%">
                          <el-table border :data="formobj.workLogs" style="width: 98%">
                            <el-table-column type="selection" width="40" align="center" />
                            <el-table-column label="开始时间" prop="beginTime">
                              <template slot-scope="scope">
                                <el-date-picker size="mini" v-model="scope.row.beginTime" align="right" type="date"
                                  placeholder="选择日期" :picker-options="pickerOptions" style="width: 130px"
                                  value-format="yyyy-MM-dd">
                                </el-date-picker>
                              </template>
                            </el-table-column>
                            <el-table-column label="结束时间" prop="endTime">
                              <template slot-scope="scope">
                                <el-date-picker size="mini" disabled v-model="scope.row.endTime" align="right"
                                  type="date" placeholder="选择日期" :picker-options="pickerOptions" style="width: 130px"
                                  value-format="yyyy-MM-dd">
                                </el-date-picker>
                              </template>
                            </el-table-column>
                            <el-table-column label="工作单位" prop="workCompany">
                              <template slot-scope="scope">
                                <el-input size="mini" disabled v-model="scope.row.workCompany" placeholder="请输入工作单位" />
                              </template>
                            </el-table-column>
                            <el-table-column label="部门" prop="workDept">
                              <template slot-scope="scope">
                                <el-input disabled size="mini" v-model="scope.row.workDept" placeholder="请输入部门" />
                              </template>
                            </el-table-column>
                            <el-table-column label="工种" prop="workType">
                              <template slot-scope="scope">
                                <el-input disabled size="mini" v-model="scope.row.workType" placeholder="请输入工种" />
                              </template>
                            </el-table-column>
                            <el-table-column label="有害因素" prop="harmTypeLogs">
                              <template slot-scope="scope">
                                <el-select filterable disabled size="mini" v-model="scope.row.harmTypeLogs" multiple
                                  placeholder="请选择有害因素" clearable>
                                  <el-option v-for="dict in harmTypeList" :key="dict.aid" :label="dict.harmtype"
                                    :value="dict.aid" />
                                </el-select>
                              </template>
                            </el-table-column>
                            <el-table-column label="防护措施" prop="fangHu">
                              <template slot-scope="scope">
                                <el-input disabled size="mini" v-model="scope.row.fangHu" placeholder="请输入防护措施" />
                              </template>
                            </el-table-column>
                          </el-table>
                        </div>
                      </el-collapse-item>
                    </el-collapse>
                  </el-form>
                </div>
              </template>
              <el-button type="primary" @click="addnew" :disabled="isdisabled" style="margin-top: 20px;">新增</el-button>
            </div>
          </div>
        </div>
      </div>
      <div class="hist3" v-if="wenzhen">
        <span class="txt">问诊信息</span>
        <el-form ref="form" :model="formobj" label-width="100px" :inline="true" size="mini">
          <el-collapse class="coll" v-model="activeName" accordion>
            <el-collapse-item class="coll" title="基本信息" name="1" style="width: 100%; font-weight: 600">
              <div style="width: 100%">
                <el-form-item label="姓名" prop="cusName">
                  <el-input disabled v-model="formobj.cusName" placeholder="请输入姓名" />
                </el-form-item>
                <el-form-item label="职业" prop="work">
                  <el-select filterable v-model="formobj.work" placeholder="请选择职业" clearable style="width: 150px"
                    disabled>
                    <el-option v-for="dict in dict.type.tj_work" :key="dict.value" :label="dict.label"
                      :value="dict.value" />
                  </el-select>
                </el-form-item>
                <el-form-item label="工作状态" prop="workStatus">
                  <el-select disabled filterable v-model="formobj.workStatus" placeholder="请选择工作状态" clearable
                    style="width: 150px">
                    <el-option v-for="dict in dict.type.tj_work_status" :key="dict.value" :label="dict.label"
                      :value="dict.value" />
                  </el-select>
                </el-form-item>
                <el-form-item label="接触毒物" prop="contactPoison">
                  <el-input disabled type="textarea" rows="4" v-model="formobj.contactPoison" placeholder="请输入接触毒物"
                    style="width: 700px" />
                </el-form-item>
                <el-form-item label="既往病史" prop="medicalHistory">
                  <el-input disabled type="textarea" rows="4" v-model="formobj.medicalHistory" placeholder="请输入既往病史"
                    style="width: 700px" />
                </el-form-item>
              </div>
            </el-collapse-item>
            <el-collapse-item title="月经史" name="2" v-show="sex">
              <div style="width: 100%">
                <el-form-item label="初潮(岁)" prop="chuchao">
                  <el-input v-model="formobj.chuchao" style="width: 70px" disabled />
                </el-form-item>
                <el-form-item label="经期" prop="jingqi">
                  <el-input v-model="formobj.jingqi" disabled style="width: 70px" />天
                </el-form-item>
                <el-form-item label="周期" prop="zhouqi">
                  <el-input v-model="formobj.zhouqi" disabled style="width: 70px" />天
                </el-form-item>
                <el-form-item label="末次月经" prop="mociage">
                  <el-input v-model="formobj.mociage" disabled style="width: 100px" />
                </el-form-item>
              </div>
            </el-collapse-item>
            <el-collapse-item title="生育史" name="3" v-show="sex">
              <div style="width: 100%">
                <el-form-item label="现有子女(人)" prop="zinv">
                  <el-input v-model="formobj.zinv" style="width: 70px" disabled />
                </el-form-item>
                <el-form-item label="流产(次)" prop="liuchan">
                  <el-input v-model="formobj.liuchan" style="width: 70px" disabled />
                </el-form-item>
                <el-form-item label="早产(次)" prop="zaochan">
                  <el-input v-model="formobj.zaochan" style="width: 70px" disabled />
                </el-form-item>
                <el-form-item label="死产(次)" prop="sichan">
                  <el-input v-model="formobj.sichan" style="width: 70px" disabled />
                </el-form-item>
                <el-form-item label="异常胎(次)" prop="yichangtai">
                  <el-input v-model="formobj.yichangtai" style="width: 70px" disabled />
                </el-form-item>
              </div>
            </el-collapse-item>
            <el-collapse-item title="烟酒史" name="4">
              <div style="width: 100%">
                <el-form-item label="是否吸烟" prop="xiyan">
                  <!-- <el-input v-model="form.xiyanpinlv" placeholder="请输入吸烟频率" /> -->
                  <el-select disabled filterable v-model="formobj.xiyan" placeholder="请选择是否吸烟" clearable
                    style="width: 150px">
                    <el-option v-for="dict in dict.type.tj_smoking_pinlv" :key="dict.value" :label="dict.label"
                      :value="dict.value" />
                  </el-select>
                </el-form-item>
                <el-form-item label="吸烟频率" prop="xiyanpinlv">
                  <el-input v-model="formobj.xiyanpinlv" disabled style="width: 70px" />支/天
                </el-form-item>
                <el-form-item label="吸烟时间" prop="xiyanyear">
                  <el-input v-model="formobj.xiyanyear" disabled style="width: 70px" />年 </el-form-item><br />
                <el-form-item label="是否饮酒" prop="yinjiu">
                  <!-- <el-input v-model="form.yinjiupinlv" placeholder="请输入饮酒频率" /> -->
                  <el-select filterable v-model="formobj.yinjiu" disabled placeholder="请选择是否饮酒" clearable
                    style="width: 150px">
                    <el-option v-for="dict in dict.type.tj_smoking_pinlv" :key="dict.value" :label="dict.label"
                      :value="dict.value" />
                  </el-select>
                </el-form-item>
                <el-form-item label="饮酒频率" prop="yinjiupinlv">
                  <el-input v-model="formobj.yinjiupinlv" disabled style="width: 70px" />ml/天
                </el-form-item>
                <el-form-item label="饮酒时间" prop="yinjiuyear">
                  <el-input v-model="formobj.yinjiuyear" disabled style="width: 70px" />年
                </el-form-item>
                <el-form-item label="其他" prop="qita">
                  <el-input v-model="formobj.qita" placeholder="请输入其他" disabled type="textarea" style="width: 600px"
                    rows="2" />
                </el-form-item>
              </div>
            </el-collapse-item>
            <el-collapse-item title="急慢性职业病史信息" name="5">
              <div style="width: 100%">
                <el-table border :data="formobj.tjAskHistorysList" ref="tjAskHistorys" style="width: 98%">
                  <el-table-column type="selection" width="40" align="center" />
                  <el-table-column label="疾病名称" prop="diseaseName">
                    <template slot-scope="scope">
                      <el-input size="mini" disabled v-model="scope.row.diseaseName" placeholder="请输入疾病名称" />
                    </template>
                  </el-table-column>
                  <el-table-column label="诊断日期" prop="diseaseData">
                    <template slot-scope="scope">
                      <el-date-picker size="mini" v-model="scope.row.diseaseData" align="right" type="date"
                        placeholder="选择日期" :picker-options="pickerOptions" style="width: 130px"
                        value-format="yyyy-MM-dd">
                      </el-date-picker>
                    </template>
                  </el-table-column>
                  <el-table-column label="诊断单位" prop="diseaseCompany">
                    <template slot-scope="scope">
                      <el-input size="mini" disabled v-model="scope.row.diseaseCompany" placeholder="请输入诊断单位" />
                    </template>
                  </el-table-column>
                  <el-table-column label="是否痊愈" prop="isOk">
                    <template slot-scope="scope">
                      <!-- <el-input v-model="scope.row.isOk" placeholder="请输入是否痊愈" /> -->
                      <el-select disabled filterable size="mini" v-model="scope.row.isOk" placeholder="请选择是否痊愈"
                        clearable>
                        <el-option v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.label"
                          :value="dict.value" />
                      </el-select>
                    </template>
                  </el-table-column>
                  <el-table-column label="备注" prop="remark">
                    <template slot-scope="scope">
                      <el-input disabled size="mini" v-model="scope.row.remark" placeholder="请输入备注" />
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </el-collapse-item>
            <el-collapse-item title="职业史" name="7">
              <div style="width: 100%">
                <el-table border :data="formobj.workLogs" style="width: 98%">
                  <el-table-column type="selection" width="40" align="center" />
                  <el-table-column label="开始时间" prop="beginTime">
                    <template slot-scope="scope">
                      <el-date-picker size="mini" v-model="scope.row.beginTime" align="right" type="date"
                        placeholder="选择日期" :picker-options="pickerOptions" style="width: 130px"
                        value-format="yyyy-MM-dd">
                      </el-date-picker>
                    </template>
                  </el-table-column>
                  <el-table-column label="结束时间" prop="endTime">
                    <template slot-scope="scope">
                      <el-date-picker size="mini" disabled v-model="scope.row.endTime" align="right" type="date"
                        placeholder="选择日期" :picker-options="pickerOptions" style="width: 130px"
                        value-format="yyyy-MM-dd">
                      </el-date-picker>
                    </template>
                  </el-table-column>
                  <el-table-column label="工作单位" prop="workCompany">
                    <template slot-scope="scope">
                      <el-input size="mini" disabled v-model="scope.row.workCompany" placeholder="请输入工作单位" />
                    </template>
                  </el-table-column>
                  <el-table-column label="部门" prop="workDept">
                    <template slot-scope="scope">
                      <el-input disabled size="mini" v-model="scope.row.workDept" placeholder="请输入部门" />
                    </template>
                  </el-table-column>
                  <el-table-column label="工种" prop="workType">
                    <template slot-scope="scope">
                      <el-input disabled size="mini" v-model="scope.row.workType" placeholder="请输入工种" />
                    </template>
                  </el-table-column>
                  <el-table-column label="有害因素" prop="harmTypeLogs">
                    <template slot-scope="scope">
                      <!-- <el-input v-model="scope.row.isOk" placeholder="请输入是否痊愈" /> -->
                      <el-select filterable disabled size="mini" v-model="scope.row.harmTypeLogs" multiple
                        placeholder="请选择有害因素" clearable>
                        <el-option v-for="dict in harmTypeList" :key="dict.aid" :label="dict.harmtype"
                          :value="dict.aid" />
                      </el-select>
                    </template>
                  </el-table-column>
                  <el-table-column label="防护措施" prop="fangHu">
                    <template slot-scope="scope">
                      <el-input disabled size="mini" v-model="scope.row.fangHu" placeholder="请输入防护措施" />
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </el-collapse-item>
          </el-collapse>
        </el-form>
      </div>
    </el-drawer>
    <el-dialog title="PDF 预览" :visible.sync="dialogVisible" :close-on-click-modal="false" width="50%">
@@ -720,8 +706,7 @@
        <el-button @click="jianqians = false">取 消</el-button>
      </span>
    </el-dialog>
    <el-dialog title="新增异常结果" :visible.sync="addNewDialogVisible" width="900px" :before-close="handleAddNewClose"
      class="custom-dialog">
    <el-dialog title="新增异常结果" :visible.sync="addNewDialogVisible" width="900px" class="custom-dialog">
      <el-form :model="newItem" ref="newItemForm" label-width="100px" class="custom-form">
        <el-form-item label="项目分类" prop="parentName">
          <el-select v-model="newItem.parentName" placeholder="请选择项目分类" clearable filterable
@@ -742,20 +727,18 @@
        <el-form-item label="单位" prop="dw">
          <el-input v-model="newItem.dw" placeholder="请输入单位" clearable></el-input>
        </el-form-item>
        <!-- 动态建议组 -->
        <div v-for="(advice, index) in newItem.map" :key="index" class="advice-group">
          <el-form-item label="建议标题" :prop="'map.' + index + '.bt'">
            <el-input v-model="advice.bt" placeholder="请输入建议标题" clearable @focus="tan"></el-input>
            <el-input v-model="advice.bt" placeholder="请输入建议标题" clearable @focus="tan($event)"></el-input>
          </el-form-item>
          <el-form-item label="建议内容" :prop="'map.' + index + '.nr'">
            <el-input v-model="advice.nr" type="textarea" rows="3" placeholder="请输入建议内容" resize="none"
              @focus="tan"></el-input>
              @focus="tan($event)"></el-input>
          </el-form-item>
          <el-button v-if="index > 0" type="danger" size="small" @click="removeAdvice(index)"
            style="margin-left: 100px; margin-bottom: 10px;">删除</el-button>
        </div>
        <el-form-item>
          <el-button type="primary" size="small" @click="addAdvice" style="margin-left: 100px;">添加建议</el-button>
        </el-form-item>
@@ -765,29 +748,28 @@
        <el-button type="primary" @click="submitNewItem">确定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="快捷建议选择" :visible.sync="showjianyi" width="1000px" class="custom-dialog">
      <!-- 添加筛选下拉框 -->
    <el-dialog title="快捷建议选择" :visible.sync="showjianyi" width="1000px" class="custom-dialog"
      :before-close="handleCloseAdviceDialog">
      <!-- 搜索区域 -->
      <div style="margin-bottom: 15px;">
        <el-form :inline="true">
          <el-form-item label="科室">
            <el-select v-model="queryParams1.ks" placeholder="请选择或输入科室" clearable filterable allow-create
              style="width: 200px" @change="filterAdvices(true)">
              <el-option v-for="dept in deptList" :key="dept" :label="dept" :value="dept" />
            </el-select>
          <el-form-item label="建议名称">
            <el-input v-model="queryParams1.zyzd" placeholder="请输入建议名称进行筛选" clearable style="width: 200px"
              @input="filterAdvices(true)" @keyup.enter.native="filterAdvices(true)" />
          </el-form-item>
        </el-form>
      </div>
      <el-table :data="advicerulesList" ref="adviceTable" border highlight-current-row
        @current-change="handleCurrentChangeAdvice" style="max-height: 400px; overflow-y: auto;">
      <!-- 建议表格 -->
      <el-table v-loading="adviceLoading" :data="advicerulesList" ref="adviceTable" border highlight-current-row
        @current-change="handleCurrentChangeAdvice" style="max-height: 400px; overflow-y: auto;"
        :empty-text="adviceEmptyText">
        <el-table-column label="科室" prop="ks" width="100" align="center" />
        <el-table-column label="建议名称" prop="jymc" align="center" />
        <el-table-column label="建议内容" prop="jynr" align="center" />
      </el-table>
      <!-- 分页组件 -->
      <!-- 分页 -->
      <div class="pag">
        <div class="pag2">
          <pagination v-show="total1 > 0" :total="total1" :page.sync="queryParams1.pageNum"
@@ -795,23 +777,38 @@
        </div>
      </div>
      <!-- 底部按钮 -->
      <span slot="footer" class="dialog-footer">
        <el-button @click="showjianyi = false">取消</el-button>
        <el-button @click="cancelAdviceDialog">取消</el-button>
        <el-button type="primary" @click="applySelectedAdvice" :disabled="!selectedAdvice">确定</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="xmopen" width="800px" append-to-body>
      <div style="margin: 20px;">
        <el-table :data="datasList" ref="elTable" v-loading="loading" @selection-change="handlexmChange" border
          height="320px">
          <el-table-column type="selection" width="40" align="center" />
          <el-table-column label="名称" align="center" prop="proName" width="100px" />
          <el-table-column label="价格" align="center" prop="price" />
          <el-table-column label="科室" align="center" prop="deptName" />
        </el-table>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormxm">确 定</el-button>
        <el-button @click="cancels">取 消</el-button>
      </div>
    </el-dialog>
    <Packages ref="bbb" :baogao="baogao" />
    <Prescription ref="Pre" :preObj="preObj" />
    <proposal ref="proposal" :cusobj="cusobj" @event1="eventchange($event)" />
    <createproposal ref="createproposal" :creatobj="creatobj" />
    <el-dialog title="常用建议维护" :visible.sync="propdialog" width="500px" append-to-body>
    </el-dialog>
    <el-dialog title="常用建议维护" :visible.sync="propdialog" width="500px" append-to-body></el-dialog>
  </div>
</template>
<script>
import _ from 'lodash';
import jianqianwenzhen from "@/components/jianqianwenzhen";
import Packages from "@/components/Packages";
import Prescription from "@/components/Prescription";
@@ -830,7 +827,9 @@
  getModified,
  isPdfOrJimu,
  addOrder,
  addOrder1
  addOrder1,
  getFcList,
  UpdFcPro
} from "@/api/doctor/checkAll";
import { getInfoById } from "@/api/hosp/history";
import { getInfo } from "@/api/login";
@@ -845,10 +844,8 @@
import { getNewDateList } from "@/api/hosp/order";
import { getconfigKey } from "@/api/login";
import moment from "moment";
import { get } from "sortablejs";
import {
  listAdvicerules,
} from "@/api/hosp/advicerules";
import { listAdvicerules } from "@/api/hosp/advicerules";
export default {
  components: {
    ViewPdf,
@@ -860,6 +857,7 @@
    Prescription,
  },
  dicts: [
    "dict_team",
    "dict_tjtype",
    "sys_user_sex",
    "sys_yes_no",
@@ -873,25 +871,38 @@
  name: "checkAll",
  data() {
    return {
      deptList: [], // 去重后的科室列表
      zhiyeJl: '', // 初始化检查结论为空
      zhiyeJg: '', // 初始化体检结果为默认值
      selectedAdvice: null,
      activeAdviceIndex: 0,
      advicerulesList: [],
      xmChange: [],
      showjianyi: false,
      isLoading: false,
      adviceLoading: false,
      adviceEmptyText: '暂无数据',
      total1: 0,
      forms: {
        pacName: ""
      },
      xmopen: false,
      datasList: [],
      queryParams1: {
        pageNum: 1,
        pageSize: 10,
        zyzd: '',
      },
      adviceCache: new Map(),
      addNewDialogVisible: false,
      newItem: {
        parentName: '',   // 项目分类,对应模板中的 parentName
        jcxm: '',         // 检测项目,对应模板中的 jcxm
        jcjg: '',         // 检测结果,对应模板中的 jcjg
        ckfw: '',         // 参考范围,对应模板中的 ckfw
        dw: '',           // 单位,对应模板中的 dw
        map: [{           // 建议列表,对应模板中的动态建议组 map
          bt: '',         // 建议标题,对应模板中的 map[index].bt
          nr: ''          // 建议内容,对应模板中的 map[index].nr
        }]
        parentName: '',
        jcxm: '',
        jcjg: '',
        ckfw: '',
        dw: '',
        map: [{ bt: '', nr: '' }]
      },
      projectCategories: [],
      // 更新总检建议
      emptyAdvice: {
        bt: "",
        nr: "",
@@ -905,7 +916,6 @@
      jianqians: false,
      sex: true,
      activeName: "1",
      wenzhen: false,
      hosproy: true,
      remarks: "",
      remark: "",
@@ -957,9 +967,7 @@
      msgtuwen: "",
      msgjianqian: "",
      msgkcf: "",
      // 页面全部数据
      checkList: [],
      // 绑定单选按钮
      tjStatus: "0",
      tjproject: "0",
      total: 0,
@@ -967,23 +975,19 @@
      Testitems: [],
      CheckBox: {},
      startTime: [],
      isCollapsed: 0,
      textarea1: "",
      loading: true,
      // 当前用户选中的值
      selectLettercurrent: " ",
      // 抽屉打开方式
      drawer: false,
      tableAll: {},
      tjNumber: "",
      // 全部小结
      DeptadviceAll: [],
      MsgId: "",
      Deptobj: "",
      // 点击参数
      changedate: [],
      dataText: [],
      status: {},
      // 查询参数
      queryParams: {
        page: 1,
        pageSize: 10,
@@ -993,10 +997,12 @@
        compId: null,
        name: null,
        checkStatus: null,
        shys: null,
        tjCategory: null
      },
      formobj: {},
      // 查询参数
      yichangList: [],
      fcList: [],
      statusList: [],
      queryParam: {
        pageNum: 1,
@@ -1022,53 +1028,153 @@
        tjCategory: undefined,
        payType: undefined,
      },
      total1: 0,
      queryParams1: {
        pageNum: 1,
        pageSize: 10,
        ks: ''
      },
      status1: 0, // 0展示异常1展示项目情况
      status1: 0,
      viewportHeight: 0,
      expends: [],
    };
  },
  created() {
    // this.getNowTime();
    console.log(this.dict.type.dict_tjtype, "职业体检");
    this.getConfigKey();
    this.getdate();
  },
  mounted() {
    this.$nextTick(() => {
      this.$refs.inputName.focus();
      this.viewportHeight =
        window.innerHeight || document.documentElement.clientHeight;
      this.viewportHeight = window.innerHeight || document.documentElement.clientHeight;
    });
  },
  methods: {
    handleAdviceBlur(row, index) {
      // 构造 advices 数据
      let advicesToSubmit = [];
      if (index === -1) {
        // advices 为空,使用 emptyAdvice 的值
        if (this.emptyAdvice.bt || this.emptyAdvice.nr) {
          advicesToSubmit = [{ bt: this.emptyAdvice.bt || '', nr: this.emptyAdvice.nr || '' }];
          // 将 emptyAdvice 的值赋值给 row.advices
          this.$set(row, 'advices', advicesToSubmit);
        }
      } else {
        // advices 不为空,直接使用 row.advices
        advicesToSubmit = row.advices;
  methods: {
    // 打开建议选择弹窗
    tan(event) {
      this.activeAdviceIndex = event.target.closest('.advice-group')
        ? Array.from(event.target.closest('.el-form').querySelectorAll('.advice-group'))
          .indexOf(event.target.closest('.advice-group'))
        : 0;
      this.queryParams1.pageNum = 1;
      this.queryParams1.pageSize = 10;
      this.queryParams1.zyzd = '';
      this.selectedAdvice = null;
      this.advicerulesList = [];
      this.total1 = 0;
      this.adviceCache.clear();
      this.filterAdvices();
      this.showjianyi = true;
    },
    // 筛选快捷建议(防抖 800ms,带缓存和加载状态)
    filterAdvices: _.debounce(function (resetPage = false) {
      if (resetPage) {
        this.queryParams1.pageNum = 1;
      }
      // 如果 advicesToSubmit 为空或没有有效数据,不提交
      if (!advicesToSubmit || advicesToSubmit.length === 0) {
      const cacheKey = `${this.queryParams1.zyzd || ''}_${this.queryParams1.pageNum}_${this.queryParams1.pageSize}`;
      if (this.adviceCache.has(cacheKey)) {
        const cachedData = this.adviceCache.get(cacheKey);
        this.advicerulesList = cachedData.rows;
        this.total1 = cachedData.total;
        this.adviceEmptyText = this.advicerulesList.length === 0 ? '暂无匹配的建议' : '暂无数据';
        return;
      }
      this.adviceLoading = true;
      this.adviceEmptyText = '加载中...';
      listAdvicerules(this.queryParams1)
        .then((response) => {
          this.advicerulesList = response.rows || [];
          this.total1 = response.total || 0;
          this.adviceCache.set(cacheKey, {
            rows: this.advicerulesList,
            total: this.total1,
          });
          this.adviceEmptyText = this.advicerulesList.length === 0 ? '暂无匹配的建议' : '暂无数据';
        })
        .catch((error) => {
          console.error('筛选快捷建议失败:', error);
          this.advicerulesList = [];
          this.total1 = 0;
          this.adviceEmptyText = '加载失败,请稍后重试';
          this.$message.error('加载建议失败,请检查网络后重试');
        })
        .finally(() => {
          this.adviceLoading = false;
        });
    }, 800),
    handleCurrentChangeAdvice(currentRow) {
      this.selectedAdvice = currentRow;
    },
    toggleCollapse3() {
      this.isCollapsed = 0;
    },
    toggleCollapse() {
      this.isCollapsed = 1;
    },
    applySelectedAdvice() {
      if (this.selectedAdvice) {
        this.$set(this.newItem.map, this.activeAdviceIndex, {
          bt: this.selectedAdvice.jymc,
          nr: this.selectedAdvice.jynr,
        });
        this.showjianyi = false;
        this.selectedAdvice = null;
      } else {
        this.$message.warning('请先选择一条建议');
      }
    },
    cancelAdviceDialog() {
      this.showjianyi = false;
      this.selectedAdvice = null;
      this.queryParams1.zyzd = '';
      this.queryParams1.pageNum = 1;
      this.advicerulesList = [];
      this.total1 = 0;
      this.adviceCache.clear();
    },
    handleCloseAdviceDialog(done) {
      if (this.selectedAdvice) {
        this.$confirm('您已选择一条建议,确定要关闭吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        })
          .then(() => {
            this.cancelAdviceDialog();
            done();
          })
          .catch(() => { });
      } else {
        this.cancelAdviceDialog();
        done();
      }
    },
    handleAdviceBlur(row, index) {
      let advicesToSubmit = [];
      if (index === -1) {
        if (this.emptyAdvice.bt || this.emptyAdvice.nr) {
          advicesToSubmit = [{ bt: this.emptyAdvice.bt || '', nr: this.emptyAdvice.nr || '' }];
          this.$set(row, 'advices', advicesToSubmit);
        }
      } else {
        advicesToSubmit = row.advices;
      }
      if (!advicesToSubmit || advicesToSubmit.length === 0) {
        return;
      }
      const parentItem = this.yichangList.find(item =>
        item.sone.some(soneItem => soneItem.orderDetailId === row.orderDetailId)
@@ -1080,20 +1186,20 @@
      }
      const data = {
        tjh: this.tableAll.tjNumber, // 体检号
        parentName: parentItem.proName, // 父级项目名称
        jcxm: row.proName, // 检测项目
        jcjg: row.proResult, // 检测结果
        ckfw: row.stanId, // 参考范围
        dw: row.proAdvice, // 单位
        map: advicesToSubmit, // 建议列表
        jyjc: parentItem.jyjc, // 检查类型(0 或 1)
        id: row.orderDetailId, // 当前项的 orderDetailId
        tjh: this.tableAll.tjNumber,
        parentName: parentItem.proName,
        jcxm: row.proName,
        jcjg: row.proResult,
        ckfw: row.stanId,
        dw: row.proAdvice,
        map: advicesToSubmit,
        jyjc: parentItem.jyjc,
        id: row.orderDetailId,
      };
      addOrder1(data).then((res) => {
        if (res.code === 200) {
          // 成功更新建议
        } else {
          this.$message.error('建议更新失败:' + (res.msg || '未知错误'));
        }
@@ -1102,79 +1208,14 @@
        this.$message.error('建议更新失败:' + error.message);
      });
    },
    handleCurrentChangeAdvice(currentRow) {
      this.selectedAdvice = currentRow; // 存储选中的建议项
    },
    applySelectedAdvice() {
      if (this.selectedAdvice) {
        this.$set(this.newItem.map, this.activeAdviceIndex, {
          bt: this.selectedAdvice.jymc, // 建议名称赋值给标题
          nr: this.selectedAdvice.jynr  // 建议内容赋值给内容
        });
        this.showjianyi = false; // 关闭弹窗
        this.selectedAdvice = null; // 清空选中项
      } else {
        this.$message.warning('请先选择一条建议');
      }
    },
    handleSelectionChange(selection) {
      console.log(selection);
    },
    tan(event) {
      this.activeAdviceIndex = event.target.closest('.advice-group')
        ? Array.from(event.target.closest('.el-form').querySelectorAll('.advice-group'))
          .indexOf(event.target.closest('.advice-group'))
        : 0; // 获取当前建议组的索引
      // 确保 projectCategories 已加载
      if (!this.projectCategories || this.projectCategories.length === 0) {
        cSWebGetPro(this.tjNumber).then((res) => {
          if (res.data && Array.isArray(res.data)) {
            this.projectCategories = res.data;
            // 提取去重后的科室列表
            this.deptList = [...new Set(this.projectCategories.map(item => item.deptName))].filter(Boolean);
          } else {
            this.$message.warning('未获取到项目分类数据');
            this.projectCategories = [];
            this.deptList = [];
          }
        }).catch((error) => {
          console.error('获取项目分类失败:', error);
          this.$message.error('获取项目分类失败');
          this.projectCategories = [];
          this.deptList = [];
        });
      } else {
        // 如果 projectCategories 已加载,直接更新 deptList
        this.deptList = [...new Set(this.projectCategories.map(item => item.deptName))].filter(Boolean);
      }
      // 重置分页参数
      this.queryParams1.pageNum = 1;
      this.queryParams1.pageSize = 10;
      // 加载快捷建议列表
      this.filterAdvices();
      this.showjianyi = true;
    },
    // 下拉框筛选快捷建议(包含分页逻辑)
    filterAdvices(resetPage = false) {
      if (resetPage) {
        this.queryParams1.pageNum = 1; // 切换科室时重置页码为 1
      }
      listAdvicerules(this.queryParams1).then((response) => {
        this.advicerulesList = response.rows;
        this.total1 = response.total;
      }).catch((error) => {
        console.error('筛选快捷建议失败:', error);
        this.$message.error('筛选快捷建议失败');
      });
    },
    submitNewItem() {
      const data = {
        tjh: this.tableAll.tjNumber, // 体检号,从 tableAll 中获取
        tjh: this.tableAll.tjNumber,
        parentName: this.newItem.parentName,
        jcxm: this.newItem.jcxm,
        jcjg: this.newItem.jcjg,
@@ -1185,7 +1226,6 @@
      };
      addOrder1(data).then((res) => {
        console.log(res);
        if (res.code === 200) {
          this.$message.success('新增异常结果成功');
          this.addNewDialogVisible = false;
@@ -1198,6 +1238,7 @@
        this.$message.error('新增异常结果失败');
      });
    },
    addnew() {
      this.newItem = {
        parentName: '',
@@ -1210,7 +1251,6 @@
      this.addNewDialogVisible = true;
      cSWebGetPro(this.tjNumber).then((res) => {
        console.log(res);
        if (res.data && Array.isArray(res.data)) {
          this.projectCategories = res.data;
        } else {
@@ -1225,22 +1265,15 @@
    },
    handleCategoryChange(value) {
      const selectedCategory = this.projectCategories.find(item => item.proName === value);
      console.log(this.projectCategories, selectedCategory);
      this.queryParams1.ks = selectedCategory.deptName || '';
      if (value) {
        this.newItem.jcxm = value; // 将选择的项目分类赋值给检测项目
        this.newItem.jcxm = value;
      }
    },
    handleAddNewClose(done) {
      // this.$confirm('确定关闭新增窗口吗?未保存的数据将丢失。')
      //   .then(() => done())
      //   .catch(() => { });
    change(val) {
      console.log('选中的值是:', val);
    },
    // 添加新的建议组
    addAdvice() {
      this.newItem.map.push({ bt: '', nr: '' });
    },
@@ -1254,26 +1287,23 @@
    },
    shanchu(row) {
      // 禁用删除按钮,防止重复点击
      this.isdisabled = true;
      // 调用后端接口删除数据
      shanchu({
        id: row.orderDetailId,
      }).then((res) => {
        if (res.code === 200) {  // 后端删除成功
          // 找到要删除项所在的父级数组
        console.log(res, 1111);
        if (res.code === 200) {
          const parentItem = this.yichangList.find(item =>
            item.sone.some(soneItem => soneItem.orderDetailId === row.orderDetailId)
          );
          if (parentItem) {
            // 从父级的 sone 数组中删除该项
            const index = parentItem.sone.findIndex(item => item.orderDetailId === row.orderDetailId);
            if (index > -1) {
              parentItem.sone.splice(index, 1);
              // 如果删除后 sone 数组为空,则删除整个父级项
              if (parentItem.sone.length === 0) {
                const parentIndex = this.yichangList.indexOf(parentItem);
                if (parentIndex > -1) {
@@ -1281,16 +1311,9 @@
                }
              }
              // 更新 expends 数组,确保展开状态正确
              this.getExpends();
              // 强制刷新表格
              this.$forceUpdate();
              this.$message.success('删除成功');
              // 可选:调用 yichangjieguo 刷新数据(如果需要与后端同步)
              // this.yichangjieguo();
            } else {
              this.$message.error('未找到要删除的子项');
            }
@@ -1304,18 +1327,61 @@
        console.error('删除失败:', error);
        this.$message.error('删除操作失败:' + error.message);
      }).finally(() => {
        // 恢复删除按钮状态
        this.isdisabled = false;
      });
    },
    // 确保 getExpends 方法存在,用于更新展开状态
    handleQuery() {
      this.xmopen = true;
      let data = {
        tjNum: this.tjNumber,
        type: 0
      };
      getFcList(data).then(res => {
        this.datasList = res.data;
      });
    },
    handleaddClick() {
      console.log(this.xmChange);
      let data = {
        orderId: this.xmChange[0].orderId,
        data: [{
          proId: this.xmChange[0].proId,
          type: 1
        }]
      };
      UpdFcPro(data).then(res => { });
    },
    handledeleteClick() {
      UpdFcPro(data).then(res => { });
    },
    handlexmChange(selection) {
      this.xmChange = [];
      this.xmChange = selection;
      if (selection.length > 1) {
        let del_row = selection.shift();
        this.$refs.elTable.toggleRowSelection(del_row, false);
      }
    },
    submitFormxm() {
      this.xmopen = false;
    },
    cancels() {
      this.xmopen = false;
      this.xmChange = [];
    },
    getExpends() {
      this.expends = this.yichangList.flatMap(item =>
        item.sone.map(soneItem => soneItem.orderDetailId)
      );
      console.log('Updated expends:', this.expends);
    },
    getConfigKey() {
      getconfigKey("sfkqtwbg").then((res) => {
        this.msgtuwen = res.msg;
@@ -1327,71 +1393,92 @@
        this.msgkcf = res.msg;
      });
    },
    //设置table中的扩展项,展开的id,此处我需要全部展开
    getRowKeys(row) {
      return row.orderDetailId;
    },
    // 项目情况
    xiangmuqingkuang() {
      cSWebGetPro(this.tjNumber).then((res) => {
        this.status1 = 1;
        this.statusList = res.data;
        if (this.statusList.length == 0) {
          _this.$message.msgSuccess("暂无项目情况");
        }
      });
    xiangmuqingkuang() {
      this.loading = true;
      cSWebGetPro(this.tjNumber)
        .then((res) => {
          this.status1 = 1;
          this.statusList = res.data;
          if (this.statusList.length == 0) {
            this.$message.success("暂无项目情况");
          }
        })
        .catch((error) => {
          console.error('获取项目情况失败:', error);
          this.$message.error('获取项目情况失败');
        })
        .finally(() => {
          this.loading = false;
        });
    },
    guanbi() {
      this.drawer = false;
    },
    yichangjieguo() {
      this.isLoading = true
      this.status1 = 0;
      let _this = this;
      this.yichangList = []
      yichang({
        tjNum: this.tjNumber,
      }).then((res) => {
        this.yichangList = res.data;
        this.yichangList.forEach((item) => {
          item.sone.forEach((soneItem) => {
            if (
              !Array.isArray(soneItem.advices) ||
              soneItem.advices.length === 0
            ) {
              // 如果 advices 是空,设置默认值
              soneItem.advices = [
                {
                  bt: "",
                  nr: "",
                },
              ];
            }
      })
        .then((res) => {
          this.isLoading = false
          this.yichangList = res.data;
          this.yichangList.forEach((item) => {
            item.sone.forEach((soneItem) => {
              if (!Array.isArray(soneItem.advices) || soneItem.advices.length === 0) {
                soneItem.advices = [{ bt: "", nr: "" }];
              }
            });
          });
          if (!this.yichangList) {
            this.$message.warning("暂无异常报告");
          }
        })
        .catch((error) => {
          this.isLoading = false
          console.error('获取异常结果失败:', error);
          this.$message.error('获取异常结果失败');
        })
        .finally(() => {
          this.isLoading = false
          this.loading = false;
        });
        if (!this.yichangList) {
          _this.$message({
            type: "warning ",
            message: "暂无异常报告",
          });
        }
      });
    },
    fuchaxiangmu() {
      this.loading = true;
      this.status1 = 2;
      let data = {
        tjNum: this.tjNumber,
        type: 1
      };
      getFcList(data)
        .then((res) => {
          this.fcList = res.data;
        })
        .catch((error) => {
          console.error('获取复查项目失败:', error);
          this.$message.error('获取复查项目失败');
        })
        .finally(() => {
          this.loading = false;
        });
    },
    getdate() {
      getNewDateList().then((res) => {
        /* this.startTime = [
          moment(res.data).format("YYYY-MM-DD 00:00:00"),
          moment(res.data).format("YYYY-MM-DD 23:59:00"),
        ]; */
        this.getList();
      });
    },
    // / 处理默认选中当前日期
    getNowTime() {
      var curDate = new Date().getTime();
      var dayNum = 7 * 24 * 3600 * 1000;
@@ -1400,9 +1487,11 @@
      var end = this.getLocalTime(curDate);
      this.startTime = [sDay, end];
    },
    add0(m) {
      return m < 10 ? "0" + m : m;
    },
    getLocalTime(nS) {
      var time = new Date(nS);
      var y = time.getFullYear();
@@ -1422,6 +1511,7 @@
        this.add0(mm)
      );
    },
    jianqian() {
      this.flags = true;
      this.jianqians = true;
@@ -1441,7 +1531,6 @@
        this.queryParams.endTime = null;
      }
      // 页面数据
      getcheckList(this.queryParams).then((response) => {
        if (response.code == 200) {
          this.loading = false;
@@ -1451,18 +1540,17 @@
            } else {
              this.checkList = response.data.customers;
            }
            this.total = response.data.total;
          } else {
            this.checkList = [];
          }
        }
      }),
        // 获取单位信息集合
        getCompany(this.queryParam).then((response) => {
          this.CompanyList = response.data;
          this.loading = false;
        });
      });
      getCompany(this.queryParam).then((response) => {
        this.CompanyList = response.data;
        this.loading = false;
      });
    },
    viewReport(row) {
@@ -1482,129 +1570,134 @@
                loading.close();
              }, 3000);
              this.$message({
                message: "报告正在生成,请两分钟后预览!",
                message: "请撤回重新生成报告",
                type: "error"
              });
            } else {
              this.dialogVisible = true;
              this.url = window.webkitURL.createObjectURL(response); //将后端返回的blob文件读取出url
              this.url = window.webkitURL.createObjectURL(response);
            }
          });
        } else {
          let url = response.data.url;
          const params = { url };
          this.$tab.openPage(
            "健康证检查表",
            "/report/zongjianjiankangzheng",
            params
          );
          this.$tab.openPage("健康证检查表", "/report/zongjianjiankangzheng", params);
        }
      });
    },
    Graphicreport() {
      this.loading = true;
      let dictType = "dict_ageunit";
      getDicts(dictType).then((res) => {
        if (res.code == 200) {
          res.data.forEach((item) => {
            if (this.tableAll.age_unit == item.dictValue) {
              this.tableAll.age_unit = item.dictLabel;
            }
          });
          let dictTypes = "sys_user_sex";
          getDicts(dictTypes).then((res) => {
            if (res.code == 200) {
              res.data.forEach((item) => {
                if (this.tableAll.cusSex == item.dictValue) {
                  this.tableAll.cusSex = item.dictLabel;
                }
              });
              let data = {
                patname: this.tableAll.cusName,
                sex: this.tableAll.cusSex,
                patage: this.tableAll.age,
                patagename: this.tableAll.age_unit,
                patbirth: this.tableAll.cusBrithday,
              };
              // let data = {
              //   patname: "脱能娥",
              //   sex: "女",
              //   patage: "60",
              //   patagename: "岁",
              //   patbirth: "1963-01-01"
              // }
              getTjYxjcList(data).then((res) => {
                this.baogao = res.data;
              });
              this.$refs.bbb.open = true;
              this.$refs.bbb.title = "报告字典";
            }
          });
        }
      });
      getDicts(dictType)
        .then((res) => {
          if (res.code == 200) {
            res.data.forEach((item) => {
              if (this.tableAll.age_unit == item.dictValue) {
                this.tableAll.age_unit = item.dictLabel;
              }
            });
            let dictTypes = "sys_user_sex";
            return getDicts(dictTypes);
          } else {
            throw new Error('获取年龄单位字典失败');
          }
        })
        .then((res) => {
          if (res.code == 200) {
            res.data.forEach((item) => {
              if (this.tableAll.cusSex == item.dictValue) {
                this.tableAll.cusSex = item.dictLabel;
              }
            });
            let data = {
              patname: this.tableAll.cusName,
              sex: this.tableAll.cusSex,
              patage: this.tableAll.age,
              patagename: this.tableAll.age_unit,
              patbirth: this.tableAll.cusBrithday,
            };
            return getTjYxjcList(data);
          } else {
            throw new Error('获取性别字典失败');
          }
        })
        .then((res) => {
          this.baogao = res.data;
          this.$refs.bbb.open = true;
          this.$refs.bbb.title = "报告字典";
        })
        .catch((error) => {
          console.error('生成图文报告失败:', error);
          this.$message.error('生成图文报告失败');
        })
        .finally(() => {
          this.loading = false;
        });
    },
    historicalreport() {
      this.loading = true;
      this.wenzhen = false;
      this.hosproy = true;
      let data = {
        cusId: this.tableAll.cusId,
      };
      reportHistory(data).then((res) => {
        this.loading = false;
        if (res.data[0] != null) {
          this.reportHistorydata = res.data;
        } else {
          this.reportHistorydata = [];
        }
      });
      reportHistory(data)
        .then((res) => {
          if (res.data[0] != null) {
            this.reportHistorydata = res.data;
          } else {
            this.reportHistorydata = [];
          }
        })
        .catch((error) => {
          console.error('获取历史报告失败:', error);
          this.$message.error('获取历史报告失败');
        })
        .finally(() => {
          this.loading = false;
        });
    },
    medicalhistory() {
      this.wenzhen = true;
      this.hosproy = false;
      this.loading = true;
      this.status1 = 3;
      let tjNumber = this.tableAll.tjNumber;
      getInfoById(tjNumber).then((response) => {
        this.formobj = response.data;
        if (this.formobj.xiyan == null) {
          this.formobj.xiyan = "1";
        }
        if (this.formobj.xiyanpinlv == null) {
          this.formobj.xiyanpinlv = "0";
        }
        if (this.formobj.xiyanyear == null) {
          this.formobj.xiyanyear = "0";
        }
        if (this.formobj.yinjiu == null) {
          this.formobj.yinjiu = "1";
        }
        if (this.formobj.yinjiupinlv == null) {
          this.formobj.yinjiupinlv = "0";
        }
        if (this.formobj.yinjiuyear == null) {
          this.formobj.yinjiuyear = "0";
        }
      });
      getInfoById(tjNumber)
        .then((response) => {
          this.formobj = response.data;
          if (this.formobj.xiyan == null) {
            this.formobj.xiyan = "1";
          }
          if (this.formobj.xiyanpinlv == null) {
            this.formobj.xiyanpinlv = "0";
          }
          if (this.formobj.xiyanyear == null) {
            this.formobj.xiyanyear = "0";
          }
          if (this.formobj.yinjiu == null) {
            this.formobj.yinjiu = "1";
          }
          if (this.formobj.yinjiupinlv == null) {
            this.formobj.yinjiupinlv = "0";
          }
          if (this.formobj.yinjiuyear == null) {
            this.formobj.yinjiuyear = "0";
          }
        })
        .catch((error) => {
          console.error('获取职业病史失败:', error);
          this.$message.error('获取职业病史失败');
        })
        .finally(() => {
          this.loading = false;
        });
    },
    // viewReport(row) {
    //   const tjNumber = row.tjNumber;
    //   const viewNum = "792997692059705344";
    //   const params = { viewNum, tjNumber };
    //   hasReportEnd(tjNumber).then((res) => {
    //     if (res == 1) {
    //       this.$tab.openPage("体检报告", "/report/viewReport", params);
    //     } else {
    //       this.$message.error("该用户体检暂未完成,无法打印体检报告!");
    //     }
    //   });
    // },
    downLoadFileImg(row) {
      const tjNumber = row.tjNumber;
      const flag = true;
      getPdf(tjNumber, flag).then((response) => {
        this.url = window.webkitURL.createObjectURL(response); //将后端返回的blob文件读取出url
        this.url = window.webkitURL.createObjectURL(response);
      });
    },
@@ -1618,7 +1711,6 @@
      this.$refs.Pre.title = "处方";
    },
    // 单选按钮
    radioChange(value) {
      this.loading = true;
      this.queryParams.checkStatus = value;
@@ -1634,21 +1726,27 @@
        this.loading = false;
      });
    },
    propoChange() {
      this.cusobj = { sex: this.tableAll.cusSex, isZj: 0 };
      this.$refs.proposal.open = true;
      this.$refs.proposal.title = "建议方案";
      // this.$refs.proposal.getList();
    },
    eventchange(data) {
      this.dataText = data;
      if (this.textarea1 == null) {
        this.textarea1 = "";
      }
      data.forEach((item) => {
        this.textarea1 += item.advice;
        if (item.advice) {
          this.textarea1 += item.advice;
        } else {
          this.textarea1 += item.jynr;
        }
      });
    },
    proposalChange() {
      if (this.textarea1) {
        this.creatobj = { proParentList: this.textarea1, isZj: 0 };
@@ -1656,16 +1754,16 @@
        this.$refs.createproposal.title = "常用建议维护";
      } else {
        this.$message({
          type: "warning ",
          type: "warning",
          message: "请先填写总检建议",
        });
      }
    },
    radiotjprojectChange() {
      if (this.tjproject == "0") {
        getupdateCheckType(this.tjNumber).then((response) => {
          this.changedate = response.data;
          this.changedate.forEach((item) => {
            this.textarea1 = item.checkAdvice;
          });
@@ -1673,21 +1771,9 @@
            for (let i = 0; i < this.changedate.length; i++) {
              this.remark = this.changedate[i].remark;
            }
            this.changedate.forEach((item) => {
              // this.remark = item.remark;
              // item.sons.forEach((item3) => {
              //   if (item3.standard.tjStandardGtValue === null) {
              //     item3.standard.tjStandardGtValue = "";
              //   }
              //   if (item3.standard.tjStandardLtValue === null) {
              //     item3.standard.tjStandardLtValue = "";
              //   }
              // });
              // item.remark = "";
            });
          } else {
            this.$message({
              type: "warning ",
              type: "warning",
              message: "该客户没有体检项目数据",
            });
          }
@@ -1695,7 +1781,6 @@
      } else if (this.tjproject == "1") {
        getupdateCheckTypeHuaYan(this.tjNumber).then((res) => {
          if (res.data) {
            // this.Testitems = res.data
            this.changedate = res.data;
            this.changedate.forEach((item) => {
              this.textarea1 = item.checkAdvice;
@@ -1704,22 +1789,10 @@
              for (let i = 0; i < this.changedate.length; i++) {
                this.remark = this.changedate[i].remark;
              }
              this.changedate.forEach((item) => {
                // this.remark = item.remark;
                item.sons.forEach((item3) => {
                  // if (item3.standard.tjStandardGtValue === null) {
                  //   item3.standard.tjStandardGtValue = "";
                  // }
                  // if (item3.standard.tjStandardLtValue === null) {
                  //   item3.standard.tjStandardLtValue = "";
                  // }
                });
                // item.remark = "";
              });
            }
          } else {
            this.$message({
              type: "warning ",
              type: "warning",
              message: "该客户没有化验项目数据",
            });
          }
@@ -1727,7 +1800,6 @@
      }
    },
    // 体检公司拼音搜索
    getRemoteData(query) {
      if (query) {
        let compName = query;
@@ -1737,12 +1809,10 @@
      }
    },
    // 选框数据
    searchSelect(val) {
      this.CheckBox = val;
    },
    // 时间
    dateChangebirthday1(val) {
      this.startTime = val;
    },
@@ -1753,9 +1823,7 @@
      }
    },
    // 搜索
    submitForm() {
      console.log(this.tjStatus);
      this.loading = true;
      this.queryParams.compId = this.CheckBox.drugManufacturerId;
      this.queryParams.checkStatus = this.tjStatus;
@@ -1767,7 +1835,6 @@
        this.queryParams.endTime = null;
      }
      // 页面数据
      getcheckList(this.queryParams).then((response) => {
        if (response.code == 200) {
          this.loading = false;
@@ -1776,7 +1843,6 @@
            this.checkList.forEach((item) => {
              this.tjStatus = item.tjStatus.toString();
            });
            this.total = response.data.total;
          } else {
            this.checkList = [];
@@ -1784,61 +1850,57 @@
        }
      });
    },
    // 重置
    resetQuery() {
      this.startTime = [];
      this.resetForm("tableList");
      this.queryParams = {
        page: 1,
        pageSize: 10,
        tjNumber: "",
        beginTime: null,
        endTime: null,
        compId: null,
        name: null,
        checkStatus: null,
        shys: null,
        tjCategory: null
      },
        this.resetForm("tableList");
      this.submitForm();
    },
    changRed({ row }) {
      if (row.ycbz != "" && row.ycbz != null) {
        // 变颜色的条件
        return {
          color: "red", // 这个return的就是样式 可以是color 也可以是backgroundColor
          color: "red",
        };
      }
    },
    red() {
      return {
        color: "red",
      };
    },
    redxiangmu({ row }) {
      if (row.type != 1) {
        // 变颜色的条件
        return {
          backgroundColor: "#AAD8DF !important", // 这个return的就是样式 可以是color 也可以是backgroundColor
          // color: "#AAD8DF ",
          backgroundColor: "#AAD8DF !important",
        };
      }
    },
    /*  changRed(row) {
      if (row.label === "↑") {
        return {
          color: "green", // 设置上箭头为绿色
        };
      } else if (row.label === "↓") {
        return {
          color: "red", // 设置下箭头为红色
        };
      }
      // 默认颜色
      return {
        color: "black",
      };
    }, */
    handleCurrentChange(val) {
      if (val != null) {
        this.handleClick(val);
      }
    },
    // 点击详情
    handleClick(row) {
      this.$refs.Pre.open = false;
      this.tableAll = row;
      this.tjproject = "0";
      this.tjNumber = this.tableAll.tjNumber;
      getState(this.tjNumber).then((res) => {
@@ -1856,6 +1918,7 @@
                };
                getModifiedState(data).then((res) => {
                  this.MsgId = res.msg;
                  this.isLoading = true
                  this.drawer = true;
                  getupdateCheckType(this.tjNumber).then((response) => {
                    this.changedate = response.data;
@@ -1863,54 +1926,38 @@
                      this.changedate.forEach((item) => {
                        this.textarea1 = item.checkAdvice || "";
                      });
                      // 这里设置初始值
                      this.initialTotalCheckAdvice = this.textarea1; // 保存总检建议
                      // 保存初始状态
                      this.initialState = JSON.parse(
                        JSON.stringify(this.changedate)
                      );
                      this.initialTotalCheckAdvice = this.textarea1;
                      this.initialState = JSON.parse(JSON.stringify(this.changedate));
                      for (let i = 0; i < this.changedate.length; i++) {
                        this.remark = this.changedate[i].remark;
                      }
                      this.changedate.forEach((item) => {
                        // this.remark = item.remark;
                        // item.sons.forEach((item3) => {
                        //   if (item3.standard.tjStandardGtValue === null) {
                        //     item3.standard.tjStandardGtValue = "";
                        //   }
                        //   if (item3.standard.tjStandardLtValue === null) {
                        //     item3.standard.tjStandardLtValue = "";
                        //   }
                        // });
                      });
                      // 回显 zhiyeJl 和 zhiyeJg
                      this.zhiyeJl = this.changedate[0].zhiyejl || '';
                      this.zhiyeJg = this.changedate[0].zhiyejg || '未发现目标性疾病';
                    } else {
                      this.$message({
                        type: "warning ",
                        type: "warning",
                        message: "该客户没有体检项目数据",
                      });
                      // 如果没有数据,清空字段
                      this.zhiyeJl = '';
                      this.zhiyeJg = '未发现目标性疾病';
                    }
                  });
                });
              }
            });
          } else {
            this.$confirm(
              "" + this.status.name + "正在修改该信息, 是否强制进去?",
              "提示",
              {
                confirmButtonText: "是",
                cancelButtonText: "否",
                type: "warning",
              }
            )
            this.$confirm("" + this.status.name + "正在修改该信息, 是否强制进去?", "提示", {
              confirmButtonText: "是",
              cancelButtonText: "否",
              type: "warning",
            })
              .then(() => {
                this.yichangjieguo();
                getInfo().then((response) => {
                  this.userId = response.user.userId;
                  if (this.userId) {
                    let data = {
                      userId: this.userId,
@@ -1919,6 +1966,7 @@
                    };
                    getforceIn(data).then((res) => {
                      this.MsgId = res.msg;
                      this.isLoading = true
                      this.drawer = true;
                      getupdateCheckType(this.tjNumber).then((response) => {
                        this.changedate = response.data;
@@ -1926,39 +1974,27 @@
                          for (let i = 0; i < this.changedate.length; i++) {
                            this.remark = this.changedate[i].remark;
                          }
                          this.initialState = JSON.parse(
                            JSON.stringify(this.changedate)
                          );
                          this.initialState = JSON.parse(JSON.stringify(this.changedate));
                          this.changedate.forEach((item) => {
                            this.textarea1 = item.checkAdvice || "";
                            // this.remark = item.remark;
                            // item.sons.forEach((item3) => {
                            //   if (item3.standard.tjStandardGtValue === null) {
                            //     item3.standard.tjStandardGtValue = "";
                            //   }
                            //   if (item3.standard.tjStandardLtValue === null) {
                            //     item3.standard.tjStandardLtValue = "";
                            //   }
                            // });
                            // item.remark = "";
                          });
                          // 保存总检建议
                          this.totalCheckAdvice = this.changedate.map(
                            (item) => item.totalCheckAdvice
                          );
                          // 回显 zhiyeJl 和 zhiyeJg
                          this.zhiyeJl = this.changedate[0].zhiyejl || '';
                          this.zhiyeJg = this.changedate[0].zhiyejg || '未发现目标性疾病';
                        } else {
                          this.$message({
                            type: "warning ",
                            type: "warning",
                            message: "该客户没有体检项目数据",
                          });
                          // 如果没有数据,清空字段
                          this.zhiyeJl = '';
                          this.zhiyeJg = '未发现目标性疾病';
                        }
                      });
                    });
                  }
                });
              })
              .catch(() => {
                this.$message({
@@ -1966,271 +2002,49 @@
                  message: "已取消进入",
                });
              });
            this.drawer = false;
          }
        } else {
          this.drawer = true;
          this.yichangjieguo();
          getInfo().then((response) => {
            this.userId = response.user.userId;
            if (this.userId) {
              let data = {
                userId: this.userId,
                tjNumber: this.tjNumber,
                state: 0,
              };
              getforceIn(data).then((res) => {
                this.MsgId = res.msg;
                this.drawer = true;
                getupdateCheckType(this.tjNumber).then((response) => {
                  this.changedate = response.data;
                  if (this.changedate) {
                    for (let i = 0; i < this.changedate.length; i++) {
                      this.remark = this.changedate[i].remark;
                    }
                    this.initialState = JSON.parse(
                      JSON.stringify(this.changedate)
                    );
                    this.changedate.forEach((item) => {
                      this.textarea1 = item.checkAdvice || "";
                      // this.remark = item.remark;
                      // item.sons.forEach((item3) => {
                      //   if (item3.standard.tjStandardGtValue === null) {
                      //     item3.standard.tjStandardGtValue = "";
                      //   }
                      //   if (item3.standard.tjStandardLtValue === null) {
                      //     item3.standard.tjStandardLtValue = "";
                      //   }
                      // });
                      // item.remark = "";
                    });
                    // 保存总检建议
                    this.totalCheckAdvice = this.changedate.map(
                      (item) => item.totalCheckAdvice
                    );
                  } else {
                    this.$message({
                      type: "warning ",
                      message: "该客户没有体检项目数据",
                    });
                  }
                });
              });
            }
          });
        }
      });
      // 获取小结
      // getDeptAdvice().then((response) => {
      //   response.data.forEach((item) => {
      //     this.DeptadviceAll = item;
      //   });
      // });
    },
    // 撤销
    getRevoke(row) {
      this.loading = true;
      const tjNumber = row.tjNumber;
      revoke(tjNumber).then((response) => {
        this.$modal.msgSuccess("撤回成功");
        if (response.code == 200) {
          this.loading = false;
          this.getList();
        }
      });
    },
    cancel() {
      this.propdialog = false;
    },
    // 是否关闭弹窗
    handleClose(done) {
      if (this.loading) {
        return;
      }
      // 检查是否有修改
      let isModified =
        JSON.stringify(this.changedate) !== JSON.stringify(this.initialState) ||
        (this.textarea1 !== this.initialTotalCheckAdvice &&
          this.textarea1 !== null);
      console.log("Initial Total Check Advice:", this.initialTotalCheckAdvice);
      console.log("Current textarea1:", this.textarea1);
      if (isModified) {
        // 如果有修改,弹出确认框
        this.$confirm("检测内容有修改,确定要提交吗?")
      if (JSON.stringify(this.initialState) !== JSON.stringify(this.changedate) || this.initialTotalCheckAdvice !== this.textarea1) {
        this.$confirm("您有未保存的更改,确定要关闭吗?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            this.loading = true;
            this.timer = setTimeout(() => {
              done();
              this.determine();
              setTimeout(() => {
                this.loading = false;
              }, 400);
            }, 2000);
          })
          .catch(() => {
            // 用户取消操作
            this.drawer = false;
            let data = {
              userId: this.userId,
              tjNumber: this.tjNumber,
              state: 1,
              id: this.MsgId,
            };
            getfiedState(data).then((res) => { });
            this.submitForm();
          });
            getfiedState(data).then((res) => {
              this.drawer = false;
              done();
            });
          })
          .catch(() => { });
      } else {
        // 如果没有修改,直接关闭
        done();
        let data = {
          userId: this.userId,
          tjNumber: this.tjNumber,
          state: 1,
        };
        getfiedState(data).then((res) => {
          this.drawer = false;
          done();
        });
      }
    },
    handleClose1() {
    handleClose1(done) {
      this.jianqians = false;
      this.flags = false;
      done();
    },
    // 生成报告
    // generate(row) {
    //   const tjNumber = row.tjNumber;
    //   getGenerate(tjNumber).then((response) => {
    //     this.$modal.msgSuccess("生成成功");
    //   });
    // },
    // xiAoJieChange(event) {
    //   if (event) {
    //     this.changedate.forEach((item) => {
    //       item.remark = "";
    //       item.parentAdvice.forEach((item1) => {
    //         event.forEach((item2) => {
    //           if (item2 == item1.id) {
    //             item.remark = item.remark + item1.advice + "。";
    //           }
    //         });
    //       });
    //     });
    //   }
    // },
    change(vale) { },
    // determine() {
    //   let tjNumber = this.tableAll.tjNumber;
    //   let tjh = this.tableAll.tjNumber;
    //   // let jyjc = this.yichangList.map(item => item.jyjc || null);
    //   let advice = this.textarea1;
    //   let data = {
    //     tjNumber,
    //     advice,
    //     checkStatus: 1,
    //   };
    //   console.log(this.yichangList, 66);
    //   let dataList = this.yichangList
    //     .map((item) => {
    //       return item.sone.map((soneItem) => ({
    //         tjh,
    //         parentName: item.proName,
    //         jcxm: soneItem.proName,
    //         map: soneItem.advices,
    //         jyjc: item.jyjc, // assuming jyjc belongs to the outer item, not soneItem
    //         jcjg: soneItem.proResult,
    //         ckfw: soneItem.stanId,
    //         dw: soneItem.proAdvice,
    //       }));
    //     })
    //     .flat(); // 使用 flat() 方法将嵌套数组展平
    //   console.log(dataList, 777);
    //   /*  addOrder(dataList).then((res) => {
    //     console.log(res, 999);
    //   }); */
    //   getTjdetailList(data)
    //     .then((response) => {
    //       if (response.code === 200) {
    //         this.$modal.msgSuccess("提交成功");
    //         // 准备生成报告的请求数据
    //         let reportData = {
    //           userId: this.userId,
    //           tjNumber: tjNumber,
    //           state: 1,
    //           id: this.MsgId,
    //         };
    //         // 生成报告并保持 loading 打开
    //         const reportPromise = gettoPdf(tjNumber)
    //           .then((res) => {
    //             this.$modal.msgSuccess("已生成报告!请前往报告核收页面确认!");
    //           })
    //           .catch((error) => {
    //             this.$modal.msgError(
    //               "打印报告失败,请前往报告打印页面补打报告!"
    //             );
    //           });
    //         // 更新状态并提交修改请求
    //         const statePromise = getfiedState(reportData).then((res) => {
    //           this.drawer = false;
    //         });
    //         // const addOrderPromise = addOrder(dataList).then((res) => {
    //         //   console.log(res, 999);
    //         // });
    //         // 处理其他修改操作
    //         const updatePromises = this.changedate.map((item) => {
    //           this.proIds = item.parentId;
    //           let remarks = item.remark;
    //           let updateOrderRemarkVos = [
    //             {
    //               tjNumber,
    //               proId: this.proIds.toString(),
    //               remarks,
    //             },
    //           ];
    //           return getModified(updateOrderRemarkVos); // 返回 Promise
    //         });
    //         // 等待所有请求完成
    //         Promise.all([
    //           reportPromise,
    //           statePromise,
    //           // addOrderPromise,
    //           ...updatePromises,
    //         ])
    //           .then(() => {
    //             // 所有请求完成,关闭 loading
    //             this.loading = false;
    //             // 更新分页信息
    //             this.queryParams.page = 1;
    //             this.queryParams.pageSize = 10;
    //             this.submitForm();
    //             this.$forceUpdate();
    //           })
    //           .catch((error) => {
    //             // 处理错误情况
    //             this.loading = false;
    //             console.error("发生错误:", error);
    //           });
    //       } else {
    //         // 提交失败,关闭 loading
    //         this.loading = false;
    //       }
    //     })
    //     .catch((error) => {
    //       // 提交请求失败,关闭 loading
    //       this.loading = false;
    //       console.error("提交请求失败:", error);
    //     });
    // },
    determine() {
      let tjNumber = this.tableAll.tjNumber;
      let tjh = this.tableAll.tjNumber;
@@ -2239,10 +2053,9 @@
        tjNumber,
        advice,
        checkStatus: 1,
        zhiyeJl: this.zhiyeJl, // 添加检查结论
        zhiyeJg: this.zhiyeJg  // 添加体检结果
      };
      console.log(this.yichangList, 6644);
      let dataList = this.yichangList
        .map((item) => {
          return item.sone.map((soneItem) => ({
@@ -2256,14 +2069,17 @@
            dw: soneItem.proAdvice,
          }));
        })
        .flat(); // 使用 flat() 方法将嵌套数组展平
        .flat();
      this.loading = true;
      getTjdetailList(data)
        .then((response) => {
          if (response.code === 200) {
            this.$modal.msgSuccess("提交成功");
            // 清空字段
            this.zhiyeJl = '';
            this.zhiyeJg = '';
            // 准备生成报告的请求数据
            let reportData = {
              userId: this.userId,
              tjNumber: tjNumber,
@@ -2271,12 +2087,8 @@
              id: this.MsgId,
            };
            // 调用 addOrderPromise
            console.log(dataList, 5555);
            addOrder(dataList)
              .then((res) => {
                console.log(res, 999);
                if (res.code == 200) {
                  gettoPdf(tjNumber)
                    .then((res) => {
@@ -2302,41 +2114,60 @@
                        remarks,
                      },
                    ];
                    return getModified(updateOrderRemarkVos); // 返回 Promise
                    return getModified(updateOrderRemarkVos);
                  });
                  // 等待所有请求完成
                  Promise.all([statePromise, ...updatePromises])
                    .then(() => {
                      // 所有请求完成,关闭 loading
                      this.loading = false;
                      // 更新分页信息
                      this.queryParams.page = 1;
                      this.queryParams.pageSize = 10;
                      this.submitForm();
                      this.$forceUpdate();
                    })
                    .catch((error) => {
                      // 处理错误情况
                      this.loading = false;
                      console.error("发生错误:", error);
                    });
                }
              })
              .catch((error) => {
                // 如果 addOrderPromise 失败,处理错误
                this.loading = false;
                console.error("addOrderPromise 失败:", error);
              });
          } else {
            // 提交失败,关闭 loading
            this.loading = false;
            this.$modal.msgError("提交失败");
          }
        })
        .catch((error) => {
          // 提交请求失败,关闭 loading
          this.loading = false;
          console.error("提交请求失败:", error);
          this.$modal.msgError("提交请求失败");
        });
    },
    getRevoke(row) {
      this.$confirm("确认撤销该报告吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          revoke(row.tjNumber).then((response) => {
            if (response.code === 200) {
              this.submitForm();
              this.$message.success("撤销成功");
            } else {
              this.$message.error("撤销失败");
            }
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消撤销",
          });
        });
    },
  },
@@ -2693,6 +2524,19 @@
  }
}
.section-title {
  font-size: 20px;
  font-weight: bold;
  color: #303133;
  background-color: #f5f7fa;
  padding: 10px 15px;
  border-left: 4px solid #409eff;
  /* 左侧蓝色边条,增强视觉效果 */
  margin-bottom: 15px;
  margin-top: 15px;
  border-radius: 4px;
}
.dialog-pager {
  display: flex;
  justify-content: center;