<template>
    <div class="right-con">
      <p>时间轴</p>
      <div style="padding: 0 20px">
            <!-- <el-date-picker
              style="width: 100%; margin-bottom: 10px"
              size="small"
              v-model="time"
              @change="inputChang"
              type="daterange"
              range-separator="-"
              value-format="yyyy-MM-dd"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            >
            </el-date-picker> -->
            <lv-cascader @change="exportTimeLineToData" @treeChange="treeChange" v-model="input" :options="options"></lv-cascader>
      </div>
      <el-scrollbar class="scroll" tag="div">
        <el-empty v-if="!timelineData.length" :image="require('@/assets/images/empty.png')" description="暂无数据~"></el-empty>
        <div class="timeline-item"
          v-for="(items, indexs) in timelineData"
          :key="indexs"
        >
          <div class="timeline-left">
            <p>{{items.date}}</p>
          </div>
          <div class="timeline-right">
            <div v-for="(item,index) in items.child" :key="'c_' + index" style="margin-bottom:5px">
              <!-- 标题 -->
              <p class="text text-head"  :style="{'font-weight':item.subCategory=='diagnose'?'normal':'bold'}">

                <!-- 标题无hover效果的 -->
                <span class="click-text text-active nohover" :class="{'noRadius': item.category==='outpatients_hospital_record' && item.subCategory=='diagnose' && item.data.diagnosticType}" v-if="setTitleNoHover(item)">
                  <titlePrev @check="(e) => check(item,e)" :item="item"/>
                  {{ item.title }}</span>

                <!-- 时间轴报告 -->

                <!--非文书或者不是文书外院的标题-->
                <!-- <template v-if="(setTimelineShow(item,'subCategory') && (item.category !='writer' || (item.category =='writer' && item.type != '外院')) && item.category !='pathology')">
                  <span
                    :class="{
                      'timelineSelectedStyle':(setTimelineShow(item,'subCategory') && (item.category !='writer' || (item.category =='writer' && item.type != '外院'))),
                      'timelineSelectedStyleNo':!((setTimelineShow(item,'subCategory') && (item.category !='writer' || (item.category =='writer' && item.type != '外院'))))
                      }"
                    @click="check(item)">
                    {{ item.title ||item.outTitle|| item.description }}
                  </span>
                </template> -->

                <!-- 新增外院 -->
                <template  v-if="secondaryTitleJudgment(item.subCategory) && item.other && item.other.templateResource">
                  <span @click="check(item)"
                    :class="{
                      'timelineSelectedStyle':secondaryTitleJudgment(item.subCategory) && item.filePath,
                      'timelineSelectedStyleNo':!(secondaryTitleJudgment(item.subCategory) && item.filePath)
                      }"
                  >
                    {{ item.data.title}}1
                  </span>
                </template>

                <!-- 标题有报告 -->
                <span class="click-text"
                :class="{'text-active': setTimelineShow(item,'subCategory') || setSortPathology(item,'subCategory')}"
                v-if="!setTitleNoHover(item) && item.subCategory != 'mdt'"
                @click="check(item)">
                <titlePrev :gray="setTimelineShow(item,'subCategory') || setSortPathology(item,'subCategory')" @check="(e) => check(item,e)" :item="item"/>
                {{ item.title }}</span>
              </p>

              

              <!-- record_mdt -->
              <template v-if="item.subCategory === 'record_mdt'">
                <div  class="sec-descript">
                  <span style="font-size: 12px;font-weight: initial;">{{ item.status }}</span>
                  <span style="font-size: 13px;font-weight: initial;">{{ item.subject }}</span>
                </div>
                <div class="sec-descript">
                  <span style="font-size: 13px;font-weight: initial;">{{ item.dateTime.slice(0,16) }}</span>
                </div>
              </template>

              <!-- 外院链接 -->
              <template v-if="item.type == '外院'">
                <div class="out-box outerCourt">
                  <p  v-if="item.filePath || item.urls" @click="handleDirectClcik(item.filePath || item.urls,item)">
                    <i class="iconfont icontuxiang" style="font-size:18px !important"></i>附件
                    <span class="red-num outerCourtNumber">{{outerCourtAttachmentNumber(item)}}</span>
                  </p>
                  <p v-if="item.dcmUrl!=''" class="middles" style="color:#3e98ff;cursor: pointer;" @click="outerCourtButtonGroup(2,item)">
                    <i class="el-icon-paperclip"></i>Dicom
                  </p>
                  <p class="middles" v-if="item.extUrl">
                    <el-popover
                      placement="top"
                      width="400"
                      trigger="hover"
                      popper-class="externalLinks">
                      <span v-for="(i,index) in item.extUrl" :key="index" @click="outerCourtButtonGroup(3,i)" class>{{i}}</span>
                      <span  style="color:#3e98ff;cursor: pointer;" slot="reference">
                        <i class="el-icon-paperclip"></i>链接<span class="red-num outerCourtNumber">{{item.extUrl.length}}</span>
                      </span>
                    </el-popover>
                  </p>
                </div>
              </template>

              <!-- 离院原因 -->
              <p class="descript">{{ item.data.homeOutHospitalTypeName }}</p>

              <!-- 描述 -->
              <p class="sec-descript" v-if="!(item.subCategory == 'pathology' && item.type == '本院') && item.subCategory != 'mdt' && (item.subCategory != 'diagnose' || (item.subCategory == 'diagnose' && item.type == '外院'))">
                <!-- {{item.des}} -->
                {{item.des&&item.type == '本院'&&(item.subCategory=='outHospital'||item.subCategory=='inHospital')?(item.subCategory=='outHospital'?'出院诊断:':'入院诊断:'):''}}{{ item.des|| item.data.content }}
                <!-- 是否显示标准的药物医嘱用量 -->
                <span class="ywts-con" v-if="item.noticed">
                  <el-tooltip
                    class="item"
                    effect="dark"
                    :content="item.noticeMsg"
                    placement="top-start"
                  >
                    <img
                      class="icon_ywts"
                      :src="require('@/assets/images/icon_ywts.png')"
                    />
                  </el-tooltip>
                </span>
                <el-tooltip placement="top-start" :open-delay="500"  class="tolStyle" v-if="item.category==='treatment'&&item.subCategory=='drug'&&item.drugAliasList.length>0">
                  <div slot="content">
                    <div v-for="(e, index) in item.drugAliasList" :key="e.drugCode + 's_+' + index" :style="index != item.drugAliasList.length - 1 ? 'margin-bottom: 4px' : ''">
                      <span class="tipPoint"></span>
                      <span >{{ e.drugAlias}}</span>
                      <br/> 
                    </div>
                  </div>
                  <span>
                    <span class="tishi_icon"></span>
                  </span>
                </el-tooltip>
              </p>

              <!-- MDT相关 -->
              <p  class="text text-head text-mdt" v-if="item.data.meetingType">
                <span class="click-text" :class="{'text-active': getMeetingType(item, 'source')}" @click="check(item, 'source')">病例资料整理</span>
                <span class="click-text" :class="{'text-active': getMeetingType(item, 'sumary')}" @click="check(item, 'sumary')">MDT小结</span>
                <span class="click-text" :class="{'text-active': getMeetingType(item, 'mdt')}" @click="check(item, 'MDT')">{{item.data.meetingType == "Tumor Board" ? "Tumor Board咨询建议书" : "MDT咨询建议书"}}</span>
              </p>

              <!-- 原始图像 -->
              <template v-if="item.data.accessionNumber && (item.data.checkType!='PT'&&item.data.checkType!='PETCT')">
                <div class="out-box outerCourt">
                  <p  v-if="item.filePath || item.urls" @click="handlerOriginalImage(item.data.accessionNumber)">
                    <i class="iconfont icontuxiang" style="font-size:18px !important"></i>原始图像
                  </p>
                  <p  v-if="item.filePath || item.urls" @click="handlerImageLink(item)">
                    <i class="iconfont iconfujian" style="font-size:16px !important"></i>复制链接
                  </p>
                </div>
              </template>

              <!-- 视频 -->
              <!-- <template v-if="item.data.accessionNumber && (item.data.checkType!='PT'&&item.data.checkType!='PETCT')">
                <div class="out-box outerCourt">
                  <p class="video" @click="handlerOriginalImage(item.data.accessionNumber)">
                    <i class="iconfont iconshipintonghuaicon" style="font-size:16px !important"></i>视频回放
                    <span class="red-num outerCourtNumber">4</span>
                  </p>
                </div>
              </template> -->
            </div>
          </div>
        </div>
        
      </el-scrollbar>
       <!-- 全屏弹窗 -->
      <el-dialog
        :visible.sync="dialogVisible"
        fullscreen
        :modal="false"
        :append-to-body="true"
        :before-close="handleClose"
        :modal-append-to-body="true"
        custom-class="new-mdt-dialog"
        class='timeLineCloes'
        :show-close="false"
      >
        <div class="tl-mdt-row">

          <!-- 左边 -->
          <div class="tl-mdt-row-left" v-show="leftShow()">
            <h3>病例资料</h3>
            <div class="origin-report-box" v-if="dialogDataType === 'GEgeReport'">
              <p><span>影像号</span><span>{{' ' + geReportShows.accessionNumber}}</span></p>
              <div class="origin-box">
                <p><span @click="OpenOriginalImage"><i class="el-icon-paperclip"></i>原始图像</span></p>
                <p><span @click="OpenAllReports"><i class="el-icon-paperclip"></i>全部报告</span></p>
              </div>
            </div>
            <el-scrollbar tag="div" class="row-left-scrollbar">
              <template v-if="dialogDataType == 'GEgeReport'">
                <p @click="handleOpenUrl(1)" class="filename-list" :class="{ 'active': switchReport == 1 }">
                  <i class="el-icon-document"></i>原始报告
                </p>
                <p @click="handleOpenUrl(2)" class="filename-list" :class="{ 'active': switchReport == 2 }">
                  <i class="el-icon-document"></i>文字报告
                </p>
                <p @click="handleOpenUrl(3)" class="filename-list" :class="{ 'active': switchReport == 3 }" v-if="geReportShows.inspectInfoRequisition==1">
                  <i class="el-icon-document"></i>检查申请单
                </p>
              </template>
              <template v-else-if="['record','fRecord','aRecord','rRecord','surgery','anesthia','pOutRecords'].includes(dialogDataType)">
                <p class="filename-list" :class="{ 'active': activeIndex == 0 }">
                  <i class="el-icon-document"></i>{{ getLeftText(dialogDataType) }}
                </p>
              </template>

              <!-- 检验 -->
              <template v-else-if="dialogDataType == 'list'">
                <p @click="handleInspectCheckClick(0)" class="filename-list" :class="{ 'active': activeIndex == 0 }">
                  <i class="el-icon-document"></i>检验报告单
                </p>
                <p @click="handleInspectCheckClick(1)" class="filename-list" v-if="inspectInfo.inspectInfoRequisition==1" :class="{ 'active': activeIndex == 1 }">
                  <i class="el-icon-document"></i>检查申请单
                </p>
              </template>

              <!-- risp -->
              <template v-else-if="dialogDataType == 'risp'">
                <template>
                  <p class="filename-list"
                  @click="hanldeUrlClick(item.type, item.url, index,item)"
                  :class="{ 'active': activeIndex == index }"
                  v-for="(item, index) in urlList" :key="'tl_' + index">
                    <i class="el-icon-document"></i>
                    {{ item.title || item.label }}
                  </p>
                </template>
                <p @click="hanldePathologicalApps(urlList[0])" class="filename-list" :class="{ 'active': activeIndex == urlList.length }">
                  <i class="el-icon-document"></i>病理申请单
                </p>
              </template>

              <!-- 检查 -->
              <template v-else>
                <template>
                  <p class="filename-list"
                  @click="hanldeUrlClick(item.type, item.url, index,item)"
                  :class="{ 'active': activeIndex == index }"
                  v-for="(item, index) in urlList" :key="'tl_' + index">
                    <i class="el-icon-document"></i>
                    {{ item.title }}
                  </p>
                </template>
                <p @click="() => { activeIndex = urlList.length; inspectionReportApps(urlList[0].daId) }"
                  v-if="examinationApplicationData.patientName && examinationApplicationData.applicationFormType!='检验'"
                  class="filename-list" :class="{ 'active': activeIndex == urlList.length }">
                  <i class="el-icon-document"></i> 检查申请单
                </p>
              </template>
            </el-scrollbar>
          </div>

          <!-- 中间 -->
          <div class="tl-mdt-row-center">
            <div>
              <template v-if="dialogDataType === 'follow'">
                <timeline-follow :followId="followItem.id" :item="followItem"/>
              </template>
            <!-- 时间轴改版GE -->
            <template v-else-if="dialogDataType === 'GEgeReport'">
              <!-- 原始报告 -->
              <div style="background: #e6e7ec;width: 100%;" v-if="(switchReport==1)">
                <div style="display: flex;justify-content: center;width:100%;height:100%"  class="geScreenLocation"  >
                  <!-- min-width: 880px;max-width:880px; -->
                  <iframe :src="url" style="display: inline-block;" width="100%" height="100%" frameborder="no"></iframe>
                </div>
              </div>
              <!-- 文字报告 -->
              <template v-if="switchReport == 2">
                  <text-report :textInfo="textInfo"></text-report>
              </template>
              <!-- 申请单 -->
              <template v-if="switchReport == 3">
                <apply-form :item="examinationApplicationData"/>
                <!-- <apply-inspect-form :item="examinationApplicationData"/> -->
                <!-- <applyInspectForm/> -->
              </template>
            </template>
            

            <!-- 手术安全核查表 -->
            <template v-else-if="dialogDataType === 'surgery'">
              <surgicalChecklist :operationId="anesthesia.operationId" :id="anesthesia.id"></surgicalChecklist>
            </template>

            <!-- 麻醉记录单 -->
            <template v-else-if="dialogDataType === 'anesthia'">
              <recordList :operationId="anesthesia.operationId" :id="anesthesia.id"></recordList>
            </template>

             <!-- 病理门诊病历 -->
            <template v-else-if="dialogDataType === 'pOutRecords'">
              <div style="top:0;height:100%;margin:0 30px">
                <pathologicalOutpatientRecord :visible="dialogVisible" :type="dialogDataType" :visitNo="visitNo"></pathologicalOutpatientRecord>
              </div>
            </template>

            <!-- 会诊申请 -->
            <template v-else-if="dialogDataType === 'aRecord'">
              <applyConsultation :visitNo="visitNo" :visible="dialogVisible" :type="dialogDataType"></applyConsultation>
            </template>

            <!-- 会诊记录 -->
            <template v-else-if="dialogDataType === 'rRecord'">
              <!-- <consultation :consultationInfo="consultationInfo"></consultation> -->
              <consultation :visitNo="visitNo" :visible="dialogVisible" :type="dialogDataType"></consultation>
            </template>

            <!-- 住院病历 -->
            <template v-else-if="dialogDataType === 'page'">
              <template>
                <iframe :src="url" width="100%" height="100%"></iframe>
              </template>
            </template>

            <!-- 检验报告 -->
            <template v-else-if="dialogDataType=='list'">
              <template v-if="activeIndex == 0">
                <respection-table ref="respectTable" :info="inspectInfo" :visible.sync="dialogVisible" :titleType="titleType" :val="backInspectInfo"/>
              </template>
              <template v-else>
                <apply-inspect-form :item="examinationApplicationData"/>
              </template>
            </template>

            <template v-else-if="dialogDataType=='check'">
              <template v-if="activeIndex == 0">
                <iframe width="100%" height="99%" :src="url" v-if="['pdf','PDF'].includes(type)" frameborder="0"/>
                <div v-else style="width: 760px;margin: 30px 0;">
                  <img :src="url" alt ref="print"  />
                </div>
              </template>
              <template v-else-if="activeIndex == 1">
                <apply-form :item="examinationApplicationData"/>
              </template>
            </template>

            <!-- 门诊实时病历 ||妇科门诊病历-->
            <template v-else-if="dialogDataType === 'record' || dialogDataType === 'fRecord'">
              <!-- <div class="styleBox">
                <iframe v-if="timelineOutpatientInformationstr" :src="timelineOutpatientInformationstr" frameborder="0" :width="widthThe?'120%':'100%'" height="100%"></iframe>
              </div> -->
              <div class="padding-box">
                <template v-if="dialogDataType === 'record'">
                  <MedicalRecord :caseHistory="caseHistory"></MedicalRecord>
                </template>
                <template v-else>
                  <Gynaecology :caseHistory="caseHistory"></Gynaecology>
                </template>
              </div>
            </template>


            <!-- GE的链接处理 -->
            <template v-else-if="dialogDataType === 'GePage'">
              <el-tabs v-model="activeName">
                <el-tab-pane
                  v-for="item of urlList"
                  :key="item.type"
                  :lazy="true"
                  :label="item.label"
                  :name="item.type"
                >
                  <iframe :src="item.url" width="100%" height="100%"></iframe>
                </el-tab-pane>
              </el-tabs>
            </template>
            <template v-else-if="dialogDataType == 'risp'">
              <div class="url-mdt-content">
                <div class="url-mdt-content-right" style="height: 100%">
                  <el-scrollbar class="mdt-in-scroll" style="height: 100%" ref="scroll">
                    <template v-if="activeIndex != urlList.length">
                      <risp-show
                      :examId="url"
                      :getDocReprotDataRequest = rispRequest.getDocReprotDataRequest
                      :getExamsInfoRequest = rispRequest.getExamsInfoRequest
                      :getReportBaseInfoRequest = rispRequest.getReportBaseInfoRequest
                      :getReferenceByReportIdRequest = rispRequest.getReferenceByReportIdRequest
                      :checkUniqueRequest = rispRequest.checkUniqueRequest
                      :getCurtCapHistoryFormRequest = rispRequest.getCurtCapHistoryFormRequest
                      style="display: inline-flex;justify-content: center;width: 100%;background: #e6e7ec;margin: 30px 0"
                      ref="rispShow"
                      @rispPrint="onRispprintStatus"
                      ></risp-show>
                    </template>
                    <template v-else>
                      <div style="width:100%;display:flex;justify-content: center;height:100%;border-left:1px solid #D7D7D7;border-right:1px solid #D7D7D7;">
                        <iframe :src="pathologicalExamination" width="100%" allowtransparency="yes" height="100%" frameborder=0></iframe>
                      </div>
                    </template>
                  </el-scrollbar>
                </div>
              </div>
            </template>

            <!-- PDF或者risp -->
            <template v-else-if="dialogDataType === 'imgPdf' ||
              dialogDataType === 'ECImg'
              ">
              <div class="url-mdt-content">
                <div class="url-mdt-content-right" style="height: 100%">
                  <el-scrollbar class="mdt-in-scroll" style="height: 100%" ref="scroll">
                    <template v-if="type.toLowerCase() === 'pdf' || type.toLowerCase() === 'word'">
                      <iframe :src="url" width="100%" height="100%"></iframe>
                    </template>
                    <template v-else>
                      <img :src="url" alt />
                      <div style="margin: -200000px; z-index: -1">
                        <img :src="url" alt ref="print" style="width: 760px" />
                      </div>
                      <div class="print-position">
                        <div class="pdf-box" ref="Page">
                          <img :src="url" class="print-rise-img" alt />
                        </div>
                      </div>
                      <div class="print-positions">
                        <div class="pdf-boxBox" ref="printBate">
                          <div class="img-item" style="page-break-after: always;" >
                            <img :src="url" class="print-rise-img" alt="">
                          </div>
                        </div>
                      </div>
                    </template>
                  </el-scrollbar>
              </div>
              <div class="url-mdt-content-extend" v-show="!(type.toLowerCase() == 'pdf' || type.toLowerCase() == 'word')">
                <!-- <template v-if="type === 'risp'">
                  <el-button
                    type="primary"
                    size="small"
                    class="print-button"
                    v-show="rispCanPrint && rispPrintButtonIsShow"
                    @click="printRisp(printInspectUrl)"
                  >打 印</el-button>
                </template>
                <template v-else>
                  <el-button
                    type="primary"
                    v-if="dialogDataType!='surgery' && dialogDataType!='anesthia'"
                    size="small"
                    class="print-button"
                    @click="handleReportPrint(urlList)"
                  >打 印</el-button>
                </template> -->
              </div>
                </div>
            </template>

            <!-- 图片或者其他链接 -->
            <template v-else>
              <img :src="url" alt />
              <div style="margin: -200000px; z-index: -1">
                <img :src="url" alt ref="print" style="width: 760px" />
              </div>
              <div class="print-position">
                <div class="pdf-box" ref="Page">
                  <img :src="url" class="print-rise-img" alt />
                </div>
              </div>
              <div class="print-positions">
                <div class="pdf-boxBox" ref="printBate">
                  <div class="img-item" style="page-break-after: always;" >
                    <img :src="url" class="print-rise-img" alt="">
                  </div>
                </div>
              </div>
            </template>
            </div>
          </div>
          <div class="tl-mdt-row-right">
            <div class="tl-right-top">
              <el-tooltip class="item" effect="dark" content="关闭" placement="bottom">
                <div style="font-size:28px" class="boxbox" @click="handleClose"><i class="el-icon-close"></i></div>
              </el-tooltip>
            </div>
            <div class="tl-right-bottom">
              <!-- <el-button type="pramary" size="small">打印</el-button> -->
            </div>
          </div>
        </div>
      <!-- <template slot="title" style="display:flex">
          <div>
            <span v-if="dialogDataType != 'record'&&dialogDataType != 'fRecord'">病例资料</span>
          <el-button
            size="mini"
            type="text"
            v-if="extUrlList.length"
            style="margin-left: 15px"
            @click="openUrlList(extUrlList)"
          >外部链接</el-button>
          </div>
         
          <el-tooltip class="item" effect="dark" content="关闭" placement="bottom">
            <div style="font-size:28px" class="boxbo" @click="handleClose"><i class="el-icon-close"></i></div>
          </el-tooltip>
        </template> -->
        <!-- @click="handleOpenLinks" -->
        



        
      </el-dialog>


      <el-dialog
        width="30%"
        :title="recordsInfo.name"
        :visible.sync="trendVisible"
        custom-class="trendDialogmdts"
        :modal-append-to-body="false"
        @before-close="trendVisible = false"
      >
        <div slot="title" class="header">
          <span class="dialog-title">{{ recordsInfo.name }}</span>
          <div style="display:flex;justify-content: center;">
            <span class="type-value">
              <i style="backgroundColor:#F94B4B;margin-right:12px"></i>危急值
            </span>
            <span class="type-value">
              <i style="backgroundColor:#06af67;margin-right:12px"></i>参考值
            </span>
            <span class="type-value">
              <i style="backgroundColor:#218cfa;margin-right:12px"></i>指标数值
            </span>
          </div>
        </div>
        <div class='clinicalSignificance' v-if='recordsInfo.clinical'>临床意义:<span>{{ recordsInfo.clinical}}</span></div>
        <line-chart :recordsInfo="recordsInfo" :visible="trendVisible"></line-chart>
      </el-dialog>
      <!-- 放射治疗的弹窗 -->
      <el-dialog
        :visible.sync="radiationVisible"
        fullscreen
        class="radiationTherapyDialog"
        :modal="false"
        :append-to-body="true"
        :before-close="handleRadiationClose"
        :modal-append-to-body="true"
      >
        <!-- 放射治疗 -->
        <template>
          <radiotherapy
            :rationInfo="rationInfo"
            :visible="radiationVisible"
            :radiationInDate="radiationInDate"
            @handleGetOrderInfo="handleGetOrderInfo"
          ></radiotherapy>
        </template>
      </el-dialog>
    </div>
</template>
<script>
import moment from 'moment'
import titlePrev from './titlePrev.vue'
import textReport from './components/timeline/textReport.vue'
import applyForm from './components/timeline/apllyForm.vue'
import applyInspectForm from './components/timeline/applyInspectForm.vue'
import { encodeURI } from "js-base64";
import {
  getDocReprotData,
  getExamsInfo,
  getReportBaseInfo,
  getReferenceByReportId,
  checkUnique,
  getCurtCapHistoryForm
} from "@/request/risp";
import {getPatientsImg,getGeList,getLoginToken,getReportInfo,getTimeLabList,getReportData,exportTimeLineToData,getTimelineFirst,querySchemeNum,queryScheme,getLoginUserInfo,getApplicationForm,timelineCopyImageLinks } from '@/request/timeline'
import {getPcafInfo,getPcrInfo} from '@/request/common.js'
import {Print} from "aegle-sp-components/src/utils/print";
import printHtml from 'aegle-sp-components/src/utils/printRisp.js'
import { httpproxyMethod } from 'aegle-sp-components/src/utils/index.js'

import lvCascader from './lv-cascader.vue'
import { handleSortData } from "aegle-sp-components/src/utils/handleTimeLineData";
import { handleSetMedicalData } from 'aegle-sp-components/src/utils/handleData'
import { cloneDeep } from 'lodash'
import lineChart from './components/lineChart/line-chart.vue'
import consultation from './components/consultation/consultation.vue'
import applyConsultation from './components/consultation/apply-consultation.vue'
import Gynaecology from './components/medicalRecords/gynaecology.vue'
import MedicalRecord from './components/medicalRecords/medicalRecord.vue'
import pathologicalOutpatientRecord from './components/medicalRecords/pathologicalOutpatientRecords.vue'
import respectionTable from './components/inspectioinTable/index.vue'

import rispShow from './components/risp-show/risp-report/index.vue'
import radiotherapy from './components/radiotherapy/radiotherapy.vue'
import surgicalChecklist from './components/anesthesia/surgicalChecklist.vue'
import recordList from './components/anesthesia/recordList.vue'
import timelineFollow from './components/follow/index'
import axios from 'axios'
import mixin from './timelineMixin'
import { mockTimeData } from './data'
import { getWriterUrl, setWriterBtn,handleDataFormat,getObjectURL,getQueryObject } from './timeline'
import { isPdfImgFile } from 'aegle-sp-components/src/utils/index'
const catalog = ['outpatients_hospital_record',]
import {DataType,preImageUrl,preGeImageUrl,GeTextInfo,DefaultReportInfo,InspectReportPatientInfo,GeReportShows,PathologicalOutpatientRecords} from './timelineConst'
export default {
    components: {
      timelineFollow,
        lineChart,
        consultation,
        applyConsultation,
        Gynaecology,
        MedicalRecord,
        lvCascader,
        rispShow,
        radiotherapy,
        surgicalChecklist,
        recordList,
        textReport,
        applyForm,
        applyInspectForm,
        titlePrev,
        pathologicalOutpatientRecord,
        respectionTable
    },
    mixins: [mixin],
    data() {
        return {
          followItem: {
            id: ''
          },
          visitNo: '',
          backInspectInfo: {daId: '',title: ''},
          //检验数据
          inspectInfo: {
            list: [],
            status: 0,
            reportPatientInfo: InspectReportPatientInfo
          },
          //GE文字报告
          textInfo: GeTextInfo,
          examinationApplicationData: {
            status: 0,
            patientName: ''
          },
          switchReport: 1,//报告类型
          widthThe: false,
          printInspectUrl: "",
          titleType: '',
          dicList:[],
          selectTreeId: [],
          dialogVisible: false,
          // dialogDataType: 'imgPdf',
          dialogDataType: 'GEgeReport',
          // dialogDataType: '',
          extUrlList: [],
          activeIndex: 0,
          urlList: [{
            label: ''
          }],
          conHeight: '500px',
          type: '',
          url: '',
          referenceList: [],
          activeReferenceIndex: 0,
          activeName: 'GePage',
          caseHistory: {},
          // consultationInfo: {},
          Type: '',
          recordsInfo: {
            list: [],
            timeList: [],
            name: "",
            unit: "",
            maxNum: "",
            minNum: "",
            itemRef: "",
            panLow: "",
            panHigh: "",
            markLineList: []
          },
          trendVisible: false,
          radiationVisible: false,
          rationInfo: {
            status: true
          },
          // 放疗弹窗
          radiationVisible: false,
          radiationInDate: "",
          time: '',
          input: '',
          configIp: 108,
          props: { multiple: true },
          categoryLineData: [],
          timelineData: [],
          tableModal: [],
          options: [],
          //risp
          rispRequest: {
            getDocReprotDataRequest: getDocReprotData,
            getExamsInfoRequest: getExamsInfo,
            getReportBaseInfoRequest: getReportBaseInfo,
            getReferenceByReportIdRequest: getReferenceByReportId,
            checkUniqueRequest: checkUnique,
            getCurtCapHistoryFormRequest: getCurtCapHistoryForm
          },
          labList: [],
          timelineArr: [],
          anesthesia: {
            operationId: '',
            id: ''
          },
          rispCanPrint: false,
          rispPrintButtonIsShow: false,
          printObj:{
            id: "medical-record", //打印区域 Dom ID
            popTitle: '门诊病历',//打印页面标题文字
            // extraCss: 'https://www.google.com,https://www.google.com',
            extraHead: '', //  可以传进去  style tag 标签；注意要逗号分隔   解决特定区域不显示问题；
          },
          timelineOutpatientInformationstr:"",
          //GE报告
          geReportShows:{
            ...GeReportShows
          },
        }
    },
    inject: ['topObj'],
    created() {
      this.configIp = this.topObj.setting == 'test' ? 108 : 111;
      this.openTimeline()
      this.conHeight = document.documentElement.clientHeight - 120 + "px";
      if(window.screen.width >2293) this.widthThe=true;
    },
    watch: {
        // 门诊病历数据
        caseHistory: {
          handler(val) {
            if (val && val.status) {
              this.dialogVisible = true;
            }
          },
          deep: true,
          immediate: true
        },
        // 放疗数据
        rationInfo: {
          handler(val) {
            if (val && this.dialogDataType === "radiationTherapy" && !val.status) {
              this.radiationVisible = true;
            }
          },
          deep: true,
          immediate: true
        },
        labList: {
          handler(val) {
            if (val.length) {
              this.recordsInfo.list = val.map(item => {
                return item.value;
              });
              this.recordsInfo.timeList = val.map(item => {
                return item.time;
              });
              let { itemRef, panLow, panHigh, list } = this.recordsInfo;
              let { maxNum, markLineList, minNum } = setMarkLineList(itemRef, panLow, panHigh, list);
              this.recordsInfo.maxNum = maxNum;
              this.recordsInfo.minNum = minNum;
              this.recordsInfo.markLineList = markLineList;
              setTimeout(() => {
                this.trendVisible = true;
              }, 0);
            }
          },
          deep: true,
          immediate: true
        },
    },
    methods: {
      handleInspectCheckClick(index) {
        if(this.dialogDataType === 'list'){
          if(!this.inspectInfo.inspectInfoRequisition) return false;
          this.activeIndex = index;
          console.log(this.backInspectInfo);
          if(index){
            this.inspectionReportApps(this.backInspectInfo.daId)
          }
        }
      },
      getLeftText(t) {
        console.log(t);
        return DataType[t] || ''
      },
      leftShow() {
        return this.dialogDataType == 'follow' ? false : true;
        if(this.dialogVisible){
          let dataType = ['aRecord','rRecord','record','fRecord','list']
          if(!dataType.includes(this.dialogDataType)) return true;
          return false
          
        }
      },
      //打开GE原始报告
      handlerOriginalImage(val){
        window.open(`http://10.72.2.75/zfp?mode=proxy&lights=on#View&un=ZFP&pw=YZgE1DLeUT1in5UvklniAKuFmApVmnv6PbqMYavKTyVZw9wMUR%2bAL5JPGm27btTp&ris_exam_id=${val}`,"_blank")
      },
      //GE跳转原始图像
      OpenOriginalImage() {
        window.open(this.geReportShows.geOriginalImage, "_blank");
      },

      //GE跳转全部图像
      OpenAllReports() {
        window.open(`http://10.72.2.76:8080/webreport/OpenAPIAction.do?cmd=showlist&un=webreport&pw=webweb&patientid=${this.geReportShows.healthCardNo}`, "_blank");
      },

      //复制链接
      async handlerImageLink(data){
        // this.$emit('imageLink',data)
        const el = document.createElement('input')
        let str =`http://survey-form.arioncc.cn/shareLinks?imageNo=${data.data.accessionNumber}`
        // 给input元素赋值需要复制的文本
        console.log(el);
        el.setAttribute('value',str)
        // 将input元素插入页面
        document.body.appendChild(el)
        // 选中input元素的文本
        el.select()
        // 复制内容到剪贴板
        document.execCommand('copy')
        // 删除input元素
        document.body.removeChild(el)
        this.$message({
          message: '复制成功',
          type: 'success'
        });
        await timelineCopyImageLinks({ imageNo: data?.data?.accessionNumber })
      },

      // 检验申请单
      async inspectionReportApps(val){
        if(val?.status ==0){
          this.examinationApplicationData.patientName='';
          this.examinationApplicationData.status=0;
        }else{
          this.examinationApplicationData.status = 0
          const res= await getApplicationForm(val)
          if(res.code==0){
            if(res?.data?.reportApplicationForm) {
              let {
              patientId,
              patientName,
              deptName,
              paymentType,
              daContent,
              medicalRecords,
              supplementaryExamination,
              checkPurpose,
              checkParts,
              applyForDoctor,
              applicationFormId,
              sampleType,
              diagnoseName,
              applyDept,
              executeDept,
              applyTime,
              daId,
              checkProName
            } = res?.data?.reportApplicationForm
            let { gender,age } = res?.data?.patientBase
              this.examinationApplicationData = {
                status:1,
                patientId,
                age,
                patientName,
                deptName,
                paymentType,
                daContent,
                medicalRecords,
                supplementaryExamination,
                checkPurpose,
                checkParts,
                applyForDoctor,
                applicationFormId,
                gender,
                sampleType,
                diagnoseName,
                applyDept,
                executeDept,
                applyTime,
                daId,
                checkProName
              }
            } else {
              this.examinationApplicationData = {
                status: 0,
                patientName: ''
              }
            }
            
          } else{
            this.$message.error(res.msg)
          }
        }
      },

      // 查询放疗方案列表
      async getOrderList(radioPatientId) {
        const res = await querySchemeNum(radioPatientId);
        if (res.code == 0) {
          this.rationInfo.dynamicTags = res.data;
          this.handleGetOrderInfo("方案1",radioPatientId);
        }
      },

      //获取放疗查看相关信息
      async handleGetOrderInfo(schemeName,radioPatientId) {
        let res = await queryScheme({ radiationTherapyId: radioPatientId || this.rationInfo.radioPatientId, scheme: schemeName});
        if (res.code != 0) return this.$message.error(res.msg);
        this.rationInfo = {
          ...this.rationInfo,
          status: false,
          radiationStepsInfo: {
            radiotherapyOrder: res.data.radiotherapyOrder,
            afterOrderInfo: res.data.afterloadRadiotherapyOrder
          }
        };
        this.dialogDataType = "radiationTherapy";
        this.radiationVisible = true
      },

      //GE报告
      async getGEReport(val){
        this.geReportShows={
          ...this.geReportShows,
          status: 0
        }
        const arr = val.split('?')[1].split("&")
        const daId = arr[0].split("=")[1]
          let params = {
          healthCardNo: arr[1].split("=")[1],
          daId: daId,
        };
        const res= await getGeList(params)
        const res2= await getApplicationForm(params.daId)
        if (res.code === 0) {
          let {
            accessionNumber,
            patientName,
            age,
            gender,
            findings,
            impression,
            checkProName,
            patientId,
            type,
            examinationDate,
            checkCode,
            inpatientId,
            checkDateStr,
          } = res.data[0]
          this.geReportShows = {
            status:1,
            accessionNumber,
            patientName,
            age,
            gender,
            findings,
            impression,
            checkProName,
            patientId,
            type,
            examinationDate,
            checkCode,
            inpatientId,
            checkDateStr,
            healthCardNo: arr[1].split("=")[1],
            daId,
            inspectInfoRequisition:res2.data.reportApplicationForm ? (res2.data.reportApplicationForm.patientName ? 1 :0):0,
            geOriginalImage: `http://10.72.2.75/zfp?mode=proxy&lights=on#View&un=ZFP&pw=YZgE1DLeUT1in5UvklniAKuFmApVmnv6PbqMYavKTyVZw9wMUR%2bAL5JPGm27btTp&ris_exam_id=${res.data[0].accessionNumber}`,
            GEUrlStr: preGeImageUrl + res.data[0].reportUrl
          }
          this.url = this.geReportShows.GEUrlStr
          this.dialogVisible = true
        } else {
          this.$message.error(res.msg);
        }
      },

      //打开外院组
      outerCourtButtonGroup(val,item){
        if(val==1){
          this.check(item)
        }else if(val==2){
          window.open(item.dcmUrl)
        }else{
          window.open(item,'_blank')
        }
      },

      //时间轴弹窗显示
      async openTimeline(d) {
        // this.exportTimeLineToData()
        this.topObj.handleOption(1,{ pointLoading: true })
        await this.getTimelineFirst()
        await this.exportTimeLineToData()
        this.topObj.handleOption(1,{ pointLoading: false })
      },

      //新版获取时间轴分类的接口
      async  getTimelineFirst() {
        const res = await getTimelineFirst(this.topObj.healthNum)
        // const res = await getTimelineFirst('10000001896')
        if (res.code != 0) return this.$message.error(res.msg);
        let arr = [],catalog = []
        for(let k in res.data) {
          arr.push({ label: res.data[k],value: k })
          catalog.push(k)
        }
        this.options = arr;
        this.selectTreeId = catalog
      },

      //获取时间轴数据新
      async exportTimeLineToData() {
        // this.timelineData = handleSortData(mockTimeData, this.topObj.doctorInfo.username)
        // console.log(this.timelineData);
        // return
        // let param = {
        //   healthCardNo: '10000007414',
        //   // healthCardNo: this.topObj.healthNum,
        //   title: this.input,
        // }
        let param = {
          title: this.input,
          healthCardNo: this.topObj.healthNum,
          // healthCardNo: '10000004750',
          type: 1,
          searchCodeList: this.selectTreeId
        }
        // if(this.time && this.time.length){
        //   param.startTime = this.time[0] + ' 00:00:00',
        //   param.endTime = this.time[1] + ' 23:59:59';
        // }
        // if(!this.selectTreeId.length) {
        //   this.timelineData = []
        //   return
        // }
        // this.selectTreeId.forEach(item => {
        //   param[item] = item
        // })
        const { code, data, msg} = await exportTimeLineToData(param)
        this.topObj.handleOption(1,{ pointLoading: false })
        if (code != 0) return this.$message.error(msg);
        if(this.selectTreeId.length){
          this.timelineData = handleSortData(data, this.topObj.doctorInfo.username)
        } else {
          this.timelineData = []
        } 
      },

      //获取token
      async getLoginToken(url) {
        let params = { userCode: this.topObj?.doctorInfo?.username };
        const res = await getLoginToken(params);
        if (res != null && res != []) this.getLoginUserInfo(url, res.token);
      },
      // 获取认证的医生相关信息
      async getLoginUserInfo(url, token) {
        const res = await getLoginUserInfo({ token });
        if (res != null && res != []) {
          const parm = getQueryObject(url)
          const seturl=`http://10.72.2.60:8080/emrweb/new_version/print_view.html?id=${parm.id}&patientId=${parm.patientId}&vaa07=${parm.vaa07}` + "&jsessionids=" + res.jessionids
          window.open(seturl,"_blank");
        }
      },

      //文书分类选择是值改变
      treeChange(e) {
        this.selectTreeId = e.filter(item => item != 'all')
        if(!this.selectTreeId.length) {
          this.timelineData = []
          return
        }
        this.exportTimeLineToData()
      },
      secondaryTitleJudgment(row){
      // console.log(row)
        if(row!='in_hospital_process'
          &&row!='outpatients_emergency_case'
          &&row!='outHospital'
          &&row!='diagnose'
          &&row!='inHospital'
          &&row!='drug'
          &&row!='examination'
          &&row!='inspectionReport'
          &&row!='record_mdt'
          &&row!='mdt'
          &&row!='diagnose' 
          &&row!='appointment' 
          &&row!='progressNote' 
          &&row!='follow' 
          &&row!='outpatient' 
          &&row!='operation' 
          &&row!='operationf' 
          &&row!='operationDoctorAdvice' 
          &&row!='radiotherapy'
          &&row!='chemotherapy' 
          &&row!='drugMedicine' 
          &&row!='otherAdvice' 
          &&row!='radiationTherapy' 
          &&row!='image' 
          &&row!='pathology' 
          &&row!='medical_record_homepage'
          &&row!='nursing_record'
          &&row!='informed_consent'
          &&row!='operation_anesthesia'
          &&row!='patient_checkup'
        ){
          return true
        }else{
          return false
        }
      },
      
       // 判断数据是否是咨询建议书或会议意见
      getMeetingType(d, t) {
        let status = false;
        if ((t == "mdt" || t == 'MDT') && d.data.status) {
          status = d.data.mergePdfUrl ? true : false;
        } else if (t == "Tumor" && d.data.status) {
          status = (d.data.meetingType == "Tumor Board" && d.data.opinionReportUrl) ? true: false;
        } else if (t == "source") {
          status = d.data.caseReportUrl ? true : false;
        } else if (t == "sumary" && d.data.status) {
          let url = d.data.meetingType == "Tumor Board" ? d.data.tboardReportUrl : d.data.reportUrl;
          status = url ? true : false;
        }
        return status;
      },
      
      //影像报告查看跳转
      checkImage(item) {
        window.open(item.dcmUrl)
      },

      //不需要判断时间轴分类的链接处理

      handleDirectClcik(d,item) {
        if(d) {
          const loadingPdf = this.$loading({
            lock: true,
            text: 'Loading',
            spinner: 'el-icon-loading',
            background: 'rgba(0, 0, 0, 0.7)'
          });
          this.handlePdfUrl(d,[{ title: item.title, label: item.title, type: "imgPdf", url: d }],loadingPdf)
        }
      },

      // 查看链接
      check(val, type) {
        this.activeIndex = 0
        console.log(val);
        // if(!this.setTimelineShow(val,val.oldSubCategory ? 'oldSubCategory' : 'subCategory')) return;
        if(val.subCategory == 'pathology' && !val.urls) {

        } else {
          if(!this.setBtnShowStatus(val, val.oldSubCategory ? 'oldSubCategory' : 'subCategory', type)) return;
        }
        
        // 外部链接处理
        this.extUrlList = val.extUrl ? (Array.isArray(val.extUrl) ? val.extUrl : val.extUrl.split(",")) : [];
        this.handleCheckType(val, val.oldSubCategory ? 'oldSubCategory' : 'subCategory', type)
      },

      // 设置普通的查看显示效果
      setTimelineShow(row, type) {
        if (!row.data.meetingType) {
          return this.setBtnShowStatus(row, row.oldSubCategory ? 'oldSubCategory' : 'subCategory', type)
          // return true
        } else {
          return false;
        }
      },

      //不能点击

      //设置title是否有hover
      setTitleNoHover(row) {
        //  (row.subCategory=='drug' && row.oldSubCategory=='drug')
        // ((item.subCategory == 'inspectionReport' || item.subCategory == 'examination') && (item.oldSubCategory != 'inspectionReport' || item.oldSubCategory != 'examination')) ||
        if(row.subCategory == 'operation' ||
        row.subCategory == 'record_mdt' ||
        row.subCategory == 'outpatient' ||
        row.subCategory == 'outHospital' ||
        row.subCategory == 'inHospital' ||
        row.subCategory == 'appointment' ||
        (row.subCategory=='drug' && (!row.oldSubCategory || row.oldSubCategory == row.subCategory))||
        // (row.subCategory == 'pathology' && Array.isArray(row.data) && row.data.length) ||
        row.subCategory == 'radiotherapy') {
          return true
        } else if(row.category == 'outpatients_hospital_record' && (row.subCategory == 'inHospital' || row.subCategory == 'outHospital'||row.subCategory == 'outPatient' || row.subCategory == 'diagnose')) {
          return true
        } else if((row.subCategory == 'inspectionReport'||row.subCategory=='examination') && (row.oldSubCategory && (row.oldSubCategory != row.subCategory))) {
          return true
        } else {
          return false
        }
      },

      setTitleHover(row) {
        if(row.title == 'record_mdt'){}
      },

      //设置分类
      setBtnShowStatus(row, name, type) {
        if (row[name] == "pathology" && row.urls) {
            return true;
          } else if (row.urls) {
            return true;
            if(row.data.checkStatus=='已审核'||!row.data.checkStatus){
              return true;
            }
          } else if (row.reportData && (name == 'subCategory' || (name == 'oldSubCategory' && (row[name] != 'inspectionReport' || row[name] == row.subCategory)))) {
            return true;
          } else if (row.other.inpatientId) {
            return true;
          }else if(row.title=="病理门诊病历"&&row.visitCardNo){
            return true;
          } else if (row.extUrl) {
            return true;
          } else if (row.data.reportSource == "1" && row.urls) {
            return true;
          } else if(row.data.reportSource=='2' && !row.data.reportUrl && row.data.checkType!='PETCT' && row.data.checkType!='PT'){
            return false;
          }  else if (row.data.reportSource == "2" && row.data.pacsPatientId) {
            return true;
          } else if(row.data.flag===1 || row.data.flag===9){
          return true;
          }  else if ((row[name] === "examination") && row.title.indexOf("PET/CT") != -1 && row.data.pacsPatientId) {
            return true;
          } else if (
            (row[name] === "examination") && Object.keys(row.other).length) {
            return true;
          } else if (
            (row[name] === "radiationTherapy") && row.schemeOut
          ) {
            return true;
          } else if(row[name]==='patient_checkup' && row.data.reportUrl){
            return true;
          }else if(row[name]==='follow' || row[name]==='nursing_record'){
            return true;
          }else if(name == 'oldSubCategory' && row[name]==='drugMedicine'){
            return true;
          }else if(row.subCategory=='image'&&row.urls==''){
            if(row.subCategory=='image'&&row.urls=='')
            return false;
          } else {
              return false;
          }
      },

      //ge报告切换处理
      handleOpenUrl(val, item) {
        this.switchReport = val
        this.activeIndex = val - 1
        if(val == 1) {

        } else if(val == 2) {
          let {inpatientId,patientName,checkCode,gender,type,patientId,checkDateStr,examination,findings,impression} = this.geReportShows;
          this.textInfo = {
            inpatientId,patientName,checkCode,gender,type,patientId,examination,findings,impression,
            checkDateStr: checkDateStr ? moment(checkDateStr).format("YYYY-MM-DD"):''
          }
        } else {
          this.inspectionReportApps(item&&item[0].subCategory=="image" ? item[0].daId : this.geReportShows?.daId)
        }
      },

      // 处理报告的url数据
      handleSetUrl(val, reportUrl,callback) {
        let preUrlArr = reportUrl.split('http').length > 2 ? reportUrl.split(",") : [reportUrl]
        let list = preUrlArr.map((item) => {
          let arr = item.split("/");
          let arr1 = arr[arr.length - 1].split(".");
          if (item.indexOf("http") !== -1) {
            return {
              title: val.title || '',
              label: val.type === "外院" ? (arr1[0].substring(arr1[0].indexOf("_") + 1, arr1[0].length)) : arr1[0],
              type: arr1[arr1.length - 1],
              subCategory: val.subCategory || val.category,
              url: item,
              daId: val.daId || val?.data?.daId
            };
          } else {
            return {
              title: val.title,
              label: arr1[0],
              type: arr1[arr1.length - 1],
              subCategory: val.subCategory || val.category,
              url: (item.indexOf("ftp") != -1 ? preGeImageUrl : preImageUrl) + item,
              daId: val.daId || val?.data?.daId
            };
          }
        });
        let writeType = val.other && (val.other.writeStatus === 1 || val.other.writeStatus === 3)
        callback ? callback() : null
        this.handleUrlList(list, writeType)
      },
      
      // 放疗
      handelSetRadiation(val) {
        const obj = cloneDeep(val)
        this.rationInfo.status = true;
        this.radiationInDate = obj.data.inHospitalDate ? obj.data.inHospitalDate.slice(0, 10) : "";
        this.rationInfo.userInfo = obj.data;
        this.rationInfo.radioPatientId = obj.data.id;
        // 查询放疗方案列表
        this.getOrderList(obj.data.id);
      },

      // 处理检验数据
      handleInspect(obj) {
        let type = "inHospital";
        let url = "";
        if (obj.data.performedBy === "外送组") {
          url = obj.data.reportUrl;
          type = "delivery";
        } else if (obj.data.testDate && obj.data.inspectionId && obj.data.fileName) {
          type = "inHospital";
          let date = handleDataFormat(obj.data.testDate);
          url = `http://10.72.2.180:8081/SampleHandler/api.tools.pdf.oldreport.jsp?NDate=${date}&SpecimenNo=${obj.data.inspectionId}&FileName=${obj.data.fileName}`;
        }
        // 检验-坐标过来的数据
        this.backInspect(obj,url, type)
      },

      // mdt数据处理
      handelSetMdt(obj, type) {
        const status = this.getMeetingType(obj,type)
        if(!status) return false
        let URL = "", sourceType = "", list = [];
        // 判断mdt会议为二级还是三级
        if (type == "MDT") {
          URL = obj.data.mergePdfUrl
            ? obj.data.mergePdfUrl
            : obj.data.meetingType == "Tumor Board"
            ? obj.data.tboardPdfUrl
            : obj.data.pdfReportUrl;
        } else if (type == "Tumor") {
          URL = obj.data.opinionPdfUrl;
        } else if (type == "source") {
          sourceType = "source";
          URL = obj.data.caseReportUrl;
        } else if (type == "sumary") {
          URL = obj.data.meetingType == "Tumor Board" ? obj.data.tboardPdfUrl : obj.data.pdfReportUrl;
        }
        if (!URL) return false;
        let preUrlArr = URL.split(",");
        // 过滤mdt的url
        list = preUrlArr.map((item) => {
          let arr = item.split("/");
          let arr1 = arr[arr.length - 1].split(".");
          let status = item.substring(item.lastIndexOf(".") + 1) == "pdf";
          let mdtProposalUrl = status ? item : `https://view.officeapps.live.com/op/view.aspx?src=${item}`;
          let sub = arr1[0].indexOf("_");
          let subLable = arr1[0].substring(sub + 1, arr1[0].length);
          return {
            title: sourceType === "source" ? subLable : arr1[0],
            label: sourceType === "source" ? subLable : arr1[0],
            type: item.substring(item.lastIndexOf(".") + 1),
            // type: status,
            dataType: 'mdt',
            url: mdtProposalUrl,
          };
        });
        if (type == "source") list[0].url = obj.data.caseReportUrl;
        if ((type == "sumary" || type == "MDT") && obj.data.updateType == 2) list[0].url ="http://wapi.arioncc.cn/oss-service/oss/aegle/20211125T135047-673_white.pdf";
        // this.handleUrlList(list)
        this.showFileCenter(list)
      },

      // 处理影像/检查的数据
      async handelSetImgE(obj, extUrlList) {
        // 影像
        if (obj.type === "本院" && obj.data.reportSource == 1) {
          if (obj.urls && obj.urls !== "null") {
            await this.inspectionReportApps(obj.data.daId)
            await this.handleSetUrl(obj, obj.urls);
          }
        } else if (obj.type === "本院" && obj.data.reportSource == 2) {
          //判断是不是pt报告，是就新开窗口查看
          if (obj.data.checkType == "PT" || obj.data.checkType == 'PETCT') {
            window.open(`http://10.72.2.43:8080/PowerWebVision/pacslistviewer?user=c3e8dc67dbe5a3a031ca2f89b8b6fb99-30800013&type=nm&PatientID=${obj.data.pacsPatientId}`);
            return;
          }
          //GE报告
          if(obj.data.daId && obj.data.healthCardNo && obj.data.reportUrl){
            let list = [
              {
                label: "GE报告",
                type: "page",
                title: obj.title,
                url: `http://10.72.2.${this.configIp}:30051/arion1/geList?daId=${obj.data.daId}&healthCardNo=${obj.data.healthCardNo}`,
              },
            ];
            this.handleUrlList(list)
          }
        } else {
          if (obj.urls && obj.urls !== "null") {
            await this.inspectionReportApps(obj.data.daId)
            await this.handleSetUrl(obj, obj.urls);
          } else if (extUrlList.length) {
            //外院上传的不添加
            this.openUrlList(extUrlList)
          }
        }
      },
      //如果是需要展示到中间的类型则走这条路
      showFileCenter(list){
        this.urlList = list;
        this.type = list[0].type;
        //如果是pdf，则直接展示
        const status = isPdfImgFile(list)
        if(!status) {
          const loadingPdf = this.$loading({
            lock: true,
            text: 'Loading',
            spinner: 'el-icon-loading',
            background: 'rgba(0, 0, 0, 0.7)'
          });
          const urlList = list.map(item => {
            return item.url
          })
          this.handlePdfUrl(urlList.join(','),list,loadingPdf)
        }
      },
      //病理申请单
    hanldePathologicalApps(val){
      this.activeIndex=this.urlList.length
        const environment = this.topObj.setting=='test' ? 108 : 111;
        // const str =`http://10.72.2.108:30006/#/application-form?daId=${val.daid}&timelineView=1`
        const str =`https://${environment==108?'web-config-all-test.arioncc.cn':'web-config-all.arioncc.cn'}/#/application-form?daId=${val.daid}&timelineView=1`
        this.pathologicalExaminationApplications=true
        this.pathologicalExamination=str
    },
      //处理查看的list，区别显示类型
      handleUrlList(list, writeType) {  
        console.log(11111);
        if (list[0].url == "http://wapi.arioncc.cn/oss-service/oss/aegle/20211125T135047-673_white.pdf") {
            this.$message.closeAll();
            this.$message.error({
              message: "文件已撤回，暂无法查看！",
              duration: 0,
              customClass: "timeline-message-custom-class"
            });
        } else {
            this.urlList = list;
            this.type = list[0].type;
            let type = this.type ? this.type.toLowerCase() : '';
            if (list[0].subCategory == "pathology" && list[0].status) {
              this.referenceList = [];
              if (list[0].status == 0) {
                this.url = list[0].url;
                this.referenceList = list[0].reference;
                this.activeReferenceIndex = -1;
              } else {
                this.url = "";
                this.$message.error({
                  message: "原签发报告病理科已撤回",
                  duration: 2000,
                  customClass: "timeline-message-custom-class"
                });
              }
            } else if(['examination','image'].includes(list[0].subCategory) && this.examinationApplicationData.patientName && this.examinationApplicationData.applicationFormType!='检验') {
              this.url = list[0].url
              this.dialogDataType = "check";
              this.dialogVisible = true;
              return
            } else {
              const str = 'png,jpg,pdf,jpeg,gif,bmp'
              if(list[0].subCategory == "outpatients_emergency_case" && str.indexOf(list[0].type) == -1){
                this.dialogVisible=false
                this.getLoginToken(list[0].url)
                return
              }else{
                this.url = list[0].url;
              } 
            }

            //如果是ge报告，则弹窗查看，不展示到中间
            if(type === 'page'&&list[0].label=="GE报告"){
              this.getGEReport(this.url)
              this.dialogDataType = "GEgeReport";
              return
            }
            console.log(list);
            // //如果是pdf，则直接展示
            const status = isPdfImgFile(list)
            console.log(status);
            if(!status) {
              const loadingPdf = this.$loading({
                lock: true,
                text: 'Loading',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
              });
              const urlList = list.map(item => {
                return item.url
              })
              this.handlePdfUrl(urlList.join(','),list,loadingPdf)
              return;
            }
            this.dialogVisible = true;
            this.dialogDataType = "imgPdf";
            const status1 = list.some(item => {
              return ["jpg","bmp","png","tif","gif","jpeg","webp","word"].includes(item.type.toLowerCase())
            })
            if (status1) {
              this.dialogDataType = "imgPdf";
            } else if (type == "gepage") {
              this.dialogDataType = "GePage";
            } else if(type == "risp"){
              this.dialogDataType = "risp";
            } else {
              this.dialogDataType = "page";

              if(list[0].label=="GE报告"){
                this.getGEReport(this.url)
                // this.$emit("acquireGEReport",this.url)
                this.dialogDataType = "GEgeReport";
              }
            }
            if (writeType) {
              this.dialogDataType = "ECImg";
            }
        }
      },

      //请求处理多个pdf文件
      handlePdfUrl(str,d,load) {
        const config = {
          method: 'post',
          url: '/api/pdf-service/',
          headers: {
            Authorization: `Bearer ${window.sessionStorage.getItem('urlToken')}`
          },
          responseType: 'blob',  
          data: {
            mainPage: false,
            url: this.topObj.setting == 'test' ? 'http://10.72.2.108:30064' : 'http://10.72.2.113:30064',  //正式
            route: `cm-mdt-pdf?imageInfos=${encodeURI(str)}`,
          },
        }
        const that = this
        axios(config)
        .then(function (response) {
          const url = getObjectURL(response.data);
          console.log(url);
          load.close()
          that.$emit('check',[{...d[0],url}])
        })
        .catch(function (error) {
          load.close()
          // console.log(error)
        })
      },
      
      //查看处理分类
      handleCheckType(val, name, type) {
        console.log('check');
        // 打开电子详情
        if(val.other && val.other.templateResource){
          this.$emit('openEmrDetail',val.other)
          return
        }
        // 检验数据
        if(val[name] === "inspectionReport" && !val.inspectionReportData && val.type === "本院") {
          if (val.data.performedBy === "外送组" ||  (val.data.testDate && val.data.inspectionId)) {
            val.data.reportUrl ? this.handleSetUrl(val,val.data.reportUrl) : this.handleInspect(val)
          } else if (val.data.reportUrl) {
            this.handleSetUrl(val, val.data.reportUrl);
          }
        }

        // 检查/影像
        else if(val[name] === "image" || val[name] === "examination") {
          if ((val[name] === "examination")&& val.other && val.other.writeStatus === 2) {
            this.$message({
              message: '原心电图报告已撤回',
              type: 'error',
              duration: 2000
            });
          } else {
            this.handelSetImgE(val, this.extUrlList);
          }
        }

        //mdt
        else if (val[name] == 'mdt') {
          this.handelSetMdt(val, type);
        }

        // 放疗
        else if (val[name] == 'radiationTherapy') {
          this.handelSetRadiation(val);
        }

        //体检
        else if(val[name] == 'patient_checkup'){
          let list =[{ title: "体检报告", label: "体检报告", type: "imgPdf",dataType: 'mdt', url: val.data.reportUrl }]
          // this.handleUrlList(list)
          this.showFileCenter(list)
        }

        //随访
        else if(val[name] == 'follow') {
          let patient = {
            healthCardNo:val.healthCardNo||"",
            patientName:val.patientName||"",
            businessId:val.followId||"",
            patientId:val.patientId||"",
            type:'随访',
            diag:val.title,
            followType:val.followType,
            indexId:val.indexId
          }
          this.followItem = {
            // id: val.indexId,//随访总id
            id: val.followId,//随访总id
            type: val.type || "",//临时还是其他
            subject: val.title || "",
            // selfId: val.followId,//每一次随访iid 
            selfId: val.indexId,//每一次随访iid 
            isMessage: false,
          }
          this.dialogDataType = 'follow'
          this.dialogVisible = true
          // this.handleFollow(patient)
        }

        // 门诊病历     
        else {
          if (val[name] == 'outpatients_emergency_case' && val.other.inpatientId) {
            if (val.other.writerType === "outpatients_emergency_case") {
              //121妇科门诊病历,实时门诊病历
              const recordType = val.other.deptId == "121" ? "fRecord" : "record";
              this.handleRecord({ value: val.other.inpatientId, time:val.data.dateTime, pationId:val.data.patientBaseId, type: recordType,})
            } else if (val.other.writerType === "consultation_apply_form") {
              // 会诊申请单
              this.handleRecord({ value: val.other.inpatientId, type: "aRecord",})
            } else if (val.other.writerType === "consultation_record") {
              // 会诊记录labList
              this.handleRecord({ value: val.other.inpatientId, type: "rRecord",})
            } else if(val.title=='门（急）诊诊断证明书') {
              window.open(val.urls, "_blank");
            }
            // 文书
          } else if (
            val[name] === "in_hospital_process" ||
            val[name] === "nursing_record" ||
            val[name] === "informed_consent" ||
            val[name] === "operation_anesthesia"
          ) {
            if (val.type === "外院") {
              this.extUrlList = val.extUrl ? (Array.isArray(val.extUrl) ? val.extUrl : val.extUrl.split(",")) : [];
              // this.extUrlList = val.extUrl ? val.extUrl.split(",") : [];
              getWriterUrl(val,(e) => { this.handleUrlList(e) })
            }else if(val.title==="手术安全核查表"){
              this.handleSurgery(val.data);
            }else if(val.title==="麻醉记录单"){
              this.handleRecordList(val.data);
            }else if(val[name]==="nursing_record" && val.assessmentLink){
              window.open(val.assessmentLink, "_blank");
            }   else {
              window.open(val.urls, "_blank");
            }
          } else if (val[name] === "medical_record_homepage") {
            this.handleSetUrl(val, val.data.filePath);
          } else if ((val[name] == "pathology") &&Array.isArray(val.data) && val.data.length) {
            // 病理
            let preUrlArr = [];
            if (type == "frozenUrl") {
              // 手术标本病理诊断冰冻按钮
              preUrlArr = val.data.filter((item) => {
                return item.type == "冰冻病理";
              });
            } else if (type == "conventionalUrl") {
              // 手术标本病理诊断 常规
              preUrlArr = val.data.filter((item) => {
                return item.type !== "冰冻病理";
              });
            } else {
              preUrlArr = val.data;
            }
            // 附件的数组处理
            let list = preUrlArr.map((item) => {
              return {
                daid:val.daId,
                label: item.filename,
                type: "risp",
                url: item.examId,
                title: item.title || '',
                status: item.status,
                daId: val.data.daId,
                reference: item.reference,
                subCategory: "pathology",
              };
            });
            this.handleUrlList(list)
            // 排除-检验数据/检查/影像/mdt/门诊病历
          } else if(val[name] === "outpatients_emergency_case" &&  val.visitCardNo) {
            this.handleRecord({ value: val.visitCardNo,time:val.data.dateTime, type: "pOutRecords",})
          } else {
            const typeStatus = name == 'oldSubCategory' ? (val.urls && val.urls !== "null"||(val.filePath && val.filePath !== "null")) : (val.urls && val.urls !== "null")
            if (typeStatus) {
              this.handleSetUrl(val, name == 'oldSubCategory' ? (val.urls || val.filePath) : val.urls);
            } else if (this.extUrlList.length) {
              this.openUrlList(this.extUrlList)
            }
          }
        }
      },
      
      // 手麻安全核查表
      handleSurgery(val) {
        if (val.flag === 9) return this.$message.error("手术安全核查表已撤回");
        this.urlList=[{label:`手术安全核查表-${val.patientName}${val.operationDate}`}]
        this.anesthesia.operationId = val.operationId;
        this.anesthesia.id = val.id;
        this.dialogDataType = 'surgery'
        this.dialogVisible = true;
      },
      // 麻醉记录单
      handleRecordList(val){
        if (val.flag === 9) return this.$message.error("麻醉记录单已撤回");
        this.urlList=[{label:`麻醉记录单-${val.patientName}${val.operationDate}`}]
        this.anesthesia.operationId = val.operationId;
        this.anesthesia.id = val.healthCardNo;
        this.dialogDataType = 'anesthia'
        this.dialogVisible = true;
      },
      // 关闭弹窗
      handleClose() {
        this.dialogVisible = false;
        let info = { status: 0};
        // this.handleGetInspect(info)
        this.examinationApplicationData = {
          status: 0,
          patientName: ''
        }
        this.extUrlList = [];
        this.urlList = [];
        this.type = "";
        this.url = "";
        this.activeIndex = 0;
        this.switchReport = 1
      },
      
      // 点击函数
      hanldeUrlClick(type, url, index, item) {
        this.activeIndex = index;
        this.type = type;
        if (item && item.subCategory == "pathology" && item.status) {
          this.referenceList = [];
          if (item.status == 0) {
            this.url = url;
            this.referenceList = item.reference;
            this.activeReferenceIndex = -1;
            } else {
            this.url = "";
            this.$message.error({
              message: "原签发报告病理科已撤回",
              duration: 2000,
              customClass: "timeline-message-custom-class"
            });
          }
          return false;
        }
        if(this.$refs["scroll"]?.wrap) this.$refs["scroll"].wrap.scrollTop = 0;
        this.url = url;
      },
      // 打印图片
      handleReportPrint(urlList) {
        const div = (this.dialogDataType === "ECImg" || urlList[0].title=="电脑多导联心电图") ? this.$refs.printPage : this.$refs.print;
        Print(div, {
          onStart: function() {},
          onEnd: function() {}
        });
      },
      //放疗打印
      printRisp() {
        let arr = [];
        let clazzes = [".timeline-risp-common-page"];
        if(this.$refs.rispShow.addPageShow) clazzes.push(".timeline-risp-add-page");
        if(Array.isArray(this.$refs.rispShow.answer) && this.$refs.rispShow.answer.length) clazzes.push(".timeline-risp-cap-page");
        for (let index = 0; index < clazzes.length; index++) {
          let parentHrtmlDom = document.querySelector(clazzes[index]);
          arr.push({
            headerDom: parentHrtmlDom.querySelector(".risp-view-top"),
            footerDom: parentHrtmlDom.querySelector(".risp-view-bottom"),
            containerDom: parentHrtmlDom.querySelector(".risp-view-middle")
          });
        }
        printHtml({ mul: true, arr: arr});
      },
      //打印table
      handleTablePrint(url) {
        if(!url) return this.$message.warning("报告未出，暂不可打印");
        if (this.printType !== "pdf") {
          Print(this.$refs.printTable, { onStart: function() {}, onEnd: function() {} });
          return
        }
        if (this.inspectInfo.url.indexOf(",") === -1) {
          window.open(this.inspectInfo.url);
          return
        }
        let preUrlArr = this.inspectInfo.url.split(",");
        preUrlArr.forEach(item => window.open(item));
      },
      
      // 趋势图
      async hanldeRowClick(row) {
        this.recordsInfo.name = row.itemName;
        this.recordsInfo.unit = row.unit;
        this.recordsInfo.itemRef = row.itemRef;
        this.recordsInfo.panLow = row.panLow;
        this.recordsInfo.panHigh = row.panHigh;
        this.recordsInfo.clinical=row.clinicalSignificance
        this.labList = [];
        const res = await getTimeLabList({ patientId: row.healthcardno, itemKey: row.itemId});
        if (res.code === 0) {
          this.labList = res.data.list.map(item => {
            return { time: item.label.slice(0, 16), value: item.value };
          });
        }
      },
      
      // 返回实时病历的visitNo
      handleRecord(val) {
        if (val.type === "fRecord") {
          // 妇科门诊病历
          let info = { code: "docctest", doctorId: 274, printType: 1, templateType: 4 }
          this.timelineOutpatientInformationstr =`http://10.72.2.${this.configIp}:30059/arion/printPage?printType=${info.printType}&templateType=${info.templateType}&visitNo=${val.value}&code=${info.code}&patientId=${val.pationId}&doctorId=${info.doctorId}&timeAxis=1`
          // this.timelineOutpatientInformationstr = httpproxyMethod(this.timelineOutpatientInformationstr)
          this.handleRecordData(val.value)
          this.dialogDataType = "fRecord";
        } else if (val.type === "record") {
          // 门诊病历
          let info = { code: "docctest", doctorId: 274, printType:1, templateType:3 }
          this.timelineOutpatientInformationstr =`http://10.72.2.${this.configIp}:30059/arion/printPage?printType=${info.printType}&templateType=${info.templateType}&visitNo=${val.value}&code=${info.code}&patientId=${val.pationId}&doctorId=${info.doctorId}&timeAxis=1`
          // this.timelineOutpatientInformationstr = httpproxyMethod(this.timelineOutpatientInformationstr)
          this.handleRecordData(val.value)
          this.dialogDataType = "record";
        } else if (val.type === "aRecord") {
          // 会诊申请单
          this.visitNo = val.value
          
          this.dialogDataType = "aRecord";
          this.dialogVisible = true
        } else if (val.type === "rRecord") {
          this.visitNo = val.value
          // 会诊记录
          this.dialogDataType = "rRecord";
          this.dialogVisible = true
        } else if(val.type === "pOutRecords"){
          this.visitNo = val.value
          // 病理门诊病历
          this.dialogDataType = "pOutRecords";
          this.dialogVisible = true
        }
      },
      // 门诊实时病历
      handleRecordData(visitNo) {
        this.caseHistory = {
          ...this.caseHistory,
          status: 0,
        };
        handleSetMedicalData(visitNo).then((info) => {
          this.caseHistory = {
            ...info,
            status: 1,
          };
        });
      },
      // 返回检验结果数据
      backInspect(d, printInspectUrl, type) {
        this.dialogDataType = "list";
        let info = { daId:d.data.daId, title:d.title};
        this.backInspectInfo = {...info}
        this.titleType = type;
        if (printInspectUrl) {
          let arr = printInspectUrl.split("/");
          let arr1 = arr[arr.length - 1].split(".");
          this.printType = arr1[arr1.length - 1].toLowerCase();
          this.printInspectUrl = printInspectUrl;
        } else {
          this.printType = "pdf";
          this.printInspectUrl = "";
        }

        
        console.log(info);
        console.log('hahahahha');
        console.log(this.dialogDataType);
        // this.$refs.respectTable && this.$refs.respectTable.inspectionOpen(info)
        this.handleGetInspect(info)
      },
      // 检验数据
      async handleGetInspect(val) {
        if (val.status === 0) {
          this.inspectInfo.status = 0;
          this.inspectInfo.list = [];
          this.inspectInfo.reportPatientInfo = cloneDeep(InspectReportPatientInfo);
        } else {
          const res = await getReportInfo({ daId: val.daId });
          const res1 = await getReportData({ daId: val.daId });
          const res2= await getApplicationForm(val.daId)
          const res3 =await getPatientsImg(val.daId)
          if (res.code === 0 && res1.code === 0) {
            if(val.url){
              this.inspectInfo = {
                list: res1.data,
                title: val.title,
                inspectInfoRequisition:res2.data.reportApplicationForm?(res2.data.reportApplicationForm.patientName ? 1 :0):0,
                status: 1
              };
            } else {
              let reportPatientInfo = {
                ...res.data,
                receivedDateTime: res.data.receivedDateTime ? res.data.receivedDateTime.slice(0, 16) : "",
                reviewDateTime: res.data.reviewDateTime ? res.data.reviewDateTime.slice(0, 16) : "",
                sampledDateTime: res.data.sampledDateTime ? res.data.sampledDateTime.slice(0, 16) : ""
              };
              this.inspectInfo = {
                list: res1.data,
                title: val.title,
                inspectInfoRequisition:res2.data.reportApplicationForm?(res2.data.reportApplicationForm.patientName ? 1 :0):0,
                reportPatientInfo: reportPatientInfo,
                elasticFigureImg:res3.data
              };
            }
          }
        }
        this.dialogVisible = true
      },
      
      // 关闭放疗弹窗
      handleRadiationClose() {
          this.radiationVisible = false;
      },
      //放疗能不能打印
      onRispprintStatus(val) {
        this.rispCanPrint = val;
      },
    }
}
</script>
<style lang="less">

.new-mdt-dialog {
    display: flex;
    flex-direction: column;
    .el-dialog__headerbtn{
      font-size: 27px;
    }
    .el-dialog__header{
      padding: 0;
      display: flex;
      justify-content: space-between;
    }
    .el-dialog__body {
      padding: 0;
      flex: 1;
      .styleBox {
      width: 100%;
      padding: 30px;
      position: absolute;
      height: auto;
      top: 50px;
      overflow-y: scroll;
      height: 94%;
      }
    }
    .mdtTableDialog {
        tbody tr {
        height: 30px !important;
      }
    }

    .mdt-in-scroll {
      height: calc(100vh - 67px);
      .el-scrollbar__view {
        height: 100%;
      }
    }
  }
.trendDialogmdts {
  z-index: 2050!important;
  width: 668px !important;
  .el-dialog__header,
  .el-dialog__body {
    padding: 20px 32px;
  }
  .el-dialog__body {
    padding: 0 20px 32px;
    display: flex;
    flex-direction: column;
    max-height: 500px;
    overflow-y: auto;
  }

  .header {
    display: flex;
    justify-content: flex-start;
    i {
      display: inline-block;
      width: 6px;
      height: 6px;
      opacity: 1;
      border-radius: 50%;
      margin-right: 6px;
      vertical-align: top;
      margin-top: 8px;
    }
    .type-value {
      margin-right: 15px;
      line-height: 22px;
    }
  }
  .dialog-title {
    height: 22px;
    opacity: 1;
    font-size: 16px;
    font-family: PingFangSC, PingFangSC-Semibold;
    font-weight: 600;
    text-align: left;
    color: rgba(0, 0, 0, 0.85);
    line-height: 22px;
    margin-right: 25px;
  }
  .clinicalSignificance{
    font-size:12px;
    padding: 0 12px;
  }
}

.time-line-box-pc {
  font-family: PingFangSC, PingFangSC-Semibold;
  .tree-con {
    label {
      margin-bottom: 0;
    }
  }
  .el-dialog {
    display: flex;
    flex-direction: column;
    .el-dialog__body {
      flex: 1;
    }
  }
  .el-scrollbar__wrap {
    overflow-x: hidden;
  }
  .el-scrollbar__view {
    height: 100%;
  }
}
.time-line-box-pc {
  .el-tabs {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .el-tabs__content {
    flex: 1;
    .el-tab-pane {
      height: 100%;
    }
  }
}
.url-mdt-content-right {
  thead {
    tr {
      th {
        border-top: 1px solid #333;
        border-bottom: 1px solid #333 !important;
      }
    }
  }
  .el-table td {
    border-bottom: none;
  }
  tbody {
    .el-table__row:last-child {
      td {
        border-bottom: none;
      }
    }
  }
  .table-report-con {
    border-bottom: 1px solid #333 !important;
  }
  .trend {
    height: 25px;
  }

  &.check-table {
    background-color: #fff;
  }
}
.timeline-message-custom-class {
  z-index: 9999 !important;
}
.reference-header {
    width: 100%;
    margin-left: 6px;
    font-size: 16px;
}
.url-mdt-content-extend {
  width: 69px;

background: #ffffff;
.print-button {
  position: absolute;
  right: 20px;
  // right: 5px;
  bottom: 30px;
  &.sp {
    right: 20px;
  }
}
.print-buttons {
  position: absolute;
  right: -20px;
  bottom: 30px;
  
}
}
</style>
<style lang="less" scoped>
@import url('./timeline.less');
</style>