Add tenant-scoped teams and projects, order attribution across four businesses, conversion inheritance, scoped statistics and audited reassignment. Reuse existing Web and mobile UI patterns; team regions and hospitals remain informational. Include incremental SQL and isolated regression coverage. Actual MySQL and browser/WebView integration validation remains pending; relates to issue #13.
68 lines
2.7 KiB
Python
68 lines
2.7 KiB
Python
"""租户项目及归属审计;区域医院关联只记录组织资料。"""
|
|
from datetime import datetime
|
|
from sqlalchemy import Column, String, Integer, SmallInteger, DateTime, Date, UniqueConstraint
|
|
from app.models.base import Base
|
|
|
|
|
|
class ProjectFields:
|
|
id = Column(String(64), primary_key=True)
|
|
tenant_no = Column(String(64), nullable=False, index=True)
|
|
order_num = Column(Integer)
|
|
remark = Column(String(512))
|
|
create_by = Column(String(64))
|
|
create_dept_id = Column(String(64), nullable=False, default='')
|
|
create_time = Column(DateTime, nullable=False, default=datetime.now)
|
|
update_by = Column(String(64))
|
|
update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now)
|
|
del_flag = Column(SmallInteger, nullable=False, default=0)
|
|
|
|
|
|
class ProjectTeam(ProjectFields, Base):
|
|
__tablename__ = 'biz_project_team'
|
|
team_name = Column(String(200), nullable=False)
|
|
leader_user_id = Column(String(64), nullable=False)
|
|
enabled = Column(SmallInteger, nullable=False, default=1)
|
|
|
|
|
|
class ProjectTeamMember(ProjectFields, Base):
|
|
__tablename__ = 'biz_project_team_member'
|
|
team_id = Column(String(64), nullable=False, index=True)
|
|
user_id = Column(String(64), nullable=False)
|
|
|
|
|
|
class ProjectTeamRegion(ProjectFields, Base):
|
|
__tablename__ = 'biz_project_team_region'
|
|
team_id = Column(String(64), nullable=False, index=True)
|
|
region_id = Column(String(64), nullable=False)
|
|
|
|
|
|
class ProjectTeamHospital(ProjectFields, Base):
|
|
__tablename__ = 'biz_project_team_hospital'
|
|
team_id = Column(String(64), nullable=False, index=True)
|
|
hospital_id = Column(String(64), nullable=False)
|
|
|
|
|
|
class Project(ProjectFields, Base):
|
|
__tablename__ = 'biz_project'
|
|
__table_args__ = (UniqueConstraint('tenant_no', 'project_no', name='uk_project_tenant_no'),)
|
|
project_no = Column(String(64), nullable=False)
|
|
project_name = Column(String(200), nullable=False)
|
|
team_id = Column(String(64), nullable=False, index=True)
|
|
leader_user_id = Column(String(64), nullable=False)
|
|
biz_types = Column(String(255), nullable=False)
|
|
start_date = Column(Date)
|
|
end_date = Column(Date)
|
|
status = Column(String(16), nullable=False, default='pending')
|
|
|
|
|
|
class ProjectAssignmentAudit(ProjectFields, Base):
|
|
__tablename__ = 'biz_project_assignment_audit'
|
|
biz_type = Column(String(32), nullable=False)
|
|
biz_id = Column(String(64), nullable=False, index=True)
|
|
old_project_id = Column(String(64))
|
|
new_project_id = Column(String(64))
|
|
old_project_name = Column(String(200))
|
|
new_project_name = Column(String(200))
|
|
reason = Column(String(512), nullable=False)
|
|
operator_name = Column(String(100))
|