"""耗材模型 管理耗材基础信息:名称、单位、单价、供应商等 """ from typing import Optional from sqlalchemy import String, Boolean, DECIMAL from sqlalchemy.orm import Mapped, mapped_column from app.models.base import BaseModel class Material(BaseModel): """耗材表""" __tablename__ = "materials" material_code: Mapped[str] = mapped_column( String(50), unique=True, nullable=False, index=True, comment="耗材编码" ) material_name: Mapped[str] = mapped_column( String(100), nullable=False, comment="耗材名称" ) unit: Mapped[str] = mapped_column( String(20), nullable=False, comment="单位(支/ml/个)" ) unit_price: Mapped[float] = mapped_column( DECIMAL(12, 2), nullable=False, comment="单价" ) supplier: Mapped[Optional[str]] = mapped_column( String(100), nullable=True, comment="供应商" ) material_type: Mapped[str] = mapped_column( String(20), nullable=False, index=True, comment="类型:consumable-耗材, injectable-针剂, product-产品" ) is_active: Mapped[bool] = mapped_column( Boolean, nullable=False, default=True, comment="是否启用" )