Browse Source

feat: 处方图片生成逻辑优化

xdd 1 tuần trước cách đây
mục cha
commit
8ca97b8ee8

+ 8 - 6
fs-service/src/main/java/com/fs/his/mapper/PrescriptionRetryRecordMapper.java

@@ -52,14 +52,16 @@ public interface PrescriptionRetryRecordMapper {
     /**
      * 更新记录
      */
-    @Update("UPDATE prescription_retry_record SET " +
-            "retry_count = #{retryCount}, " +
-            "error_reason = #{errorReason}, " +
-            "status = #{status}, " +
-            "remark = #{remark} " +
-            "WHERE id = #{id}")
+    @Update("<script>UPDATE prescription_retry_record SET " +
+            "<if test='retryCount != null'>retry_count = #{retryCount}, </if>" +
+            "<if test='errorReason != null'>error_reason = #{errorReason}, </if>" +
+            "<if test='status != null'>status = #{status}, </if>" +
+            "<if test='remark != null'>remark = #{remark}, </if>" +
+            "update_time = now() " +
+            "WHERE id = #{id}</script>")
     int update(PrescriptionRetryRecord record);
 
+
     /**
      * 更新状态
      */

+ 4 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsPrescribeServiceImpl.java

@@ -997,6 +997,10 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
                 log.info("处方单号: {} 图片生成成功", prescribeId);
             } catch (Exception e) {
                 log.error("处方单号: {} 图片生成失败, 错误信息: {}", prescribeId, e.getMessage(), e);
+                record.setStatus(3);
+                record.setUpdateTime(LocalDateTime.now());
+                record.setErrorReason(ExceptionUtils.getFullStackTrace(e));
+                prescriptionRetryRecordMapper.update(record);
             }
         }