diff --git a/packages/esm-form-entry-app/src/app/form-data-source/form-data-source.service.ts b/packages/esm-form-entry-app/src/app/form-data-source/form-data-source.service.ts index db168f8ee6..defff67c5e 100644 --- a/packages/esm-form-entry-app/src/app/form-data-source/form-data-source.service.ts +++ b/packages/esm-form-entry-app/src/app/form-data-source/form-data-source.service.ts @@ -341,17 +341,15 @@ export class FormDataSourceService { } } public getPatientObject(patient): PatientModel { - let model: PatientModel = { - sex: this.getGender(patient?.gender), - birthdate: new Date(patient?.birthDate), - age: this.calculateAge(patient?.birthDate), - identifiers: [], - gendercreatconstant: patient?.gender === 'female' ? 0.85 : patient?.gender === 'male' ? 1 : undefined, + return { + ...patient, + patientUuid: patient.id, + sex: this.getGender(patient.gender), + birthdate: patient.birthDate ? new Date(patient.birthDate) : undefined, + age: this.calculateAge(patient.birthDate), + gendercreatconstant: patient.gender === 'female' ? 0.85 : patient.gender === 'male' ? 1 : undefined, + identifiers: this.mapFHIRPatientIdentifiersToOpenMRSIdentifiers(patient), }; - - model.identifiers = this.mapFHIRPatientIdentifiersToOpenMRSIdentifiers(patient); - - return model; } private calculateAge(birthday) { diff --git a/packages/esm-form-entry-app/src/app/types/index.ts b/packages/esm-form-entry-app/src/app/types/index.ts index b0685a3fe2..3ce24440b0 100644 --- a/packages/esm-form-entry-app/src/app/types/index.ts +++ b/packages/esm-form-entry-app/src/app/types/index.ts @@ -454,6 +454,8 @@ export interface PatientModel { age: number; gendercreatconstant?: number; identifiers: Array; + patientUuid: string; + [key: string]: any; } export interface IdentifierPayload {