diff --git a/pkg/clinical/usecases/clinical/patient.go b/pkg/clinical/usecases/clinical/patient.go index de01d9cc..06f0e4a6 100644 --- a/pkg/clinical/usecases/clinical/patient.go +++ b/pkg/clinical/usecases/clinical/patient.go @@ -375,16 +375,6 @@ func (c *UseCasesClinicalImpl) CreatePatient(ctx context.Context, input dto.Pati IdentificationDocuments: documents, } - exists, err := c.CheckPatientExistenceUsingPhoneNumber(ctx, registrationInput) - if err != nil { - utils.ReportErrorToSentry(err) - return nil, fmt.Errorf("unable to check patient existence: %w", err) - } - - if exists { - return nil, fmt.Errorf("patient with phone number already exists") - } - patientInput, err := c.SimplePatientRegistrationInputToPatientInput(ctx, registrationInput) if err != nil { return nil, err diff --git a/pkg/clinical/usecases/clinical/patient_unit_test.go b/pkg/clinical/usecases/clinical/patient_unit_test.go index 658384ad..3e151fe5 100644 --- a/pkg/clinical/usecases/clinical/patient_unit_test.go +++ b/pkg/clinical/usecases/clinical/patient_unit_test.go @@ -1548,64 +1548,6 @@ func TestUseCasesClinicalImpl_CreatePatient(t *testing.T) { }, wantErr: false, }, - { - name: "sad case: patient already exists", - args: args{ - ctx: addTenantIdentifierContext(context.Background()), - input: dto.PatientInput{ - FirstName: gofakeit.Name(), - LastName: gofakeit.Name(), - BirthDate: scalarutils.Date{ - Year: 1997, - Month: 12, - Day: 12, - }, - Gender: dto.GenderFemale, - Identifiers: []dto.IdentifierInput{ - { - Type: dto.IdentifierTypeNationalID, - Value: "12345678", - }, - }, - Contacts: []dto.ContactInput{ - { - Type: dto.ContactTypePhoneNumber, - Value: "0700000000", - }, - }, - }, - }, - wantErr: true, - }, - { - name: "sad case: error searching for patient", - args: args{ - ctx: addTenantIdentifierContext(context.Background()), - input: dto.PatientInput{ - FirstName: gofakeit.Name(), - LastName: gofakeit.Name(), - BirthDate: scalarutils.Date{ - Year: 1997, - Month: 12, - Day: 12, - }, - Gender: dto.GenderFemale, - Identifiers: []dto.IdentifierInput{ - { - Type: dto.IdentifierTypeNationalID, - Value: "12345678", - }, - }, - Contacts: []dto.ContactInput{ - { - Type: dto.ContactTypePhoneNumber, - Value: "0700000000", - }, - }, - }, - }, - wantErr: true, - }, { name: "sad case: invalid phone number", args: args{ @@ -1764,24 +1706,6 @@ func TestUseCasesClinicalImpl_CreatePatient(t *testing.T) { infra := infrastructure.NewInfrastructureInteractor(fakeExt, fakeFHIR, fakeOCL, fakeUpload, fakePubSub) c := clinicalUsecase.NewUseCasesClinicalImpl(infra) - if tt.name == "sad case: patient already exists" { - fakeFHIR.MockSearchFHIRPatientFn = func(ctx context.Context, searchParams string, tenant dto.TenantIdentifiers, pagination dto.Pagination) (*domain.PatientConnection, error) { - return &domain.PatientConnection{ - Edges: []*domain.PatientEdge{ - { - Node: &domain.FHIRPatient{}, - }, - }, - }, nil - } - } - - if tt.name == "sad case: error searching for patient" { - fakeFHIR.MockSearchFHIRPatientFn = func(ctx context.Context, searchParams string, tenant dto.TenantIdentifiers, pagination dto.Pagination) (*domain.PatientConnection, error) { - return nil, fmt.Errorf("failed to search for patient") - } - } - if tt.name == "sad case: fail to get tenant tags" { fakeExt.MockGetTenantIdentifiersFn = func(ctx context.Context) (*dto.TenantIdentifiers, error) { return nil, fmt.Errorf("failed to get tenant identifiers")