From e53cd07766366a09d0488923c1211a7b8485df58 Mon Sep 17 00:00:00 2001 From: Stanslaus Date: Sun, 18 Jul 2021 17:17:46 +0300 Subject: [PATCH 1/2] assign isanteplus id to be the local fp id within the local fp server --- .../api/impl/RegistrationCoreServiceImpl.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/org/openmrs/module/registrationcore/api/impl/RegistrationCoreServiceImpl.java b/api/src/main/java/org/openmrs/module/registrationcore/api/impl/RegistrationCoreServiceImpl.java index 53a1c39..a5bf64e 100644 --- a/api/src/main/java/org/openmrs/module/registrationcore/api/impl/RegistrationCoreServiceImpl.java +++ b/api/src/main/java/org/openmrs/module/registrationcore/api/impl/RegistrationCoreServiceImpl.java @@ -553,7 +553,7 @@ public BiometricEngine getBiometricEngine() { @Override public BiometricData saveBiometricsForPatient(Patient patient, BiometricData biometricData) { -// Only dealing with the subject IDs..no need to poll the engines +// Only dealing with the subject IDs...Need to update the local FP id thought to match patient ID BiometricSubject subject = biometricData.getSubject(); if (subject == null) { log.debug("There are no biometrics to save for patient"); @@ -570,6 +570,15 @@ public BiometricData saveBiometricsForPatient(Patient patient, BiometricData bio if (identifierExists) { log.debug("Identifier already exists for patient"); } else { + + // Patient ID already formed at this stage, match the local fingerprint ID + if(idType.getUuid().equals(RegistrationCoreConstants.GP_BIOMETRICS_PERSON_IDENTIFIER_TYPE_UUID)){ + try{ + subject = getBiometricEngine().updateSubjectId(biometricData.getSubject().getSubjectId(), patient.getPatientIdentifier().getIdentifier()); + }catch(Exception e){ + log.error("Identifier update error....will proceed with the UUID"); + } + } log.info("Saving new patient Identifier.....: "); PatientIdentifier identifier = identifierBuilder.createIdentifier(idType.getUuid(), subject.getSubjectId(), null); From 5be77de0949126b7fe9092464c64baf919f42cb0 Mon Sep 17 00:00:00 2001 From: Stanslaus Date: Tue, 17 Aug 2021 22:28:46 +0300 Subject: [PATCH 2/2] Add extra enrollement status to the enum --- .../api/biometrics/model/EnrollmentStatus.java | 2 ++ .../api/impl/RegistrationCoreServiceImpl.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/org/openmrs/module/registrationcore/api/biometrics/model/EnrollmentStatus.java b/api/src/main/java/org/openmrs/module/registrationcore/api/biometrics/model/EnrollmentStatus.java index ae32fe6..847bc1e 100644 --- a/api/src/main/java/org/openmrs/module/registrationcore/api/biometrics/model/EnrollmentStatus.java +++ b/api/src/main/java/org/openmrs/module/registrationcore/api/biometrics/model/EnrollmentStatus.java @@ -3,4 +3,6 @@ public enum EnrollmentStatus { SUCCESS, ALREADY_REGISTERED, + NOT_REGISTERED, + ERROR, } diff --git a/api/src/main/java/org/openmrs/module/registrationcore/api/impl/RegistrationCoreServiceImpl.java b/api/src/main/java/org/openmrs/module/registrationcore/api/impl/RegistrationCoreServiceImpl.java index a5bf64e..2af1e8e 100644 --- a/api/src/main/java/org/openmrs/module/registrationcore/api/impl/RegistrationCoreServiceImpl.java +++ b/api/src/main/java/org/openmrs/module/registrationcore/api/impl/RegistrationCoreServiceImpl.java @@ -579,13 +579,13 @@ public BiometricData saveBiometricsForPatient(Patient patient, BiometricData bio log.error("Identifier update error....will proceed with the UUID"); } } - + log.info("Saving new patient Identifier.....: "); PatientIdentifier identifier = identifierBuilder.createIdentifier(idType.getUuid(), subject.getSubjectId(), null); log.info("New patient identifier saved for patient...: " + identifier); patient.addIdentifier(identifier); patientService.savePatientIdentifier(identifier); - log.debug("New patient identifier saved for patient: " + identifier); + log.debug("New patient identifier saved for patient: " + identifier); } } else { // TODO: In the future we could add additional support for different storage options - eg. as person attributes