From 7a07ff882c57c79b1ec9c1ac02f3f8c51d4352b4 Mon Sep 17 00:00:00 2001 From: chenqi Date: Wed, 24 Jun 2026 09:21:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=81=A2=E5=A4=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E5=BA=93=E9=85=8D=E7=BD=AE=E5=B9=B6?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DV41=E8=BF=81=E7=A7=BB=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../V41__bug735_add_stopper_id_to_requests.sql | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V41__bug735_add_stopper_id_to_requests.sql b/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V41__bug735_add_stopper_id_to_requests.sql index da7e0dd0f..76463d0c9 100644 --- a/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V41__bug735_add_stopper_id_to_requests.sql +++ b/healthlink-his-server/healthlink-his-application/src/main/resources/db/migration/V41__bug735_add_stopper_id_to_requests.sql @@ -2,8 +2,16 @@ -- 原因:stopper_name 映射到 update_by 字段,签发时 MyBatis-Plus 自动填充导致错误赋值 -- 修复:添加专用 stopper_id 字段,仅在停嘱操作时设置 --- 药品请求表添加停嘱医生ID字段 -ALTER TABLE med_medication_request ADD COLUMN IF NOT EXISTS stopper_id BIGINT; +-- 药品请求表添加停嘱医生ID字段(仅当表存在时) +DO $$ BEGIN + ALTER TABLE med_medication_request ADD COLUMN IF NOT EXISTS stopper_id BIGINT; +EXCEPTION WHEN undefined_table THEN + RAISE NOTICE 'med_medication_request table does not exist, skipping'; +END $$; --- 服务请求表添加停嘱医生ID字段 -ALTER TABLE wor_service_request ADD COLUMN IF NOT EXISTS stopper_id BIGINT; +-- 服务请求表添加停嘱医生ID字段(仅当表存在时) +DO $$ BEGIN + ALTER TABLE wor_service_request ADD COLUMN IF NOT EXISTS stopper_id BIGINT; +EXCEPTION WHEN undefined_table THEN + RAISE NOTICE 'wor_service_request table does not exist, skipping'; +END $$;