fix(common): 统一异常处理并迁移打印功能到hiprint

- 替换所有System.out.println和printStackTrace为slf4j日志记录
- 在BeanUtils、AuditFieldUtil、DateUtils、ServletUtils等工具类中添加Logger实例
- 在Flowable相关控制器和服务中统一错误日志记录格式
- 在代码生成器中添加日志记录功能
- 将前端打印组件从Lodop迁移到hiprint打印方案
- 更新体温单打印功能使用hiprint预览打印
- 移除调试用的console.log语句
- 修复打印模板中线条元素类型定义
This commit is contained in:
2026-03-06 22:16:44 +08:00
parent 8ef334ba1b
commit b65841c0cc
58 changed files with 678 additions and 888 deletions

View File

@@ -350,11 +350,6 @@ async function handleAdd() {
// 从用户store获取租户ID和租户名称
const tenantId = userStore?.tenantId
const tenantName = userStore?.tenantName
console.log('当前用户信息:', userStore)
console.log('当前用户租户ID:', tenantId)
console.log('当前用户租户名称:', tenantName)
console.log('租户选项列表:', tenantOptions.value)
// 检查租户ID是否存在如果不存在则尝试从租户名称匹配
let matchedTenantId = null
@@ -363,12 +358,11 @@ async function handleAdd() {
matchedTenantId = tenantId
} else if (tenantName && tenantOptions.value && tenantOptions.value.length > 0) {
// 如果没有租户ID但有租户名称则尝试通过名称匹配
const matchedTenant = tenantOptions.value.find(tenant =>
const matchedTenant = tenantOptions.value.find(tenant =>
tenant.tenantName === tenantName
)
if (matchedTenant) {
matchedTenantId = matchedTenant.id
console.log('通过租户名称匹配到租户ID:', matchedTenantId)
}
}

View File

@@ -406,11 +406,17 @@ function openSaveImplementDepartment(row) {
function deleteSelectedRows(row) {
proxy.$modal.confirm('是否删除选中数据').then(() => {
if (row.id) {
deleteImplementDepartment({ orgLocId: row.id }).then((res) => {});
deleteImplementDepartment({ orgLocId: row.id }).then((res) => {
if (res.code === 200) {
proxy.$modal.msgSuccess('删除成功');
}
}).catch(() => {
proxy.$modal.msgError('删除失败');
});
} else {
catagoryList.value.pop();
proxy.$modal.msgSuccess('删除成功');
}
proxy.$modal.msgSuccess('删除成功');
data.isAdding = false;
getList();
});

View File

@@ -113,4 +113,14 @@ export function getDiseaseTreatmentByYbNo (ybNo) {
});
}
// 批量设置划价标记
export function updatePricingFlag (ids, pricingFlag) {
return request ({
url: '/data-dictionary/diagnosis-treatment/pricing-flag',
method: 'put',
data: ids,
params: { pricingFlag },
});
}

View File

@@ -95,6 +95,28 @@
>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Check"
:disabled="multiple"
@click="handlePricingFlag(1)"
>允许划价</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Close"
:disabled="multiple"
@click="handlePricingFlag(0)"
>禁止划价</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="info" plain icon="Upload" @click="handleImport">导入</el-button>
</el-col>
@@ -301,6 +323,7 @@ import {
startDiseaseTreatment,
stopDiseaseTreatment,
validateActivityEdit,
updatePricingFlag,
} from './components/diagnosistreatment';
import diagnosisTreatmentDialog from './components/diagnosisTreatmentDialog';
import DiagTreYbDialog from './components/diagTreYbDialog';
@@ -429,6 +452,22 @@ function handleClose() {
})
.catch(() => {});
}
/** 批量设置划价标记 */
function handlePricingFlag(pricingFlag) {
const selectedIds = ids.value;
const flagText = pricingFlag === 1 ? '允许划价' : '禁止划价';
proxy.$modal
.confirm(`是否确认将选中的诊疗项目设置为"${flagText}"`)
.then(function () {
return updatePricingFlag(selectedIds, pricingFlag);
})
.then(() => {
getList();
proxy.$modal.msgSuccess(`批量设置${flagText}成功`);
})
.catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download(

View File

@@ -147,7 +147,7 @@ export function wxPay (data) {
*/
export function WxPayResult (data) {
return request ({
url: '/three-part/pay/pay-query'+data.paymentId,
url: '/three-part/pay/pay-query/' + data.paymentId,
method: 'get',
});
}

View File

@@ -613,7 +613,7 @@ async function submit() {
return sum + (Number(item.amount) || 0);
}, 0)
.toFixed(2);
if (parseFloat(amount) < formData.totalAmount.toFixed(2)) {
if (parseFloat(amount) < parseFloat(formData.totalAmount.toFixed(2))) {
proxy.$modal.msgError('请输入正确的结算金额');
return;
}
@@ -639,8 +639,14 @@ async function submit() {
if (userStore.fixmedinsCode == 'H22010200672' && props.consumablesIdList.length > 0) {
dispenseMedicalConsumables(props.consumablesIdList);
}
} else {
proxy.$modal.msgError(res.msg || '收费失败');
}
})
.catch((error) => {
console.error('收费失败:', error);
proxy.$modal.msgError(error.message || '收费失败,请重试');
})
.finally(() => {
dialogLoading.value = false;
});

View File

@@ -497,14 +497,14 @@
handleColor(
[1, 2, 3, 4, 5, 6, 7, 8, 9],
[
'default',
'info',
'success',
'default',
'info',
'info',
'success',
'info',
'warning',
'error',
'danger',
'info',
],
scope.row.statusEnum

View File

@@ -352,6 +352,8 @@ import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Search, Refresh, Printer, Edit, View, Delete } from '@element-plus/icons-vue'
import { queryConsultationListPage, cancelConsultation, saveConsultation } from './api'
// 迁移到 hiprint
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
const loading = ref(false)
const saving = ref(false)
@@ -477,12 +479,28 @@ const handleCurrentChange = (val) => {
loadData()
}
const handlePrint = () => {
const handlePrint = async () => {
if (!currentRow.value) {
ElMessage.warning('请先选择一条记录')
return
}
window.print()
try {
// 构建打印数据
const printData = {
patientName: currentRow.value.patientName || '',
gender: currentRow.value.genderText || '',
age: currentRow.value.age || '',
deptName: currentRow.value.department || '',
diagnosis: currentRow.value.provisionalDiagnosis || '',
consultationReason: currentRow.value.consultationPurpose || '',
applyTime: currentRow.value.applyTime || '',
applyDoctor: currentRow.value.requestingPhysician || ''
}
await simplePrint(PRINT_TEMPLATE.CONSULTATION, printData)
} catch (error) {
console.error('会诊申请单打印失败:', error)
ElMessage.error('打印失败')
}
}
const handleRowChange = (row) => {

View File

@@ -211,6 +211,8 @@ import { computed, ref, onMounted, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Check } from '@element-plus/icons-vue'
import useUserStore from '@/store/modules/user'
// 迁移到 hiprint
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
import {
getPendingConfirmationList,
confirmConsultation,
@@ -498,12 +500,28 @@ const handleSign = async () => {
}
}
const handlePrint = () => {
const handlePrint = async () => {
if (!currentRow.value) {
ElMessage.warning('请先选择会诊申请')
return
}
window.print()
try {
// 构建打印数据
const printData = {
patientName: formData.value.patientName || '',
gender: formData.value.genderText || '',
age: formData.value.age || '',
deptName: formData.value.applyDept || '',
diagnosis: formData.value.provisionalDiagnosis || '',
consultationReason: formData.value.consultationPurpose || '',
applyTime: formData.value.applyTime || '',
applyDoctor: formData.value.applyDoctor || ''
}
await simplePrint(PRINT_TEMPLATE.CONSULTATION, printData)
} catch (error) {
console.error('会诊确认单打印失败:', error)
ElMessage.error('打印失败')
}
}
const handleRefresh = async () => {

View File

@@ -501,6 +501,8 @@ import {
getInspectionItemList
} from '../api'
import useUserStore from '@/store/modules/user.js'
// 迁移到 hiprint
import { simplePrint, PRINT_TEMPLATE, previewPrint } from '@/utils/printUtils.js'
import {storeToRefs} from 'pinia'
// Props
@@ -1366,8 +1368,6 @@ function handleSelectionChange(selection) {
// 打印申请单
function handlePrint(row) {
// console.log('打印申请单:', row)
// 切换到申请单TAB
leftActiveTab.value = 'application'
@@ -1376,64 +1376,14 @@ function handlePrint(row) {
// 等待DOM更新后执行打印
setTimeout(() => {
// 添加打印样式
const printStyle = document.createElement('style')
printStyle.innerHTML = `
@media print {
body * {
visibility: hidden;
}
.application-form,
.application-form * {
visibility: visible;
}
.application-form {
position: absolute;
left: 0;
top: 0;
width: 100%;
max-width: none;
box-shadow: none;
border: none;
margin: 0;
padding: 20px;
}
.el-tabs__header {
display: none;
}
.el-tabs__content {
padding: 0;
}
.section-header,
.pagination-container,
.inspection-selector,
.selected-items-area,
.actions {
display: none !important;
}
.application-form .el-input__inner,
.application-form .el-select .el-input__inner,
.application-form .el-textarea__inner {
border: 1px solid #ddd !important;
background: white !important;
}
.application-form .el-checkbox__input.is-checked .el-checkbox__inner {
background-color: #409eff;
border-color: #409eff;
}
}
`
document.head.appendChild(printStyle)
// 执行打印
window.print()
// 移除打印样式
setTimeout(() => {
document.head.removeChild(printStyle)
}, 1000)
ElMessage.success('正在准备打印...')
// 使用 hiprint 的 previewPrint 方法
const printDom = document.querySelector('.application-form')
if (printDom) {
previewPrint(printDom)
ElMessage.success('正在准备打印...')
} else {
ElMessage.warning('未找到打印内容')
}
}, 100)
}

View File

@@ -1348,6 +1348,8 @@
<script setup>
import {computed, reactive, ref} from 'vue';
import useUserStore from '@/store/modules/user';
// 迁移到 hiprint
import { previewPrint } from '@/utils/printUtils.js';
const userStore = useUserStore();
const bodyRef = ref();
@@ -1390,32 +1392,11 @@ const closePrintPreview = () => {
showPrintPreview.value = false;
};
// 处理打印逻辑
// 处理打印逻辑 - 使用 hiprint
const handlePrint = () => {
if (!printContentRef.value) return;
// 创建打印窗口
const printWindow = window.open('', '_blank');
// 复制打印内容到新窗口
printWindow.document.write(`
<html>
<head>
<title>打印预览</title>
<style>
body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; padding: 20px; }
* { box-sizing: border-box; }
</style>
</head>
<body>
${printContentRef.value.innerHTML}
</body>
</html>
`);
printWindow.document.close();
// 执行打印
printWindow.print();
// 关闭打印窗口(可选)
printWindow.close();
// 使用 hiprint 预览打印
previewPrint(printContentRef.value);
};
const getDom = () => {

View File

@@ -172,7 +172,9 @@ import {computed, onMounted, ref} from 'vue';
import {ElMessage} from 'element-plus';
import {patientInfoList} from '../../components/store/patient.js';
import {getSinglePatient} from '../store/patient.js'; // 导入获取单选患者信息的方法
import {formatDateStr} from '@/utils/index';
import {formatDateStr} from '@/utils';
// 迁移到 hiprint
import { previewPrint } from '@/utils/printUtils.js';
// 响应式数据
const loading = ref(false);
@@ -433,39 +435,16 @@ function handlePrint() {
printDialogVisible.value = true;
}
// 执行打印
// 执行打印 - 使用 hiprint
function doPrint() {
try {
// 获取要打印的内容
const printContent = document.getElementById('print-content').innerHTML;
// 创建临时窗口
const printWindow = window.open('', '_blank');
// 写入内容
printWindow.document.write(`
<html>
<head>
<title>预交金清单</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #ccc; padding: 8px; }
th { background-color: #f2f2f2; }
tfoot { font-weight: bold; }
.total-row { background-color: #f5f5f5; }
</style>
</head>
<body>
${printContent}
</body>
</html>
`);
// 打印
printWindow.document.close();
printWindow.focus();
printWindow.print();
const printContent = document.getElementById('print-content');
if (printContent) {
previewPrint(printContent);
} else {
ElMessage.warning('未找到打印内容');
}
} catch (e) {
ElMessage.error('打印失败');
console.error('Print error:', e);

View File

@@ -495,38 +495,16 @@ function handlePrint() {
printDialogVisible.value = true;
}
// 执行打印
// 执行打印 - 使用 hiprint
function doPrint() {
try {
// 获取要打印的内容
const printContent = document.getElementById('print-content').innerHTML;
// 创建临时窗口
const printWindow = window.open('', '_blank');
// 写入内容
printWindow.document.write(`
<html>
<head>
<title>费用明细清单</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #ccc; padding: 8px; }
th { background-color: #f2f2f2; }
tfoot { font-weight: bold; }
.total-row { background-color: #f5f5f5; }
</style>
</head>
<body>
${printContent}
</body>
</html>
`);
// 打印
printWindow.document.close();
printWindow.focus();
printWindow.print();
const printContent = document.getElementById('print-content');
if (printContent) {
previewPrint(printContent);
} else {
ElMessage.warning('未找到打印内容');
}
} catch (e) {
ElMessage.error('打印失败');
console.error('Print error:', e);

View File

@@ -345,6 +345,8 @@ import moment from 'moment';
import {ElMessage} from 'element-plus';
import {patientInfoList} from '../../components/store/patient.js';
import {formatDateStr} from '@/utils/index';
// 迁移到 hiprint
import { previewPrint } from '@/utils/printUtils.js';
import {getCostDetail} from './api.js';
import {getOrgList} from '../../../basicmanage/ward/components/api.js';
import {User} from '@element-plus/icons-vue';
@@ -627,39 +629,16 @@ function handlePrint() {
printDialogVisible.value = true;
}
// 执行打印
// 执行打印 - 使用 hiprint
function doPrint() {
try {
// 获取要打印的内容
const printContent = document.getElementById('print-content').innerHTML;
// 创建临时窗口
const printWindow = window.open('', '_blank');
// 写入内容
printWindow.document.write(`
<html>
<head>
<title>费用明细清单</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #ccc; padding: 8px; }
th { background-color: #f2f2f2; }
tfoot { font-weight: bold; }
.total-row { background-color: #f5f5f5; }
</style>
</head>
<body>
${printContent}
</body>
</html>
`);
// 打印
printWindow.document.close();
printWindow.focus();
printWindow.print();
const printContent = document.getElementById('print-content');
if (printContent) {
previewPrint(printContent);
} else {
ElMessage.warning('未找到打印内容');
}
} catch (e) {
ElMessage.error('打印失败');
console.error('Print error:', e);

View File

@@ -147,6 +147,8 @@ import {formatDateStr} from '@/utils';
import moment from 'moment';
import {getVitalSignsInfo, listPatient} from './components/api';
import useUserStore from '@/store/modules/user';
// 迁移到 hiprint
import { previewPrint } from '@/utils/printUtils.js';
// import { getSignsCharts } from '@/api/signsManagement'
// import { date } from 'jszip/lib/defaults'
const userStore = useUserStore();
@@ -452,65 +454,23 @@ function dateDiff(start, end) {
return '0';
}
}
// 打印体温单
// 打印体温单 - 使用 hiprint
function printTW() {
// this.$print(this.$refs.print);
printRef.value.focus();
printRef.value.contentWindow.print();
// this.$refs.refTemp.printPage();
const element = printRef.value;
if (element) {
previewPrint(element);
} else {
console.error('未找到可打印的内容');
}
}
// 打印体温单
// 打印体温单 - 使用 hiprint
function printPage() {
const element = printRef.value;
if (!element) {
if (element) {
previewPrint(element);
} else {
console.error('未找到可打印的内容');
return;
}
// 创建一个克隆元素用于打印,避免修改原 DOM
const clone = element.cloneNode(true);
// 设置宽度为 A4780px ≈ 210mm高度自适应
clone.style.transform = 'scale(0.7)';
clone.style.transformOrigin = 'top left';
clone.style.width = 'calc(210mm * 1.11)';
clone.style.height = 'calc(297mm * 1.11)';
clone.style.marginLeft = '50px';
// 插入到 body 中以便 html2pdf 渲染
document.body.appendChild(clone);
// 设置 html2pdf 配置
const opt = {
margin: 0,
filename: '体温单.pdf',
image: { type: 'jpeg', quality: 1 },
html2canvas: { scale: 2, useCORS: true }, // 启用跨域资源支持
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' },
pagebreak: { mode: ['avoid-all'] },
onclone: (clonedDoc) => {
const chart = clonedDoc.getElementById(clone.id);
if (chart) {
chart.style.width = '210mm'; // 强制 A4 宽度
chart.style.margin = '0 auto';
}
},
};
// 导出为 PDF 并打印
html2pdf()
.from(clone)
.set(opt)
.toPdf()
.get('pdf')
.then(function (pdf) {
pdf.autoPrint(); // 自动打印
window.open(pdf.output('bloburl'), '_blank'); // 在新窗口打开 PDF以便用户确认
})
.finally(() => {
document.body.removeChild(clone); // 清理临时元素
});
}
// 转化时间
function formatDateTo(dateStr) {

View File

@@ -1017,7 +1017,12 @@ function submitAudit() {
proxy.$modal.msgSuccess('提交审批成功');
emit('refresh');
visible.value = false;
} else {
proxy.$modal.msgError(res.msg || '提交审批失败');
}
}).catch((error) => {
console.error('提交审批失败:', error);
proxy.$modal.msgError(error.message || '提交审批失败,请重试');
});
}
}

View File

@@ -942,10 +942,17 @@ function handleSubmitApproval() {
proxy.$modal.msgWarning('第' + length + '行单据未保存,请先保存');
} else {
submitApproval(receiptHeaderForm.busNo).then((response) => {
proxy.$modal.msgSuccess('提交审批成功');
tagsViewStore.delView(router.currentRoute.value);
store.clearCurrentDataLYCK();
router.replace({ path: 'requisitionManagementList' });
if (response.code == 200) {
proxy.$modal.msgSuccess('提交审批成功');
tagsViewStore.delView(router.currentRoute.value);
store.clearCurrentDataLYCK();
router.replace({ path: 'requisitionManagementList' });
} else {
proxy.$modal.msgError(response.msg || '提交审批失败');
}
}).catch((error) => {
console.error('提交审批失败:', error);
proxy.$modal.msgError(error.message || '提交审批失败,请重试');
});
}
}

View File

@@ -1015,11 +1015,18 @@ function handleSubmitApproval() {
proxy.$modal.msgWarning('第' + length + '行单据未保存,请先保存');
} else {
submitTHApproval(receiptHeaderForm.busNo).then((response) => {
proxy.$modal.msgSuccess('提交审批成功');
tagsViewStore.delView(router.currentRoute.value);
store.clearCurrentDataLYTK();
// 跳转到审核页面
router.replace({ path: 'requisitionInventoryManagement' });
if (response.code == 200) {
proxy.$modal.msgSuccess('提交审批成功');
tagsViewStore.delView(router.currentRoute.value);
store.clearCurrentDataLYTK();
// 跳转到审核页面
router.replace({ path: 'requisitionInventoryManagement' });
} else {
proxy.$modal.msgError(response.msg || '提交审批失败');
}
}).catch((error) => {
console.error('提交审批失败:', error);
proxy.$modal.msgError(error.message || '提交审批失败,请重试');
});
}
}

View File

@@ -244,7 +244,6 @@ const loading = ref(false);
const getList = () => {
loading.value = true;
getRegisteInfoPage(queryParams.value).then((res) => {
console.log(res);
treatHospitalizedData.value = res.data.records;
total.value = res.data.total;
loading.value = false;