Tổng quan hệ thống / EVN CBM Database Schema v2.0
PK Primary Key
FK Foreign Key
ENUM Enum
JSONB JSON
IDX Index
45+
Tổng số bảng
Trải rộng 11 module
220+
Tổng số trường
Có kiểu dữ liệu đầy đủ
11
Module chức năng
Từ Tài sản đến Audit
6
Cấp RBAC
Admin → Vận hành
Bản đồ Module
Tổ chức & Tài sản
organizations → equipment
9 bảng
Phân tích FMECA
IEC 60812 — Failure modes, CN/RPN
7 bảng
Kiểm tra & Thử nghiệm
Templates, ngưỡng, lịch sử đo
8 bảng
Tính toán CHI
Công thức 3 tầng, lịch sử sức khỏe
5 bảng
Quyết định SCBD
Ma trận hệ số, phê duyệt, N-1
3 bảng
Kế hoạch CBM
Lịch bảo trì Tháng/Quý/Năm
2 bảng
Báo cáo & Dashboard
PDF/Excel tự động, lịch gửi mail
3 bảng
Người dùng & RBAC
6 cấp role, override, session
7 bảng
Audit & Hạ tầng
Audit log, import, SLD, alerts
7 bảng
🗺️ Quan hệ chính giữa các bảng
organizations stations
stations load_zones
stations systems
systems equipment
equipment_types equipment
equipment equipment_fmeca
equipment inspection_records
equipment chi_history
equipment scbd_decisions
equipment equipment_alerts
chi_config chi_history
fmeca_config equipment_fmeca
inspection_items record_values
inspection_item_thresholds record_values
scbd_decisions cbm_plan_items
users user_roles
roles role_permissions
sld_diagrams sld_nodes
sld_nodes equipment
cbm_plans cbm_plan_items
🏭
Module 1 — Tổ chức & Tài sản
Cấu trúc phân cấp: Tổ chức → Trạm → Vùng phụ tải → Hệ thống → Thiết bị. Quản lý danh mục, thông số kỹ thuật và lịch sử điều động.
🏢
organizations
Tổ chức / Công ty / Nhà máy điện
idBIGINTPKKhóa chính
codeVARCHAR(50)IDXMã tổ chức (duy nhất)
nameVARCHAR(200)Tên tổ chức
descriptionTEXTMô tả
deleted_atTIMESTAMPTZSoft delete
created_atTIMESTAMPTZThời điểm tạo
updated_atTIMESTAMPTZThời điểm cập nhật
7 trường
🏗️
stations
Trạm biến áp / Đường dây / NMĐ
idBIGINTPK
organization_idBIGINTFK→ organizations.id
codeVARCHAR(50)IDXMã trạm
nameVARCHAR(200)Tên trạm
station_typeVARCHAR(50)ENUMLoại trạm
voltage_levelVARCHAR(20)Cấp điện áp (kV)
deleted_atTIMESTAMPTZSoft delete
created_atTIMESTAMPTZ
updated_atTIMESTAMPTZ
9 trường
load_zones
Vùng phụ tải trong trạm
idBIGINTPK
station_idBIGINTFK→ stations.id
nameVARCHAR(200)Tên vùng phụ tải
load_classSMALLINTENUM1=Đặc biệt quan trọng · 2=Quan trọng · 3=Khác
descriptionTEXTMô tả
created_atTIMESTAMPTZ
6 trường
🔌
systems
Hệ thống / Phân khu trong trạm
idBIGINTPK
station_idBIGINTFK→ stations.id
codeVARCHAR(50)IDXMã hệ thống
nameVARCHAR(200)Ví dụ: 220KV Yard, 33KV Switchgear
descriptionTEXT
created_atTIMESTAMPTZ
updated_atTIMESTAMPTZ
7 trường
📋
equipment_types
Danh mục loại thiết bị (MBA, MC, DCL…)
idBIGINTPK
codeVARCHAR(20)IDXMBA · MC · DCL · CT · VT…
nameVARCHAR(200)Tên loại thiết bị
descriptionTEXT
4 trường
⚙️
equipment
Thiết bị vật lý (MBA T1, MC-231…)
idBIGINTPK
system_idBIGINTFK→ systems.id
equipment_type_idBIGINTFK→ equipment_types.id
codeVARCHAR(50)IDXMã thiết bị (duy nhất)
nameVARCHAR(200)Tên thiết bị
manufacturerVARCHAR(200)Hãng sản xuất
installation_dateDATENgày lắp đặt
current_statusVARCHAR(20)ENUMgood · fair · average · poor · fail
deleted_atTIMESTAMPTZSoft delete
created_atTIMESTAMPTZ
updated_atTIMESTAMPTZ
11 trườngCHI lấy từ view → chi_history
📐
equipment_type_param_definitions
Định nghĩa thông số kỹ thuật theo loại thiết bị
idBIGINTPK
equipment_type_idBIGINTFK→ equipment_types.id
param_keyVARCHAR(100)Tên thông số (ví dụ: capacity_mva)
data_typeVARCHAR(20)ENUMnumeric · text · date
unitVARCHAR(30)Đơn vị (MVA, kV, A…)
is_requiredBOOLEANBắt buộc nhập?
6 trường
📊
equipment_parameters
Giá trị thông số kỹ thuật của từng thiết bị
idBIGINTPK
equipment_idBIGINTFKIDX→ equipment.id
param_definition_idBIGINTFK→ equipment_type_param_definitions.id
value_numericDECIMAL(18,4)Giá trị số (nullable)
value_textTEXTGiá trị văn bản (nullable)
created_atTIMESTAMPTZ
6 trường
🔄
equipment_transfer_history
Lịch sử điều động thiết bị giữa các hệ thống
idBIGINTPK
equipment_idBIGINTFKIDX→ equipment.id
from_system_idBIGINTFK→ systems.id
to_system_idBIGINTFK→ systems.id
reasonTEXTLý do điều động
transferred_atTIMESTAMPTZThời điểm điều động
transferred_byBIGINTFK→ users.id
7 trường
⚠️
Module 2 — Phân tích FMECA
Failure Mode, Effects & Criticality Analysis theo IEC 60812. Quản lý cấu hình CN/RPN, danh mục hư hỏng và kết quả đánh giá từng thiết bị.
⚙️
fmeca_config
Cấu hình hệ số CN/RPN với versioning
idBIGINTPK
versionVARCHAR(20)IDXPhiên bản (ví dụ: v1.0)
cn_severity_coeffDECIMAL(5,4)Hệ số mức nghiêm trọng CN
rpn_detect_coeffDECIMAL(5,4)Hệ số độ phát hiện RPN
descriptionTEXTGhi chú thay đổi
is_currentBOOLEANPhiên bản đang áp dụng
created_atTIMESTAMPTZ
7 trường
🚦
fmeca_rpn_thresholds
Thang phân loại rủi ro theo điểm RPN
idBIGINTPK
level_nameVARCHAR(50)Thấp · Trung bình · Cao · Nguy hiểm
min_rpnINTEGERNgưỡng RPN tối thiểu
max_rpnINTEGERNgưỡng RPN tối đa
colorVARCHAR(20)Màu nhãn (#hex)
5 trường
🎯
failure_modes
Dạng hư hỏng theo loại thiết bị
idBIGINTPK
equipment_type_idBIGINTFK→ equipment_types.id
codeVARCHAR(50)Mã dạng hư hỏng
nameVARCHAR(300)Tên dạng hư hỏng
descriptionTEXT
5 trường
💥
failure_effects
Hậu quả khi hư hỏng xảy ra
idBIGINTPK
failure_mode_idBIGINTFK→ failure_modes.id
descriptionTEXTMô tả hậu quả và tác động lan rộng
3 trường
🔬
failure_causes
Nguyên nhân gốc rễ gây hư hỏng
idBIGINTPK
failure_mode_idBIGINTFK→ failure_modes.id
descriptionTEXTCăn nguyên chính
3 trường
⚗️
failure_mechanisms
Cơ chế vật lý/hóa học dẫn đến hư hỏng
idBIGINTPK
failure_mode_idBIGINTFK→ failure_modes.id
descriptionTEXTLý giải cơ chế hư hỏng
3 trường
📝
equipment_fmeca
Kết quả đánh giá FMECA từng thiết bị
idBIGINTPK
equipment_idBIGINTFKIDX→ equipment.id
failure_mode_idBIGINTFK→ failure_modes.id
fmeca_config_idBIGINTFK→ fmeca_config.id
severitySMALLINTMức nghiêm trọng S (1–10)
probabilitySMALLINTXác suất xuất hiện O (1–10)
detectabilitySMALLINTĐộ phát hiện D (1–10)
cn_valueDECIMAL(8,2)Chỉ số nghiêm trọng CN
rpn_valueDECIMAL(8,2)Chỉ số rủi ro RPN = S×O×D
assessed_atTIMESTAMPTZThời điểm đánh giá
assessed_byBIGINTFK→ users.id
is_currentBOOLEANĐánh giá hiện hành?
12 trường
🔍
Module 3–4 — Kiểm tra & Thử nghiệm
Quản lý mẫu phiếu kiểm tra, ngưỡng cảnh báo tự động, ánh xạ FMECA–Kiểm tra và lưu trữ toàn bộ kết quả đo thực tế.
📋
inspection_templates
Mẫu phiếu kiểm tra theo loại thiết bị
idBIGINTPK
equipment_type_idBIGINTFK→ equipment_types.id
versionVARCHAR(20)Phiên bản form
nameVARCHAR(200)Tên mẫu
is_currentBOOLEANForm đang áp dụng
created_atTIMESTAMPTZ
6 trường
🗂️
inspection_categories
Nhóm hạng mục theo cấp kiểm tra
idBIGINTPK
template_idBIGINTFK→ inspection_templates.id
inspection_levelSMALLINTENUM1=Online · 2=Offline · 3=Chuyên sâu
nameVARCHAR(200)Tên nhóm hạng mục
parent_idBIGINTFK→ self (phân cấp)
5 trường
inspection_items
Hạng mục kiểm tra chi tiết nhất
idBIGINTPK
category_idBIGINTFK→ inspection_categories.id
codeVARCHAR(50)IDXMã hạng mục
nameVARCHAR(300)Tên hạng mục
scoring_typeVARCHAR(30)ENUMnumeric · pass_fail · enum
weightDECIMAL(5,4)Trọng số wk
standard_frequencyINTEGERTần suất đo chuẩn (ngày)
7 trường
🚦
inspection_item_thresholds
Ngưỡng xanh/vàng/đỏ tự động cho hạng mục
idBIGINTPK
inspection_item_idBIGINTFK→ inspection_items.id
level_nameVARCHAR(30)Bình thường · Cảnh báo · Nguy hiểm
threshold_minDECIMAL(12,4)Ngưỡng thấp nhất
threshold_maxDECIMAL(12,4)Ngưỡng cao nhất
colorVARCHAR(20)Màu nhãn (#hex)
6 trường
📅
frequency_adjustment_matrix
Ma trận điều chỉnh tần suất kiểm định (per-item)
idBIGINTPK
inspection_item_idBIGINTFK→ inspection_items.id
load_classSMALLINTENUM1 · 2 · 3
chi_statusVARCHAR(20)ENUMgood · fair · average · poor · fail
coefficientDECIMAL(5,3)Hệ số điều chỉnh chu kỳ
5 trường
🔗
fm_inspection_mapping
Ánh xạ Dạng hư hỏng ↔ Hạng mục kiểm tra
idBIGINTPK
failure_mode_idBIGINTFK→ failure_modes.id
inspection_item_idBIGINTFK→ inspection_items.id
3 trườngJunction table M2M
📡
inspection_records
Phiếu kiểm tra thực tế có ghi nhận thời gian
idBIGINTPK
equipment_idBIGINTFKIDX→ equipment.id
template_idBIGINTFK→ inspection_templates.id
inspection_levelSMALLINTENUM1 · 2 · 3
source_typeVARCHAR(20)ENUMmanual · import · mobile_app · iot
statusVARCHAR(20)ENUMdraft · submitted · approved
inspected_atTIMESTAMPTZIDXThời điểm kiểm tra thực tế
inspector_idBIGINTFK→ users.id
8 trường
📊
inspection_record_values
Giá trị đo cho từng hạng mục trong phiếu
idBIGINTPK
record_idBIGINTFKIDX→ inspection_records.id
inspection_item_idBIGINTFK→ inspection_items.id
threshold_idBIGINTFK→ inspection_item_thresholds.id
measured_valueDECIMAL(14,4)Giá trị đo thực tế
scoreDECIMAL(5,2)Điểm quy đổi
is_passBOOLEANCờ Đạt / Không đạt
7 trường
💜
Module 5–6 — Tính toán CHI
Condition Health Index: cấu hình công thức 3 tầng (Config → Levels → Factors), thang 5 bậc sức khỏe, lịch sử biến động có versioning đầy đủ.
⚙️
chi_config
Cấu hình tổng thể dòng công thức CHI
idBIGINTPK
versionVARCHAR(20)IDXPhiên bản (ví dụ: v2.1)
formula_displayTEXTChuỗi công thức rút gọn cho UI
descriptionTEXTGhi chú thay đổi
is_currentBOOLEANPhiên bản đang áp dụng
created_atTIMESTAMPTZ
6 trường
🔢
chi_config_levels
Trọng số mảng theo cấp kiểm tra
idBIGINTPK
chi_config_idBIGINTFK→ chi_config.id
level_numberSMALLINT1 · 2 · 3
overall_weightDECIMAL(5,4)Tỷ lệ trọng số mảng (tổng = 1.0)
4 trường
🧮
chi_config_factors
Hệ số con trong từng cấp tính
idBIGINTPK
level_idBIGINTFK→ chi_config_levels.id
factor_nameVARCHAR(200)Tên thông số nhân
coefficientDECIMAL(7,4)Trọng số
4 trường
🌡️
chi_thresholds
Thang 5 bậc sức khỏe từ 0 đến 10
idBIGINTPK
level_nameVARCHAR(20)Good · Fair · Average · Poor · Fail
min_valueDECIMAL(5,2)Điểm thấp nhất của bậc
max_valueDECIMAL(5,2)Điểm cao nhất của bậc
color_primaryVARCHAR(20)Màu nhận diện (#hex)
5 trường
📈
chi_history
Lịch sử biến động sức khỏe thiết bị
idBIGINTPK
equipment_idBIGINTFKIDX→ equipment.id
chi_config_idBIGINTFK→ chi_config.id (traceability)
chi_valueDECIMAL(5,2)IDXĐiểm CHI (0.00 – 10.00)
statusVARCHAR(20)ENUMgood · fair · average · poor · fail
calculation_detailsJSONBJSONBToàn bộ chi tiết phép tính
calculated_atTIMESTAMPTZIDXComposite index với equipment_id DESC
calculated_byBIGINTFK→ users.id (null = hệ thống tự động)
8 trườngIndex: (equipment_id, calculated_at DESC)
🛠️
Module 7 — Quyết định SCBD
Sửa Chữa Bảo Dưỡng: Ma trận hệ số phụ tải và sức khỏe, quyết định kỳ hạn bảo trì với luồng phê duyệt chính thức và kiểm tra N-1.
📊
frequency_matrix_load_zone
Hệ số điều chỉnh theo lớp phụ tải
idBIGINTPK
load_classSMALLINTENUM1=Đặc biệt · 2=Quan trọng · 3=Khác
coefficientDECIMAL(5,3)Hệ số điều chỉnh kỳ hạn theo tải
3 trường
📉
frequency_matrix_chi_status
Hệ số điều chỉnh theo trạng thái sức khỏe
idBIGINTPK
chi_statusVARCHAR(20)ENUMgood · fair · average · poor · fail
chi_coefficientDECIMAL(5,3)Hệ số riêng theo CHI
3 trườngTổng hệ số = tính tại runtime
📜
scbd_decisions
Quyết định bảo dưỡng với luồng phê duyệt
idBIGINTPK
equipment_idBIGINTFKIDX→ equipment.id
current_chiDECIMAL(5,2)Điểm CHI tại thời điểm ra quyết định
new_frequencyINTEGERChu kỳ bảo dưỡng tính ra (ngày)
recommended_actionVARCHAR(30)ENUMmaintain · increase_freq · reduce_load · sctx_scl · replace
n1_violationBOOLEANCờ vi phạm tiêu chí N-1
statusVARCHAR(20)ENUMdraft · pending_approval · approved · rejected
approved_byBIGINTFK→ users.id
approved_atTIMESTAMPTZThời điểm phê duyệt
rejection_reasonTEXTLý do từ chối (nullable)
created_byBIGINTFK→ users.id
created_atTIMESTAMPTZ
12 trường
📅
Module 8 — Kế hoạch CBM
Quản lý lộ trình bảo trì trên hệ thống lịch theo Tháng/Quý/Năm, có truy nguyên về quyết định SCBD gốc.
📁
cbm_plans
Kế hoạch CBM tổng lực theo kỳ
idBIGINTPK
nameVARCHAR(300)Tên kế hoạch
plan_period_typeVARCHAR(20)ENUMmonthly · quarterly · yearly
start_dateDATENgày bắt đầu kỳ kế hoạch
end_dateDATENgày kết thúc kỳ kế hoạch
statusVARCHAR(20)ENUMdraft · active · completed · cancelled
created_byBIGINTFK→ users.id
created_atTIMESTAMPTZ
8 trường
📌
cbm_plan_items
Công tác bảo trì đơn vị trong kế hoạch
idBIGINTPK
plan_idBIGINTFK→ cbm_plans.id
equipment_idBIGINTFK→ equipment.id
scbd_decision_idBIGINTFK→ scbd_decisions.id (nullable)
work_typeVARCHAR(50)ENUMLoại công việc bảo trì
priorityVARCHAR(10)ENUMhigh · medium · low
responsible_teamVARCHAR(200)Đội chịu trách nhiệm
statusVARCHAR(20)ENUMpending · in_progress · done · cancelled
scl_sheet_codeVARCHAR(100)Mã SCL/kế toán (ERP reference)
source_systemVARCHAR(50)Hệ thống nguồn của mã SCL
created_atTIMESTAMPTZ
11 trường
📊
Module 9 — Báo cáo & Dashboard
Quản lý mẫu báo cáo, lịch gửi mail tự động PDF/Excel cho Ban Giám Đốc, và lưu trữ các file đã xuất.
📄
report_templates
Mẫu bố cục và cấu hình báo cáo
idBIGINTPK
nameVARCHAR(200)Tên mẫu báo cáo
report_typeVARCHAR(50)ENUMLoại báo cáo
template_configJSONBJSONBCấu hình layout (JSON)
created_atTIMESTAMPTZ
5 trường
🔔
scheduled_reports
Lịch gửi báo cáo tự động định kỳ
idBIGINTPK
template_idBIGINTFK→ report_templates.id
schedule_typeVARCHAR(20)ENUMweekly · monthly · quarterly
output_formatVARCHAR(10)ENUMpdf · xlsx
recipient_emailsTEXT[]Danh sách email nhận
is_activeBOOLEANĐang bật?
created_atTIMESTAMPTZ
7 trường
📦
generated_reports
Lịch sử các báo cáo đã được xuất ra
idBIGINTPK
template_idBIGINTFK→ report_templates.id
generated_byBIGINTFK→ users.id
file_pathTEXTĐường dẫn file lưu trữ
file_formatVARCHAR(10)pdf · xlsx
file_sizeBIGINTKích thước file (bytes)
generated_atTIMESTAMPTZThời điểm xuất file
7 trường
👥
Module 10 — Người dùng & RBAC
Role-Based Access Control 6 cấp: Admin → HĐQT → GĐ Nhà máy → Phòng Vận hành. Hỗ trợ override đặc cách cấp user và session management JWT.
👤
users
Người dùng hệ thống EVN CBM
idBIGINTPK
emailVARCHAR(200)IDXEmail đăng nhập (unique)
full_nameVARCHAR(200)Họ tên đầy đủ
departmentVARCHAR(200)Phòng ban gốc
is_activeBOOLEANTài khoản hoạt động?
deleted_atTIMESTAMPTZSoft delete
created_atTIMESTAMPTZ
7 trường
🎖️
roles
Chức danh / Cấp bậc trong hệ thống
idBIGINTPK
codeVARCHAR(50)IDXMã chức danh (unique)
nameVARCHAR(200)Tên chức danh
levelSMALLINTCấp bậc 1–10 (1 = cao nhất)
descriptionTEXTMô tả quyền hạn tổng quát
5 trường
🔑
permissions
Danh mục quyền hạn API theo module
idBIGINTPK
codeVARCHAR(100)IDXFormat: [module].[action]
moduleVARCHAR(50)Tên module
actionVARCHAR(50)Hành động: read · create · approve · export…
descriptionTEXTMô tả quyền này
5 trường
🔗
role_permissions
Liên kết Roles ↔ Permissions (M2M)
idBIGINTPK
role_idBIGINTFK→ roles.id
permission_idBIGINTFK→ permissions.id
3 trườngJunction table M2M
🎭
user_roles
Gán chức danh cho người dùng
idBIGINTPK
user_idBIGINTFK→ users.id
role_idBIGINTFK→ roles.id
assigned_byBIGINTFK→ users.id
assigned_atTIMESTAMPTZThời điểm gán
5 trường
user_module_permissions
Override đặc cách cấp User (ghi đè role)
idBIGINTPK
user_idBIGINTFK→ users.id
moduleVARCHAR(50)Tên module ghi đè
can_accessBOOLEANCho phép / Chặn
grant_reasonTEXTLý do cấp đặc cách
granted_byBIGINTFK→ users.id
created_atTIMESTAMPTZ
7 trườngQuy tắc: user-level ghi đè role
🔐
user_sessions
Quản lý phiên đăng nhập và JWT
idBIGINTPK
user_idBIGINTFKIDX→ users.id
token_hashVARCHAR(255)IDXHash của JWT / refresh token
expires_atTIMESTAMPTZThời điểm hết hạn
revoked_atTIMESTAMPTZThời điểm thu hồi (logout)
device_infoVARCHAR(300)Thông tin thiết bị / trình duyệt
created_atTIMESTAMPTZ
7 trườngHỗ trợ JWT blacklisting
📋
Module 11 — Audit Log & Hạ tầng
Sổ theo dõi toàn bộ hành vi với delta dữ liệu, versioning công thức, import, sơ đồ SLD và quản lý cảnh báo thiết bị.
📖
audit_logs
Sổ theo dõi toàn bộ hành vi người dùng
idBIGINTPK
user_idBIGINTFKIDX→ users.id
action_typeVARCHAR(20)ENUMcreate · edit · delete · approve · export · view · login · logout
moduleVARCHAR(50)Module bị tác động
target_typeVARCHAR(100)Tên bảng / entity
target_idBIGINTID của row bị tác động
old_valueJSONBJSONBDữ liệu trước khi thay đổi
new_valueJSONBJSONBDữ liệu sau khi thay đổi
statusVARCHAR(20)ENUMsuccess · warning · error
ip_addressINETĐịa chỉ IP
created_atTIMESTAMPTZIDXComposite index: (user_id, created_at)
11 trườngold_value + new_value hỗ trợ rollback
🧪
formula_versions
Snapshot toàn bộ cây công thức (nguồn duy nhất)
idBIGINTPK
config_typeVARCHAR(30)ENUMchi · fmeca
snapshotJSONBJSONBToàn bộ cây công thức tại thời điểm snapshot
versionVARCHAR(20)IDXPhiên bản (nguồn sự thật duy nhất)
created_byBIGINTFK→ users.id
created_atTIMESTAMPTZ
6 trường
📥
import_logs
Theo dõi quy trình import Excel / XML
idBIGINTPK
user_idBIGINTFK→ users.id
import_typeVARCHAR(50)ENUMLoại dữ liệu import
statusVARCHAR(20)ENUMpending · success · partial · failed
success_countINTEGERSố dòng import thành công
error_countINTEGERSố dòng lỗi
created_atTIMESTAMPTZ
7 trường
🗺️
sld_diagrams
Sơ đồ đơn tuyến (SLD) canvas
idBIGINTPK
station_idBIGINTFK→ stations.id
nameVARCHAR(200)Tên sơ đồ
diagram_dataJSONBJSONBCấu hình canvas đầy đủ
versionINTEGERPhiên bản sơ đồ
created_atTIMESTAMPTZ
6 trường
🎨
sld_layers
Layer phân cực trong sơ đồ đơn tuyến
idBIGINTPK
diagram_idBIGINTFK→ sld_diagrams.id
nameVARCHAR(200)Tên layer
layer_typeVARCHAR(50)ENUMbus · feeder · device · annotation
colorVARCHAR(20)Màu layer (#hex)
is_visibleBOOLEANHiển thị mặc định?
6 trường
📍
sld_nodes
Điểm neo thiết bị trên bản vẽ SLD
idBIGINTPK
diagram_idBIGINTFK→ sld_diagrams.id
layer_idBIGINTFK→ sld_layers.id
equipment_idBIGINTFK→ equipment.id (nullable)
node_typeVARCHAR(50)ENUMbus · breaker · transformer · load…
position_xDECIMAL(10,2)Tọa độ X trên canvas
position_yDECIMAL(10,2)Tọa độ Y trên canvas
7 trường
🚨
equipment_alerts
Cảnh báo ngưỡng thiết bị — lưu trữ và xác nhận
idBIGINTPK
equipment_idBIGINTFKIDX→ equipment.id
alert_typeVARCHAR(50)ENUMchi_threshold · inspection_fail · n1_violation
severityVARCHAR(20)ENUMwarning · critical · emergency
threshold_idBIGINTFK→ inspection_item_thresholds.id (nullable)
triggered_valueDECIMAL(14,4)Giá trị đo khi alert kích hoạt
triggered_atTIMESTAMPTZIDXThời điểm kích hoạt
acknowledged_byBIGINTFK→ users.id (null = chưa xác nhận)
acknowledged_atTIMESTAMPTZThời điểm xác nhận
statusVARCHAR(20)ENUMactive · acknowledged · resolved
10 trường
🏷️
Enum Values — Tham chiếu
Danh sách đầy đủ các giá trị hằng số được sử dụng xuyên suốt toàn bộ hệ thống.
load_class
1 — Đặc biệt quan trọng2 — Quan trọng3 — Khác
inspection_level
1 — Online2 — Offline (Cắt điện)3 — Chuyên sâu
chi_status / current_status
goodfairaveragepoorfail
action_type (audit)
createeditdeleteapproveexportviewloginlogout
audit status
successwarningerror
recommended_action
maintainincrease_freqreduce_loadsctx_sclreplace
priority
highmediumlow
scbd_decisions status
draftpending_approvalapprovedrejected
source_type (inspection)
manualimportmobile_appiot
scoring_type
numericpass_failenum
plan_period_type
monthlyquarterlyyearly
alert type / severity
chi_thresholdinspection_failn1_violationwarningcriticalemergency
cbm_plan_items status
pendingin_progressdonecancelled
formula_versions config_type
chifmeca
param data_type
numerictextdate