feat(patient-connection-page demo added)

This commit is contained in:
2025-12-18 00:38:09 +05:30
parent 1fbe30242c
commit 3ad5bd633d
9 changed files with 977 additions and 23 deletions

View File

@@ -32,13 +32,14 @@ model User {
notifications Notification[]
cloudFolders CloudFolder[]
cloudFiles CloudFile[]
communications Communication[]
}
model Patient {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
firstName String
lastName String
dateOfBirth DateTime @db.Date
dateOfBirth DateTime @db.Date
gender String
phone String
email String?
@@ -51,14 +52,15 @@ model Patient {
policyHolder String?
allergies String?
medicalConditions String?
status PatientStatus @default(UNKNOWN)
status PatientStatus @default(UNKNOWN)
userId Int
createdAt DateTime @default(now())
user User @relation(fields: [userId], references: [id])
createdAt DateTime @default(now())
user User @relation(fields: [userId], references: [id])
appointments Appointment[]
claims Claim[]
groups PdfGroup[]
payment Payment[]
communications Communication[]
@@index([insuranceId])
@@index([createdAt])
@@ -109,22 +111,22 @@ model Staff {
}
model Claim {
id Int @id @default(autoincrement())
patientId Int
appointmentId Int
userId Int
staffId Int
patientName String
memberId String
dateOfBirth DateTime @db.Date
remarks String
id Int @id @default(autoincrement())
patientId Int
appointmentId Int
userId Int
staffId Int
patientName String
memberId String
dateOfBirth DateTime @db.Date
remarks String
missingTeethStatus MissingTeethStatus @default(No_missing)
missingTeeth Json? // { "T_14": "X", "T_G": "O", ... }
serviceDate DateTime
insuranceProvider String // e.g., "Delta MA"
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
status ClaimStatus @default(PENDING)
missingTeeth Json? // { "T_14": "X", "T_G": "O", ... }
serviceDate DateTime
insuranceProvider String // e.g., "Delta MA"
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
status ClaimStatus @default(PENDING)
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
appointment Appointment @relation(fields: [appointmentId], references: [id], onDelete: Cascade)
@@ -145,7 +147,7 @@ enum ClaimStatus {
}
enum MissingTeethStatus {
No_missing
No_missing
endentulous
Yes_missing
}
@@ -378,3 +380,46 @@ model CloudFileChunk {
@@unique([fileId, seq])
@@index([fileId, seq])
}
// patient-connection-
enum CommunicationChannel {
sms
voice
}
enum CommunicationDirection {
outbound
inbound
}
enum CommunicationStatus {
queued
sent
delivered
failed
completed
busy
no_answer
}
model Communication {
id Int @id @default(autoincrement())
patientId Int
userId Int?
channel CommunicationChannel
direction CommunicationDirection
status CommunicationStatus
body String?
callDuration Int?
twilioSid String?
createdAt DateTime @default(now())
// Relations
patient Patient @relation(fields: [patientId], references: [id])
user User? @relation(fields: [userId], references: [id])
@@map("communications")
}

View File

@@ -9,4 +9,5 @@ export * from "./user-types";
export * from "./databaseBackup-types";
export * from "./notifications-types";
export * from "./cloudStorage-types";
export * from "./payments-reports-types";
export * from "./payments-reports-types";
export * from "./patientConnection-types";

View File

@@ -0,0 +1,42 @@
import { CommunicationUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas";
import { z } from "zod";
/**
* Full Communication type (Prisma unchecked create input)
*/
export type Communication = z.infer<
typeof CommunicationUncheckedCreateInputObjectSchema
>;
/**
* Insert Communication
* - excludes auto-generated fields
*/
export const insertCommunicationSchema = (
CommunicationUncheckedCreateInputObjectSchema as unknown as z.ZodObject<any>
).omit({
id: true,
createdAt: true,
});
export type InsertCommunication = z.infer<
typeof insertCommunicationSchema
>;
/**
* Update Communication
* - excludes immutable fields
* - makes everything optional
*/
export const updateCommunicationSchema = (
CommunicationUncheckedCreateInputObjectSchema as unknown as z.ZodObject<any>
)
.omit({
id: true,
createdAt: true,
})
.partial();
export type UpdateCommunication = z.infer<
typeof updateCommunicationSchema
>;

View File

@@ -17,4 +17,5 @@ export * from '../shared/schemas/enums/NotificationTypes.schema'
export * from '../shared/schemas/objects/NotificationUncheckedCreateInput.schema'
export * from '../shared/schemas/objects/DatabaseBackupUncheckedCreateInput.schema'
export * from '../shared/schemas/objects/CloudFolderUncheckedCreateInput.schema'
export * from '../shared/schemas/objects/CloudFileUncheckedCreateInput.schema'
export * from '../shared/schemas/objects/CloudFileUncheckedCreateInput.schema'
export * from '../shared/schemas/objects/CommunicationUncheckedCreateInput.schema'