Skip to content

整改闭环跟踪规则

适用于施工安全、隐患治理、质量问题整改的闭环跟踪与验收场景。

规则文件内容

请复制以下内容,保存为 .cursor/rules/rectification-closed-loop.mdc

markdown
---
description: 隐患整改闭环、验收回退与超时升级业务规则
globs: src/modules/hazards/**, src/modules/rectification/**, src/modules/acceptance/**
---

# 整改闭环跟踪业务规则

## 1. 核心原则
- **问题必闭环**:每个隐患必须从上报走到验收结论。
- **验收可回退**:验收不通过必须回退整改并记录原因。
- **时限可管控**:按隐患等级分配整改时限并自动升级。

## 2. 隐患等级与时限
- `L1`(重大):`24` 小时内完成整改
- `L2`(较重):`72` 小时内完成整改
- `L3`(一般):`7` 天内完成整改

到期未完成需自动升级提醒项目负责人。

## 3. 状态定义
- `reported`:已上报
- `assigned`:已派发
- `rectifying`:整改中
- `pending_acceptance`:待验收
- `closed`:已关闭
- `reopened`:验收不通过重开
- `overdue`:超期

## 4. 状态流转规则
- `reported -> assigned`
- `assigned -> rectifying`
- `rectifying -> pending_acceptance`
- `pending_acceptance -> closed`
- `pending_acceptance -> reopened`
- `reopened -> rectifying`
- `assigned|rectifying|pending_acceptance -> overdue`(超过截止时间)

```ts
type RectificationStatus =
  | 'reported'
  | 'assigned'
  | 'rectifying'
  | 'pending_acceptance'
  | 'closed'
  | 'reopened'
  | 'overdue';

const TRANSITIONS: Record<RectificationStatus, RectificationStatus[]> = {
  reported: ['assigned'],
  assigned: ['rectifying', 'overdue'],
  rectifying: ['pending_acceptance', 'overdue'],
  pending_acceptance: ['closed', 'reopened', 'overdue'],
  reopened: ['rectifying'],
  overdue: ['rectifying', 'pending_acceptance'],
  closed: []
};

5. 验收规则

  • 验收必须包含:现场照片、验收结论、验收人、验收时间。
  • 验收不通过必须写明原因并回退到 reopened
  • 同一隐患回退次数超过 2 次,触发管理层复核。

6. 升级与通知规则

  • 距截止 6 小时触发临期提醒。
  • 超期后每 12 小时提醒一次责任人和项目经理。
  • L1 超期需同步通知安全负责人。

7. 审计与证据规则

  • 所有状态变更写入 rectification_logs
  • 关键节点需保存附件证据(图片、视频、报告)。
  • 禁止直接从 rectifying 跳到 closed,必须经过验收。

8. 数据模型约束

  • hazards 必须包含:hazard_level, description, location, status, deadline_at
  • rectification_orders 必须包含:hazard_id, assignee_id, plan, started_at, finished_at
  • acceptance_records 必须包含:hazard_id, result, checker_id, checked_at, attachments
  • rectification_logs 必须包含:hazard_id, from_status, to_status, operator_id, created_at

9. 实施注意事项

  • 隐患等级调整时需同步更新整改截止时间与通知计划。
  • 验收附件建议接入对象存储并保留不可篡改摘要。
  • 超期任务建议配置日终汇总报表,支持管理复盘。

## 适用场景

- 建筑施工安全隐患整改
- 工程质量问题闭环管理
- 设备缺陷整改与复验

基于 AI 辅助开发,快速、灵活、可靠