use of org.ehrbase.fhirbridge.core.domain.PatientEhr in project fhir-bridge by ehrbase.
the class EhrStatusService method updateEhrStatus.
@Async
public void updateEhrStatus() throws InterruptedException {
log.info("--- Start Update Process ---");
Pageable pageable = PageRequest.of(0, 100);
Page<PatientEhr> result = null;
int count = 0;
while (result == null || result.hasNext()) {
result = patientEhrRepository.findAll(pageable);
pageable = result.getPageable().next();
for (var patientEhr : result) {
handlePatient(patientEhr);
log.info("Processing: {}/{}", ++count, result.getTotalElements());
}
}
log.info("--- Update Process Completed ---");
}
use of org.ehrbase.fhirbridge.core.domain.PatientEhr in project fhir-bridge by ehrbase.
the class EhrLookupProcessor method createEhr.
/**
* Creates an EHR for the given patient ID.
*
* @param patientId the given patient ID
* @return the EHR ID
*/
private UUID createEhr(IIdType patientId) {
Patient patient = patientDao.read(patientId);
Identifier pseudonym = PatientUtils.getPseudonym(patient);
PartySelf subject = new PartySelf(new PartyRef(new HierObjectId(pseudonym.getValue()), "DEMOGRAPHIC", "PERSON"));
EhrStatus ehrStatus = new EhrStatus(ARCHETYPE_NODE_ID, new DvText("EHR Status"), subject, true, true, null);
UUID ehrId = openEhrClient.ehrEndpoint().createEhr(ehrStatus);
PatientEhr patientEhr = new PatientEhr(patientId.getIdPart(), ehrId);
patientEhrRepository.save(patientEhr);
LOG.debug("Created PatientEhr: patientId={}, ehrId={}", patientEhr.getPatientId(), patientEhr.getEhrId());
return ehrId;
}
Aggregations