feat(server): 扫描报告存储(scan_reports)+诊断阈值配置(diagnosis_config)+admin 编辑
- scan_reports 表+dao+3个报告接口(POST/latest/:id,requireUser) - GET /treatment/diagnosis-config 下发实时阈值(免发版调参) - admin SettingsView 加 diagnosis_config JSON 编辑器 - 注意: schema.sql 变更需手动 TencentDB 迁移
这个提交包含在:
+20
-1
@@ -84,6 +84,24 @@ CREATE TABLE IF NOT EXISTS treatment_records (
|
||||
CONSTRAINT fk_treatment_user FOREIGN KEY (user_id) REFERENCES users (user_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS scan_reports (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
user_id BIGINT UNSIGNED NOT NULL,
|
||||
device_id VARCHAR(32) NULL,
|
||||
scanned_at DATETIME NULL,
|
||||
regions JSON NULL COMMENT 'array of per-region analysis',
|
||||
overall JSON NULL COMMENT 'array of overall tendencies',
|
||||
recommend_mask INT NOT NULL DEFAULT 0 COMMENT 'bitmask of regions recommended for care',
|
||||
recommend_plan JSON NULL COMMENT 'array of {wavelength, mask, label_key}',
|
||||
raw_pd JSON NULL COMMENT 'raw PD samples for the calibration dataset (may be partial)',
|
||||
calibrated TINYINT NOT NULL DEFAULT 0 COMMENT 'whether thresholds were calibrated',
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id),
|
||||
KEY idx_scan_reports_user_created (user_id, created_at),
|
||||
KEY idx_scan_reports_device_created (device_id, created_at),
|
||||
CONSTRAINT fk_scan_reports_user FOREIGN KEY (user_id) REFERENCES users (user_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS device_events (
|
||||
event_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
device_id VARCHAR(32) NOT NULL,
|
||||
@@ -185,4 +203,5 @@ INSERT IGNORE INTO system_settings (setting_key, setting_value) VALUES
|
||||
('enable_register', 'true'),
|
||||
('enable_binding', 'true'),
|
||||
('enable_free_mode', 'true'),
|
||||
('maintenance_mode', 'false');
|
||||
('maintenance_mode', 'false'),
|
||||
('diagnosis_config', '{"calibrated": false, "note": "占位阈值,待真机标定后调整", "levels": {"low": 0.15, "mid": 0.35, "high": 0.55}, "problem_wavelength": {"aging": 2, "acne": 3, "pigment": 4, "deep": 1}}');
|
||||
|
||||
在新工单中引用
屏蔽一个用户