2025-03-12 17:51:54 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div id="PrintElementOptionSetting" style="display:none;"></div>
|
|
|
|
|
|
2025-03-13 15:35:35 +08:00
|
|
|
|
<!-- 添加全屏加载遮罩 -->
|
|
|
|
|
<div
|
|
|
|
|
v-loading.fullscreen.lock="fullscreenLoading"
|
|
|
|
|
element-loading-text="正在导入数据,请勿关闭页面..."
|
|
|
|
|
element-loading-background="rgba(0, 0, 0, 0.8)">
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-03-12 17:51:54 +08:00
|
|
|
|
<ContentWrap style="height: 70px; display: flex; align-items: center;">
|
|
|
|
|
<!-- 搜索工作栏 -->
|
|
|
|
|
<el-form
|
|
|
|
|
class="-mb-15px"
|
|
|
|
|
:model="queryParams"
|
|
|
|
|
ref="queryFormRef"
|
|
|
|
|
:inline="true"
|
|
|
|
|
label-width="68px"
|
|
|
|
|
>
|
|
|
|
|
<el-form-item label="体检编号" prop="medicalSn">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.medicalSn"
|
|
|
|
|
placeholder="请输入体检编号"
|
|
|
|
|
clearable
|
2025-03-13 15:35:35 +08:00
|
|
|
|
@input="handleQuery"
|
2025-03-12 17:51:54 +08:00
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
class="!w-200px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="姓名" prop="pname">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.pname"
|
|
|
|
|
placeholder="请输入姓名"
|
|
|
|
|
clearable
|
|
|
|
|
@input="handleQuery"
|
2025-03-13 15:35:35 +08:00
|
|
|
|
@keyup.enter="handleQuery"
|
2025-03-12 17:51:54 +08:00
|
|
|
|
class="!w-200px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
2025-03-13 15:35:35 +08:00
|
|
|
|
<el-form-item label="身份证号" prop="cardId">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.cardId"
|
|
|
|
|
placeholder="请输入身份证号"
|
2025-03-12 17:51:54 +08:00
|
|
|
|
clearable
|
2025-03-13 15:35:35 +08:00
|
|
|
|
@input="handleQuery"
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
class="!w-200px"
|
2025-03-12 17:51:54 +08:00
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" @click="handleQuery">
|
|
|
|
|
<Icon icon="ep:search" class="mr-5px" /> 查询
|
|
|
|
|
</el-button>
|
2025-03-13 15:35:35 +08:00
|
|
|
|
<el-button type="success" :loading="importLoading" @click="handleImport">
|
2025-03-12 17:51:54 +08:00
|
|
|
|
<Icon icon="ep:upload" class="mr-5px" /> 导入Excel文件
|
|
|
|
|
</el-button>
|
|
|
|
|
<input
|
|
|
|
|
type="file"
|
|
|
|
|
ref="fileInputRef"
|
|
|
|
|
accept=".xlsx,.xls"
|
|
|
|
|
style="display: none"
|
|
|
|
|
@change="uploadFile"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<el-table
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
:data="list"
|
|
|
|
|
:stripe="true"
|
|
|
|
|
:show-overflow-tooltip="true"
|
|
|
|
|
:header-cell-style="{ background: 'rgb(235, 241, 250)', height: '56px',color:'#333333' }"
|
|
|
|
|
:row-style="{ height: '56px' }"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column label="体检编号" align="center" prop="medicalSn" />
|
|
|
|
|
<el-table-column label="姓名" align="center" prop="pname" />
|
|
|
|
|
<el-table-column label="性别" align="center" prop="gender" />
|
|
|
|
|
<el-table-column label="身份证号" align="center" prop="cardId" />
|
|
|
|
|
<el-table-column label="联系电话" align="center" prop="phoneNum" />
|
|
|
|
|
<el-table-column label="住址" align="center" prop="domicileaddress" />
|
2025-03-13 15:35:35 +08:00
|
|
|
|
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormatter" />
|
2025-03-12 17:51:54 +08:00
|
|
|
|
<el-table-column label="操作" align="center" fixed="right" width="120px">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button
|
|
|
|
|
link
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="handlePrint(scope.row)"
|
|
|
|
|
>
|
|
|
|
|
打印导检单
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<!-- 分页 -->
|
|
|
|
|
<Pagination
|
|
|
|
|
:total="total"
|
|
|
|
|
v-model:page="queryParams.pageNo"
|
|
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 -->
|
|
|
|
|
<DepartmentForm ref="formRef" @success="getList" />
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { PatientApi, type PatientVO } from '@/api/inspect/inspectpatient'
|
|
|
|
|
import * as SummaryApi from "@/api/summary";
|
|
|
|
|
import { newHiprintPrintTemplate } from "@/views/summary/utils/template-helper";
|
|
|
|
|
import template from "@/views/summary/print/template";
|
2025-03-13 15:35:35 +08:00
|
|
|
|
import { ElMessageBox } from 'element-plus';
|
2025-03-12 17:51:54 +08:00
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'Department' })
|
|
|
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
const loading = ref(true) // 列表的加载中
|
2025-03-13 15:35:35 +08:00
|
|
|
|
const importLoading = ref(false) // 导入Excel的加载状态
|
|
|
|
|
const fullscreenLoading = ref(false) // 全屏加载状态
|
2025-03-12 17:51:54 +08:00
|
|
|
|
const list = ref<PatientVO[]>([]) // 用于展示的数据
|
|
|
|
|
const total = ref(0) // 列表的总页数
|
|
|
|
|
const queryParams = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
2025-03-13 15:35:35 +08:00
|
|
|
|
medicalSn: undefined as string | undefined,
|
|
|
|
|
pname: undefined as string | undefined,
|
2025-03-12 17:51:54 +08:00
|
|
|
|
medicalDateTime: [],
|
2025-03-13 15:35:35 +08:00
|
|
|
|
cardId: undefined as string | undefined,
|
|
|
|
|
phoneNum: undefined as string | undefined,
|
|
|
|
|
domicileaddress: undefined as string | undefined
|
2025-03-12 17:51:54 +08:00
|
|
|
|
})
|
|
|
|
|
const queryFormRef = ref() // 搜索的表单
|
|
|
|
|
const fileInputRef = ref<HTMLInputElement | null>(null) // 文件输入引用
|
|
|
|
|
|
|
|
|
|
/** 获取列表 */
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = await PatientApi.getPatientPage({
|
2025-03-13 15:35:35 +08:00
|
|
|
|
...queryParams,
|
|
|
|
|
pname: queryParams.pname?.trim() || undefined
|
2025-03-12 17:51:54 +08:00
|
|
|
|
})
|
2025-03-13 15:35:35 +08:00
|
|
|
|
|
|
|
|
|
// 在前端进行精确匹配筛选
|
|
|
|
|
if (queryParams.pname) {
|
|
|
|
|
list.value = data.list.filter(item => item.pname === queryParams.pname?.trim())
|
|
|
|
|
total.value = list.value.length
|
|
|
|
|
} else {
|
|
|
|
|
list.value = data.list
|
|
|
|
|
total.value = data.total
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('查询出错:', error)
|
2025-03-12 17:51:54 +08:00
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 搜索操作 */
|
|
|
|
|
const handleQuery = () => {
|
|
|
|
|
queryParams.pageNo = 1
|
|
|
|
|
getList()
|
|
|
|
|
}
|
2025-03-13 15:35:35 +08:00
|
|
|
|
|
2025-03-12 17:51:54 +08:00
|
|
|
|
/** 添加/修改操作 */
|
|
|
|
|
const formRef = ref()
|
|
|
|
|
/** 初始化 **/
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getList()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
/** 打印报告按钮操作 */
|
|
|
|
|
const handlePrint = async (row: PatientVO) => {
|
2025-03-13 15:35:35 +08:00
|
|
|
|
const data = await PatientApi.getPatientInfo(row.medicalSn)
|
|
|
|
|
//判断是否存在血常规、尿常规、生化检查编号
|
|
|
|
|
if(!data.xcgcode && !data.ncgcode && !data.shqx){
|
|
|
|
|
await PatientApi.syncinspectApplyTj(row.medicalSn)
|
|
|
|
|
createPrint(row.medicalSn)
|
|
|
|
|
} else {
|
|
|
|
|
// 如果检验单已存在,弹出确认对话框
|
|
|
|
|
const confirmResult = await ElMessageBox.confirm(
|
|
|
|
|
'检验单已存在,是否重新创建?',
|
|
|
|
|
'提示',
|
|
|
|
|
{
|
|
|
|
|
confirmButtonText: '是',
|
|
|
|
|
cancelButtonText: '否',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}
|
|
|
|
|
).catch(() => 'cancel')
|
2025-03-12 17:51:54 +08:00
|
|
|
|
|
2025-03-13 15:35:35 +08:00
|
|
|
|
// 用户点击"是",重新创建检验单
|
|
|
|
|
if (confirmResult === 'confirm') {
|
|
|
|
|
await PatientApi.syncinspectApplyTj(row.medicalSn)
|
|
|
|
|
}
|
|
|
|
|
// 用户点击"否",直接继续打印流程
|
|
|
|
|
createPrint(row.medicalSn)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/** 打印导检单 */
|
|
|
|
|
const createPrint = async (medicalSn) => {
|
|
|
|
|
try {
|
|
|
|
|
|
2025-03-12 17:51:54 +08:00
|
|
|
|
// 使用SummaryApi打印导检单
|
2025-03-13 15:35:35 +08:00
|
|
|
|
const dataPrint = await SummaryApi.printInfoOfMedicalSn(medicalSn);
|
2025-03-12 17:51:54 +08:00
|
|
|
|
console.log('获取到的打印数据:', dataPrint);
|
|
|
|
|
|
|
|
|
|
// 创建打印模板 - 修改这里,使用固定的模板名称而不是动态获取
|
|
|
|
|
const hiprintTemplate = newHiprintPrintTemplate("InspectionChecklist", {
|
|
|
|
|
template: template,
|
|
|
|
|
settingContainer: "#PrintElementOptionSetting",
|
|
|
|
|
});
|
|
|
|
|
console.log('打印模板创建成功');
|
|
|
|
|
|
|
|
|
|
// 打印设置
|
|
|
|
|
const options = {leftOffset: -1, topOffset: -1};
|
|
|
|
|
|
|
|
|
|
// 扩展配置
|
|
|
|
|
const ext = {
|
|
|
|
|
callback: () => {
|
|
|
|
|
console.log("浏览器打印窗口已打开");
|
|
|
|
|
},
|
|
|
|
|
styleHandler: () => {
|
|
|
|
|
return "<style>.hiprint-printElement-text{color:black !important;}</style>";
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 调用浏览器打印
|
|
|
|
|
hiprintTemplate.print(dataPrint, options, ext);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('打印导检单失败,详细错误:', error);
|
|
|
|
|
message.error(`打印导检单失败: ${error.message || '未知错误'}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-13 15:35:35 +08:00
|
|
|
|
/** 状态格式化 */
|
|
|
|
|
const statusFormatter = (row: any) => {
|
|
|
|
|
const statusMap: Record<string, string> = {
|
|
|
|
|
'0': '待检查',
|
|
|
|
|
'1': '已检查',
|
|
|
|
|
'2': '放弃',
|
|
|
|
|
'3': '挂起,择日检',
|
|
|
|
|
'4': '已汇总',
|
|
|
|
|
'5': '终检审核',
|
|
|
|
|
'6': '报告已取'
|
|
|
|
|
}
|
|
|
|
|
return statusMap[row.status] || '未知'
|
2025-03-12 17:51:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 处理导入按钮点击 */
|
|
|
|
|
const handleImport = () => {
|
|
|
|
|
fileInputRef.value?.click()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 处理文件上传 */
|
|
|
|
|
const uploadFile = async (event: Event) => {
|
|
|
|
|
const target = event.target as HTMLInputElement
|
|
|
|
|
if (!target.files || target.files.length === 0) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const file = target.files[0]
|
|
|
|
|
if (!file.name.endsWith('.xlsx') && !file.name.endsWith('.xls')) {
|
|
|
|
|
message.error('请上传Excel文件(.xlsx或.xls格式)')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
2025-03-13 15:35:35 +08:00
|
|
|
|
importLoading.value = true // 设置导入按钮加载状态为true
|
|
|
|
|
fullscreenLoading.value = true // 设置全屏加载状态为true
|
|
|
|
|
console.log('全屏加载状态已设置为:', fullscreenLoading.value) // 调试日志
|
|
|
|
|
|
2025-03-12 17:51:54 +08:00
|
|
|
|
const formData = new FormData()
|
|
|
|
|
formData.append('file', file)
|
|
|
|
|
|
|
|
|
|
await PatientApi.uploadExcel(formData)
|
|
|
|
|
message.success('导入成功')
|
|
|
|
|
// 重置文件输入
|
|
|
|
|
if (fileInputRef.value) {
|
|
|
|
|
fileInputRef.value.value = ''
|
|
|
|
|
}
|
|
|
|
|
// 刷新列表
|
|
|
|
|
await getList()
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('导入失败:', error)
|
|
|
|
|
message.error('导入失败,请检查文件格式是否正确')
|
|
|
|
|
} finally {
|
2025-03-13 15:35:35 +08:00
|
|
|
|
importLoading.value = false // 设置导入按钮加载状态为false
|
|
|
|
|
fullscreenLoading.value = false // 设置全屏加载状态为false
|
|
|
|
|
console.log('全屏加载状态已重置为:', fullscreenLoading.value) // 调试日志
|
2025-03-12 17:51:54 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|