fix(common): 统一异常处理并迁移打印功能到hiprint
- 替换所有System.out.println和printStackTrace为slf4j日志记录 - 在BeanUtils、AuditFieldUtil、DateUtils、ServletUtils等工具类中添加Logger实例 - 在Flowable相关控制器和服务中统一错误日志记录格式 - 在代码生成器中添加日志记录功能 - 将前端打印组件从Lodop迁移到hiprint打印方案 - 更新体温单打印功能使用hiprint预览打印 - 移除调试用的console.log语句 - 修复打印模板中线条元素类型定义
This commit is contained in:
@@ -117,7 +117,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {getLodop} from '../../../plugins/print/LodopFuncs'
|
||||
// 迁移到 hiprint
|
||||
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
|
||||
|
||||
export default {
|
||||
name: 'VuePrintNb',
|
||||
@@ -143,37 +144,38 @@ export default {
|
||||
else if (pressure.bloodPressureShrinkOne === null) return ''
|
||||
return pressure.bloodPressureShrinkOne + '/' + pressure.bloodPressureDiastoleOne
|
||||
},
|
||||
printTriage(printerName) {
|
||||
/**
|
||||
* 使用 hiprint 执行打印
|
||||
* @param {string} printerName 打印机名称
|
||||
*/
|
||||
async printTriage(printerName) {
|
||||
console.log(this.printData, 'printData')
|
||||
const LODOP = getLodop()
|
||||
const printer = this.getPrinter(LODOP, printerName)
|
||||
if (printer === null) {
|
||||
this.openMesBox('6', '没有找到打印机【' + printerName + '】')
|
||||
return
|
||||
}
|
||||
LODOP.PRINT_INIT()
|
||||
LODOP.SET_PRINTER_INDEX(printer) // 指定打印机
|
||||
this.setPrint(LODOP)
|
||||
LODOP.SET_PRINT_PAGESIZE(0, '100mm', '140mm', '')
|
||||
// LODOP.PREVIEW(); // 打印预览
|
||||
LODOP.PRINT() // 直接打印
|
||||
},
|
||||
setPrint(LODOP) {
|
||||
LODOP.ADD_PRINT_HTM(0, 0, '100%', '100%', document.getElementById('div1').innerHTML)
|
||||
LODOP.ADD_PRINT_BARCODE(40, 100, 100, 100, 'qrcode', this.printData.hisId) // 设置条码位置、宽高、字体、值
|
||||
LODOP.ADD_PRINT_HTM(200, 0, '100%', '100%', document.getElementById('div2').innerHTML)
|
||||
LODOP.ADD_PRINT_HTM(230, 10, '100%', '100%', document.getElementById('div3').innerHTML)
|
||||
LODOP.ADD_PRINT_HTM(295, 10, '100%', '100%', document.getElementById('div4').innerHTML)
|
||||
},
|
||||
// 获取打印机
|
||||
getPrinter(LODOP, name) {
|
||||
const listCount = LODOP.GET_PRINTER_COUNT() // 当前打印设备数量
|
||||
for (let i = 0; i < listCount; i++) {
|
||||
if (LODOP.GET_PRINTER_NAME(i) === name) {
|
||||
return name
|
||||
try {
|
||||
// 构建打印数据
|
||||
const printData = {
|
||||
hisId: this.printData.hisId,
|
||||
triageLevel: this.printData.triageLevel,
|
||||
dept: this.printData.dept,
|
||||
patientName: this.printData.patientName,
|
||||
sex: this.printData.sex,
|
||||
age: this.printData.age,
|
||||
temperature: this.printData.observation ? this.printData.observation.temperature : '',
|
||||
sphygmus: this.printData.observation ? this.printData.observation.sphygmus : '',
|
||||
breath: this.printData.observation ? this.printData.observation.breath : '',
|
||||
bloodPressure: this.getBloodPressure(this.printData.observation),
|
||||
bloodOxygen: this.printData.observation ? this.printData.observation.bloodOxygen : '',
|
||||
triageTime: this.printData.triageTime,
|
||||
tel: this.printData.tel,
|
||||
greenText: this.printData.greenText || ''
|
||||
}
|
||||
// 使用 hiprint 打印
|
||||
await simplePrint(PRINT_TEMPLATE.TRIAGE_TICKET, printData, printerName)
|
||||
} catch (error) {
|
||||
console.error('分诊条打印失败:', error)
|
||||
if (this.openMesBox) {
|
||||
this.openMesBox('6', '打印失败: ' + (error.message || '未知错误'))
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user