Files
Agent-System/deploy/postgres/archive/pre-goose/2026-09-11-seed-ten-projects.sql
T
weichenandCursor 265f09c1f2 fix(server): cache health probes, surface SSE marshal errors, fail closed on missing duties
Health checks reuse a two-second snapshot and bound the schema query. Task SSE writes an error frame when an event cannot be encoded. ResolveDocTask errors when the frozen plan has no duty row, while explicit none-duties stay zero. Drop the unwired semantic-summary replace env, record the intentional dev versus release model split, document the test/main cutover path, and archive pre-goose SQL.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-19 09:16:18 +00:00

463 lines
31 KiB
PL/PgSQL

-- 10 个示例医疗器械项目数据初始化脚本 (针对项目评审全流程落地)
BEGIN;
INSERT INTO projects (id, code, name, customer_name, device_type, intended_use, target_market, current_stage, environment, status, creator_user_id, active_workflow_key, workflow_selection_version, created_at, updated_at)
VALUES (6001, 'PROJ-WANGJING-0021', '膝骨关节炎综合治疗仪', '中国中医科学院望京医院骨伤科', '中药离子导入与多频温控电热综合治疗设备', '用于早中期膝骨关节炎患者的局部经皮靶向定向透药导入、穴位多频电刺激止痛与温热理疗', '中国 NMPA II类 (YY 0601-2007 中药定向透药治疗仪, GB 9706.1-2020, YY 0505-2012)', 'V0.5', 'dev', 'active', 1, 'main', 1, now(), now())
ON CONFLICT (id) DO UPDATE SET
code = EXCLUDED.code,
name = EXCLUDED.name,
customer_name = EXCLUDED.customer_name,
device_type = EXCLUDED.device_type,
intended_use = EXCLUDED.intended_use,
target_market = EXCLUDED.target_market,
creator_user_id = 1,
active_workflow_key = 'main',
workflow_selection_version = 1,
updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6001, 'main', 'active', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'active', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6001, 'product_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6001, 'test_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6001-pm-01', 6001, 'product_manager', 'completed', 1, 'V0.5', 'system_reqs', 'doc-proj6001-system_reqs', '智能产品经理已生成系统需求规格书并通过门禁', now() - interval '2 hours', now() - interval '1 hour', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6001-tm-01', 6001, 'test_manager', 'completed', 1, 'V0.5', 'test_manager', 'doc-proj6001-test_manager', '智能测试经理已建立测试方案并完成需求全量映射', now() - interval '50 minutes', now() - interval '30 minutes', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO document_lineage (project_id, downstream_doc_id, downstream_version, upstream_doc_id, upstream_version, upstream_sha256, is_stale, created_at)
VALUES (6001, 'doc-proj6001-test_manager', 1, 'doc-proj6001-system_reqs', 1, '8f74e4bc4391ec4a6fdfb62e3a634d537063f34e1dbcfdeec8f79760bf52ae4a', false, now())
ON CONFLICT (downstream_doc_id, downstream_version, upstream_doc_id, upstream_version) DO UPDATE SET
upstream_sha256 = EXCLUDED.upstream_sha256,
is_stale = false;
INSERT INTO projects (id, code, name, customer_name, device_type, intended_use, target_market, current_stage, environment, status, creator_user_id, active_workflow_key, workflow_selection_version, created_at, updated_at)
VALUES (6002, 'PROJ-TINAVI-0050', '移动式C形臂X射线机', '北京天智航医疗科技股份有限公司', '骨科手术三维透视导航配准高频X射线成像系统', '用于骨科创伤与脊柱微创手术中实时高频脉冲透视、三维空间重构及导航配准标记点追踪', '中国 NMPA III类 (GB 9706.1-2020, GB 9706.103, GB 9706.254, YY 0505)', 'V0.5', 'dev', 'active', 1, 'main', 1, now(), now())
ON CONFLICT (id) DO UPDATE SET
code = EXCLUDED.code,
name = EXCLUDED.name,
customer_name = EXCLUDED.customer_name,
device_type = EXCLUDED.device_type,
intended_use = EXCLUDED.intended_use,
target_market = EXCLUDED.target_market,
creator_user_id = 1,
active_workflow_key = 'main',
workflow_selection_version = 1,
updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6002, 'main', 'active', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'active', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6002, 'product_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6002, 'test_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6002-pm-01', 6002, 'product_manager', 'completed', 1, 'V0.5', 'system_reqs', 'doc-proj6002-system_reqs', '智能产品经理已生成系统需求规格书并通过门禁', now() - interval '2 hours', now() - interval '1 hour', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6002-tm-01', 6002, 'test_manager', 'completed', 1, 'V0.5', 'test_manager', 'doc-proj6002-test_manager', '智能测试经理已建立测试方案并完成需求全量映射', now() - interval '50 minutes', now() - interval '30 minutes', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO document_lineage (project_id, downstream_doc_id, downstream_version, upstream_doc_id, upstream_version, upstream_sha256, is_stale, created_at)
VALUES (6002, 'doc-proj6002-test_manager', 1, 'doc-proj6002-system_reqs', 1, '483e0647c100d48ef5ef84bc9d1a7765a1cd8cedb81d15f61cae567f5cccc2ea', false, now())
ON CONFLICT (downstream_doc_id, downstream_version, upstream_doc_id, upstream_version) DO UPDATE SET
upstream_sha256 = EXCLUDED.upstream_sha256,
is_stale = false;
INSERT INTO projects (id, code, name, customer_name, device_type, intended_use, target_market, current_stage, environment, status, creator_user_id, active_workflow_key, workflow_selection_version, created_at, updated_at)
VALUES (6003, 'PROJ-ROBOT-0025', '移动式远程查房听问诊系统', '解放军总医院第一医学中心急诊重症监护室', '移动式隔离病区智能巡诊查房与电子听诊系统', '用于传染病隔离病房及危重监护室中远程医生自主导航移动巡诊、高保真电子听诊心肺音与音视频问诊', '中国 NMPA II类 (GB 9706.1-2020, YY 0505, 机器人安全通用要求)', 'V0.5', 'dev', 'active', 1, 'main', 1, now(), now())
ON CONFLICT (id) DO UPDATE SET
code = EXCLUDED.code,
name = EXCLUDED.name,
customer_name = EXCLUDED.customer_name,
device_type = EXCLUDED.device_type,
intended_use = EXCLUDED.intended_use,
target_market = EXCLUDED.target_market,
creator_user_id = 1,
active_workflow_key = 'main',
workflow_selection_version = 1,
updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6003, 'main', 'active', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'active', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6003, 'product_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6003, 'test_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6003-pm-01', 6003, 'product_manager', 'completed', 1, 'V0.5', 'system_reqs', 'doc-proj6003-system_reqs', '智能产品经理已生成系统需求规格书并通过门禁', now() - interval '2 hours', now() - interval '1 hour', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6003-tm-01', 6003, 'test_manager', 'completed', 1, 'V0.5', 'test_manager', 'doc-proj6003-test_manager', '智能测试经理已建立测试方案并完成需求全量映射', now() - interval '50 minutes', now() - interval '30 minutes', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO document_lineage (project_id, downstream_doc_id, downstream_version, upstream_doc_id, upstream_version, upstream_sha256, is_stale, created_at)
VALUES (6003, 'doc-proj6003-test_manager', 1, 'doc-proj6003-system_reqs', 1, '13ad277e56bd20a2ef06e6d71ecabbffe6236083569103a4646b477f8740d5e8', false, now())
ON CONFLICT (downstream_doc_id, downstream_version, upstream_doc_id, upstream_version) DO UPDATE SET
upstream_sha256 = EXCLUDED.upstream_sha256,
is_stale = false;
INSERT INTO projects (id, code, name, customer_name, device_type, intended_use, target_market, current_stage, environment, status, creator_user_id, active_workflow_key, workflow_selection_version, created_at, updated_at)
VALUES (6004, 'PROJ-XHJ-0089', '一次性使用高频手术电极', '常州祥合洁医疗科技有限公司', '无源微创高频腹腔镜手术电极附件', '与兼容的高频手术设备主机配套,用于内窥镜或普腹手术中对人体软组织进行电切、电凝止血与剥离', '中国 NMPA II类 (GB 9706.202-2021 高频手术设备专标, GB/T 16886, GB 9706.1)', 'V0.5', 'dev', 'active', 1, 'main', 1, now(), now())
ON CONFLICT (id) DO UPDATE SET
code = EXCLUDED.code,
name = EXCLUDED.name,
customer_name = EXCLUDED.customer_name,
device_type = EXCLUDED.device_type,
intended_use = EXCLUDED.intended_use,
target_market = EXCLUDED.target_market,
creator_user_id = 1,
active_workflow_key = 'main',
workflow_selection_version = 1,
updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6004, 'main', 'active', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'active', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6004, 'product_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6004, 'test_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6004-pm-01', 6004, 'product_manager', 'completed', 1, 'V0.5', 'system_reqs', 'doc-proj6004-system_reqs', '智能产品经理已生成系统需求规格书并通过门禁', now() - interval '2 hours', now() - interval '1 hour', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6004-tm-01', 6004, 'test_manager', 'completed', 1, 'V0.5', 'test_manager', 'doc-proj6004-test_manager', '智能测试经理已建立测试方案并完成需求全量映射', now() - interval '50 minutes', now() - interval '30 minutes', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO document_lineage (project_id, downstream_doc_id, downstream_version, upstream_doc_id, upstream_version, upstream_sha256, is_stale, created_at)
VALUES (6004, 'doc-proj6004-test_manager', 1, 'doc-proj6004-system_reqs', 1, 'fbd0fab840ef3ee0fc7dfebd81aa1aa86774282ea195604133bce4c1a6df8c31', false, now())
ON CONFLICT (downstream_doc_id, downstream_version, upstream_doc_id, upstream_version) DO UPDATE SET
upstream_sha256 = EXCLUDED.upstream_sha256,
is_stale = false;
INSERT INTO projects (id, code, name, customer_name, device_type, intended_use, target_market, current_stage, environment, status, creator_user_id, active_workflow_key, workflow_selection_version, created_at, updated_at)
VALUES (6005, 'PROJ-ENDO-0029', '自动化牙髓根管治疗仪', '首都医科大学附属北京口腔医院牙体牙髓科', '牙科电动根管自适应预备与根尖阻抗测距一体化系统', '用于牙科牙体牙髓病及根尖周病治疗中根管的机用镍钛锉旋转往复预备扩锉与根尖孔生理狭窄区精确定位', '中国 NMPA II类 (YY 0836-2011 牙科根管预备机, YY 0505, GB 9706.1-2020)', 'V0.5', 'dev', 'active', 1, 'main', 1, now(), now())
ON CONFLICT (id) DO UPDATE SET
code = EXCLUDED.code,
name = EXCLUDED.name,
customer_name = EXCLUDED.customer_name,
device_type = EXCLUDED.device_type,
intended_use = EXCLUDED.intended_use,
target_market = EXCLUDED.target_market,
creator_user_id = 1,
active_workflow_key = 'main',
workflow_selection_version = 1,
updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6005, 'main', 'active', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'active', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6005, 'product_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6005, 'test_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6005-pm-01', 6005, 'product_manager', 'completed', 1, 'V0.5', 'system_reqs', 'doc-proj6005-system_reqs', '智能产品经理已生成系统需求规格书并通过门禁', now() - interval '2 hours', now() - interval '1 hour', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6005-tm-01', 6005, 'test_manager', 'completed', 1, 'V0.5', 'test_manager', 'doc-proj6005-test_manager', '智能测试经理已建立测试方案并完成需求全量映射', now() - interval '50 minutes', now() - interval '30 minutes', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO document_lineage (project_id, downstream_doc_id, downstream_version, upstream_doc_id, upstream_version, upstream_sha256, is_stale, created_at)
VALUES (6005, 'doc-proj6005-test_manager', 1, 'doc-proj6005-system_reqs', 1, 'b8c9a0363ecc46659fb79409eed60c06431044abb25a865b24e8136017dde9a6', false, now())
ON CONFLICT (downstream_doc_id, downstream_version, upstream_doc_id, upstream_version) DO UPDATE SET
upstream_sha256 = EXCLUDED.upstream_sha256,
is_stale = false;
INSERT INTO projects (id, code, name, customer_name, device_type, intended_use, target_market, current_stage, environment, status, creator_user_id, active_workflow_key, workflow_selection_version, created_at, updated_at)
VALUES (6006, 'PROJ-ARNAV-0035', '智能手术AR导航系统', '水木东方自研医疗器械研发中心 (转化医学实验室)', '独立医疗器械软件 (SaMD, II类医疗器械)', '用于显微外科与骨科导航中将术前三维 CT/MRI 重建解剖结构与光学透视 AR 眼镜实时精准配准叠加', '中国 NMPA II类 (YY/T 0664-2020 软件生存周期, GB/T 25000.51, 医疗器械网络安全)', 'V0.5', 'dev', 'active', 1, 'main', 1, now(), now())
ON CONFLICT (id) DO UPDATE SET
code = EXCLUDED.code,
name = EXCLUDED.name,
customer_name = EXCLUDED.customer_name,
device_type = EXCLUDED.device_type,
intended_use = EXCLUDED.intended_use,
target_market = EXCLUDED.target_market,
creator_user_id = 1,
active_workflow_key = 'main',
workflow_selection_version = 1,
updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6006, 'main', 'active', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'active', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6006, 'product_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6006, 'test_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6006-pm-01', 6006, 'product_manager', 'completed', 1, 'V0.5', 'system_reqs', 'doc-proj6006-system_reqs', '智能产品经理已生成系统需求规格书并通过门禁', now() - interval '2 hours', now() - interval '1 hour', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6006-tm-01', 6006, 'test_manager', 'completed', 1, 'V0.5', 'test_manager', 'doc-proj6006-test_manager', '智能测试经理已建立测试方案并完成需求全量映射', now() - interval '50 minutes', now() - interval '30 minutes', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO document_lineage (project_id, downstream_doc_id, downstream_version, upstream_doc_id, upstream_version, upstream_sha256, is_stale, created_at)
VALUES (6006, 'doc-proj6006-test_manager', 1, 'doc-proj6006-system_reqs', 1, '37eb3e2b0ba16369fd8c94f88c40d6cbca8635bf998acd1be75dd069a1599056', false, now())
ON CONFLICT (downstream_doc_id, downstream_version, upstream_doc_id, upstream_version) DO UPDATE SET
upstream_sha256 = EXCLUDED.upstream_sha256,
is_stale = false;
INSERT INTO projects (id, code, name, customer_name, device_type, intended_use, target_market, current_stage, environment, status, creator_user_id, active_workflow_key, workflow_selection_version, created_at, updated_at)
VALUES (6007, 'PROJ-LT-0068', '等离子射频手术电极', '北京蓝汀医疗器械开发有限公司', '微创关节与耳鼻喉低温等离子多极射频刀头', '与等离子射频手术主机配合,在生理盐水导电介质中激发低温等离子体薄层,用于微创软组织的精确消融打孔与凝血', '中国 NMPA II类 (YY 9706.202, GB 9706.1-2020, GB/T 16886)', 'V0.5', 'dev', 'active', 1, 'main', 1, now(), now())
ON CONFLICT (id) DO UPDATE SET
code = EXCLUDED.code,
name = EXCLUDED.name,
customer_name = EXCLUDED.customer_name,
device_type = EXCLUDED.device_type,
intended_use = EXCLUDED.intended_use,
target_market = EXCLUDED.target_market,
creator_user_id = 1,
active_workflow_key = 'main',
workflow_selection_version = 1,
updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6007, 'main', 'active', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'active', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6007, 'product_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6007, 'test_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6007-pm-01', 6007, 'product_manager', 'completed', 1, 'V0.5', 'system_reqs', 'doc-proj6007-system_reqs', '智能产品经理已生成系统需求规格书并通过门禁', now() - interval '2 hours', now() - interval '1 hour', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6007-tm-01', 6007, 'test_manager', 'completed', 1, 'V0.5', 'test_manager', 'doc-proj6007-test_manager', '智能测试经理已建立测试方案并完成需求全量映射', now() - interval '50 minutes', now() - interval '30 minutes', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO document_lineage (project_id, downstream_doc_id, downstream_version, upstream_doc_id, upstream_version, upstream_sha256, is_stale, created_at)
VALUES (6007, 'doc-proj6007-test_manager', 1, 'doc-proj6007-system_reqs', 1, '8930ba436f8126ee65975896fc8f8deb63a4c04495df38252fccb1913a74b74e', false, now())
ON CONFLICT (downstream_doc_id, downstream_version, upstream_doc_id, upstream_version) DO UPDATE SET
upstream_sha256 = EXCLUDED.upstream_sha256,
is_stale = false;
INSERT INTO projects (id, code, name, customer_name, device_type, intended_use, target_market, current_stage, environment, status, creator_user_id, active_workflow_key, workflow_selection_version, created_at, updated_at)
VALUES (6008, 'PROJ-PLASMA-0092', '低温等离子体手术系统', '天津医科大学总医院耳鼻咽喉头颈外科', '医用多功能低温等离子手术发生器与控制系统', '用于耳鼻咽喉、关节外科、脊柱微创手术中通过 100kHz 射频激发低温等离子体对软组织进行分子键裂解消融、精确切割与双极电凝止血', '中国 NMPA III类 (GB 9706.1-2020, YY 9706.202, YY 0505)', 'V0.5', 'dev', 'active', 1, 'main', 1, now(), now())
ON CONFLICT (id) DO UPDATE SET
code = EXCLUDED.code,
name = EXCLUDED.name,
customer_name = EXCLUDED.customer_name,
device_type = EXCLUDED.device_type,
intended_use = EXCLUDED.intended_use,
target_market = EXCLUDED.target_market,
creator_user_id = 1,
active_workflow_key = 'main',
workflow_selection_version = 1,
updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6008, 'main', 'active', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'active', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6008, 'product_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6008, 'test_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6008-pm-01', 6008, 'product_manager', 'completed', 1, 'V0.5', 'system_reqs', 'doc-proj6008-system_reqs', '智能产品经理已生成系统需求规格书并通过门禁', now() - interval '2 hours', now() - interval '1 hour', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6008-tm-01', 6008, 'test_manager', 'completed', 1, 'V0.5', 'test_manager', 'doc-proj6008-test_manager', '智能测试经理已建立测试方案并完成需求全量映射', now() - interval '50 minutes', now() - interval '30 minutes', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO document_lineage (project_id, downstream_doc_id, downstream_version, upstream_doc_id, upstream_version, upstream_sha256, is_stale, created_at)
VALUES (6008, 'doc-proj6008-test_manager', 1, 'doc-proj6008-system_reqs', 1, 'f5e59970599eaa44aae8270654e019f8dcb517e519bee1828581992e681f6eaf', false, now())
ON CONFLICT (downstream_doc_id, downstream_version, upstream_doc_id, upstream_version) DO UPDATE SET
upstream_sha256 = EXCLUDED.upstream_sha256,
is_stale = false;
INSERT INTO projects (id, code, name, customer_name, device_type, intended_use, target_market, current_stage, environment, status, creator_user_id, active_workflow_key, workflow_selection_version, created_at, updated_at)
VALUES (6009, 'PROJ-ESWT-0095', '体外气压弹道冲击波治疗仪', '北京大学第三医院运动医学研究所', '气压弹道式体外冲击波组织损伤治疗设备', '用于慢性软组织肌腱止点病变、跟腱炎、足底筋膜炎、肩周炎的局部无创高能压力脉冲松解与骨肌镇痛', '中国 NMPA II类 (YY 0650-2008 体外冲击波治疗机专标, GB 9706.1-2020, YY 0505)', 'V0.5', 'dev', 'active', 1, 'main', 1, now(), now())
ON CONFLICT (id) DO UPDATE SET
code = EXCLUDED.code,
name = EXCLUDED.name,
customer_name = EXCLUDED.customer_name,
device_type = EXCLUDED.device_type,
intended_use = EXCLUDED.intended_use,
target_market = EXCLUDED.target_market,
creator_user_id = 1,
active_workflow_key = 'main',
workflow_selection_version = 1,
updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6009, 'main', 'active', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'active', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6009, 'product_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6009, 'test_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6009-pm-01', 6009, 'product_manager', 'completed', 1, 'V0.5', 'system_reqs', 'doc-proj6009-system_reqs', '智能产品经理已生成系统需求规格书并通过门禁', now() - interval '2 hours', now() - interval '1 hour', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6009-tm-01', 6009, 'test_manager', 'completed', 1, 'V0.5', 'test_manager', 'doc-proj6009-test_manager', '智能测试经理已建立测试方案并完成需求全量映射', now() - interval '50 minutes', now() - interval '30 minutes', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO document_lineage (project_id, downstream_doc_id, downstream_version, upstream_doc_id, upstream_version, upstream_sha256, is_stale, created_at)
VALUES (6009, 'doc-proj6009-test_manager', 1, 'doc-proj6009-system_reqs', 1, '2044a120873753211b08d80a8ade4153e41c7928342128f7128332dd7df1d252', false, now())
ON CONFLICT (downstream_doc_id, downstream_version, upstream_doc_id, upstream_version) DO UPDATE SET
upstream_sha256 = EXCLUDED.upstream_sha256,
is_stale = false;
INSERT INTO projects (id, code, name, customer_name, device_type, intended_use, target_market, current_stage, environment, status, creator_user_id, active_workflow_key, workflow_selection_version, created_at, updated_at)
VALUES (6010, 'PROJ-MSK-0108', '肌骨超声影像处理软件', '中日友好医院超声诊断科与风湿免疫科', '独立超声影像处理辅助分析软件 (SaMD, II类医疗器械)', '用于风湿关节炎及运动损伤中高频肌骨超声图像的滑膜增生厚度、肌腱断端撕裂间距及血流多普勒信号的智能测量与报告生成', '中国 NMPA II类 (YY/T 0664-2020, GB/T 25000.51, 医疗器械软件指导原则)', 'V0.5', 'dev', 'active', 1, 'main', 1, now(), now())
ON CONFLICT (id) DO UPDATE SET
code = EXCLUDED.code,
name = EXCLUDED.name,
customer_name = EXCLUDED.customer_name,
device_type = EXCLUDED.device_type,
intended_use = EXCLUDED.intended_use,
target_market = EXCLUDED.target_market,
creator_user_id = 1,
active_workflow_key = 'main',
workflow_selection_version = 1,
updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6010, 'main', 'active', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'active', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6010, 'product_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO project_workflows (project_id, workflow_key, status, enabled, updated_at)
VALUES (6010, 'test_manager', 'ready', true, now())
ON CONFLICT (project_id, workflow_key) DO UPDATE SET status = 'ready', enabled = true, updated_at = now();
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6010-pm-01', 6010, 'product_manager', 'completed', 1, 'V0.5', 'system_reqs', 'doc-proj6010-system_reqs', '智能产品经理已生成系统需求规格书并通过门禁', now() - interval '2 hours', now() - interval '1 hour', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO workflow_runs (run_id, project_id, workflow_key, status, started_by, stage_key, task_key, output_doc_id, output_summary, started_at, finished_at, created_at)
VALUES ('run-proj6010-tm-01', 6010, 'test_manager', 'completed', 1, 'V0.5', 'test_manager', 'doc-proj6010-test_manager', '智能测试经理已建立测试方案并完成需求全量映射', now() - interval '50 minutes', now() - interval '30 minutes', now())
ON CONFLICT (run_id) DO NOTHING;
INSERT INTO document_lineage (project_id, downstream_doc_id, downstream_version, upstream_doc_id, upstream_version, upstream_sha256, is_stale, created_at)
VALUES (6010, 'doc-proj6010-test_manager', 1, 'doc-proj6010-system_reqs', 1, '69cd6354e2d88fec777a00e1fe5c6ee9e297ba0119615ba9482b09ee311f7373', false, now())
ON CONFLICT (downstream_doc_id, downstream_version, upstream_doc_id, upstream_version) DO UPDATE SET
upstream_sha256 = EXCLUDED.upstream_sha256,
is_stale = false;
COMMIT;