154 lines
2.7 KiB
Python
154 lines
2.7 KiB
Python
from datetime import datetime
|
|
from typing import List
|
|
from .BaseSchemas import *
|
|
from pydantic import Field
|
|
|
|
# Response schemas (used for API responses)
|
|
class Clinic(ClinicBase):
|
|
id: int
|
|
create_time: datetime
|
|
update_time: datetime
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class ClinicDoctorResponse(ClinicDoctorBase):
|
|
id: int
|
|
create_time: datetime
|
|
update_time: datetime
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class UserResponse(UserBase):
|
|
id: int
|
|
create_time: datetime
|
|
update_time: datetime
|
|
password: str = Field(exclude=True)
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
allow_population_by_field_name = True
|
|
|
|
class Doctor(DoctorBase):
|
|
id: int
|
|
create_time: datetime
|
|
update_time: datetime
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class Patient(PatientBase):
|
|
id: int
|
|
create_time: datetime
|
|
update_time: datetime
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class AppointmentSchema(AppointmentBase):
|
|
id: int
|
|
create_time: datetime
|
|
update_time: datetime
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class Calendar(CalendarBase):
|
|
id: int
|
|
create_time: datetime
|
|
update_time: datetime
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
# custom schema for response
|
|
class CalendarTimeSchema(BaseModel):
|
|
time: str
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class ClinicSchema(BaseModel):
|
|
id: int
|
|
name: str
|
|
address: str
|
|
phone: str
|
|
email: str
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
# Detailed response schemas with nested relationships
|
|
class ClinicWithDoctors(Clinic):
|
|
doctors: List[Doctor] = []
|
|
|
|
|
|
class DoctorWithAppointments(Doctor):
|
|
appointments: List[AppointmentSchema] = []
|
|
calendars: List[CalendarTimeSchema] = []
|
|
clinic: ClinicSchema
|
|
|
|
|
|
class DoctorWithCalendar(Doctor):
|
|
calendars: List[CalendarTimeSchema] = []
|
|
clinic: ClinicSchema
|
|
|
|
|
|
class PatientWithAppointments(Patient):
|
|
appointments: List[AppointmentSchema] = []
|
|
|
|
|
|
class AppointmentDetailed(AppointmentSchema):
|
|
|
|
class Doctor(BaseModel):
|
|
id: int
|
|
name: str
|
|
age: int
|
|
email: str
|
|
phone: str
|
|
address: str
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
class Patient(BaseModel):
|
|
id: int
|
|
name: str
|
|
age: int
|
|
email: str
|
|
phone: str
|
|
address: str
|
|
dob: str
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
doctor: Doctor
|
|
patient: Patient
|
|
|
|
|
|
class ClinicDoctorResponse(ClinicDoctorBase):
|
|
id: int
|
|
create_time: datetime
|
|
update_time: datetime
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class CallTranscriptsResponse(CallTranscriptsBase):
|
|
id: int
|
|
create_time: datetime
|
|
update_time: datetime
|
|
|
|
class Config:
|
|
orm_mode = True |