Initial commit: 智能项目定价模型

This commit is contained in:
kuzma
2026-01-31 21:33:06 +08:00
commit ef0824303f
174 changed files with 31705 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
"""耗材模型
管理耗材基础信息:名称、单位、单价、供应商等
"""
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="是否启用"
)