Files
his/迁移记录-DB变更记录/20260106_check_and_add_surgery_indication.sql
chenqi 0b4b63dfbe feat(surgery): 增加手术室确认信息和次要手术功能
- 添加手术室确认时间和确认人字段显示
- 实现次要手术的添加、编辑和删除功能
- 增加急诊标志和植入高值耗材开关选项
- 添加手术费用和麻醉费用计算功能
- 实现手术和麻醉项目的远程搜索功能
- 增加第一助手和第二助手选择功能
- 优化医生列表加载逻辑,支持多接口获取
- 添加按钮图标提升界面体验
- 修复encounterId为空时的接口调用问题
2026-01-07 17:00:06 +08:00

54 lines
1.5 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 检查并添加手术指征字段
-- 执行时间2025-01-06
-- 说明:修复手术指征字段无法保存或展示的问题
-- 1. 检查surgery_indication字段是否存在
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1
FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = 'cli_surgery'
AND column_name = 'surgery_indication'
) THEN
-- 字段不存在,添加该字段
ALTER TABLE cli_surgery ADD COLUMN surgery_indication TEXT;
-- 添加字段注释
COMMENT ON COLUMN cli_surgery.surgery_indication IS '手术指征';
RAISE NOTICE '已添加 surgery_indication 字段到 cli_surgery 表';
ELSE
RAISE NOTICE 'surgery_indication 字段已存在于 cli_surgery 表';
END IF;
END $$;
-- 2. 验证字段是否添加成功
SELECT
column_name,
data_type,
is_nullable,
column_default,
character_maximum_length
FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = 'cli_surgery'
AND column_name = 'surgery_indication';
-- 3. 查看最近的手术记录,检查surgery_indication字段是否有数据
SELECT
id,
surgery_no,
surgery_name,
surgery_indication,
create_time
FROM cli_surgery
WHERE delete_flag = '0'
ORDER BY create_time DESC
LIMIT 5;
-- 4. 更新说明
-- 手术指征字段已添加,可以正常保存和展示数据
-- 该字段为TEXT类型,可以存储较长的文本内容