feature: Phase 2- splitting the treatment schema into TreatmentDetail and LabCase.

This commit is contained in:
2026-06-28 15:34:56 +03:30
parent dc965b2528
commit 8b4ef6195d
12 changed files with 749 additions and 232 deletions

View File

@@ -61,24 +61,47 @@ export const TREATMENT_TYPES = [
export type TreatmentType = (typeof TREATMENT_TYPES)[number];
export interface TreatmentCaseSendInfo {
export interface LabCaseSendInfo {
organizationId: string;
organizationName: string;
sentAt: string;
}
export interface PastTreatmentCase {
/** @deprecated Use LabCaseSendInfo */
export type TreatmentCaseSendInfo = LabCaseSendInfo;
export interface PastTreatmentDetail {
id: string;
clientId: string;
treatmentType: TreatmentType;
teeth: FdiToothId[];
notes?: string | null;
attachmentMetas?: TreatmentAttachmentMeta[];
sendToOrganizationIds?: string[];
sends?: TreatmentCaseSendInfo[];
labCaseId?: string | null;
destinationOrganizationId?: string | null;
sends?: LabCaseSendInfo[];
sentAt?: string | null;
}
/** @deprecated Use PastTreatmentDetail */
export type PastTreatmentCase = PastTreatmentDetail;
export interface PastLabCase {
id: string;
clientId: string;
destinationOrganizationId: string | null;
labComment?: string | null;
sentAt?: string | null;
treatmentDetailIds: string[];
details: Array<{
id: string;
clientId: string;
treatmentType: string;
teeth: FdiToothId[];
}>;
sends?: LabCaseSendInfo[];
}
export interface PastTreatment {
id: string;
patientId: string;
@@ -86,7 +109,8 @@ export interface PastTreatment {
title: string;
treatmentAt: string;
status: string;
cases: PastTreatmentCase[];
details: PastTreatmentDetail[];
labCases: PastLabCase[];
documents: TreatmentAttachmentMeta[];
}
@@ -96,19 +120,23 @@ export interface LinkedOrganizationOption {
active: boolean;
}
export interface TreatmentCaseDraft {
export interface TreatmentDetailDraft {
clientId: string;
id?: string;
treatmentType: TreatmentType;
teeth: FdiToothId[];
comment: string;
attachmentMetas: TreatmentAttachmentMeta[];
labCaseId?: string | null;
sendToOrganizationIds: string[];
sends?: TreatmentCaseSendInfo[];
sends?: LabCaseSendInfo[];
sentAt?: string | null;
}
export type SavedTreatmentCasePayload = {
/** @deprecated Use TreatmentDetailDraft — kept for editor components until Phase 4 rename */
export type TreatmentCaseDraft = TreatmentDetailDraft;
export type SavedTreatmentDetailPayload = {
clientId: string;
id?: string;
treatmentType: TreatmentType;
@@ -117,12 +145,35 @@ export type SavedTreatmentCasePayload = {
attachmentIds: string[];
};
/** @deprecated Use SavedTreatmentDetailPayload */
export type SavedTreatmentCasePayload = SavedTreatmentDetailPayload;
export interface SaveLabCasePayload {
clientId: string;
id?: string;
destinationOrganizationId?: string;
labComment?: string;
treatmentDetailIds: string[];
}
export interface SaveTreatmentPayload {
appointmentId: string;
patientId: string;
cases: SavedTreatmentCasePayload[];
details: SavedTreatmentDetailPayload[];
}
export interface SendTreatmentCasePayload {
organizationIds: string[];
export interface LabCaseResponse {
id: string;
clientId: string;
destinationOrganizationId: string | null;
labComment: string | null;
sentAt: string | null;
treatmentDetailIds: string[];
details: Array<{
id: string;
clientId: string;
treatmentType: string;
teeth: string[];
}>;
sends: LabCaseSendInfo[];
}