From 97a161a5042d9ef92605f306163f040823491f1f Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 10 七月 2025 18:06:46 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java              |    2 ++
 smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java |    9 +++++----
 smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml              |    4 ++++
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java b/smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java
index 8a00b1b..266b9e9 100644
--- a/smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java
@@ -92,6 +92,8 @@
      */
     void createPatMedOuthosp(@Param("templateName") String templateName, @Param("newName") String newName);
 
+    void createPatMedOuthospAutoAdd(@Param("newName") String newName);
+
 
     void setAutoIncrement(@Param("tableName") String tableName, @Param("autoInc") long autoInc);
 
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
index c8e8bb5..b6e641e 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -920,7 +920,7 @@
         int count = patMedOuthospMapper.countPatMedOuthosp();
         if (count > 3000000) {
             // 2. 鍐疯棌琛ㄥ苟鏂板缓
-            String timeSuffix = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
+            String timeSuffix = new SimpleDateFormat("yyyyMM").format(new Date());
             String oldName = "pat_med_outhosp";
             String newName = oldName + "_" + timeSuffix;
 
@@ -937,9 +937,10 @@
                 }
             }
 
-            // 4. 鏂板缓
-            patMedOuthospMapper.createPatMedOuthosp(oldName, newName);
-
+            // 4. 鏂板缓(姝ゆ椂鍙墿鍐疯〃锛孭atMedOuthosp娌′簡锛岄渶瑕佹柊寤轰竴涓�)
+            patMedOuthospMapper.createPatMedOuthosp(newName, oldName);
+            //璁剧疆鏂拌〃鑷涓婚敭
+            patMedOuthospMapper.createPatMedOuthospAutoAdd(oldName);
             // 5. 璁剧疆鏂拌〃鑷璧峰鍊�
             patMedOuthospMapper.setAutoIncrement(oldName, maxId + 1);
 
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
index 6822850..50f29e7 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
@@ -382,6 +382,10 @@
         CREATE TABLE ${newName} LIKE ${templateName}
     </update>
 
+    <update id="createPatMedOuthospAutoAdd">
+        ALTER TABLE ${newName} MODIFY COLUMN id BIGINT NOT NULL AUTO_INCREMENT;
+    </update>
+
     <update id="setAutoIncrement">
         ALTER TABLE ${tableName} AUTO_INCREMENT = #{autoInc}
     </update>

--
Gitblit v1.9.3