daia-final-v2

Tables (49)

AiOutput

  • id — uuid
  • image_id — uuid — Foreign key → Image.id — NOT NULL
  • confidence — double
  • category — "DentalDiseaseType" — NOT NULL
  • tooth_number — integer — NOT NULL
  • surface — text
  • geometry — jsonb — NOT NULL
  • color_hex — text — NOT NULL
  • level — integer
  • ai_treatment_items — "TreatmentItemType" — NOT NULL
  • status — "Status" — NOT NULL
  • is_deleted — boolean — NOT NULL
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

AiRun

  • id — uuid
  • exam_id — uuid — Foreign key → Exam.id — NOT NULL
  • model_name — text — NOT NULL
  • model_version — text
  • params — jsonb — NOT NULL
  • status — "AiRunStatus" — NOT NULL
  • started_at — timestamptz — NOT NULL
  • finished_at — timestamptz
  • log_uri — text

Annotation

  • id — uuid
  • exam_id — uuid — Foreign key → Exam.id — NOT NULL
  • image_id — uuid — Foreign key → Image.id — NOT NULL
  • ai_output_id — uuid — Foreign key → AiOutput.id
  • copy_from_id — uuid
  • category — "DentalDiseaseType" — NOT NULL
  • tooth_number — integer — NOT NULL
  • surface — text
  • geometry — jsonb — NOT NULL
  • color_hex — text — NOT NULL
  • source — "SourceType" — NOT NULL
  • confidence — double
  • level — integer
  • status — "AnnotationStatus" — NOT NULL
  • treatment_items — "TreatmentItemType" — NOT NULL
  • note — text
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

AnnotationHistory

  • id — uuid
  • ai_output_id — uuid — Foreign key → AiOutput.id
  • previous_annotation_id — uuid — Foreign key → Annotation.id — NOT NULL
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

Appointment

  • id — uuid
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • patient_hospital_id — uuid — Foreign key → PatientHospital.id
  • case_id — uuid — Foreign key → TreatmentCase.id
  • doctor_id — uuid — Foreign key → User.id
  • created_by_id — uuid — Foreign key → User.id
  • status — "AppointmentStatus" — NOT NULL
  • reserved_at — timestamptz — NOT NULL
  • visit_date — date — NOT NULL
  • visit_time — time — NOT NULL
  • category — "AppointmentTreatmentCategory" — NOT NULL
  • patient_note — text
  • reschedule_reason — text
  • estimate_response_id — uuid — Foreign key → HospitalEstimateResponse.id
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

AppointmentTimeline

  • id — uuid
  • appointment_id — uuid — Foreign key → Appointment.id — NOT NULL
  • previous_status — "AppointmentStatus"
  • next_status — "AppointmentStatus" — NOT NULL
  • changed_by_id — uuid — Foreign key → User.id
  • reason — text
  • changed_at — timestamptz — NOT NULL
  • created_at — timestamptz — NOT NULL

CareStreak

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • current_days — integer — NOT NULL
  • status — "CareStreakStatus" — NOT NULL
  • last_recorded_at — timestamptz
  • last_milestone_at — timestamptz
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL

CaseDocument

  • id — uuid
  • case_id — uuid — Foreign key → TreatmentCase.id — NOT NULL
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • document_type — "CaseDocumentType" — NOT NULL
  • status — "CaseDocumentStatus" — NOT NULL
  • file_name — text
  • file_uri — text — NOT NULL
  • mime_type — text
  • file_size_bytes — integer
  • uploaded_by_id — uuid — Foreign key → User.id
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

ChatLog

  • id — uuid
  • chat_thread_id — uuid — Foreign key → ChatThread.id — NOT NULL
  • sender_type — "ChatSenderType" — NOT NULL
  • content — text — NOT NULL
  • image_uri — text
  • estimate_request_id — uuid — Foreign key → EstimateRequest.id
  • appointment_id — uuid — Foreign key → Appointment.id
  • created_at — timestamptz — NOT NULL

ChatThread

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • created_at — timestamptz — NOT NULL

EstimateRequest

  • id — uuid
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • category — "EstimateCategory" — NOT NULL
  • description — text
  • attachment_uri — text
  • status — "EstimateStatus" — NOT NULL
  • created_at — timestamptz — NOT NULL

Exam

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • patient_hospital_id — uuid — Foreign key → PatientHospital.id
  • doctor_id — uuid — Foreign key → User.id
  • chart_num — text — NOT NULL
  • exam_date — timestamptz — NOT NULL
  • status — "ExamStatus" — NOT NULL
  • save_status — "SaveStatus" — NOT NULL
  • note — text
  • confirmed_by_id — uuid — Foreign key → User.id
  • confirmed_at — timestamptz
  • review_status — "ExamReviewStatus" — NOT NULL
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

FeeCatalogItem

  • id — uuid
  • category — "TreatmentItemType" — NOT NULL
  • item_name — text — NOT NULL
  • note — text
  • national_base_price — integer
  • sort_order — integer — NOT NULL
  • is_active — boolean — NOT NULL
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL

HealthRecord

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • case_id — uuid — Foreign key → TreatmentCase.id
  • record_type — "HealthRecordType" — NOT NULL
  • title — text — NOT NULL
  • description — text
  • source — "HealthRecordSource" — NOT NULL
  • payload — jsonb
  • recorded_at — timestamptz — NOT NULL
  • created_by_id — uuid — Foreign key → User.id
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

Hospital

  • id — uuid
  • business_no — text — NOT NULL
  • name — text — NOT NULL
  • address — text
  • latitude — double
  • longitude — double
  • phone_number — text
  • is_open — boolean — NOT NULL
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

HospitalConnectionQr

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • qr_payload — text — NOT NULL
  • image_uri — text
  • is_active — boolean — NOT NULL
  • generated_at — timestamptz — NOT NULL
  • updated_by_id — uuid — Foreign key → User.id
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL

HospitalEstimateResponse

  • id — uuid
  • estimate_request_id — uuid — Foreign key → EstimateRequest.id — NOT NULL
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • amount — text — NOT NULL
  • content — text — NOT NULL
  • writer_id — uuid — Foreign key → User.id — NOT NULL
  • created_at — timestamptz — NOT NULL

HospitalFeePrice

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • fee_catalog_item_id — uuid — Foreign key → FeeCatalogItem.id — NOT NULL
  • base_price — integer — NOT NULL
  • updated_by_id — uuid — Foreign key → User.id
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL

HospitalReview

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • rating — numeric(2,1) — NOT NULL
  • content — text
  • tags — "ReviewTag" — NOT NULL
  • is_visible — boolean — NOT NULL
  • visited_at — timestamptz
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

HospitalRoleLicense

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • role_id — uuid — Foreign key → Role.id — NOT NULL
  • billing_cycle — "BillingCycle" — NOT NULL
  • seat_limit — integer — NOT NULL
  • is_active — boolean — NOT NULL
  • starts_at — timestamptz — NOT NULL
  • ends_at — timestamptz
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

Image

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • type — "ImageType" — NOT NULL
  • uri — text — NOT NULL
  • width — integer
  • height — integer
  • pixel_spacing_x — double
  • pixel_spacing_y — double
  • tooth_numbers — integer — NOT NULL
  • modality — "ImageModality" — NOT NULL
  • device_info — text
  • status — "Status" — NOT NULL
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

MissingTooth

  • id — uuid
  • exam_id — uuid — Foreign key → Exam.id — NOT NULL
  • tooth_number — integer — NOT NULL
  • status — "ExtractionSiteStatus" — NOT NULL
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

MyDenAccount

  • id — uuid
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • email — text
  • phone — text
  • password_hash — text
  • status — "MyDenAccountStatus" — NOT NULL
  • refresh_token_hash — text
  • last_login_at — timestamptz
  • withdrawn_at — timestamptz
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

MyDenDevice

  • id — uuid
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • device_id — text — NOT NULL
  • platform — "MyDenDevicePlatform" — NOT NULL
  • push_token — text
  • app_version — text
  • push_enabled — boolean — NOT NULL
  • last_seen_at — timestamptz
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

MyDenNotification

  • id — uuid
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • timeline_event_id — uuid — Foreign key → TimelineEvent.id
  • notification_type — "NotificationType" — NOT NULL
  • title — text — NOT NULL
  • body — text
  • priority — "NotificationPriority" — NOT NULL
  • deep_link — text
  • is_read — boolean — NOT NULL
  • read_at — timestamptz
  • sent_at — timestamptz
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

MyDenNotificationSetting

  • id — uuid
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • report_enabled — boolean — NOT NULL
  • treatment_plan_enabled — boolean — NOT NULL
  • appointment_enabled — boolean — NOT NULL
  • recall_enabled — boolean — NOT NULL
  • warranty_enabled — boolean — NOT NULL
  • health_record_enabled — boolean — NOT NULL
  • marketing_enabled — boolean — NOT NULL
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL

MyDenVerification

  • id — uuid
  • patient_id — uuid — Foreign key → Patient.id
  • email — text
  • phone — text
  • channel — "MyDenVerificationChannel" — NOT NULL
  • type — "MyDenVerificationType" — NOT NULL
  • code_hash — text
  • token_hash — text
  • attempt_count — integer — NOT NULL
  • resend_count — integer — NOT NULL
  • expires_at — timestamptz — NOT NULL
  • verified_at — timestamptz
  • consumed_at — timestamptz
  • last_sent_at — timestamptz
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL

Patient

  • id — uuid
  • name — text — NOT NULL
  • birth_date — text — NOT NULL
  • email — text
  • gender — "Gender" — NOT NULL
  • phone — text
  • address — text
  • latest_exam_id — uuid — Foreign key → Exam.id
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

PatientHospital

  • id — uuid
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • assigned_doctor_id — uuid — Foreign key → User.id
  • status — "PatientHospitalStatus" — NOT NULL
  • connection_status — "PatientHospitalConnectionStatus" — NOT NULL
  • request_source — "PatientHospitalRequestSource"
  • hospital_connection_qr_id — uuid — Foreign key → HospitalConnectionQr.id
  • connection_requested_at — timestamptz
  • connection_approved_at — timestamptz
  • connection_rejected_at — timestamptz
  • connection_canceled_at — timestamptz
  • connection_expired_at — timestamptz
  • connection_revoked_at — timestamptz
  • connection_approved_by_id — uuid — Foreign key → User.id
  • connection_rejected_reason — text
  • connected_at — timestamptz
  • disconnected_at — timestamptz
  • last_exam_id — uuid — Foreign key → Exam.id
  • last_case_id — uuid — Foreign key → TreatmentCase.id
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

PatientReleasePacket

  • id — uuid
  • case_id — uuid — Foreign key → TreatmentCase.id — NOT NULL
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • exam_id — uuid — Foreign key → Exam.id
  • treatment_plan_id — uuid — Foreign key → TreatmentPlan.id
  • packet_type — "ReleasePacketType" — NOT NULL
  • status — "ReleasePacketStatus" — NOT NULL
  • version — integer — NOT NULL
  • title — text — NOT NULL
  • summary — text
  • payload — jsonb
  • approved_by_id — uuid — Foreign key → User.id
  • approved_at — timestamptz
  • released_at — timestamptz
  • release_failed_at — timestamptz
  • release_failed_reason — text
  • release_attempt_count — integer — NOT NULL
  • revoked_at — timestamptz
  • revoked_reason — text
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

Recall

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • case_id — uuid — Foreign key → TreatmentCase.id
  • warranty_card_id — uuid — Foreign key → WarrantyCard.id
  • appointment_id — uuid — Foreign key → Appointment.id
  • recall_type — "RecallType" — NOT NULL
  • status — "RecallStatus" — NOT NULL
  • title — text — NOT NULL
  • recommended_date — timestamptz — NOT NULL
  • dismissed_until — timestamptz
  • booked_at — timestamptz
  • created_by_id — uuid — Foreign key → User.id
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

ReservationAvailabilitySetting

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • apply_holiday — boolean — NOT NULL
  • max_booking_days — integer — NOT NULL
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL

ReservationAvailableTime

  • id — uuid
  • availability_setting_id — uuid — Foreign key → ReservationAvailabilitySetting.id — NOT NULL
  • weekday — "Weekday" — NOT NULL
  • is_holiday — boolean — NOT NULL
  • starts_at — time — NOT NULL
  • ends_at — time — NOT NULL
  • lunch_starts_at — time
  • lunch_ends_at — time
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL

Role

  • id — uuid
  • code — "RoleCode" — NOT NULL
  • label — text — NOT NULL
  • unit_price — integer — NOT NULL
  • created_at — timestamptz — NOT NULL

TimelineEvent

  • id — uuid
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • hospital_id — uuid — Foreign key → Hospital.id
  • case_id — uuid — Foreign key → TreatmentCase.id
  • event_type — "TimelineEventType" — NOT NULL
  • category — "TimelineEventCategory" — NOT NULL
  • title — text — NOT NULL
  • description — text
  • occurred_at — timestamptz — NOT NULL
  • source — "TimelineEventSource" — NOT NULL
  • related_entity_type — text
  • related_entity_id — uuid
  • deep_link — text
  • priority — "TimelinePriority" — NOT NULL
  • is_new — boolean — NOT NULL
  • read_at — timestamptz
  • created_at — timestamptz — NOT NULL

ToothState

  • id — uuid
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • tooth_number — integer — NOT NULL
  • status — "ToothStateStatus" — NOT NULL
  • current_exam_id — uuid — Foreign key → Exam.id
  • last_treated_at — timestamptz
  • updated_by_id — uuid — Foreign key → User.id
  • updated_at — timestamptz — NOT NULL

ToothStateHistory

  • id — uuid
  • tooth_state_id — uuid — Foreign key → ToothState.id — NOT NULL
  • exam_id — uuid — Foreign key → Exam.id
  • before_status — "ToothStateStatus"
  • after_status — "ToothStateStatus" — NOT NULL
  • changed_by_id — uuid — Foreign key → User.id
  • reason — text
  • created_at — timestamptz — NOT NULL

TreatmentCase

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • patient_hospital_id — uuid — Foreign key → PatientHospital.id
  • owner_user_id — uuid — Foreign key → User.id
  • title — text — NOT NULL
  • case_type — "TreatmentCaseType" — NOT NULL
  • status — "TreatmentCaseStatus" — NOT NULL
  • release_status — "CaseReleaseStatus" — NOT NULL
  • app_view_status — "CaseAppViewStatus" — NOT NULL
  • opened_at — timestamptz — NOT NULL
  • released_at — timestamptz
  • first_viewed_at — timestamptz
  • last_viewed_at — timestamptz
  • closed_at — timestamptz
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

TreatmentCaseExam

  • id — uuid
  • case_id — uuid — Foreign key → TreatmentCase.id — NOT NULL
  • exam_id — uuid — Foreign key → Exam.id — NOT NULL
  • relation_type — "TreatmentCaseExamRelationType" — NOT NULL
  • order_index — integer — NOT NULL
  • created_at — timestamptz — NOT NULL

TreatmentGroup

  • id — uuid
  • treatment_plan_id — uuid — Foreign key → TreatmentPlan.id — NOT NULL
  • category — "DentalDiseaseType" — NOT NULL
  • status — "TreatmentGroupStatus" — NOT NULL
  • treatment_item_types — "TreatmentItemType" — NOT NULL
  • note — text
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

TreatmentItem

  • id — uuid
  • treatment_plan_id — uuid — Foreign key → TreatmentPlan.id — NOT NULL
  • treatment_group_id — uuid — Foreign key → TreatmentGroup.id — NOT NULL
  • fee_catalog_item_id — uuid — Foreign key → FeeCatalogItem.id
  • hospital_fee_price_id — uuid — Foreign key → HospitalFeePrice.id
  • tooth_number — integer
  • surface — text
  • procedure_code — text
  • title — text — NOT NULL
  • quantity — integer — NOT NULL
  • unit_price — integer — NOT NULL
  • original_unit_price — integer
  • recommended_by — "RecommendationSource" — NOT NULL
  • reason_text — text
  • price_adjust_reason — text
  • accepted — boolean — NOT NULL
  • order_index — integer — NOT NULL
  • note — text
  • copy_from_id — uuid
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

TreatmentPlan

  • id — uuid
  • case_id — uuid — Foreign key → TreatmentCase.id
  • exam_id — uuid — Foreign key → Exam.id — NOT NULL
  • writer_id — uuid — Foreign key → User.id — NOT NULL
  • editor_id — uuid — Foreign key → User.id
  • doctor_id — uuid — Foreign key → User.id
  • consultant_id — uuid — Foreign key → User.id
  • fee_schedule_note — text
  • version — integer — NOT NULL
  • status — "TreatmentPlanStatus" — NOT NULL
  • total_cost — integer
  • discount — integer
  • note — text
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

TreatmentPlanConsent

  • id — uuid
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • case_id — uuid — Foreign key → TreatmentCase.id — NOT NULL
  • treatment_plan_id — uuid — Foreign key → TreatmentPlan.id — NOT NULL
  • consent_status — "TreatmentPlanConsentStatus" — NOT NULL
  • consented_at — timestamptz
  • created_at — timestamptz — NOT NULL

TreatmentPlanVersion

  • id — uuid
  • treatment_plan_id — uuid — Foreign key → TreatmentPlan.id — NOT NULL
  • version — integer — NOT NULL
  • summary — jsonb
  • total_cost — integer
  • discount — integer
  • saved_by_id — uuid — Foreign key → User.id
  • change_reason — text
  • created_at — timestamptz — NOT NULL

User

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id
  • role_id — uuid — Foreign key → Role.id — NOT NULL
  • password — text
  • status — "UserStatus" — NOT NULL
  • label — "UserLabel"
  • name — text — NOT NULL
  • email — text — NOT NULL
  • birth_date — text
  • promotion_email_consent — boolean — NOT NULL
  • refresh_token — text
  • session_id — text
  • password_reset_code_hash — text
  • password_reset_code_expires_at — timestamptz
  • password_changed_at — timestamptz
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

WarrantyCard

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • case_id — uuid — Foreign key → TreatmentCase.id
  • policy_id — uuid — Foreign key → WarrantyPolicy.id
  • title — text — NOT NULL
  • category — text
  • status — "WarrantyCardStatus" — NOT NULL
  • issue_status — "WarrantyIssueStatus" — NOT NULL
  • issued_by_id — uuid — Foreign key → User.id
  • issued_at — timestamptz
  • patient_accepted_at — timestamptz
  • starts_at — timestamptz
  • expires_at — timestamptz
  • coverage_summary — text
  • patient_notice — text
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

WarrantyComponent

  • id — uuid
  • warranty_card_id — uuid — Foreign key → WarrantyCard.id — NOT NULL
  • component_type — "WarrantyComponentType" — NOT NULL
  • name — text — NOT NULL
  • tooth_number — integer
  • coverage_months — integer — NOT NULL
  • starts_at — timestamptz
  • expires_at — timestamptz
  • status — "WarrantyComponentStatus" — NOT NULL
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz

WarrantyPolicy

  • id — uuid
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • version — integer — NOT NULL
  • name — text — NOT NULL
  • status — "WarrantyPolicyStatus" — NOT NULL
  • policy — jsonb — NOT NULL
  • activated_at — timestamptz
  • created_by_id — uuid — Foreign key → User.id
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL

WarrantyServiceRequest

  • id — uuid
  • warranty_card_id — uuid — Foreign key → WarrantyCard.id — NOT NULL
  • patient_id — uuid — Foreign key → Patient.id — NOT NULL
  • hospital_id — uuid — Foreign key → Hospital.id — NOT NULL
  • case_id — uuid — Foreign key → TreatmentCase.id
  • request_type — "WarrantyServiceRequestType" — NOT NULL
  • status — "WarrantyServiceRequestStatus" — NOT NULL
  • title — text
  • description — text
  • attachment_urls — jsonb
  • requested_at — timestamptz — NOT NULL
  • received_at — timestamptz
  • resolved_at — timestamptz
  • rejected_at — timestamptz
  • rejected_reason — text
  • created_at — timestamptz — NOT NULL
  • updated_at — timestamptz — NOT NULL
  • deleted_at — timestamptz