diff --git a/src/main/java/com/dpkj/common/exception/ControllerAdvice.java b/src/main/java/com/dpkj/common/exception/ControllerAdvice.java index 596c4c8..4298bbb 100644 --- a/src/main/java/com/dpkj/common/exception/ControllerAdvice.java +++ b/src/main/java/com/dpkj/common/exception/ControllerAdvice.java @@ -60,7 +60,7 @@ public class ControllerAdvice { */ @ExceptionHandler(value = NullPointerException.class) public Result nullPointException(NullPointerException nullPointerException) { - log.error("空指针异常类型: {},信息: {}", nullPointerException.getClass(),nullPointerException.getMessage()); + log.error("空指针异常类型: {},信息: {}", nullPointerException.getClass(), nullPointerException); return Result.error(ErrorEnum.NULL_POINTER_EXCEPTION); } @@ -86,7 +86,7 @@ public class ControllerAdvice { */ @ExceptionHandler(value = HttpMessageNotReadableException.class) public Result httpMessageNotReadAbleException(HttpMessageNotReadableException e){ - log.warn("异常类型: {} 无可读信息: {}", e.getClass(), e.getMessage()); + log.warn("异常类型: {} 无可读信息: ", e.getClass(), e); return Result.error(ErrorEnum.HTTP_MESSAGE_NOT_READABLE_EXCEPTION); } @@ -97,7 +97,7 @@ public class ControllerAdvice { */ @ExceptionHandler(value = RuntimeException.class) public Result runtimeException(RuntimeException e){ - log.error("运行时异常:{}", e.getMessage()); + log.error("运行时异常:", e); if (e instanceof RRException){ RRException rrException = (RRException) e; return Result.error(rrException.getCode(), rrException.getMsg()); @@ -111,7 +111,7 @@ public class ControllerAdvice { */ @ExceptionHandler(value = HttpRequestMethodNotSupportedException.class) public Result httpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e){ - log.warn("暂不支持该请求: {}", e.getMessage()); + log.warn("暂不支持该请求: ", e); return Result.error("暂不支持此请求方式"); } @@ -121,7 +121,7 @@ public class ControllerAdvice { */ @ExceptionHandler(MethodArgumentTypeMismatchException.class) public Result methodArgument(MethodArgumentTypeMismatchException e){ - log.warn("参数发生错误: {}", e.getMessage()); + log.warn("参数发生错误: ", e); return Result.error("参数发生错误"); } @@ -132,7 +132,7 @@ public class ControllerAdvice { */ @ExceptionHandler(MissingServletRequestParameterException.class) public Result exception(MissingServletRequestParameterException e){ - log.warn("缺少请求参数: {}", e.getMessage()); + log.warn("缺少请求参数: ", e); return Result.error("缺少请求参数"); } diff --git a/src/main/java/com/dpkj/modules/print/service/impl/RegisterServiceImpl.java b/src/main/java/com/dpkj/modules/print/service/impl/RegisterServiceImpl.java index c916997..77a2143 100644 --- a/src/main/java/com/dpkj/modules/print/service/impl/RegisterServiceImpl.java +++ b/src/main/java/com/dpkj/modules/print/service/impl/RegisterServiceImpl.java @@ -51,6 +51,13 @@ public class RegisterServiceImpl implements PrintService { width = FIXED_WIDTH; } + if ( StringUtils.isEmpty(printerConfig.getTimeType())){ + throw new RRException("获取打印时间格式出错:" + printerConfig.getTimeType()); + } + if ( StringUtils.isEmpty(printerConfig.getTerminalNumber())){ + throw new RRException("获取终端号出错:" + printerConfig.getTerminalNumber()); + } + // 强行设置终端号 data.put("terminalNumber", printerConfig.getTerminalNumber()); @@ -129,8 +136,8 @@ public class RegisterServiceImpl implements PrintService { int pieceHeight = Math.min(MAX_HEIGHT, height - startY); // 创建一个新的 BufferedImage 对象,用于存储切割的部分 - BufferedImage piece = new BufferedImage(FIXED_WIDTH, pieceHeight, BufferedImage.TYPE_INT_RGB); - piece.getGraphics().drawImage(originalImage, 0, 0, FIXED_WIDTH, pieceHeight, 0, startY, FIXED_WIDTH, startY + pieceHeight, null); + BufferedImage piece = new BufferedImage(width, pieceHeight, BufferedImage.TYPE_INT_RGB); + piece.getGraphics().drawImage(originalImage, 0, 0, width, pieceHeight, 0, startY, width, startY + pieceHeight, null); // 保存切割的图片块 File outputFile = new File(saveDir + "/output_" + (i + 1) + ".jpg"); diff --git a/src/main/resources/templates/department.html b/src/main/resources/templates/department.html index 82526a0..6cfb6af 100644 --- a/src/main/resources/templates/department.html +++ b/src/main/resources/templates/department.html @@ -3,183 +3,73 @@ 门诊缴费凭证 - -
-
-
************
-
-
+
+
+
************
+
+
-
+
-----------------------------------------------------------------------------
-
-
-
姓名:
-
性别:
-
年龄:
+
+
+
+ 姓名: +
+
性别:
+
年龄:
-
-
门诊号:
-
就诊医生:
+
+
+ 门诊号:
+
+ 就诊医生: +
-
就诊科室:
+
就诊科室:
-
+
-----------------------------------------------------------------------------
-
-
-
费用总额:
-
个人支付:
+
+
+
费用总额:
+
个人支付:
-
实收金额:
-
实收金额:
+
实收金额:
+
实收金额:
-
+
-----------------------------------------------------------------------------
-
- - - - - - +
+
项目名称数量单价小计
+ + + + + - - - - - + + + + +
项目名称数量单价小计
-
+
-----------------------------------------------------------------------------
-
+
终端编号:
打印时间:
-
- 温馨提示
+
+ 温馨提示
1.请取走全部凭条、并妥善保管
2.如果对缴费结算存在疑问,请到人工窗口咨询
diff --git a/src/main/resources/templates/department2.html b/src/main/resources/templates/department2.html new file mode 100644 index 0000000..82526a0 --- /dev/null +++ b/src/main/resources/templates/department2.html @@ -0,0 +1,188 @@ + + + + + 门诊缴费凭证 + + + +
+
+
************
+
+
+
+
+ ----------------------------------------------------------------------------- +
+
+
+
姓名:
+
性别:
+
年龄:
+
+
+
门诊号:
+
就诊医生:
+
+
就诊科室:
+
+
+ ----------------------------------------------------------------------------- +
+
+
+
费用总额:
+
个人支付:
+
+
实收金额:
+
实收金额:
+
+
+ ----------------------------------------------------------------------------- +
+
+ + + + + + + + + + + + + +
项目名称数量单价小计
+
+
+ ----------------------------------------------------------------------------- +
+
+
终端编号:
+
打印时间:
+
+
+ 温馨提示
+ 1.请取走全部凭条、并妥善保管
+ 2.如果对缴费结算存在疑问,请到人工窗口咨询 +
+
+ +