Add the Healthcare platform backend (phases 13.0–13.7) with Alembic migration revision fix, production deploy script, validation reports, shared UI exports, and loyalty list page client directives so Next.js build succeeds. Co-authored-by: Cursor <cursoragent@cursor.com>
110 lines
3.1 KiB
Python
110 lines
3.1 KiB
Python
"""Doctor and Patient DTOs — Phase 13.0."""
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from uuid import UUID
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
from app.models.types import ProfileStatus
|
|
from app.schemas.common import ORMBase
|
|
|
|
_FORBID = ConfigDict(extra="forbid")
|
|
|
|
|
|
class DoctorCreate(BaseModel):
|
|
model_config = _FORBID
|
|
|
|
user_id: str = Field(max_length=100)
|
|
clinic_id: UUID | None = None
|
|
department_id: UUID | None = None
|
|
code: str = Field(max_length=50)
|
|
display_name: str = Field(max_length=255)
|
|
specialty: str | None = Field(default=None, max_length=100)
|
|
license_number: str | None = Field(default=None, max_length=100)
|
|
status: ProfileStatus = ProfileStatus.ACTIVE
|
|
contact: dict | None = None
|
|
metadata_json: dict | None = None
|
|
|
|
|
|
class DoctorUpdate(BaseModel):
|
|
model_config = _FORBID
|
|
|
|
clinic_id: UUID | None = None
|
|
department_id: UUID | None = None
|
|
display_name: str | None = Field(default=None, max_length=255)
|
|
specialty: str | None = Field(default=None, max_length=100)
|
|
license_number: str | None = Field(default=None, max_length=100)
|
|
status: ProfileStatus | None = None
|
|
contact: dict | None = None
|
|
metadata_json: dict | None = None
|
|
version: int = Field(ge=1)
|
|
|
|
|
|
class DoctorRead(ORMBase):
|
|
id: UUID
|
|
tenant_id: UUID
|
|
user_id: str
|
|
clinic_id: UUID | None
|
|
department_id: UUID | None
|
|
code: str
|
|
display_name: str
|
|
specialty: str | None
|
|
license_number: str | None
|
|
status: ProfileStatus
|
|
contact: dict | None
|
|
metadata_json: dict | None
|
|
version: int
|
|
is_deleted: bool
|
|
created_by: str | None
|
|
updated_by: str | None
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class PatientCreate(BaseModel):
|
|
model_config = _FORBID
|
|
|
|
user_id: str = Field(max_length=100)
|
|
code: str = Field(max_length=50)
|
|
display_name: str = Field(max_length=255)
|
|
status: ProfileStatus = ProfileStatus.ACTIVE
|
|
date_of_birth: str | None = Field(default=None, max_length=32)
|
|
gender: str | None = Field(default=None, max_length=32)
|
|
contact: dict | None = None
|
|
emergency_contact: dict | None = None
|
|
metadata_json: dict | None = None
|
|
|
|
|
|
class PatientUpdate(BaseModel):
|
|
model_config = _FORBID
|
|
|
|
display_name: str | None = Field(default=None, max_length=255)
|
|
status: ProfileStatus | None = None
|
|
date_of_birth: str | None = Field(default=None, max_length=32)
|
|
gender: str | None = Field(default=None, max_length=32)
|
|
contact: dict | None = None
|
|
emergency_contact: dict | None = None
|
|
metadata_json: dict | None = None
|
|
version: int = Field(ge=1)
|
|
|
|
|
|
class PatientRead(ORMBase):
|
|
id: UUID
|
|
tenant_id: UUID
|
|
user_id: str
|
|
code: str
|
|
display_name: str
|
|
status: ProfileStatus
|
|
date_of_birth: str | None
|
|
gender: str | None
|
|
contact: dict | None
|
|
emergency_contact: dict | None
|
|
metadata_json: dict | None
|
|
version: int
|
|
is_deleted: bool
|
|
created_by: str | None
|
|
updated_by: str | None
|
|
created_at: datetime
|
|
updated_at: datetime
|