feat(procedure-combos) - v1
This commit is contained in:
@@ -58,6 +58,7 @@ model Patient {
|
||||
createdAt DateTime @default(now())
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
appointments Appointment[]
|
||||
procedures AppointmentProcedure[]
|
||||
claims Claim[]
|
||||
groups PdfGroup[]
|
||||
payment Payment[]
|
||||
@@ -92,6 +93,7 @@ model Appointment {
|
||||
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
staff Staff? @relation(fields: [staffId], references: [id])
|
||||
procedures AppointmentProcedure[]
|
||||
claims Claim[]
|
||||
|
||||
@@index([patientId])
|
||||
@@ -111,6 +113,40 @@ model Staff {
|
||||
claims Claim[] @relation("ClaimStaff")
|
||||
}
|
||||
|
||||
enum ProcedureSource {
|
||||
COMBO
|
||||
MANUAL
|
||||
}
|
||||
|
||||
model AppointmentProcedure {
|
||||
id Int @id @default(autoincrement())
|
||||
appointmentId Int
|
||||
patientId Int
|
||||
|
||||
procedureCode String
|
||||
procedureLabel String?
|
||||
fee Decimal? @db.Decimal(10,2)
|
||||
|
||||
category String?
|
||||
isDirect Boolean @default(false)
|
||||
|
||||
toothNumber String?
|
||||
toothSurface String?
|
||||
oralCavityArea String?
|
||||
|
||||
source ProcedureSource @default(MANUAL)
|
||||
comboKey String?
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)
|
||||
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([appointmentId])
|
||||
@@index([patientId])
|
||||
}
|
||||
|
||||
|
||||
model Claim {
|
||||
id Int @id @default(autoincrement())
|
||||
patientId Int
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AppointmentUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas";
|
||||
import { AppointmentUncheckedCreateInputObjectSchema, AppointmentProcedureUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas";
|
||||
import {z} from "zod";
|
||||
|
||||
export type Appointment = z.infer<typeof AppointmentUncheckedCreateInputObjectSchema>;
|
||||
@@ -19,4 +19,35 @@ export const updateAppointmentSchema = (
|
||||
createdAt: true,
|
||||
})
|
||||
.partial();
|
||||
export type UpdateAppointment = z.infer<typeof updateAppointmentSchema>;
|
||||
export type UpdateAppointment = z.infer<typeof updateAppointmentSchema>;
|
||||
|
||||
|
||||
// Appointment Procedure Types.
|
||||
|
||||
export type AppointmentProcedure = z.infer<
|
||||
typeof AppointmentProcedureUncheckedCreateInputObjectSchema
|
||||
>;
|
||||
|
||||
export const insertAppointmentProcedureSchema = (
|
||||
AppointmentProcedureUncheckedCreateInputObjectSchema as unknown as z.ZodObject<any>
|
||||
).omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
});
|
||||
|
||||
export type InsertAppointmentProcedure = z.infer<
|
||||
typeof insertAppointmentProcedureSchema
|
||||
>;
|
||||
|
||||
export const updateAppointmentProcedureSchema = (
|
||||
AppointmentProcedureUncheckedCreateInputObjectSchema as unknown as z.ZodObject<any>
|
||||
)
|
||||
.omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
})
|
||||
.partial();
|
||||
|
||||
export type UpdateAppointmentProcedure = z.infer<
|
||||
typeof updateAppointmentProcedureSchema
|
||||
>;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// using this, as the browser load only the required files , not whole db/shared/schemas/ files.
|
||||
export * from '../shared/schemas/objects/AppointmentUncheckedCreateInput.schema';
|
||||
export * from '../shared/schemas/objects/AppointmentProcedureUncheckedCreateInput.schema';
|
||||
export * from '../shared/schemas/objects/PatientUncheckedCreateInput.schema';
|
||||
export * from '../shared/schemas/enums/PatientStatus.schema';
|
||||
export * from '../shared/schemas/objects/UserUncheckedCreateInput.schema';
|
||||
|
||||
Reference in New Issue
Block a user