"""手术消耗明细的领域对象(服务端内部流转 / 持久化使用)。""" from __future__ import annotations from dataclasses import dataclass from datetime import datetime @dataclass class SurgeryConsumptionStored: """内存 / 数据库持久化用的明细行(含 source,仅服务端内部使用,不随 HTTP 返回)。 HTTP 层面的表示为 ``app.schemas.SurgeryConsumptionDetail``; 转换由上层(pipeline)在返回给客户端前完成,以隔离领域与 API。 ``pending_confirmation_id``:非空表示该行仍为医生待确认占位(``item_name`` 一般为「待确认」); 确认后由注册表替换为最终耗材行并清空此字段。 """ item_id: str item_name: str qty: int doctor_id: str timestamp: datetime source: str = "vision" pending_confirmation_id: str | None = None