use of org.karnak.backend.cache.CachedPatient in project karnak by OsiriX-Foundation.
the class CSVDialog method readCSVPatients.
private void readCSVPatients() {
try {
// Read CSV line by line and use the string array as you want
for (String[] row : allRows.subList(fromLineField.getValue().intValue() - 1, allRows.size())) {
String issuerOfPatientID = selectValuesPositionHashMap.get(ISSUER_OF_PATIENT_ID).equals(-1) ? "" : row[selectValuesPositionHashMap.get(ISSUER_OF_PATIENT_ID)];
final CachedPatient newPatient = new CachedPatient(row[selectValuesPositionHashMap.get(EXTERNAL_PSEUDONYM)], row[selectValuesPositionHashMap.get(PATIENT_ID)], row[selectValuesPositionHashMap.get(PATIENT_FIRST_NAME)], row[selectValuesPositionHashMap.get(PATIENT_LAST_NAME)], issuerOfPatientID, projectEntity.getId());
patientsList.add(newPatient);
}
} catch (Exception e) {
LOGGER.error("Error when reading selected columns", e);
}
}
use of org.karnak.backend.cache.CachedPatient in project karnak by OsiriX-Foundation.
the class ExternalIDForm method getNewPatient.
public CachedPatient getNewPatient() {
CachedPatient newPatient = new CachedPatient(externalIdField.getValue(), patientIdField.getValue(), patientFirstNameField.getValue(), patientLastNameField.getValue(), issuerOfPatientIdField.getValue(), projectEntity.getId());
binder.validate();
if (binder.isValid()) {
binder.readBean(null);
return newPatient;
}
return null;
}
use of org.karnak.backend.cache.CachedPatient in project karnak by OsiriX-Foundation.
the class ExternalIDGrid method readAllCacheValue.
public void readAllCacheValue() {
if (externalIDCache != null) {
Collection<PseudonymPatient> pseudonymPatients = externalIDCache.getAll();
patientsListInCache = new ArrayList<>();
for (Iterator<PseudonymPatient> iterator = pseudonymPatients.iterator(); iterator.hasNext(); ) {
final CachedPatient patient = (CachedPatient) iterator.next();
if (projectEntity != null && patient.getProjectID() != null && patient.getProjectID().equals(projectEntity.getId())) {
patientsListInCache.add(patient);
}
}
setItems(patientsListInCache);
}
refreshPaginator();
}
use of org.karnak.backend.cache.CachedPatient in project karnak by OsiriX-Foundation.
the class ExternalIDGridTest method should_add_patient_and_check_existence.
@Test
void should_add_patient_and_check_existence() {
// Call constructor
ExternalIDGrid externalIDGrid = new ExternalIDGrid();
// Add patient
CachedPatient patient = new CachedPatient("pseudonym", "patientId", "patientFirstName", "patientLastName", "issuerOfPatientId", 1L);
patient.setProjectID(1L);
// set project
ProjectEntity projectEntity = new ProjectEntity();
projectEntity.setId(1L);
externalIDGrid.setProjectEntity(projectEntity);
// Test no patient in cache
assertFalse(externalIDGrid.patientExist(patient));
// Add patient
externalIDGrid.addPatient(patient);
// Test patient in cache
assertTrue(externalIDGrid.patientExist(patient));
}
use of org.karnak.backend.cache.CachedPatient in project karnak by OsiriX-Foundation.
the class MappingResultComponentTest method should_handle_result_patient_found.
@Test
void should_handle_result_patient_found() {
// Init data
Patient patient = new CachedPatient("pseudonym", "patientId", "patientFirstName", "patientLastName", "issuerOfPatientId", 1L);
// Call method
MappingResultComponent mappingResultComponent = new MappingResultComponent();
mappingResultComponent.handleResultFindPatient(patient, "PSEUDO", "Cache");
// Test results
assertEquals("Cache", mappingResultComponent.getPatientFoundDetails().getSummaryText());
assertNotNull(mappingResultComponent.getPatientFoundDetails().getContent());
}
Aggregations