"""简历诊断问题表(bg_resume_diagnosis_issue)""" from datetime import datetime from typing import Optional from sqlalchemy import BigInteger, Integer, String, Text, DateTime, JSON from sqlalchemy.orm import Mapped, mapped_column from app.core.database import Base class ResumeDiagnosisIssue(Base): """简历诊断问题表 bg_resume_diagnosis_issue""" __tablename__ = "bg_resume_diagnosis_issue" id: Mapped[int] = mapped_column(BigInteger, primary_key=True) report_id: Mapped[int] = mapped_column(BigInteger, nullable=False, comment="关联report.id") resume_id: Mapped[int] = mapped_column(BigInteger, nullable=False, comment="关联bg_user_resume.id") user_id: Mapped[int] = mapped_column(BigInteger, nullable=False, comment="用户ID") module_type: Mapped[str] = mapped_column(String(32), nullable=False, comment="模块类型: summary/education/work/internship/project/competition") module_record_id: Mapped[int] = mapped_column(BigInteger, nullable=False, comment="模块记录ID,summary时为resume_id") finding: Mapped[Optional[str]] = mapped_column(Text, nullable=True, comment="诊断发现") importance: Mapped[Optional[str]] = mapped_column(Text, nullable=True, comment="为什么重要") suggestion: Mapped[Optional[str]] = mapped_column(Text, nullable=True, comment="改进建议") urgent_issues: Mapped[Optional[dict]] = mapped_column(JSON, nullable=True, comment='紧急修复子类型计数 {"typo": 0}') important_issues: Mapped[Optional[dict]] = mapped_column(JSON, nullable=True, comment='重点优化子类型计数 {"no_result": 0, "no_quantify": 0, "weak_relevance": 0}') expression_issues: Mapped[Optional[dict]] = mapped_column(JSON, nullable=True, comment='表达提升子类型计数 {"not_concise": 0, "format_inconsistent": 0}') optimized_content: Mapped[Optional[list | str]] = mapped_column(JSON, nullable=True, comment="AI改写后的内容,子表模块与原description格式一致[{id,text}]保持原id只改写text,summary模块为纯文本字符串") status: Mapped[int] = mapped_column(Integer, default=0, comment="0=待处理 1=已处理") user_feedback: Mapped[int] = mapped_column(Integer, default=0, comment="0=未评价 1=符合 2=不符合") create_time: Mapped[datetime] = mapped_column(DateTime, default=datetime.now, comment="创建时间") update_time: Mapped[datetime] = mapped_column(DateTime, default=datetime.now, onupdate=datetime.now, comment="更新时间")