|  | @@ -0,0 +1,136 @@
 | 
	
		
			
				|  |  | +<template>
 | 
	
		
			
				|  |  | +  <div class="layout_container">
 | 
	
		
			
				|  |  | +    <header class="round-header">
 | 
	
		
			
				|  |  | +      <el-select v-model="inquiry.reportType" style="width: 100px">
 | 
	
		
			
				|  |  | +        <el-option
 | 
	
		
			
				|  |  | +          v-for="item in reportTypes"
 | 
	
		
			
				|  |  | +          :key="item.value"
 | 
	
		
			
				|  |  | +          :label="item.value"
 | 
	
		
			
				|  |  | +          :value="item.value"
 | 
	
		
			
				|  |  | +        ></el-option>
 | 
	
		
			
				|  |  | +      </el-select>
 | 
	
		
			
				|  |  | +      <CyDateRange />
 | 
	
		
			
				|  |  | +      <el-divider direction="vertical" />
 | 
	
		
			
				|  |  | +      <el-button icon="Search" type="primary" @click="queryList">查询</el-button>
 | 
	
		
			
				|  |  | +    </header>
 | 
	
		
			
				|  |  | +    <div class="layout_main layout_container layout-horizontal">
 | 
	
		
			
				|  |  | +      <aside class="layout_el-table">
 | 
	
		
			
				|  |  | +        <el-table
 | 
	
		
			
				|  |  | +          :data="tableList"
 | 
	
		
			
				|  |  | +          stripe
 | 
	
		
			
				|  |  | +          highlight-current-row
 | 
	
		
			
				|  |  | +          @row-click="handleClickRow"
 | 
	
		
			
				|  |  | +        >
 | 
	
		
			
				|  |  | +          <el-table-column prop="patientName" label="患者姓名" width="70"></el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column prop="instrument" label="送检项目" width="120"></el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column prop="reportType" label="报告类别" width="70"></el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column label="报告时间" width="130">
 | 
	
		
			
				|  |  | +            <template #default="{row}">
 | 
	
		
			
				|  |  | +              {{ filterReportTime(row.bgrq) }}
 | 
	
		
			
				|  |  | +            </template>
 | 
	
		
			
				|  |  | +          </el-table-column>
 | 
	
		
			
				|  |  | +        </el-table>
 | 
	
		
			
				|  |  | +      </aside>
 | 
	
		
			
				|  |  | +      <div class="layout_main">
 | 
	
		
			
				|  |  | +        <iframe style="width: 99%; height: 99%" :src="pdfSrc" />
 | 
	
		
			
				|  |  | +      </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +  </div>
 | 
	
		
			
				|  |  | +</template>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<script setup>
 | 
	
		
			
				|  |  | +import useDateRange from "@/utils/cy-use/useDateRange";
 | 
	
		
			
				|  |  | +import {getByteReport, getReportList} from "@/api/inspections";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const {CyDateRange, dateRange} = useDateRange({aFewDaysAgo: 3, clearable: false})
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const reportTypes = [
 | 
	
		
			
				|  |  | +  { value: '全部' },
 | 
	
		
			
				|  |  | +  { value: '常规报告' },
 | 
	
		
			
				|  |  | +  { value: '病理' },
 | 
	
		
			
				|  |  | +  { value: 'TCT' },
 | 
	
		
			
				|  |  | +  { value: 'TS' },
 | 
	
		
			
				|  |  | +  { value: '微生物' },
 | 
	
		
			
				|  |  | +]
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const jyKey = ref('')
 | 
	
		
			
				|  |  | +const blKey = ref('')
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const inquiry = reactive({
 | 
	
		
			
				|  |  | +  key: '',
 | 
	
		
			
				|  |  | +  id: '',
 | 
	
		
			
				|  |  | +  begin: '',
 | 
	
		
			
				|  |  | +  end: '',
 | 
	
		
			
				|  |  | +  barcode: '',
 | 
	
		
			
				|  |  | +  reportType: '全部'
 | 
	
		
			
				|  |  | +})
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const key = computed(() => {
 | 
	
		
			
				|  |  | +  return inquiry.reportType === '病理' ? blKey.value : jyKey.value
 | 
	
		
			
				|  |  | +})
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const tableList = ref([])
 | 
	
		
			
				|  |  | +function queryList() {
 | 
	
		
			
				|  |  | +  inquiry.begin = dateRange.value.start
 | 
	
		
			
				|  |  | +  inquiry.end = dateRange.value.end
 | 
	
		
			
				|  |  | +  inquiry.key = key.value
 | 
	
		
			
				|  |  | +  getReportList(inquiry).then(res => {
 | 
	
		
			
				|  |  | +    tableList.value = res
 | 
	
		
			
				|  |  | +  })
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +const pdfSrc = ref('')
 | 
	
		
			
				|  |  | +function handleClickRow(row) {
 | 
	
		
			
				|  |  | +  // let barcode = row.customerBarcode
 | 
	
		
			
				|  |  | +  // if (!barcode || barcode.length < 5) {
 | 
	
		
			
				|  |  | +  //   barcode = row.adiconBarcode
 | 
	
		
			
				|  |  | +  // }
 | 
	
		
			
				|  |  | +  // inquiry.barcode = barcode
 | 
	
		
			
				|  |  | +  // inquiry.reportType = row.reportType
 | 
	
		
			
				|  |  | +  // inquiry.key = key.value
 | 
	
		
			
				|  |  | +  // getReportItems(inquiry).then(res => {
 | 
	
		
			
				|  |  | +  //   reportItems.value = res
 | 
	
		
			
				|  |  | +  // })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  inquiry.key = key.value
 | 
	
		
			
				|  |  | +  inquiry.id = row.id
 | 
	
		
			
				|  |  | +  getByteReport(inquiry).then(res => {
 | 
	
		
			
				|  |  | +    showPDF('data:application/pdf;base64,' + res)
 | 
	
		
			
				|  |  | +  })
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +function showPDF(base64) {
 | 
	
		
			
				|  |  | +  const blob = base64ToBlob(base64);
 | 
	
		
			
				|  |  | +  pdfSrc.value = URL.createObjectURL(blob)
 | 
	
		
			
				|  |  | +  // 创建一个iframe来显示PDF
 | 
	
		
			
				|  |  | +  // const iframe = document.createElement('iframe');
 | 
	
		
			
				|  |  | +  // iframe.style = 'width: 100%; height: 100vh;';
 | 
	
		
			
				|  |  | +  // iframe.src = url;
 | 
	
		
			
				|  |  | +  // document.body.appendChild(iframe);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +function base64ToBlob(base64) {
 | 
	
		
			
				|  |  | +  const parts = base64.split(';base64,');
 | 
	
		
			
				|  |  | +  const contentType = parts[0].split(':')[1];
 | 
	
		
			
				|  |  | +  const raw = window.atob(parts[1]);
 | 
	
		
			
				|  |  | +  const rawLength = raw.length;
 | 
	
		
			
				|  |  | +  const uInt8Array = new Uint8Array(rawLength);
 | 
	
		
			
				|  |  | +  for (let i = 0; i < rawLength; ++i) {
 | 
	
		
			
				|  |  | +    uInt8Array[i] = raw.charCodeAt(i);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +  return new Blob([uInt8Array], {type: contentType});
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +function filterReportTime(time) {
 | 
	
		
			
				|  |  | +  return time.split('.')[0].replace('T', ' ')
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +onMounted(() => {
 | 
	
		
			
				|  |  | +  // adiconLogin().then(res => {
 | 
	
		
			
				|  |  | +  //   jyKey.value = res.jyKey
 | 
	
		
			
				|  |  | +  //   blKey.value = res.blKey
 | 
	
		
			
				|  |  | +  // })
 | 
	
		
			
				|  |  | +  jyKey.value = "GTQJ3ZUVQ6FykidteTgUyni2fdhNYe+0jXtlhKt7Ik0srls1M7/uXg=="
 | 
	
		
			
				|  |  | +  blKey.value = "8bAMqh3jI/SSVQC7k1YlI3patI69vAIQjXtlhKt7Ik0srls1M7/uXg=="
 | 
	
		
			
				|  |  | +})
 | 
	
		
			
				|  |  | +</script>
 |