TreatmentType and ProsthesisType database shcema and data updated. Lab dispatch wired through new data.
This commit is contained in:
@@ -155,6 +155,7 @@ model TreatmentDetail {
|
||||
attachments TreatmentDetailAttachment[]
|
||||
labCaseLink LabCaseDetail?
|
||||
labCaseTasks LabCaseTask[]
|
||||
toothProsthesis LabCaseToothProsthesis[]
|
||||
|
||||
@@index([treatmentId, sortOrder])
|
||||
@@map("treatment_details")
|
||||
@@ -188,10 +189,11 @@ model LabCase {
|
||||
labComment String?
|
||||
sentAt DateTime?
|
||||
|
||||
treatment Treatment @relation(fields: [treatmentId], references: [id], onDelete: Cascade)
|
||||
details LabCaseDetail[]
|
||||
sends LabCaseSend[]
|
||||
tasks LabCaseTask[]
|
||||
treatment Treatment @relation(fields: [treatmentId], references: [id], onDelete: Cascade)
|
||||
details LabCaseDetail[]
|
||||
sends LabCaseSend[]
|
||||
tasks LabCaseTask[]
|
||||
toothProsthesis LabCaseToothProsthesis[]
|
||||
|
||||
@@index([treatmentId, sortOrder])
|
||||
@@map("lab_cases")
|
||||
@@ -226,36 +228,92 @@ model TreatmentType {
|
||||
code String @unique
|
||||
labDependent Boolean @default(false)
|
||||
sortOrder Int @default(0)
|
||||
|
||||
workflowSteps TreatmentWorkflowStep[]
|
||||
isActive Boolean @default(true)
|
||||
|
||||
@@map("treatment_types")
|
||||
}
|
||||
|
||||
model TreatmentWorkflowStep {
|
||||
id String @id @default(uuid())
|
||||
treatmentTypeId String
|
||||
stepOrder Int
|
||||
label String
|
||||
enum CatalogEntityKind {
|
||||
TREATMENT_TYPE
|
||||
PROSTHESIS_TYPE
|
||||
LAB_WORKFLOW_STEP
|
||||
}
|
||||
|
||||
treatmentType TreatmentType @relation(fields: [treatmentTypeId], references: [id], onDelete: Cascade)
|
||||
model CatalogTranslation {
|
||||
id String @id @default(uuid())
|
||||
entityKind CatalogEntityKind
|
||||
entityCode String
|
||||
locale String
|
||||
label String
|
||||
|
||||
@@unique([treatmentTypeId, stepOrder])
|
||||
@@map("treatment_workflow_steps")
|
||||
@@unique([entityKind, entityCode, locale])
|
||||
@@map("catalog_translations")
|
||||
}
|
||||
|
||||
model ProsthesisType {
|
||||
id String @id @default(uuid())
|
||||
code String @unique
|
||||
sortOrder Int @default(0)
|
||||
isActive Boolean @default(true)
|
||||
skipPackingShipping Boolean @default(false)
|
||||
|
||||
steps ProsthesisTypeStep[]
|
||||
|
||||
@@map("prosthesis_types")
|
||||
}
|
||||
|
||||
model LabWorkflowStep {
|
||||
id String @id @default(uuid())
|
||||
code String @unique
|
||||
sortOrder Int @default(0)
|
||||
|
||||
prosthesisSteps ProsthesisTypeStep[]
|
||||
|
||||
@@map("lab_workflow_steps")
|
||||
}
|
||||
|
||||
model ProsthesisTypeStep {
|
||||
id String @id @default(uuid())
|
||||
prosthesisTypeId String
|
||||
labWorkflowStepId String
|
||||
stepOrder Int
|
||||
|
||||
prosthesisType ProsthesisType @relation(fields: [prosthesisTypeId], references: [id], onDelete: Cascade)
|
||||
labWorkflowStep LabWorkflowStep @relation(fields: [labWorkflowStepId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([prosthesisTypeId, stepOrder])
|
||||
@@unique([prosthesisTypeId, labWorkflowStepId])
|
||||
@@map("prosthesis_type_steps")
|
||||
}
|
||||
|
||||
model LabCaseToothProsthesis {
|
||||
id String @id @default(uuid())
|
||||
labCaseId String
|
||||
treatmentDetailId String
|
||||
tooth String
|
||||
prosthesisTypeCode String
|
||||
|
||||
labCase LabCase @relation(fields: [labCaseId], references: [id], onDelete: Cascade)
|
||||
detail TreatmentDetail @relation(fields: [treatmentDetailId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([labCaseId, treatmentDetailId, tooth])
|
||||
@@map("lab_case_tooth_prosthesis")
|
||||
}
|
||||
|
||||
model LabCaseTask {
|
||||
id String @id @default(uuid())
|
||||
labCaseId String
|
||||
treatmentDetailId String
|
||||
tooth String
|
||||
treatmentType String
|
||||
stepOrder Int
|
||||
stepLabel String
|
||||
assigneeUserId String?
|
||||
assignedAt DateTime?
|
||||
priority Int @default(3)
|
||||
status LabTaskStatus @default(PENDING)
|
||||
id String @id @default(uuid())
|
||||
labCaseId String
|
||||
treatmentDetailId String
|
||||
tooth String
|
||||
treatmentType String
|
||||
prosthesisTypeCode String
|
||||
workflowStepCode String
|
||||
stepOrder Int
|
||||
stepLabel String
|
||||
assigneeUserId String?
|
||||
assignedAt DateTime?
|
||||
priority Int @default(3)
|
||||
status LabTaskStatus @default(PENDING)
|
||||
|
||||
labCase LabCase @relation(fields: [labCaseId], references: [id], onDelete: Cascade)
|
||||
detail TreatmentDetail @relation(fields: [treatmentDetailId], references: [id], onDelete: Cascade)
|
||||
@@ -264,7 +322,7 @@ model LabCaseTask {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([labCaseId, tooth, treatmentType, stepOrder])
|
||||
@@unique([labCaseId, treatmentDetailId, tooth, stepOrder])
|
||||
@@index([labCaseId, status])
|
||||
@@index([assigneeUserId, priority, createdAt])
|
||||
@@index([assignedAt, labCaseId, priority])
|
||||
|
||||
Reference in New Issue
Block a user