|
@@ -8569,5 +8569,22 @@ private void runMigration100() {
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.warn("创建survey_records表失败(可能已存在): " + e.getMessage());
|
|
log.warn("创建survey_records表失败(可能已存在): " + e.getMessage());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 迁移211: 创建 report_blocks 表(通用报告展示块,按报告类型存储 blocks JSON)
|
|
|
|
|
+ try {
|
|
|
|
|
+ jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS report_blocks (" +
|
|
|
|
|
+ "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
|
|
|
|
|
+ "report_type VARCHAR(32) NOT NULL COMMENT 'gut_flora/dan/physical_exam/tongue', " +
|
|
|
|
|
+ "report_id BIGINT NOT NULL COMMENT '各类型报告主键ID', " +
|
|
|
|
|
+ "blocks JSON NOT NULL COMMENT '块数组 [{type,title,items,extra}]', " +
|
|
|
|
|
+ "version INT DEFAULT 1, " +
|
|
|
|
|
+ "created_at DATETIME, " +
|
|
|
|
|
+ "updated_at DATETIME, " +
|
|
|
|
|
+ "UNIQUE KEY uk_report_type_id (report_type, report_id)" +
|
|
|
|
|
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='报告通用展示块'");
|
|
|
|
|
+ log.info("已创建report_blocks表");
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ // 表已存在,忽略错误
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|