结果中添加level隐患等级与class列表

This commit is contained in:
yueliuli 2026-04-23 11:18:21 +08:00
parent 5de4531e1a
commit 41573ac5c7
1 changed files with 9 additions and 0 deletions

View File

@ -456,6 +456,14 @@ def hazard_inspection(
all_bases.append(base) all_bases.append(base)
temp_obj["base_id"] = all_bases.index(base) temp_obj["base_id"] = all_bases.index(base)
# 隐患等级
if get_hazard_level_from_rule(rule_dict, class_list[track_info["class_id"]], tag) == "重大隐患":
temp_obj["level"] = 1
elif get_hazard_level_from_rule(rule_dict, class_list[track_info["class_id"]], tag) == "一般隐患":
temp_obj["level"] = 0
else:
temp_obj["level"] = -1,
# 其他字段 # 其他字段
temp_obj["track_id"] = track_id temp_obj["track_id"] = track_id
temp_obj["hazard_track_id"] = hazard_count temp_obj["hazard_track_id"] = hazard_count
@ -477,6 +485,7 @@ def hazard_inspection(
# 构建最终结果 # 构建最终结果
final_result = { final_result = {
"class_list": class_list,
"tag": all_tags, "tag": all_tags,
"base": all_bases, "base": all_bases,
"objects": all_objects "objects": all_objects