docs(requirement): 添加手术室维护界面需求文档
- 创建手术室维护界面PRD文档 - 定义页面概述、核心功能和用户价值 - 设计整体布局和页面区域详细描述 - 规范交互功能和数据结构说明 - 说明开发实现要点和注意事项 - 移除中医诊断主诊断功能实现说明文档 - 移除公告通知弹窗功能说明文档 - 移除手术人员字段不显示问题解决方案文档 - 移除手术和麻醉信息Redis缓存实现说明文档 - 移除手术室管理添加类型和所属科室字段说明文档
This commit is contained in:
@@ -1,82 +1,4 @@
|
||||
-- 为手术室管理表添加类型和所属科室字段(PostgreSQL版本)
|
||||
-- 作者: 系统管理员
|
||||
-- 日期: 2026-01-09
|
||||
-- 说明: 添加手术室类型字段,区分不同类型的手术室(急诊、择期、日间、复合手术室)
|
||||
|
||||
-- 1. 检查并添加手术室类型字段到 adm_operating_room 表
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema = 'public'
|
||||
AND table_name = 'adm_operating_room'
|
||||
AND column_name = 'room_type_enum'
|
||||
) THEN
|
||||
ALTER TABLE adm_operating_room
|
||||
ADD COLUMN room_type_enum INTEGER DEFAULT 2;
|
||||
|
||||
COMMENT ON COLUMN adm_operating_room.room_type_enum IS
|
||||
'手术室类型:1-急诊手术室,2-择期手术室,3-日间手术室,4-复合手术室';
|
||||
|
||||
RAISE NOTICE '已添加字段 room_type_enum';
|
||||
ELSE
|
||||
RAISE NOTICE '字段 room_type_enum 已存在,跳过添加';
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- 2. 更新现有数据的默认值为择期手术室(2)
|
||||
UPDATE adm_operating_room
|
||||
SET room_type_enum = 2
|
||||
WHERE room_type_enum IS NULL;
|
||||
|
||||
-- 3. 检查并添加索引以提高查询性能
|
||||
DO $$
|
||||
BEGIN
|
||||
-- 检查并添加 room_type_enum 索引
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_indexes
|
||||
WHERE schemaname = 'public'
|
||||
AND tablename = 'adm_operating_room'
|
||||
AND indexname = 'idx_room_type'
|
||||
) THEN
|
||||
CREATE INDEX idx_room_type ON adm_operating_room(room_type_enum);
|
||||
RAISE NOTICE '已创建索引 idx_room_type';
|
||||
ELSE
|
||||
RAISE NOTICE '索引 idx_room_type 已存在,跳过创建';
|
||||
END IF;
|
||||
|
||||
-- 检查并添加 organization_id 索引
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_indexes
|
||||
WHERE schemaname = 'public'
|
||||
AND tablename = 'adm_operating_room'
|
||||
AND indexname = 'idx_org_id'
|
||||
) THEN
|
||||
CREATE INDEX idx_org_id ON adm_operating_room(organization_id);
|
||||
RAISE NOTICE '已创建索引 idx_org_id';
|
||||
ELSE
|
||||
RAISE NOTICE '索引 idx_org_id 已存在,跳过创建';
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- 4. 检查并插入手术室类型字典数据
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM sys_dict_type
|
||||
WHERE dict_type = 'operating_room_type'
|
||||
) THEN
|
||||
INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, create_time, remark)
|
||||
VALUES ('手术室类型', 'operating_room_type', '0', 'system', NOW(), '手术室类型字典');
|
||||
RAISE NOTICE '已添加字典类型 operating_room_type';
|
||||
ELSE
|
||||
RAISE NOTICE '字典类型 operating_room_type 已存在,跳过添加';
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- 5. 检查并插入手术室类型字典项数据
|
||||
DO $$
|
||||
@@ -88,8 +10,8 @@ BEGIN
|
||||
WHERE dict_type = 'operating_room_type'
|
||||
AND dict_value = '1'
|
||||
) THEN
|
||||
INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, status, create_by, create_time, remark)
|
||||
VALUES ('room_type_emergency', 1, '急诊手术室', '1', 'operating_room_type', '0', 'system', NOW(), '用于急诊手术的手术室');
|
||||
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, status, create_by, create_time, remark)
|
||||
VALUES (1, '急诊手术室', '1', 'operating_room_type', '0', 'system', NOW(), '用于急诊手术的手术室');
|
||||
RAISE NOTICE '已添加字典项:急诊手术室';
|
||||
ELSE
|
||||
RAISE NOTICE '字典项:急诊手术室 已存在,跳过添加';
|
||||
@@ -101,8 +23,8 @@ BEGIN
|
||||
WHERE dict_type = 'operating_room_type'
|
||||
AND dict_value = '2'
|
||||
) THEN
|
||||
INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, status, create_by, create_time, remark)
|
||||
VALUES ('room_type_elective', 2, '择期手术室', '2', 'operating_room_type', '0', 'system', NOW(), '用于择期手术的手术室');
|
||||
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, status, create_by, create_time, remark)
|
||||
VALUES (2, '择期手术室', '2', 'operating_room_type', '0', 'system', NOW(), '用于择期手术的手术室');
|
||||
RAISE NOTICE '已添加字典项:择期手术室';
|
||||
ELSE
|
||||
RAISE NOTICE '字典项:择期手术室 已存在,跳过添加';
|
||||
@@ -114,8 +36,8 @@ BEGIN
|
||||
WHERE dict_type = 'operating_room_type'
|
||||
AND dict_value = '3'
|
||||
) THEN
|
||||
INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, status, create_by, create_time, remark)
|
||||
VALUES ('room_type_day_surgery', 3, '日间手术室', '3', 'operating_room_type', '0', 'system', NOW(), '用于日间手术的手术室');
|
||||
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, status, create_by, create_time, remark)
|
||||
VALUES (3, '日间手术室', '3', 'operating_room_type', '0', 'system', NOW(), '用于日间手术的手术室');
|
||||
RAISE NOTICE '已添加字典项:日间手术室';
|
||||
ELSE
|
||||
RAISE NOTICE '字典项:日间手术室 已存在,跳过添加';
|
||||
@@ -127,28 +49,14 @@ BEGIN
|
||||
WHERE dict_type = 'operating_room_type'
|
||||
AND dict_value = '4'
|
||||
) THEN
|
||||
INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, status, create_by, create_time, remark)
|
||||
VALUES ('room_type_hybrid', 4, '复合手术室', '4', 'operating_room_type', '0', 'system', NOW(), '用于复合手术的手术室');
|
||||
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, status, create_by, create_time, remark)
|
||||
VALUES (4, '复合手术室', '4', 'operating_room_type', '0', 'system', NOW(), '用于复合手术的手术室');
|
||||
RAISE NOTICE '已添加字典项:复合手术室';
|
||||
ELSE
|
||||
RAISE NOTICE '字典项:复合手术室 已存在,跳过添加';
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- 6. 验证修改 - 查看新增的字段
|
||||
SELECT
|
||||
table_name,
|
||||
column_name,
|
||||
data_type,
|
||||
is_nullable,
|
||||
column_default,
|
||||
col_description(pgc_catalog.oid, pg_namespace.oid, pg_class.oid, pg_attribute.attnum) AS column_comment
|
||||
FROM
|
||||
information_schema.columns
|
||||
WHERE
|
||||
table_schema = 'public'
|
||||
AND table_name = 'adm_operating_room'
|
||||
AND column_name = 'room_type_enum';
|
||||
|
||||
-- 7. 显示所有手术室及其类型
|
||||
SELECT
|
||||
|
||||
Reference in New Issue
Block a user