diff --git a/.cursor/rules/dyolink-overview.mdc b/.cursor/rules/dyolink-overview.mdc index 77e9b9b..93c1b35 100644 --- a/.cursor/rules/dyolink-overview.mdc +++ b/.cursor/rules/dyolink-overview.mdc @@ -11,7 +11,7 @@ Monorepo: `backend/` (NestJS + Prisma), `frontend/` (Next.js + next-intl), `infr - **CLINIC** orgs: patients, appointments, treatment, staff. - **LAB** orgs: cases, tasks, lab workflows. -- Named **patients** are scoped to `createdByOrganizationId`. `mobile` stays globally unique — other-org / walk-in hit `PATIENT_MOBILE_UNAVAILABLE` (no shared row). +- Named **patients** are scoped to `createdByOrganizationId`. `identification` stays globally unique — other-org / walk-in hit `PATIENT_IDENTIFICATION_UNAVAILABLE` (no shared row). `mobile` is not unique. - Tab access: `TAB_*_READ` / `TAB_*_EDIT` in `backend/src/common/permissions.ts`. EDIT implies READ. ## Agent behavior diff --git a/.cursor/rules/patients.mdc b/.cursor/rules/patients.mdc index 8bc239c..f607824 100644 --- a/.cursor/rules/patients.mdc +++ b/.cursor/rules/patients.mdc @@ -7,6 +7,7 @@ alwaysApply: false # Patients - List / get / update / create: **this org** + `isWalkIn: false` (`createdByOrganizationId`). -- `Patient.mobile` stays **globally unique**. Same-org named create returns `{ existing: true }`. Other org, walk-in, or null creator → `PATIENT_MOBILE_UNAVAILABLE` (409). Do **not** return or mention the other clinic’s row. +- `Patient.identification` stays **globally unique**. Same-org named create returns `{ existing: true }`. Other org, walk-in, or null creator → `PATIENT_IDENTIFICATION_UNAVAILABLE` (409). Do **not** return or mention the other clinic’s row. +- `Patient.mobile` is required for named patients but **not** unique. - Appointment create/update and `POST /treatments` named `patientId`: `ensurePatientInOrg` (named + this org). Walk-in sentinel is per clinic (`walk-in-patient.ts`), hidden from Patients/search/booking. - History / lab-case lists still query treatments for **this** `organizationId` even if the patient UUID is guessed. diff --git a/.cursor/skills/treatment-workspace/SKILL.md b/.cursor/skills/treatment-workspace/SKILL.md index 1ee0e48..9c60a8d 100644 --- a/.cursor/skills/treatment-workspace/SKILL.md +++ b/.cursor/skills/treatment-workspace/SKILL.md @@ -202,7 +202,7 @@ Use shared `Checkbox` (not native ``) to avoid focus-driv -Walk-in uses one sentinel `Patient` per clinic (`isWalkIn`, hidden from Patients/search/booking). Display via i18n, never the stored name. Named patients are this-org only (`createdByOrganizationId`); another clinic’s mobile is `PATIENT_MOBILE_UNAVAILABLE`, not a shared row. Patient search: same workspace patient with a live visit → no-op; else open today’s strip visit if any; else load latest history into the editor; **no history and no strip visit → do not auto-create**. Detach the previous visit, keep the searched patient, and show an inline editor empty state (`noTreatmentFoundTitle` / `noTreatmentFoundBody`) that points to **New treatment** in the rail (Walk-in, current named patient card, or search). +Walk-in uses one sentinel `Patient` per clinic (`isWalkIn`, hidden from Patients/search/booking). Display via i18n, never the stored name. Named patients are this-org only (`createdByOrganizationId`); another clinic’s identification is `PATIENT_IDENTIFICATION_UNAVAILABLE`, not a shared row. Patient search: same workspace patient with a live visit → no-op; else open today’s strip visit if any; else load latest history into the editor; **no history and no strip visit → do not auto-create**. Detach the previous visit, keep the searched patient, and show an inline editor empty state (`noTreatmentFoundTitle` / `noTreatmentFoundBody`) that points to **New treatment** in the rail (Walk-in, current named patient card, or search). Draft writes for appointments require provider match (`ensureAppointmentProvider`). Standalone requires `treatment.providerUserId === actor`. diff --git a/AGENTS.md b/AGENTS.md index 7aac795..0a48c12 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -64,7 +64,7 @@ frontend/src/ **Appointments (quick ref):** Do not delete (or change patient) when `hasTreatment`; codes `APPOINTMENT_HAS_TREATMENT` / `APPOINTMENT_PATIENT_LOCKED`. Past days: no new bookings; edit/delete OK without treatment; with treatment → toast. Appointment delete does not cascade-delete treatments. Working hours: client IANA `timeZone` on create/update — never `Date#getHours()`/`getDay()` on the UTC server. Logical API errors: `AppException` + `errors.*` (never Nest English throws). Patient must belong to this org (`ensurePatientInOrg`). See `.cursor/rules/appointments.mdc`, `.cursor/skills/api-errors/SKILL.md`. -**Patients (quick ref):** List/get/update/create are this-org named patients (`createdByOrganizationId`, `isWalkIn: false`). Mobile stays globally unique. Same-org mobile create returns `existing: true`; other org / walk-in / null creator → `PATIENT_MOBILE_UNAVAILABLE` (409, no leak). See `.cursor/rules/patients.mdc`. +**Patients (quick ref):** List/get/update/create are this-org named patients (`createdByOrganizationId`, `isWalkIn: false`). `identification` stays globally unique; `mobile` is not. Same-org identification create returns `existing: true`; other org / walk-in / null creator → `PATIENT_IDENTIFICATION_UNAVAILABLE` (409, no leak). See `.cursor/rules/patients.mdc`. **Staff (quick ref):** Owner / `TAB_STAFF_EDIT` can **remove** a password (`POST /staff/members/:id/clear-password`) and copy a setup link — never set one for someone else. Login page unchanged (`passwordHash: null` cannot sign in). `/accept-invite` `password_setup` is password-only. See `.cursor/rules/staff.mdc`. diff --git a/backend/prisma/migrations/20260917220000_patient_identification_unique/migration.sql b/backend/prisma/migrations/20260917220000_patient_identification_unique/migration.sql new file mode 100644 index 0000000..b119b4f --- /dev/null +++ b/backend/prisma/migrations/20260917220000_patient_identification_unique/migration.sql @@ -0,0 +1,19 @@ +-- Move global unique identity from mobile → identification. + +ALTER TABLE "patients" ADD COLUMN "identification" TEXT; + +-- Walk-ins: reuse walk-in mobile sentinel (already unique per org). +UPDATE "patients" +SET "identification" = "mobile" +WHERE "isWalkIn" = true; + +-- Named / other rows: stable unique backfill from id. +UPDATE "patients" +SET "identification" = '__legacy__:' || "id" +WHERE "identification" IS NULL; + +ALTER TABLE "patients" ALTER COLUMN "identification" SET NOT NULL; + +CREATE UNIQUE INDEX "patients_identification_key" ON "patients"("identification"); + +DROP INDEX IF EXISTS "patients_mobile_key"; diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma index 967317c..436cbd7 100644 --- a/backend/prisma/schema.prisma +++ b/backend/prisma/schema.prisma @@ -103,7 +103,8 @@ model Patient { id String @id @default(uuid()) firstName String lastName String - mobile String @unique + identification String @unique + mobile String email String? dateOfBirth DateTime? notes String? diff --git a/backend/src/common/errors/error-codes.ts b/backend/src/common/errors/error-codes.ts index 27aca4e..fc4a478 100644 --- a/backend/src/common/errors/error-codes.ts +++ b/backend/src/common/errors/error-codes.ts @@ -84,7 +84,7 @@ export const ErrorCode = { APPOINTMENT_NOT_PROVIDER: 'APPOINTMENT_NOT_PROVIDER', PATIENT_NOT_FOUND: 'PATIENT_NOT_FOUND', - PATIENT_MOBILE_UNAVAILABLE: 'PATIENT_MOBILE_UNAVAILABLE', + PATIENT_IDENTIFICATION_UNAVAILABLE: 'PATIENT_IDENTIFICATION_UNAVAILABLE', WORKING_HOURS_INVALID: 'WORKING_HOURS_INVALID', WORKING_HOURS_OWNER_NOT_ALLOWED: 'WORKING_HOURS_OWNER_NOT_ALLOWED', diff --git a/backend/src/common/walk-in-patient.ts b/backend/src/common/walk-in-patient.ts index cadcdf3..1f79ec4 100644 --- a/backend/src/common/walk-in-patient.ts +++ b/backend/src/common/walk-in-patient.ts @@ -26,11 +26,13 @@ export async function ensureWalkInPatient( return { id: existing.id, isWalkIn: true }; } + const walkInKey = walkInMobileForOrganization(organizationId); const created = await prisma.patient.create({ data: { firstName: 'Walk-in', lastName: 'Walk-in', - mobile: walkInMobileForOrganization(organizationId), + identification: walkInKey, + mobile: walkInKey, isWalkIn: true, createdByOrganizationId: organizationId, }, diff --git a/backend/src/modules/appointments/appointments.service.ts b/backend/src/modules/appointments/appointments.service.ts index adc1c86..9ff58d8 100644 --- a/backend/src/modules/appointments/appointments.service.ts +++ b/backend/src/modules/appointments/appointments.service.ts @@ -102,7 +102,7 @@ export class AppointmentsService { }, include: { patient: { - select: { id: true, firstName: true, lastName: true, mobile: true }, + select: { id: true, firstName: true, lastName: true, identification: true, mobile: true }, }, treatment: { select: { id: true } }, }, @@ -168,7 +168,7 @@ export class AppointmentsService { }, include: { patient: { - select: { id: true, firstName: true, lastName: true, mobile: true }, + select: { id: true, firstName: true, lastName: true, identification: true, mobile: true }, }, }, }); @@ -245,7 +245,7 @@ export class AppointmentsService { }, include: { patient: { - select: { id: true, firstName: true, lastName: true, mobile: true }, + select: { id: true, firstName: true, lastName: true, identification: true, mobile: true }, }, }, }); diff --git a/backend/src/modules/patients/dto/create-patient.dto.ts b/backend/src/modules/patients/dto/create-patient.dto.ts index ec14ba0..6612267 100644 --- a/backend/src/modules/patients/dto/create-patient.dto.ts +++ b/backend/src/modules/patients/dto/create-patient.dto.ts @@ -13,17 +13,22 @@ export class CreatePatientDto { @IsString() @MinLength(1, { message: ErrorCode.VALIDATION_FIELD_REQUIRED }) @MaxLength(80) - firstName: string; + firstName!: string; @IsString() @MinLength(1, { message: ErrorCode.VALIDATION_FIELD_REQUIRED }) @MaxLength(80) - lastName: string; + lastName!: string; + + @IsString() + @MinLength(1, { message: ErrorCode.VALIDATION_FIELD_REQUIRED }) + @MaxLength(80) + identification!: string; @IsString() @MinLength(1, { message: ErrorCode.VALIDATION_FIELD_REQUIRED }) @MaxLength(30) - mobile: string; + mobile!: string; @IsOptional() @Transform(emptyStringToUndefined) diff --git a/backend/src/modules/patients/patients.controller.ts b/backend/src/modules/patients/patients.controller.ts index ff4007a..7325f5d 100644 --- a/backend/src/modules/patients/patients.controller.ts +++ b/backend/src/modules/patients/patients.controller.ts @@ -25,7 +25,7 @@ export class PatientsController { constructor(private readonly patientsService: PatientsService) {} @Post() - @ApiOperation({ summary: 'Create or return this clinic’s patient by mobile' }) + @ApiOperation({ summary: 'Create or return this clinic’s patient by identification' }) create(@Body() createPatientDto: CreatePatientDto, @Req() req) { const organizationId = this.patientsService.getOrganizationIdFromUser(req.user); return this.patientsService.create(createPatientDto, organizationId); diff --git a/backend/src/modules/patients/patients.service.ts b/backend/src/modules/patients/patients.service.ts index cdd78f5..dc7048b 100644 --- a/backend/src/modules/patients/patients.service.ts +++ b/backend/src/modules/patients/patients.service.ts @@ -14,10 +14,11 @@ export class PatientsService { async create(createPatientDto: CreatePatientDto, organizationId: string) { const firstName = this.requireNonEmptyName(createPatientDto.firstName, 'firstName'); const lastName = this.requireNonEmptyName(createPatientDto.lastName, 'lastName'); + const identification = this.requireNonEmptyIdentification(createPatientDto.identification); const mobile = this.resolveMobile(createPatientDto.mobile); const existing = await this.prisma.patient.findUnique({ - where: { mobile }, + where: { identification }, }); if (existing) { @@ -27,13 +28,14 @@ export class PatientsService { ) { return { success: true, data: existing, existing: true as const }; } - throw new AppException(ErrorCode.PATIENT_MOBILE_UNAVAILABLE, HttpStatus.CONFLICT); + throw new AppException(ErrorCode.PATIENT_IDENTIFICATION_UNAVAILABLE, HttpStatus.CONFLICT); } const patient = await this.prisma.patient.create({ data: { firstName, lastName, + identification, mobile, email: createPatientDto.email?.trim() || null, notes: createPatientDto.notes?.trim() || null, @@ -90,6 +92,7 @@ export class PatientsService { const data: { firstName?: string; lastName?: string; + identification?: string; mobile?: string; email?: string | null; notes?: string | null; @@ -102,16 +105,19 @@ export class PatientsService { if (updatePatientDto.lastName !== undefined) { data.lastName = this.requireNonEmptyName(updatePatientDto.lastName, 'lastName'); } - if (updatePatientDto.mobile !== undefined) { - const mobile = this.resolveMobile(updatePatientDto.mobile); + if (updatePatientDto.identification !== undefined) { + const identification = this.requireNonEmptyIdentification(updatePatientDto.identification); const taken = await this.prisma.patient.findUnique({ - where: { mobile }, - select: { id: true, createdByOrganizationId: true, isWalkIn: true }, + where: { identification }, + select: { id: true }, }); if (taken && taken.id !== id) { - throw new AppException(ErrorCode.PATIENT_MOBILE_UNAVAILABLE, HttpStatus.CONFLICT); + throw new AppException(ErrorCode.PATIENT_IDENTIFICATION_UNAVAILABLE, HttpStatus.CONFLICT); } - data.mobile = mobile; + data.identification = identification; + } + if (updatePatientDto.mobile !== undefined) { + data.mobile = this.resolveMobile(updatePatientDto.mobile); } if (updatePatientDto.email !== undefined) { data.email = updatePatientDto.email?.trim() || null; @@ -222,6 +228,16 @@ export class PatientsService { return trimmed; } + private requireNonEmptyIdentification(value: string): string { + const trimmed = value?.trim() ?? ''; + if (!trimmed) { + throw new AppException(ErrorCode.VALIDATION_FIELD_REQUIRED, HttpStatus.BAD_REQUEST, [ + { field: 'identification', code: ErrorCode.VALIDATION_FIELD_REQUIRED }, + ]); + } + return trimmed; + } + private async assertCanViewPatients(userId: string, organizationId: string) { const membership = await this.prisma.membership.findUnique({ where: { diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 34fca98..fecb28e 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -401,10 +401,13 @@ "errorSavePatient": "Failed to save patient.", "firstName": "First name", "lastName": "Last name", + "identification": "Identification", + "identificationLabel": "Identification:", + "identificationRequired": "Identification is required.", "mobile": "Mobile", "mobilePlaceholder": "09121234567", "mobileLabel": "Mobile:", - "patientAlreadyExists": "A patient with this mobile already exists: {firstName} {lastName}. They were selected for you.", + "patientAlreadyExists": "A patient with this identification already exists: {firstName} {lastName}. They were selected for you.", "savePatient": "Save Patient", "dialogTitle": "New patient", "searchPlaceholder": "Search patients by name, mobile, email", @@ -1234,7 +1237,7 @@ "APPOINTMENT_NOT_FOUND": "Appointment not found.", "APPOINTMENT_NOT_PROVIDER": "You are not the provider for this appointment.", "PATIENT_NOT_FOUND": "Patient not found.", - "PATIENT_MOBILE_UNAVAILABLE": "This mobile number cannot be added for this clinic.", + "PATIENT_IDENTIFICATION_UNAVAILABLE": "This identification cannot be added for this clinic.", "WORKING_HOURS_INVALID": "Working hours are invalid. Check that shifts do not overlap.", "WORKING_HOURS_OWNER_NOT_ALLOWED": "Set owner working hours from account settings.", "WORKING_HOURS_CONFLICTS_WITH_APPOINTMENTS": "These hours conflict with upcoming appointments. Reschedule or remove those appointments first.", diff --git a/frontend/messages/fa.json b/frontend/messages/fa.json index 73963b5..4fa6ab4 100644 --- a/frontend/messages/fa.json +++ b/frontend/messages/fa.json @@ -401,10 +401,13 @@ "errorSavePatient": "ذخیره بیمار ناموفق بود.", "firstName": "نام", "lastName": "نام خانوادگی", + "identification": "شناسه", + "identificationLabel": "شناسه:", + "identificationRequired": "شناسه الزامی است.", "mobile": "موبایل", "mobilePlaceholder": "09121234567", "mobileLabel": "موبایل:", - "patientAlreadyExists": "بیماری با این شماره موبایل از قبل وجود دارد: {firstName} {lastName}. برای شما انتخاب شد.", + "patientAlreadyExists": "بیماری با این شناسه از قبل وجود دارد: {firstName} {lastName}. برای شما انتخاب شد.", "savePatient": "ذخیره بیمار", "dialogTitle": "بیمار جدید", "searchPlaceholder": "جستجوی بیماران بر اساس نام، موبایل، ایمیل", @@ -1235,7 +1238,7 @@ "APPOINTMENT_NOT_FOUND": "نوبت یافت نشد.", "APPOINTMENT_NOT_PROVIDER": "شما ارائه‌دهنده این نوبت نیستید.", "PATIENT_NOT_FOUND": "بیمار یافت نشد.", - "PATIENT_MOBILE_UNAVAILABLE": "این شماره موبایل را نمی‌توان برای این کلینیک ثبت کرد.", + "PATIENT_IDENTIFICATION_UNAVAILABLE": "این شناسه را نمی‌توان برای این کلینیک ثبت کرد.", "WORKING_HOURS_INVALID": "ساعات کاری نامعتبر است. هم‌پوشانی شیفت‌ها را بررسی کنید.", "WORKING_HOURS_OWNER_NOT_ALLOWED": "ساعات کاری مالک را از تنظیمات حساب تنظیم کنید.", "WORKING_HOURS_CONFLICTS_WITH_APPOINTMENTS": "این ساعات با نوبت‌های آینده تداخل دارد. ابتدا آن نوبت‌ها را تغییر دهید یا حذف کنید.", diff --git a/frontend/messages/nl.json b/frontend/messages/nl.json index 3eef1d3..d466274 100644 --- a/frontend/messages/nl.json +++ b/frontend/messages/nl.json @@ -401,10 +401,13 @@ "errorSavePatient": "Patiënt opslaan mislukt.", "firstName": "Voornaam", "lastName": "Achternaam", + "identification": "Identificatie", + "identificationLabel": "Identificatie:", + "identificationRequired": "Identificatie is verplicht.", "mobile": "Mobiel", "mobilePlaceholder": "0612345678", "mobileLabel": "Mobiel:", - "patientAlreadyExists": "Er bestaat al een patiënt met dit mobiele nummer: {firstName} {lastName}. Deze is voor u geselecteerd.", + "patientAlreadyExists": "Er bestaat al een patiënt met deze identificatie: {firstName} {lastName}. Deze is voor u geselecteerd.", "savePatient": "Patiënt opslaan", "dialogTitle": "Nieuwe patiënt", "searchPlaceholder": "Zoek patiënten op naam, mobiel, e-mail", @@ -1234,7 +1237,7 @@ "APPOINTMENT_NOT_FOUND": "Afspraak niet gevonden.", "APPOINTMENT_NOT_PROVIDER": "U bent niet de zorgverlener van deze afspraak.", "PATIENT_NOT_FOUND": "Patiënt niet gevonden.", - "PATIENT_MOBILE_UNAVAILABLE": "Dit mobiele nummer kan niet voor deze kliniek worden toegevoegd.", + "PATIENT_IDENTIFICATION_UNAVAILABLE": "Deze identificatie kan niet voor deze kliniek worden toegevoegd.", "WORKING_HOURS_INVALID": "De werktijden zijn ongeldig. Controleer of diensten niet overlappen.", "WORKING_HOURS_OWNER_NOT_ALLOWED": "Stel werktijden van de eigenaar in via accountinstellingen.", "WORKING_HOURS_CONFLICTS_WITH_APPOINTMENTS": "Deze tijden conflicteren met aankomende afspraken. Plan die eerst om of verwijder ze.", diff --git a/frontend/src/components/ui/appointments/AppointmentBookingModal.tsx b/frontend/src/components/ui/appointments/AppointmentBookingModal.tsx index 9e2abb3..a2d7fa0 100644 --- a/frontend/src/components/ui/appointments/AppointmentBookingModal.tsx +++ b/frontend/src/components/ui/appointments/AppointmentBookingModal.tsx @@ -54,11 +54,12 @@ interface AppointmentBookingModalProps { function patientFromRecord( patient: AppointmentRecord['patient'], -): Pick { +): Pick { return { id: patient.id, firstName: patient.firstName, lastName: patient.lastName, + identification: patient.identification, mobile: patient.mobile, }; } @@ -93,7 +94,7 @@ export function AppointmentBookingModal({ const [endTime, setEndTime] = useState('09:30'); const [purpose, setPurpose] = useState(defaultPurpose); const [selectedPatient, setSelectedPatient] = useState< - Pick | null + Pick | null >(null); const [error, setError] = useState(''); @@ -147,6 +148,7 @@ export function AppointmentBookingModal({ id: initialPatient.id, firstName: initialPatient.firstName, lastName: initialPatient.lastName, + identification: initialPatient.identification, mobile: initialPatient.mobile, } : null, @@ -175,6 +177,7 @@ export function AppointmentBookingModal({ id: patient.id, firstName: patient.firstName, lastName: patient.lastName, + identification: patient.identification, mobile: patient.mobile, }; setSelectedPatient(next); diff --git a/frontend/src/components/ui/patient/CreatePatientModal.tsx b/frontend/src/components/ui/patient/CreatePatientModal.tsx index 72a6406..d549584 100644 --- a/frontend/src/components/ui/patient/CreatePatientModal.tsx +++ b/frontend/src/components/ui/patient/CreatePatientModal.tsx @@ -23,7 +23,9 @@ interface CreatePatientModalProps { variant?: 'inline' | 'dialog'; } -type FieldErrors = Partial>; +type FieldErrors = Partial< + Record<'firstName' | 'lastName' | 'identification' | 'mobile' | 'email', string> +>; function CreatePatientFormFields({ formData, @@ -56,6 +58,9 @@ function CreatePatientFormFields({ if (!formData.lastName?.trim()) { nextErrors.lastName = t('lastNameRequired'); } + if (!formData.identification?.trim()) { + nextErrors.identification = t('identificationRequired'); + } if (!formData.mobile?.trim()) { nextErrors.mobile = tValidation('mobileRequired'); } else if (!isValidMobile(normalizeMobile(formData.mobile) ?? '')) { @@ -81,8 +86,9 @@ function CreatePatientFormFields({ () => !formData.firstName?.trim() || !formData.lastName?.trim() || + !formData.identification?.trim() || !isValidMobile(normalizeMobile(formData.mobile || '') ?? ''), - [formData.firstName, formData.lastName, formData.mobile], + [formData.firstName, formData.lastName, formData.identification, formData.mobile], ); const mobileDisplayError = useMemo(() => { @@ -91,7 +97,11 @@ function CreatePatientFormFields({ } const raw = formData.mobile?.trim() ?? ''; if (!raw) { - if (formData.firstName?.trim() && formData.lastName?.trim()) { + if ( + formData.firstName?.trim() && + formData.lastName?.trim() && + formData.identification?.trim() + ) { return tValidation('mobileRequired'); } return undefined; @@ -105,6 +115,7 @@ function CreatePatientFormFields({ formData.mobile, formData.firstName, formData.lastName, + formData.identification, tValidation, ]); @@ -137,6 +148,18 @@ function CreatePatientFormFields({ required error={fieldErrors.lastName} /> + { + onChange({ identification: e.target.value }); + if (fieldErrors.identification) { + setFieldErrors((prev) => ({ ...prev, identification: undefined })); + } + }} + required + error={fieldErrors.identification} + /> {patient.firstName} {patient.lastName} +

+ {t('identificationLabel')} {patient.identification} +

{t('mobileLabel')} {formatMobileForDisplay(patient.mobile)}

diff --git a/frontend/src/components/ui/patient/PatientsPage.tsx b/frontend/src/components/ui/patient/PatientsPage.tsx index 3f1d0b7..6e5abdc 100644 --- a/frontend/src/components/ui/patient/PatientsPage.tsx +++ b/frontend/src/components/ui/patient/PatientsPage.tsx @@ -19,6 +19,7 @@ import { PatientAppointmentHistory } from '@/components/ui/patient/PatientAppoin const EMPTY_PATIENT_FORM: CreatePatientInput = { firstName: '', lastName: '', + identification: '', mobile: '', email: '', }; diff --git a/frontend/src/types/appointment.ts b/frontend/src/types/appointment.ts index 5b5b9f7..a378b1f 100644 --- a/frontend/src/types/appointment.ts +++ b/frontend/src/types/appointment.ts @@ -22,7 +22,7 @@ export interface AppointmentRecord { startAt: string; endAt: string; purpose: string; - patient: Pick; + patient: Pick; /** True when a treatment record is linked to this appointment. */ hasTreatment?: boolean; } diff --git a/frontend/src/types/patient.ts b/frontend/src/types/patient.ts index 1dad2bf..834e453 100644 --- a/frontend/src/types/patient.ts +++ b/frontend/src/types/patient.ts @@ -2,6 +2,7 @@ export interface Patient { id: string; firstName: string; lastName: string; + identification: string; mobile: string; email?: string | null; dateOfBirth?: string | null; @@ -15,6 +16,7 @@ export interface Patient { export interface CreatePatientInput { firstName: string; lastName: string; + identification: string; mobile: string; email?: string; dateOfBirth?: string;