This commit is contained in:
Flow 2025-08-14 15:01:17 +08:00
parent 4ab72870e7
commit 27a821e585

View File

@ -104,7 +104,7 @@
<el-table-column
prop="examid"
label="检查ID"
min-width="120"
min-width="200"
align="center"
show-overflow-tooltip
>
@ -116,7 +116,7 @@
</el-tooltip>
</template>
</el-table-column>
<el-table-column prop="name" label="姓名" min-width="70" align="center" />
<el-table-column prop="name" label="姓名" min-width="200" align="center" />
<el-table-column
prop="gender"
label="性别"
@ -137,59 +137,6 @@
>
<template #default="{ row }"> {{ row.age }} </template>
</el-table-column>
<el-table-column prop="wearstarttime" label="佩戴时间" align="center" min-width="300">
<template #default="{ row, $index }">
<!-- 编辑状态 -->
<div v-if="row.editingMeasureTime" class="wear-time-editor">
<el-date-picker
v-model="row.wearstarttime"
type="datetime"
placeholder="选择时间"
size="small"
style="width: 140px"
value-format="YYYY-MM-DD HH:mm:ss"
:popper-class="'no-tooltip'"
/>
<div class="edit-actions">
<el-button
type="success"
size="small"
circle
@click="saveMeasureTime(row, $index)"
class="confirm-btn"
>
<Icon icon="ep:check" />
</el-button>
<el-button
type="danger"
size="small"
circle
@click="cancelEditMeasureTime(row, $index)"
class="cancel-btn"
>
<Icon icon="ep:close" />
</el-button>
</div>
</div>
<!-- 显示状态 -->
<div v-else class="wear-time-display">
<div class="time-content">
<span class="time-text">{{ formatMeasureTime(row.wearstarttime) }}</span>
</div>
<div class="edit-button-wrapper">
<el-button
type="primary"
size="small"
circle
@click="editMeasureTime(row, $index)"
class="edit-btn"
>
<Icon icon="ep:edit" />
</el-button>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="采集" min-width="80" align="center" show-overflow-tooltip>
<template #default="{ row }">
@ -215,7 +162,7 @@
</el-button>
</template>
</el-table-column>
<el-table-column label="导入数据" min-width="110" align="center" show-overflow-tooltip>
<el-table-column label="导入数据" min-width="80" align="center" show-overflow-tooltip>
<template #default="{ row }">
<el-button
type="primary"
@ -227,7 +174,7 @@
</el-button>
</template>
</el-table-column>
<el-table-column label="上传" min-width="110" align="center" show-overflow-tooltip>
<el-table-column label="上传" min-width="80" align="center" show-overflow-tooltip>
<template #default="{ row }">
<el-button
v-if="!row.uploading"
@ -623,7 +570,7 @@
<template #footer>
<div class="dialog-footer">
<el-button @click="closeReportView">关闭</el-button>
<el-button type="primary" @click="handlePrintReport" :icon="Download">打印图片</el-button>
<el-button type="primary" @click="handlePrintReport" :icon="Download">打印</el-button>
</div>
</template>
</el-dialog>
@ -671,6 +618,12 @@ const selectedFolderPath = ref('')
const currentFolderPath = ref('')
const folderNavigationHistory = ref<string[]>([])
//
const reportViewVisible = ref(false)
const reportImageUrl = ref('')
const currentReportRow = ref<EcgworkstationVO | null>(null)
const reportLoading = ref(false)
//
const filteredFolderList = computed(() => {
if (!folderSearchKeyword.value) return folderList.value
@ -1118,9 +1071,46 @@ const handleAnalysis = async (row) => {
}
}
/** 采集(占位,后续由你提供实现) */
const handleCollect = (row: EcgworkstationVO) => {
ElMessage.info('采集功能待实现')
/** 采集 */
const handleCollect = async (row: EcgworkstationVO) => {
try {
//
const params = {
examId: row.examid,
patientName: row.name,
sex: row.gender === '1' ? '男' : row.gender === '2' ? '女' : '未知',
age: row.age?.toString() || ''
}
//
const response = await fetch('http://localhost:48082/api/analyzecj-json', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const result = await response.json()
//
if (result.message === '采集程序已启动') {
ElMessage.success('采集程序已启动,正在进行数据采集...')
} else if (result.message === '采集设备未连接') {
ElMessage.warning('采集设备未连接,请检查设备连接状态')
return
} else {
//
ElMessage.success(result.message || '采集请求已发送')
}
} catch (error) {
console.error('启动采集程序失败:', error)
ElMessage.error('启动采集程序失败,请检查程序是否正确安装')
}
}
//
@ -1453,41 +1443,66 @@ const handleUpload = async (row: any) => {
}
}
/** handleApply = async (row) => {
/** 申请上级审核 */
const handleApply = async (row) => {
try {
const userinfo = await getUserProfile()
orfOrg(userinf).gid)
if ErM= nul k (
} else ow
const orginfo = await OrgApi.getOrg(userinfo.orgid)
if (orginfo.parentOrgId != null) {
await EcgworkstationApi.applySuperiorReview(row.id, orginfo.parentOrgId)
ElMessage.success(`${row.name} 申请成功`)
getList()
} else {
ElMessage.error('无上级机构')
return
}
} catch (error) {
console.error('申请失败:', error)
ElMessage.error('申请失败,请重试')
}
}
//
const result = await EcgworkstationApi.getPdfUrl({
orgid: row.orgid,
examid: row.examid
/** 查看报告 */
const handleViewReport = async (row) => {
try {
//
const loading = ElLoading.service({
lock: true,
text: '正在加载报告...',
background: 'rgba(0, 0, 0, 0.8)'
})
// APIURLdata
let pdfUrl = ''
if (typeof result === 'string') {
// APIURL
pdfUrl = result.replace(/`/g, '').trim()
} else if (result && result.data) {
// APIdataURL
pdfUrl = result.data.replace(/`/g, '').trim()
}
if (pdfUrl) {
console.log('处理后的PDF URL:', pdfUrl)
reportImageUrl.value = pdfUrl
reportViewVisible.value = true
ElMessage.success('报告加载成功')
} else {
console.warn('API返回数据异常:', {
result,
resultType: typeof result,
hasData: !!result?.data
try {
//
const result = await EcgworkstationApi.getPdfUrl({
orgid: row.orgid,
examid: row.examid
})
ElMessage.warning('报告未生成或查询失败')
// APIURLdata
let pdfUrl = ''
if (typeof result === 'string') {
// APIURL
pdfUrl = result.replace(/`/g, '').trim()
} else if (result && result.data) {
// APIdataURL
pdfUrl = result.data.replace(/`/g, '').trim()
}
if (pdfUrl) {
console.log('处理后的PDF URL:', pdfUrl)
//
openReportWindow(pdfUrl, row)
} else {
console.warn('API返回数据异常:', {
result,
resultType: typeof result,
hasData: !!result?.data
})
ElMessage.warning('报告未生成或查询失败')
}
} finally {
loading.close()
}
} catch (error) {
console.error('查询报告失败:', error)
@ -1497,11 +1512,173 @@ const handleUpload = async (row: any) => {
status: error?.response?.status
})
ElMessage.error('查询报告失败,请重试')
} finally {
reportLoading.value = false
}
}
/** 打开报告窗口 */
const openReportWindow = (imageUrl, patientInfo) => {
const reportWindow = window.open(
'',
'_blank',
'width=1000,height=700,scrollbars=yes,resizable=yes'
)
if (!reportWindow) {
ElMessage.error('无法打开报告窗口,请检查浏览器设置')
return
}
const reportContent = `
<!DOCTYPE html>
<html>
<head>
<title>心电图报告</title>
<meta charset="UTF-8">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Microsoft YaHei', Arial, sans-serif;
background: #f5f5f5;
min-height: 100vh;
display: flex;
flex-direction: column;
}
.button-container {
text-align: center;
padding: 20px;
background: white;
border-bottom: 1px solid #e9ecef;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.content {
flex: 1;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
}
.image-container {
background: white;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
padding: 20px;
max-width: 95%;
max-height: 95%;
text-align: center;
}
.report-image {
max-width: 100%;
max-height: 100%;
object-fit: contain;
display: block;
border-radius: 4px;
margin: 0 auto;
}
.loading {
text-align: center;
color: #666;
font-size: 16px;
padding: 40px;
}
.error {
text-align: center;
color: #f56c6c;
font-size: 16px;
padding: 40px;
}
.btn {
padding: 12px 24px;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 16px;
font-weight: 500;
transition: all 0.3s;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.btn-print {
background: #007bff;
color: white;
}
.btn-print:hover {
background: #0056b3;
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
@media print {
body {
background: white;
}
.button-container {
display: none !important;
}
.content {
padding: 0 !important;
}
.image-container {
box-shadow: none !important;
padding: 0 !important;
max-width: 100% !important;
max-height: 100% !important;
}
.report-image {
width: 100% !important;
height: auto !important;
max-width: none !important;
max-height: none !important;
page-break-inside: avoid;
}
}
</style>
</head>
<body>
<div class="button-container">
<button class="btn btn-print" onclick="window.print()">
🖨 打印
</button>
</div>
<div class="content">
<div class="image-container">
<div class="loading" id="loading">正在加载心电图...</div>
<div class="error" id="error" style="display: none;">图片加载失败请重试</div>
<img
src="${imageUrl}"
alt="心电图"
class="report-image"
style="display: none;"
onload="document.getElementById('loading').style.display='none'; this.style.display='block';"
onerror="document.getElementById('loading').style.display='none'; document.getElementById('error').style.display='block';"
>
</div>
</div>
</body>
</html>
`
reportWindow.document.write(reportContent)
reportWindow.document.close()
reportWindow.focus()
}
/** 打印报告 */
const handlePrintReport = () => {
if (!reportImageUrl.value) {
@ -1509,80 +1686,77 @@ const handlePrintReport = () => {
return
}
//
const printStyle = `
<style>
@media print {
//
const printWindow = window.open('', '_blank')
if (!printWindow) {
ElMessage.error('无法打开打印窗口,请检查浏览器设置')
return
}
//
const printContent = `
<!DOCTYPE html>
<html>
<head>
<title>心电图报告打印</title>
<style>
* {
visibility: hidden !important;
margin: 0 !important;
padding: 0 !important;
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
width: 100% !important;
height: 100% !important;
margin: 0 !important;
padding: 0 !important;
overflow: hidden !important;
width: 100%;
height: 100%;
overflow: hidden;
}
.medical-image {
visibility: visible !important;
position: fixed !important;
top: 0 !important;
left: 0 !important;
width: 100vw !important;
height: 100vh !important;
border: none !important;
margin: 0 !important;
padding: 0 !important;
z-index: 9999 !important;
object-fit: contain !important;
background: white !important;
box-shadow: none !important;
.print-container {
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: white;
}
.medical-image img {
width: 100% !important;
height: 100% !important;
object-fit: contain !important;
.print-image {
max-width: 100%;
max-height: 100%;
object-fit: contain;
display: block;
}
/* 隐藏所有其他元素 */
.el-dialog,
.el-dialog *:not(.medical-image):not(.medical-image *),
.dialog-footer,
.report-view-container > *:not(.report-content),
.report-content > *:not(.report-image-container),
.report-image-container > *:not(.medical-image) {
display: none !important;
visibility: hidden !important;
@media print {
.print-container {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.print-image {
width: 100%;
height: auto;
max-width: none;
max-height: none;
page-break-inside: avoid;
}
}
}
</style>
</style>
</head>
<body>
<div class="print-container">
<img src="${reportImageUrl.value}" alt="心电图报告" class="print-image" onload="setTimeout(() => window.print(), 500);" onerror="alert('图片加载失败');">
</div>
</body>
</html>
`
// head
const existingStyle = document.querySelector('#print-style')
if (existingStyle) {
existingStyle.remove()
}
const styleElement = document.createElement('style')
styleElement.id = 'print-style'
styleElement.innerHTML = printStyle
document.head.appendChild(styleElement)
//
window.print()
//
setTimeout(() => {
if (styleElement) {
styleElement.remove()
}
}, 1000)
//
printWindow.document.write(printContent)
printWindow.document.close()
}
/** 关闭报告查看弹窗 */