<template>
  <div>
    <!--组件-->
    <div style="display: flex;" @contextmenu.prevent="onContextmenu">
      <div
        :style="`position: absolute; top: 0px; left: ${Math.floor((window.pageWidth - 120) / 2) - 110}px; display: flex;z-index: 3;`">
        <div v-show="checkPagePriv(pagePriv.privs, '新增综述')">
          <el-button style="height: 28px;" class="commonbutton" @click="addSummary"
            :disabled="sumBtnDisabled('addSummary')">新增综述</el-button>
        </div>
      </div>
      <div style="width:50%;">
        <el-table id="tableSummary" row-key="id" :data="sumDoctorCheck.summaryList" width="100%" :height="sumHeight"
          border size="small">
          <el-table-column type="index" width="30" align="center" />
          <el-table-column prop="summaryTitle" label="综述">
            <template slot="header">
              <div style="display: flex;justify-content:space-between;">
                <div>综述</div>
                <div></div>
              </div>
            </template>
            <template slot-scope="scope">
              <div>
                <div style="display: flex;">
                  <el-input v-model="scope.row.summaryTitle" placeholder="请输入综述" :ref="scope.row.id" :id="scope.row.id"
                    :disabled="sumBtnDisabled('addSummary')"></el-input>
                  <el-button v-show="checkPagePriv(pagePriv.privs, '新增综述明细')" icon="el-icon-plus"
                    style="min-width:21px;height:21px;padding:2px;" @click="addSum(scope.$index)"
                    :disabled="sumBtnDisabled('addSummary')"></el-button>
                  <el-button v-show="checkPagePriv(pagePriv.privs, '删除综述')" type="danger" icon="el-icon-delete"
                    style="margin-left: 2px;min-width:21px;height:21px;padding:2px;" @click="delSumHead(scope.$index)"
                    :disabled="sumBtnDisabled('addSummary')"></el-button>
                </div>
                <el-table :id="scope.row.id" :row-key="scope.$index + scope.row.id" style="margin-left: 10px;"
                  :data="scope.row.details" border @row-click="rowClick" :show-header="false">
                  <el-table-column width="30">
                    <template slot-scope="scope2">
                      <div>{{ scope2.$index + 1 }})</div>
                    </template>
                  </el-table-column>
                  <el-table-column prop="summaryContent" label="综述" min-width="200">
                    <template slot-scope="scope2">
                      <div style="display: flex;">
                        <el-input type="textarea" v-model="scope2.row.summaryContent" placeholder="请输入综述"
                          :disabled="sumBtnDisabled('addSummary')" :id="scope2.row.id" :ref="scope2.row.id"
                          :autosize="{ minRows: 1, maxRows: 20 }">
                        </el-input>
                        <el-button v-show="checkPagePriv(pagePriv.privs, '删除综述明细')" type="danger" icon="el-icon-delete"
                          style="margin-left: 2px;min-width:21px;height:21px;padding:2px;"
                          @click="delSug(scope.row.details, scope2.$index)"
                          :disabled="sumBtnDisabled('addSummary')"></el-button>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column width="8" />
                </el-table>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div style="position: absolute; top: 0px; right: 2px; display: flex;z-index: 3;">
        <div style="margin-right: 5px;">
          <el-button style="height: 28px;" class="commonbutton" @click="btnCollapseAll"
            :disabled="sumBtnDisabled('collapse')">{{
              collapse ?
                '展开' : '折叠' }}全部建议</el-button>
        </div>
        <div v-show="checkPagePriv(pagePriv.privs, '新增建议')">
          <el-button style="height: 28px;" class="commonbutton" @click="addSuggtion"
            :disabled="sumBtnDisabled()">新增建议</el-button>
        </div>
      </div>
      <div style="width:50%;">
        <el-table id="tableSuggestion" row-key="id" :data="sumDoctorCheck.suggestionList" width="100%"
          :height="sumHeight" border size="small" ref="tableSuggestion">
          <el-table-column width="30" align="center">
            <template slot-scope="scope">
              <el-tag class="moveTag" style="cursor: move;background-color: #EEEEEE;">
                <div style="width: 16px;">{{ scope.$index + 1 }}</div>
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="suggestionTitle" label="建议">
            <template slot="header">
              <div style="display: flex;justify-content:space-between;">
                <div>建议</div>
                <div></div>
              </div>
            </template>
            <template slot-scope="scope">
              <div>
                <div style="display: flex;" @dblclick="openSymbols(scope.$index, 'suggestionTitle', -1)">
                  <el-input v-model="scope.row.suggestionTitle" placeholder="请输入建议标题" :ref="scope.row.id"
                    :id="scope.row.id" :disabled="sumBtnDisabled()">
                  </el-input>
                  <el-button type="danger" :icon="scope.row.collapse ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"
                    style="min-width:21px;height:21px;padding:2px;"
                    @click="btnCollapse(sumDoctorCheck.suggestionList, scope.$index, scope.row)"
                    :disabled="sumBtnDisabled('collapse')"></el-button>
                  <el-button v-show="checkPagePriv(pagePriv.privs, '删除建议')" type="danger" icon="el-icon-delete"
                    style="margin-left: 2px;min-width:21px;height:21px;padding:2px;" @click="delSugHead(scope.$index)"
                    :disabled="sumBtnDisabled()"></el-button>
                </div>
                <div v-show="!scope.row.collapse">
                  <div style="display: flex;margin-top: 2px;">
                    <div style="width:60px;">诊断</div>
                    <el-input placeholder="请选择诊断" :value="`${scope.row.diagnosisNames}`" size="small" disabled>
                    </el-input>
                    <el-tooltip content="选择诊断" placement="top">
                      <el-button icon="el-icon-search" style="min-width:21px;height:21px;padding:2px;"
                        @click="btnChooseDiagnosis(scope.$index)" :disabled="sumBtnDisabled()"></el-button>
                    </el-tooltip>
                    <el-tooltip content="根据诊断搜索医学解释、常见原因及健康指导" placement="top">
                      <el-button icon="el-icon-cpu" style="margin-left: 2px;min-width:21px;height:21px;padding:2px;"
                        @click="btnAIdiagnosis(scope.row.diagnosisNames)" :disabled="sumBtnDisabled()"></el-button>
                    </el-tooltip>
                    <!--
                    <el-select v-model="scope.row.diagnosisIds" multiple placeholder="请选择" style="width: 100%;"
                      :disabled="sumBtnDisabled()" @change="changeDiagnosis" filterable class="no-animation">                      
                      <el-option v-for="item in diagnosises" :key="item.id" :value="item.id" :label="item.displayName"
                        :disabled="disabledDiagnosis(item.id, scope.$index)" />
                    </el-select>
                    -->
                  </div>
                  <!--医学解释-->
                  <div v-if="dispTermReason == 'Y'" style="display: flex;margin-top: 2px;">
                    <div style="width:60px;">医学解释</div>
                    <el-tooltip content="新增医学解释" placement="top">
                      <el-button v-show="checkPagePriv(pagePriv.privs, '新增医学解释')" type="success" icon="el-icon-plus"
                        style="min-width:21px;height:21px;padding:2px;" @click="addSug(scope.$index, 0)"
                        :disabled="sumBtnDisabled()">
                      </el-button>
                    </el-tooltip>
                    <el-table :id="'0_sug' + scope.row.id" row-key="displayOrder" style="margin-left: 5px;"
                      :data="scope.row.medicalInterpretations" border @row-click="rowClickSug0" :show-header="false">
                      <el-table-column width="30">
                        <template slot-scope="scope2">
                          <el-tag class="moveTag2" style="cursor: move;background-color: #EEEEEE;">
                            <div style="width: 16px;">{{ scope2.$index + 1 }}).</div>
                          </el-tag>
                        </template>
                      </el-table-column>
                      <el-table-column prop="suggestionContent" label="建议" min-width="200">
                        <template slot-scope="scope2">
                          <div @dblclick="openSymbols(scope.$index, 'medicalInterpretations', scope2.$index)">
                            <el-input type="textarea" v-model="scope2.row.suggestionContent" placeholder="请输入建议内容"
                              :disabled="sumBtnDisabled()" :autosize="{ minRows: 1, maxRows: 10 }">
                            </el-input>
                          </div>
                        </template>
                      </el-table-column>
                      <el-table-column label="操作" width="25">
                        <template slot-scope="scope2">
                          <el-button v-show="checkPagePriv(pagePriv.privs, '删除医学解释')" type="danger"
                            style="min-width:21px;height:21px;padding:2px;" icon="el-icon-delete"
                            @click="delSug(scope.row.medicalInterpretations, scope2.$index)"
                            :disabled="sumBtnDisabled()" size="small"></el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                  <!--常见原因-->
                  <div v-if="dispTermReason == 'Y'" style="display: flex;margin-top: 2px;">
                    <div style="width:60px;">常见原因</div>
                    <el-tooltip content="新增常见原因" placement="top">
                      <el-button v-show="checkPagePriv(pagePriv.privs, '新增常见原因')" type="danger" icon="el-icon-plus"
                        style="min-width:21px;height:21px;padding:2px;" @click="addSug(scope.$index, 1)"
                        :disabled="sumBtnDisabled()">
                      </el-button>
                    </el-tooltip>
                    <el-table :id="'1_sug' + scope.row.id" row-key="displayOrder" style="margin-left: 5px;"
                      :data="scope.row.commonReasons" border @row-click="rowClickSug1" :show-header="false">
                      <el-table-column width="30">
                        <template slot-scope="scope2">
                          <el-tag class="moveTag2" style="cursor: move;background-color: #EEEEEE;">
                            <div style="width: 16px;">{{ scope2.$index + 1 }}).</div>
                          </el-tag>
                        </template>
                      </el-table-column>
                      <el-table-column prop="suggestionContent" label="建议" min-width="200">
                        <template slot-scope="scope2">
                          <div @dblclick="openSymbols(scope.$index, 'commonReasons', scope2.$index)">
                            <el-input type="textarea" v-model="scope2.row.suggestionContent" placeholder="请输入建议内容"
                              :disabled="sumBtnDisabled()" :autosize="{ minRows: 1, maxRows: 10 }">
                            </el-input>
                          </div>
                        </template>
                      </el-table-column>
                      <el-table-column label="操作" width="25">
                        <template slot-scope="scope2">
                          <el-button v-show="checkPagePriv(pagePriv.privs, '删除常见原因')" type="danger"
                            style="min-width:21px;height:21px;padding:2px;" icon="el-icon-delete"
                            @click="delSug(scope.row.commonReasons, scope2.$index)" :disabled="sumBtnDisabled()"
                            size="small"></el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                  <!--健康指导-->
                  <div style="display: flex;margin-top: 2px;">
                    <div style="width:60px;">健康指导</div>
                    <el-tooltip content="新增健康指导" placement="top">
                      <el-button v-show="checkPagePriv(pagePriv.privs, '新增健康指导')" type="danger" icon="el-icon-plus"
                        style="min-width:21px;height:21px;padding:2px;" @click="addSug(scope.$index, 2)"
                        :disabled="sumBtnDisabled()">
                      </el-button>
                    </el-tooltip>
                    <el-table :id="'2_sug' + scope.row.id" row-key="displayOrder" style="margin-left: 5px;"
                      :data="scope.row.healthGuidances" border @row-click="rowClickSug2" :show-header="false">
                      <el-table-column width="30">
                        <template slot-scope="scope2">
                          <el-tag class="moveTag2" style="cursor: move;background-color: #EEEEEE;">
                            <div style="width: 16px;">{{ scope2.$index + 1 }}).</div>
                          </el-tag>
                        </template>
                      </el-table-column>
                      <el-table-column prop="suggestionContent" label="建议" min-width="200">
                        <template slot-scope="scope2">
                          <div @dblclick="openSymbols(scope.$index, 'healthGuidances', scope2.$index)">
                            <el-input type="textarea" v-model="scope2.row.suggestionContent" placeholder="请输入健康指导"
                              :disabled="sumBtnDisabled()" :autosize="{ minRows: 1, maxRows: 10 }">
                            </el-input>
                          </div>
                        </template>
                      </el-table-column>
                      <el-table-column label="操作" width="25">
                        <template slot-scope="scope2">
                          <el-button v-show="checkPagePriv(pagePriv.privs, '删除健康指导')" type="danger"
                            style="min-width:21px;height:21px;padding:2px;" icon="el-icon-delete"
                            @click="delSug(scope.row.healthGuidances, scope2.$index)" :disabled="sumBtnDisabled()"
                            size="small"></el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                </div>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
    <!--弹窗-->
    <div>
      <!-- 插入特殊符号 -->
      <el-dialog title="插入特殊符号" :visible.sync="dialogWinSymbols" width="600px" :close-on-click-modal="false">
        <div style="margin-top: -5px;">
          <div style="overflow-y:auto; width:100%;display: flex;flex-wrap: wrap;align-content: flex-start;">
            <div v-for="item in symbols" :key="item.id" style="margin: 1px  2px;cursor:pointer;"
              @click="insertSymbols(item.displayName)">
              <el-tag
                style="padding: 0 3px;height: 24px;line-height: 24px;font-size: 15px;color: #303133;background-color: white;">
                {{ item.displayName }}
              </el-tag>
            </div>
          </div>
          <div style="padding: 5px 0;">录入结果：</div>
          <el-input id="resultBox" class="commonFont" style="width: 100%;" type="textarea"
            :autosize="{ minRows: 4, maxRows: 4 }" v-model="curResult" />
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="btnOkResult">确定</el-button>
          <el-button @click="dialogWinSymbols = false">关闭</el-button>
        </span>
      </el-dialog>

      <el-dialog title="选择诊断" :visible.sync="dialogDiagnosises" width="800px" :close-on-click-modal="false">
        <div style="height: 320px;">
          <el-select v-model="choosedDiagnosisIds" multiple placeholder="请选择" style="width: 100%;" filterable
            :filter-method="filterMethod" popper-class="diagnosisSelect" :popper-append-to-body="false">
            <el-option v-for="item in diagnosisesFilter" :key="item.id" :value="item.id" :label="item.displayName" />
          </el-select>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="btnOkDiagnosis">确定</el-button>
          <el-button @click="dialogDiagnosises = false">关闭</el-button>
        </span>
      </el-dialog>

      <!-- AI诊断（所有小结信息）-->
      <div v-show="AI.visible"
        :style="`z-index:3;border-radius: 10px;border: 1px solid #ddd;background-color:#FFF; position: absolute;top:0px;left:0px;width:${AI.width}px;height: ${AI.height}px;opacity:1;`">
        <div v-show="AI.max" style="display: flex;justify-content: space-between;">
          <p>AI诊断内容：</p>
          <el-tooltip content="隐藏 AI诊断内容" placement="top">
            <i class="el-icon-minus" @click="btnAImax(AI.max)" style="font-size: 24px;color: red;cursor:pointer;"></i>
          </el-tooltip>
        </div>
        <div v-show="!AI.max">
          <el-tooltip content="显示 AI诊断内容" placement="top">
            <i class="el-icon-plus" @click="btnAImax(AI.max)" style="font-size: 24px;color: red;cursor:pointer;"></i>
          </el-tooltip>
        </div>
        <el-input v-show="AI.max" type="textarea" v-model="AI.diagnosis" placeholder="AI诊断内容"
          :autosize="{ minRows: AIDH, maxRows: AIDH }" style="text-align: right;">
        </el-input>
        <div v-show="AI.max" style="text-align: right; margin-top: 10px;">
          <el-button class="commonbutton" @click="AI.visible = false">关闭</el-button>
        </div>
      </div>
    </div>

  </div>
</template>
<script>
import { mapState } from 'vuex';
import Sortable from "sortablejs";
import { getapi, postapi, putapi, deletapi } from "@/api/api";
import { getPagePriv, checkPagePriv, deepCopy, arrayExistObj } from '../../utlis/proFunc';
export default {
  components: {},
  props: ["patientRegisterId", "tabChoosed"],
  data() {
    return {
      pagePriv: {
        routeUrlorPageName: 'sumDoctorCheck', //当前页面归属路由或归属页面权限名称
        privs: [] // 页面权限
      },
      sumDetails: [],
      suggestionCurRow: 0, //当前操作建议的行
      dialogDiagnosises: false, // 诊断选择窗口
      diagnosises: [], // 诊断
      diagnosisesFilter: [], // 可选的诊断
      choosedDiagnosisIds: [],  // 已选的诊断 id 集合
      disabledDiagnosisIds: [],  // 不可选的诊断 id 集合
      diagnosisesChoosed: [],  // 已选的诊断集合

      collapse: false,  // 折叠/展开全部建议

      dispTermReason: 'N',  // 显示医学解释与常见原因

      dialogWinSymbols: false,
      selection: { // 光标位置
        start: 0, end: 0
      },
      symbols: [], //特殊符号 
      curResult: "", // 当前输入框内容

      dbclObj: { // 输入特殊符号前，双击的对象
        index: -1,
        colName: '', // 
        subIndex: -1,
      },
      summary_check_default_summay_modifiable: 'N',

      AI: {
        width: 500,
        height: 24,
        max: true,
        visible: false,
        diagnosis: 'AI诊断信息',
      }
    };
  },

  created() {
    //获取用户当前页面的权限
    let userPriv = window.sessionStorage.getItem('userPriv')
    if (userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName))

    // 获取是否显示医学解释与常见原因
    // 获取系统参数(医生诊台侧边项目归类模式 0-检检类别，1-指引类别，2-报告类别)
    postapi('/api/app/SysParmValue/GetSysParmValueBySysParmId', { sysParmId: 'summary_check_disp_reas' })
      .then(res => {
        if (res.code > -1) {
          this.dispTermReason = res.data || "Y"
        }
      })

    this.AI.height = this.frameHeight
  },

  //挂载完成
  async mounted() {
    // this.rowDrop();  （综述取消拖拽）
    this.rowDropSuggestion();

    await this.dictInit()
    // document.addEventListener('DOMContentLoaded', function () {
    //   const textarea = document.querySelector('textarea');
    //   textarea.addEventListener('input', function () {
    //     // 当文本域内容变化时调整大小
    //     console.log('textarea.addEventListener',textarea.style.height)
    //     textarea.style.height = 'auto'; // 重置高度
    //     // textarea.style.height = textarea.scrollHeight + 'px'; // 根据滚动高度调整高度
    //   });
    // });
    this.summaryList(this.dataTransOpts.tableS.patient_register.id)
    this.suggestionList(this.dataTransOpts.tableS.patient_register.id)
  },

  computed: {
    ...mapState(['window', 'dict', 'dataTransOpts', 'doctorCheck', 'sumDoctorCheck']),

    sumHeight() {
      let tempHeight = this.window.pageHeight < 600 ? 600 : this.window.pageHeight
      return tempHeight - 335
    },

    frameHeight() {
      return this.window.pageHeight - 42 - 10
    },
    // AIdiagnosisHeight
    AIDH() {
      return Math.floor((this.AI.height - 24 - 42 - 4) / 21.5)
    }
  },

  methods: {
    checkPagePriv,

    // textareaResize() {
    //   const textarea = document.querySelectorAll('textarea');
    //   textarea.forEach(e => {
    //     e.style.height = 'auto'; // 重置高度        
    //   });      
    // },
    // 获取诊断数据
    async dictInit() {

      // 获取诊断  /api/app/diagnosis/getlistinsuggestion , {}
      postapi('/api/app/Diagnosis/GetSimpleDiagnosisWithSuggestions').then(res => {
        if (res.code > -1) {
          this.diagnosises = res.data
        }
      })

      //获取结果状态提示数据
      postapi('/api/app/CommonChar/GetCommonCharList', {}).then(res => {
        if (res.code >= 0) {
          this.symbols = res.data
        }
      })

      let sysParmId = "summary_check_default_summay_modifiable"
      try {
        let sysParm = await postapi('/api/app/SysParmValue/GetSysParmValueBySysParmId', { sysParmId })
        this.summary_check_default_summay_modifiable = sysParm.data.toUpperCase()
        // console.log('dictInit this.summary_check_default_summay_modifiable',this.summary_check_default_summay_modifiable,sysParm.data.toUpperCase())
      } catch (error) {
        console.log('获取参数 summary_check_default_summay_modifiable 失败', error)
      }

    },

    // 增加综述
    addSummary() {
      let id = String(new Date().getTime())
      let pojo = {
        id,
        patientRegisterId: this.dataTransOpts.tableS.patient_register.id,
        summaryTitle: '',
        details: [{
          id: 'detail' + id,
          summaryContent: '',
        }]
      }

      this.sumDoctorCheck.summaryList.push(pojo);
      this.$nextTick(() => {
        this.$refs[id].focus();
      })
    },

    //增加建议
    addSuggtion() {
      let id = String(new Date().getTime())
      let pojo = {
        id,
        patientRegisterId: this.dataTransOpts.tableS.patient_register.id,
        diagnosisIds: [],
        medicalInterpretations: [
          {
            sumSuggestionHeaderId: id, // 拖拽用到
            diagnosisId: '',  // 关联诊断用到
            suggestionContent: '',
          }
        ],
        commonReasons: [
          {
            sumSuggestionHeaderId: id, // 拖拽用到
            diagnosisId: '',
            suggestionContent: '',
          }
        ],
        healthGuidances: [
          {
            sumSuggestionHeaderId: id, // 拖拽用到
            diagnosisId: '',
            suggestionContent: '',
          }
        ],
      }

      this.sumDoctorCheck.suggestionList.push(pojo);
      this.$nextTick(() => {
        this.$refs[id].focus();
      })
    },

    // 单个折叠展开建议
    btnCollapseAll() {
      this.collapse = !this.collapse
      this.sumDoctorCheck.suggestionList.forEach((e, index) => {
        e.collapse = this.collapse
        this.$set(this.sumDoctorCheck.suggestionList, index, e)
      });
    },

    // 单个折叠展开建议
    btnCollapse(data, index, row) {
      row.collapse = !row.collapse
      this.$set(data, index, row)
      // this.sumDoctorCheck.suggestionList[index]['collapse'] = !this.sumDoctorCheck.suggestionList[index]['collapse']
      this.$nextTick(() => {
        this.$refs['tableSuggestion'].doLayout()
      })
    },

    //选择诊断
    btnChooseDiagnosis(index) {
      this.suggestionCurRow = index
      this.choosedDiagnosisIds = this.sumDoctorCheck.suggestionList[index].diagnosisIds || []

      this.disabledDiagnosisIds = []
      this.sumDoctorCheck.suggestionList.forEach((e, i) => {
        if (i != index) {
          if (e.diagnosisIds) this.disabledDiagnosisIds = this.disabledDiagnosisIds.concat(e.diagnosisIds)
        }
      });

      this.diagnosisesFilter = []
      this.diagnosisesChoosed = []

      this.diagnosises.forEach(e => {
        if (e.id && this.disabledDiagnosisIds.indexOf(e.id) == -1) {
          console.log('this.disabledDiagnosisIds', e.id, this.disabledDiagnosisIds, this.choosedDiagnosisIds)
          if (this.choosedDiagnosisIds.indexOf(e.id) == -1) {
            console.log('this.diagnosisesFilter', e.id, this.diagnosisesFilter)
            if (this.diagnosisesFilter.length < 20) this.diagnosisesFilter.push(e)
          } else {
            this.diagnosisesChoosed.push(e)
          }
        }
      });
      this.diagnosisesFilter = this.diagnosisesFilter.concat(this.diagnosisesChoosed)
      this.dialogDiagnosises = true
    },

    // 根据诊断，搜索医学解释、常见原因、健康指导
    // AI诊断 AI重新诊断
    btnAIdiagnosis(diagnosis) {
      if (!diagnosis) {
        this.$message.warning({ showClose: true, message: '诊断内容为空，无法搜索医学解释、常见原因及健康指导信息。' })
        return
      }

      let message = '性别：' + this.doctorCheck.prBase.sexName + '，年龄：' + this.doctorCheck.prBase.age + '岁，检查结果：' + diagnosis
        + ' 请给出医学解释、常见原因及健康指导'


      postapi('/api/app/AIMessage/GetAIMessageResult', { message })
        .then(res => {
          if (res.code > -1) {
            this.AI.visible = true
            this.AI.diagnosis = res.data.result
            this.btnAImax(false)
          } else {
            this.$message.error({ showClose: true, message: res.message })
          }
        })

    },

    btnAImax(max) {
      this.AI.max = !max
      if (this.AI.max) {
        this.AI.width = 500
        this.AI.height = this.frameHeight
      } else {
        this.AI.width = 24
        this.AI.height = 24
      }
    },

    //快速选择组合项目时，调整可按拼间简码及简称查找
    filterMethod(keyWords) {
      if (keyWords) {
        let diagnosisesFilter = []
        this.diagnosises.forEach(e => {
          if (this.disabledDiagnosisIds.indexOf(e.id) == -1) {
            if (this.choosedDiagnosisIds.indexOf(e.id) == -1) {
              if (e.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1 || e.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1) {
                if (diagnosisesFilter.length < 20) diagnosisesFilter.push(e)
              }
            }
          }
        })
        this.diagnosisesFilter = diagnosisesFilter.concat(this.diagnosisesChoosed)
      }
    },

    btnOkDiagnosis() {
      this.changeDiagnosis(this.choosedDiagnosisIds)
      this.dialogDiagnosises = false
    },

    // 获取人员是否已总检过
    getHaveSumData(patientRegisterId) {
      this.sumDoctorCheck.summaryList = [];
      this.sumDoctorCheck.suggestionList = [];
      if (!patientRegisterId) return

      // console.log('getHaveSumData', this.dataTransOpts.tableS.patient_register.completeFlag)
      if (this.dataTransOpts.tableS.patient_register.completeFlag == '3') {
        this.summaryList(patientRegisterId, 'Y')
        this.suggestionList(patientRegisterId, 'Y')
        return
      }
      postapi('/api/app/patientregister/GetHaveSumData', { patientRegisterId })
        .then(async (res) => {
          if (res.code > -1) {
            let isGetExistData = res.data
            if (res.data == 'Y') {
              try {
                await this.$confirm('检测到该人员已经生成过总检信息。', '确认信息', {
                  distinguishCancelAndClose: true,
                  confirmButtonText: '重新生成总检信息',
                  cancelButtonText: '获取上次总检信息',
                  showClose: false
                })
                isGetExistData = 'N'
              } catch (error) {
                //console.log()
              }
            }
            this.summaryList(patientRegisterId, isGetExistData)
            this.suggestionList(patientRegisterId, isGetExistData)
          }
        })
    },

    //获取综述
    summaryList(RegisterId, isGetExistData) {
      if (!RegisterId) {
        this.sumDoctorCheck.summaryList = [];
        return
      }

      // 旧接口： console.log(`/api/app/sumsummaryheader/getsumsummarylist?PatientRegisterId=${RegisterId}`)
      let body = {
        patientRegisterId: RegisterId,
        isGetExistData,
      }
      postapi('/api/app/sumsummaryheader/getsumsummarylist', body)
        .then((res) => {
          // console.log("summaryList", res.data);
          if (res.code > -1) {
            let summaryList = []
            res.data.forEach((e, i) => {
              let details = []
              e.details.forEach((e2, i2) => {
                details.push({ id: `summaryDetails_${i2}`, summaryContent: ' ' })
              });
              summaryList.push({ id: `summary_${i}`, summaryTitle: ' ', details })
            });
            this.sumDoctorCheck.summaryList = summaryList

            // 自动高度有问题，需要这样处理一下
            setTimeout(() => {
              res.data.forEach((e, i) => {
                e.id = `summary_${i}`
                e.details.forEach((e2, i2) => {
                  e2.id = `summaryDetails_${i2}`
                });
              });
              this.sumDoctorCheck.summaryList = res.data;

            }, 10);
            // this.sumDoctorCheck.summaryList = res.data;
            // this.textareaResize()
          }
        })
        .catch((err) => {
          this.$message({ type: "error", message: `操作失败，原因：${err}` });
        });
    },

    //获取建议
    suggestionList(RegisterId, isGetExistData) {
      this.sumDoctorCheck.suggestionList = [];
      if (!RegisterId) return;
      // {
      //   "patientRegisterId": "3a11ee70-02cb-c5e6-a087-79ecdd0356b6",
      //   "isGetExistData": "Y"
      // }
      let body = {
        patientRegisterId: RegisterId,
        isGetExistData,
      }
      // 旧接口： console.log(`/api/app/sumsuggestionheader/getsumsuggestionlist?PatientRegisterId=${RegisterId}`)

      postapi('/api/app/sumsuggestionheader/getsumsuggestionlist', body)
        .then((res) => {
          // console.log("suggestionList", res.data);
          if (res.code > -1) {
            // 处理拖动排序使用
            let suggestionList = []
            res.data.forEach((e, i) => {
              e.id = `suggestion_${i}`
              e.collapse = this.collapse
              let medicalInterpretations = []
              if (e.medicalInterpretations) {
                e.medicalInterpretations.forEach((e0, i0) => {
                  e0.sumSuggestionHeaderId = `suggestion_${i}`
                  e0.id = `medicalInterpretations_${i0}`
                  medicalInterpretations.push(Object.assign({}, e0, { suggestionContent: '' }))
                });
              }
              let commonReasons = []
              if (e.commonReasons) {
                e.commonReasons.forEach((e0, i0) => {
                  e0.sumSuggestionHeaderId = `suggestion_${i}`
                  e0.id = `commonReasons_${i0}`
                  commonReasons.push(Object.assign({}, e0, { suggestionContent: '' }))
                });
              }
              let healthGuidances = []
              if (e.healthGuidances) {
                e.healthGuidances.forEach((e0, i0) => {
                  e0.sumSuggestionHeaderId = `suggestion_${i}`
                  e0.id = `healthGuidances_${i0}`
                  healthGuidances.push(Object.assign({}, e0, { suggestionContent: '' }))
                });
              }
              suggestionList.push(Object.assign({}, e, { medicalInterpretations, commonReasons, healthGuidances }))
            });
            this.sumDoctorCheck.suggestionList = suggestionList
            setTimeout(() => {
              this.sumDoctorCheck.suggestionList = res.data;
            }, 10);
          }
        });
    },

    // 按钮可用
    sumBtnDisabled(btnType) {
      let patientRegister = this.dataTransOpts.tableS.patient_register
      let ret = true

      //' 请选择体检人员'
      if (!patientRegister.id) return ret
      // '人员已锁定，不可执行此操作'
      if (patientRegister.isLock && patientRegister.isLock == 'Y') return ret

      // console.log('btnType', btnType, this.summary_check_default_summay_modifiable)

      switch (btnType) {
        case 'collapse':
          return false;
        case 'addSummary':
          if (patientRegister.completeFlag && patientRegister.completeFlag != '3' && this.summary_check_default_summay_modifiable == 'Y') {
            return false;
          } else {
            return true;
          }
        default:
          break;
      }

      if (patientRegister.completeFlag && patientRegister.completeFlag != '3') ret = false

      return ret
    },

    // 诊断选择
    changeDiagnosis(v) {
      // console.log('changeDiagnosis', v)
      let suggestionTitle = []
      if (v.length == 0) {
        this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['suggestionTitle'] = ''
        return
      }
      //先找到是操作的建议行
      // let lv = `${v}`
      // let suggestionList = deepCopy(this.sumDoctorCheck.suggestionList)
      // suggestionList.forEach(e => {
      //   e.diagnosisIds = `${e.diagnosisIds}`
      // });
      // let lfind = arrayExistObj(suggestionList, 'diagnosisIds', lv)
      // if (lfind == -1) return
      // this.suggestionCurRow = lfind

      let sumSuggestionHeaderId = this.sumDoctorCheck.suggestionList[this.suggestionCurRow].id

      v.forEach(e => {
        let ld = arrayExistObj(this.diagnosises, 'id', e)
        if (ld > -1) {
          suggestionTitle.push(this.diagnosises[ld]["displayName"])
          //添加医学解释
          let medicalInterpretations = this.diagnosises[ld]['medicalInterpretations']
          if (medicalInterpretations) {
            if (!this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['medicalInterpretations']) {
              this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['medicalInterpretations'] = []
            }

            medicalInterpretations.forEach(e2 => {
              let lf = arrayExistObj(this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['medicalInterpretations'], "suggestionContent", e2.suggestionContent)
              if (lf == -1) {
                this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['medicalInterpretations'].push({
                  sumSuggestionHeaderId,
                  suggestionContent: e2.suggestionContent,
                  displayOrder: Math.random(),
                })
              }
            });
            // 将空的医学解释删除
            if (this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['medicalInterpretations'].length > 0) {
              for (let index = this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['medicalInterpretations'].length; index > 0; index--) {
                let element = this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['medicalInterpretations'][index - 1];
                if (!element?.suggestionContent) this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['medicalInterpretations'].splice(index - 1, 1)
              }
            }
          }

          //添加常见原因
          let commonReasons = this.diagnosises[ld]['commonReasons']
          if (commonReasons) {
            if (!this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['commonReasons']) {
              this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['commonReasons'] = []
            }
            commonReasons.forEach(e2 => {
              let lf = arrayExistObj(this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['commonReasons'], "suggestionContent", e2.suggestionContent)
              if (lf == -1) {
                this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['commonReasons'].push({
                  sumSuggestionHeaderId,
                  suggestionContent: e2.suggestionContent,
                  displayOrder: Math.random(),
                })
              }
            });
            // 将空的常见原因删除
            if (this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['commonReasons'].length > 0) {
              for (let index = this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['commonReasons'].length; index > 0; index--) {
                let element = this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['commonReasons'][index - 1];
                if (!element?.suggestionContent) this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['commonReasons'].splice(index - 1, 1)
              }
            }
          }

          //添加健康指导
          let healthGuidances = this.diagnosises[ld]['healthGuidances']
          if (healthGuidances) {
            if (!this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['healthGuidances']) {
              this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['healthGuidances'] = []
            }
            healthGuidances.forEach(e2 => {
              let lf = arrayExistObj(this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['healthGuidances'], "suggestionContent", e2.suggestionContent)
              if (lf == -1) {
                this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['healthGuidances'].push({
                  sumSuggestionHeaderId,
                  suggestionContent: e2.suggestionContent,
                  displayOrder: Math.random(),
                })
              }
            });
            // 将空的健康指导删除
            if (this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['healthGuidances'].length > 0) {
              for (let index = this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['healthGuidances'].length; index > 0; index--) {
                let element = this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['healthGuidances'][index - 1];
                if (!element?.suggestionContent) this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['healthGuidances'].splice(index - 1, 1)
              }
            }
          }
        }
      });
      this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['diagnosisIds'] = v
      this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['suggestionTitle'] = `${suggestionTitle}`
      this.sumDoctorCheck.suggestionList[this.suggestionCurRow]['diagnosisNames'] = `${suggestionTitle}`
      this.$nextTick(() => {
        this.$refs['tableSuggestion'].doLayout()
      })
    },

    // 新增综述明细
    addSum(index) {
      let id = String(new Date().getTime())
      this.sumDoctorCheck.summaryList[index]['details'].push({
        id,
        summaryContent: '',
      })
      this.$nextTick(() => {
        this.$refs[id].focus();
      })

    },

    //增加建议明细
    addSug(index, contentType) {
      this.suggestionCurRow = index

      let lcontentType = 'healthGuidances'
      switch (contentType) {
        case 0:
          lcontentType = 'medicalInterpretations'
          break;
        case 1:
          lcontentType = 'commonReasons'
          break;
        default:
          break;
      }
      if (!this.sumDoctorCheck.suggestionList[index][lcontentType]) this.sumDoctorCheck.suggestionList[index][lcontentType] = []
      this.sumDoctorCheck.suggestionList[index][lcontentType].push({
        sumSuggestionHeaderId: this.sumDoctorCheck.suggestionList[index].id,  // 拖拽用到
        suggestionContent: '',
        displayOrder: Math.random(),
      })
      this.$nextTick(() => {
        this.$refs['tableSuggestion'].doLayout()
      })
      console.log('this.sumDoctorCheck.suggestionList', index, this.sumDoctorCheck.suggestionList)
    },

    //删除建议头及明细
    delSumHead(index) {
      this.$confirm("此操作将删除该记录, 是否继续?", "提示", {
        confirmButtonText: "是",
        cancelButtonText: "否",
        type: "warning",
      }).then(() => {
        //删除建议
        this.sumDoctorCheck.summaryList.splice(index, 1)
      }).catch((err) => {
        if (err == 'cancel') {
          console.log(`已取消 ${err}`)
        } else {
          this.$message.error(`操作失败 ${err}`)
        }
      });
    },

    //删除建议头及明细
    delSugHead(index) {
      this.$confirm("此操作将删除该记录, 是否继续?", "提示", {
        confirmButtonText: "是",
        cancelButtonText: "否",
        type: "warning",
      }).then(() => {
        //删除建议
        this.sumDoctorCheck.suggestionList.splice(index, 1)
      }).catch((err) => {
        if (err == 'cancel') {
          console.log(`已取消 ${err}`)
        } else {
          this.$message.error(`操作失败 ${err}`)
        }
      });
    },



    //删除/综述建议明细
    delSug(details, indexD) {
      this.$confirm("此操作将删除该记录, 是否继续?", "提示", {
        confirmButtonText: "是",
        cancelButtonText: "否",
        type: "warning",
      }).then(() => {
        //删除建议明细
        details.splice(indexD, 1);
      }).catch((err) => {
        if (err == 'cancel') {
          console.log(`已取消 ${err}`)
        } else {
          this.$message.error(`操作失败 ${err}`)
        }
      });
    },

    //选择组合项目
    rowClick(row) {
      console.log('rowClick row', row)
      let lfind = arrayExistObj(this.sumDoctorCheck.summaryList, 'id', row.sumSummaryHeaderId)
      if (lfind > -1) {
        this.sumDetails = this.sumDoctorCheck.summaryList[lfind].details
        this.rowDropSumDetail(row.sumSummaryHeaderId)
      }
      console.log('this.sumDetails', this.sumDetails)
    },

    //综述明细拖拽
    rowDropSumDetail(id) {
      this.$nextTick(() => {
        const fEl = document.getElementById(id)  // document.querySelector(`#${id} tbody`) querySelector为静态方法不支持动态传参;
        console.log('rowDropSumDetail tbody', fEl, fEl.children) //el.childNodes,el.children
        const el = this.findEl(fEl, 'TBODY')
        console.log('rowDropSumDetail tbody', el) //el.childNodes,el.children
        const that = this;
        Sortable.create(el, {
          animation: 150, // ms, number 单位：ms，定义排序动画的时间
          //拖拽结束
          onEnd({ newIndex, oldIndex }) {
            that.isshow = false;
            const currRow = that.sumDetails.splice(oldIndex, 1)[0];
            that.sumDetails.splice(newIndex, 0, currRow);
          },
        });
      });
    },

    // 打开特殊符号输入
    openSymbols(index, colName, subIndex) {
      if (this.dataTransOpts.tableS.patient_register.completeFlag == '3') return
      this.dbclObj = { index, colName, subIndex }
      switch (colName) {
        case 'suggestionTitle':
          this.curResult = this.sumDoctorCheck.suggestionList[index][colName]
          break;
        default:
          this.curResult = this.sumDoctorCheck.suggestionList[index][colName][subIndex]['suggestionContent']
          break;
      }
      this.dialogWinSymbols = true
      this.watchSelection()
    },

    // 光标位置插入特殊符号
    insertSymbols(symbols) {
      let result = this.curResult || ''
      if (result) {
        result = result.substring(0, this.selection.start) + symbols + result.substring(this.selection.end)
      } else {
        result = symbols
      }
      this.curResult = result
      this.selection.start++
      this.selection.end++
    },
    // 获取光标位置的函数
    getCaretPosition() {
      let input = document.getElementById('resultBox');
      this.selection.start = input.selectionStart;
      this.selection.end = input.selectionEnd;
      // console.log('selection',this.selection)
    },

    watchSelection() {
      this.$nextTick(() => {
        let that = this
        let resultBox = document.getElementById('resultBox'); //用数组可以读取多个标签的元素  //.inline-input
        // 绑定键盘事件到文本框
        resultBox.addEventListener('click', function (event) {
          // 获取光标位置
          that.getCaretPosition()
        })

        resultBox.addEventListener('input', function (event) {
          // 获取光标位置
          that.getCaretPosition()
        })
      })
    },

    btnOkResult() {
      switch (this.dbclObj.colName) {
        case 'suggestionTitle':
          this.sumDoctorCheck.suggestionList[this.dbclObj.index][this.dbclObj.colName] = this.curResult
          break;
        default:
          this.sumDoctorCheck.suggestionList[this.dbclObj.index][this.dbclObj.colName][this.dbclObj.subIndex]['suggestionContent'] = this.curResult
          break;
      }
      this.dialogWinSymbols = false
    },

    findEl(fEl, nodeName) {
      let el = null
      for (let i = 0; i < fEl.children.length; i++) {
        console.log(fEl.children[i].nodeName)
        if (fEl.children[i].nodeName == nodeName) {
          el = fEl.children[i]
          break
        } else {
          el = this.findEl(fEl.children[i], nodeName)
        }
        if (el) break
      }
      return el
    },


    rowClickSug0(row) {
      this.rowClickSug(row, 0)
    },
    rowClickSug1(row) {
      this.rowClickSug(row, 1)
    },
    rowClickSug2(row) {
      // console.log('column',column.property) -- suggestionContent
      this.rowClickSug(row, 2)
    },

    rowClickSug(row, contentType) {
      let lcontentType = 'healthGuidances'
      switch (contentType) {
        case 0:
          lcontentType = 'medicalInterpretations'
          break;
        case 1:
          lcontentType = 'commonReasons'
          break;
        default:
          break;
      }
      let lfind = arrayExistObj(this.sumDoctorCheck.suggestionList, 'id', row.sumSuggestionHeaderId)
      if (lfind > -1) {
        this.sugDetails = this.sumDoctorCheck.suggestionList[lfind][lcontentType]
        this.rowDropSugDetail(contentType, row.sumSuggestionHeaderId)
      }
      // console.log('this.sumDetails', lfind, this.sugDetails)
    },

    //建议明细拖拽
    rowDropSugDetail(contentType, id) {
      this.$nextTick(() => {
        const fEl = document.getElementById(`${contentType}_sug${id}`)  // document.querySelector(`#${id} tbody`) querySelector为静态方法不支持动态传参;
        console.log('rowDropSumDetail tbody', fEl, fEl.children) //el.childNodes,el.children
        const el = this.findEl(fEl, 'TBODY')
        console.log('rowDropSumDetail tbody', el) //el.childNodes,el.children
        const that = this;

        Sortable.create(el, {
          handle: ".moveTag2",
          animation: 150, // ms, number 单位：ms，定义排序动画的时间
          // 拖拽结束
          onEnd({ newIndex, oldIndex }) {
            that.isshow = false;
            const currRow = that.sugDetails.splice(oldIndex, 1)[0];
            that.sugDetails.splice(newIndex, 0, currRow);
          },
        });
      });
    },

    //拖拽（综述取消拖拽）
    rowDrop() {
      this.$nextTick(() => {
        const el = document.querySelector("#tableSummary tbody");
        console.log('tbody', el)
        const that = this;
        Sortable.create(el, {
          animation: 150, // ms, number 单位：ms，定义排序动画的时间
          //拖拽结束
          onEnd({ newIndex, oldIndex }) {
            that.isshow = false;
            const currRow = that.sumDoctorCheck.summaryList.splice(oldIndex, 1)[0];
            that.sumDoctorCheck.summaryList.splice(newIndex, 0, currRow);
          },
        });
      });
    },

    //拖拽
    rowDropSuggestion() {
      this.$nextTick(() => {
        const el = document.querySelector("#tableSuggestion tbody");
        console.log('tbody', el)
        const that = this;
        Sortable.create(el, {
          handle: ".moveTag",
          animation: 150, // ms, number 单位：ms，定义排序动画的时间
          //拖拽结束
          onEnd({ newIndex, oldIndex }) {
            that.isshow = false;
            const currRow = that.sumDoctorCheck.suggestionList.splice(oldIndex, 1)[0];
            that.sumDoctorCheck.suggestionList.splice(newIndex, 0, currRow);
          },
        });
      });
    },

    // 右击复制粘贴
    // 依次为：撤销、重做、剪切、复制、粘贴、删除、全选、非选
    // undo: () => Promise<any>;
    // redo: () => Promise<any>;
    // cut: () =>Promise<any>;
    // copy: () => Promise<any>;
    // paste: () => Promise<any>;
    // delete: () => Promise<any>;
    // selectAll: () => Promise<any>;
    // unselect: () => Promise<any>;
    onContextmenu(event) {
      if (!this.$peisAPI) {
        return
      }

      console.log('this.$peisAPI.contextMenuForPeis()')
      this.$peisAPI.contextMenuForPeis()
        .then(res => {
          console.log('res', res)
        })
        .catch(err => {
          console.log('err', err)
        })
        .finally(() => {
          console.log('finally')
        })

      /*
      let items = [
        {
          label: "复制",
          onClick: () => {
            console.log('this.$peisAPI.copy()')
            this.$peisAPI.copy()
              .then(res => {
                console.log('res', res)
              })
              .catch(err => {
                console.log('err', err)
              })
              .finally(() => {
                console.log('finally')
              })
          },
        }, {
          label: "剪切",          
          onClick: () => {
            console.log('this.$peisAPI.cut()')
            this.$peisAPI.cut()
              .then(res => {
                console.log('res', res)
              })
              .catch(err => {
                console.log('err', err)
              })
              .finally(() => {
                console.log('finally')
              })
          },
        }, {
          label: "粘贴",
          onClick: () => {
            console.log('this.$peisAPI.paste()')
            this.$peisAPI.paste()
              .then(res => {
                console.log('res', res)
              })
              .catch(err => {
                console.log('err', err)
              })
              .finally(() => {
                console.log('finally')
              })
          },
        }
      ]

      this.$contextmenu({
        items,
        event,
        x: event.clientX,
        y: event.clientY,
        customClass: "custom-class",
        zIndex: 3,
        minWidth: 80,
      });
      */
    }
  },

  //监听事件
  watch: {
    // 虚拟表 人员更换时，综述建议一定刷新
    "dataTransOpts.tableS.patient_register.id": {
      // immediate:true,
      handler(newVal, oldVal) {
        console.log(`watch 总检--综述建议patient_register.id newVal: ${newVal}, oldVal: ${oldVal} patientRegisterId: ${this.dataTransOpts.tableS.patient_register.id}`);
        if (newVal != oldVal && this.tabChoosed != '1') this.getHaveSumData(this.dataTransOpts.tableS.patient_register.id)
      }
    },

    // 虚拟表 触发强制刷新 （sumDoctor.M 合并包含：综述、建议、对比、历史等，不包含总检诊断）
    "dataTransOpts.refresh.sumDoctor.M": {
      // immediate:true,
      handler(newVal, oldVal) {
        console.log(`watch 总检--综述建议sumDoctor.M  newVal: ${newVal}, oldVal: ${oldVal} patientRegisterId: ${this.dataTransOpts.tableS.patient_register.id}`);
        if (newVal != oldVal && this.tabChoosed == '1') this.getHaveSumData(this.dataTransOpts.tableS.patient_register.id)
      }
    },
  },
};
</script>
<style scoped>
@import '../../assets/css/global_table.css';
@import '../../assets/css/global.css';

::v-deep .el-icon-search:before {
  color: #00F;
}


/* 设置单元格内内容顶对齐 */
::v-deep .el-table__cell {
  display: table-cell;
  /* 使单元格表现为表格单元 */
  vertical-align: top;
  /* 顶对齐 el-table_2_column_2   el-table__cell */
}

::v-deep .el-textarea__inner {
  min-height: 23px;
  height: 23px;
  line-height: 1.25;
  padding: 1px 15px 1px 2px;
}

::v-deep .el-table__empty-text {
  line-height: 22px;
}

::v-deep .el-tag {
  color: black;
  padding: 0 5px;
  font-size: 14px;
}

::v-deep .el-table__empty-block {
  min-height: 22px;
}

::v-deep .el-input__inner {
  min-height: 23px;
  height: 23px;
  padding: 1px 15px 1px 2px;
}

::v-deep .commonFont .el-textarea__inner {
  font-family: "Microsoft YaHei";
}

::v-deep .diagnosisSelect .el-select-dropdown__wrap {
  background-color: #FFF;
  max-height: 288px;
}
</style>
