diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml.bak b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml.bak new file mode 100755 index 000000000..019afb542 --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml.bak @@ -0,0 +1,385 @@ + + + + + + + + + + + + + + diff --git a/openhis-server-new/openhis-domain/src/main/resources/mapper/administration/EncounterDiagnosisMapper.xml b/openhis-server-new/openhis-domain/src/main/resources/mapper/administration/EncounterDiagnosisMapper.xml index 59e8ac007..a297876df 100755 --- a/openhis-server-new/openhis-domain/src/main/resources/mapper/administration/EncounterDiagnosisMapper.xml +++ b/openhis-server-new/openhis-domain/src/main/resources/mapper/administration/EncounterDiagnosisMapper.xml @@ -27,6 +27,7 @@ AND T1.delete_flag = '0' AND T2.delete_flag = '0' AND T1.tenant_id = #{tenantId} + LIMIT 1 \ No newline at end of file diff --git a/sql/迁移记录-DB变更记录/20260529_fix_BUG#613_add_column_back_reason.sql b/sql/迁移记录-DB变更记录/20260529_fix_BUG#613_add_column_back_reason.sql index 08f941cd5..e50ff420f 100644 --- a/sql/迁移记录-DB变更记录/20260529_fix_BUG#613_add_column_back_reason.sql +++ b/sql/迁移记录-DB变更记录/20260529_fix_BUG#613_add_column_back_reason.sql @@ -1,13 +1,17 @@ -- Bug #613: 医嘱退回流程 — med_medication_request 表缺少退回原因字段 --- 执行前检查:如果列已存在则跳过 +-- 退回原因必填(NOT NULL),前端弹窗 + 后端都做校验 DO $$ BEGIN IF NOT EXISTS ( SELECT 1 FROM information_schema.columns WHERE table_name = 'med_medication_request' AND column_name = 'back_reason' ) THEN - ALTER TABLE med_medication_request ADD COLUMN back_reason VARCHAR(500) DEFAULT NULL; - COMMENT ON COLUMN med_medication_request.back_reason IS '退回原因'; + ALTER TABLE med_medication_request ADD COLUMN back_reason VARCHAR(500) NOT NULL DEFAULT ''; + COMMENT ON COLUMN med_medication_request.back_reason IS '退回原因(必填)'; + ELSE + -- 列已存在,确保 NOT NULL + ALTER TABLE med_medication_request ALTER COLUMN back_reason SET NOT NULL; + ALTER TABLE med_medication_request ALTER COLUMN back_reason SET DEFAULT ''; END IF; END $$;