Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ public String getExportCcdEndpoint() {
return getProperty(XDSSENDER_EXPORT_CCD_ENDPOINT);
}

// Base URL of the consolidated IPS mediator (e.g. https://<openhim>/SHR/ips). Used to pull a
// patient's cross-facility summary by CRUID for continuity of care.
// Opt-in: empty by default so existing deployments keep the legacy CCD retrieval. Set this to
// the SHR IPS mediator base (e.g. https://<openhim>/SHR/ips) to enable IPS-based retrieval.
public String getIpsEndpoint() {
return getProperty(XDSSENDER_IPS_ENDPOINT);
return getProperty(XDSSENDER_IPS_ENDPOINT, "");
}

public String getLocalPatientIdRoot() { return getProperty("mpi-client.pid.local"); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public interface CcdService {
@Transactional
Ccd downloadAndSaveCcd(Patient patient) throws XDSException;

@Transactional
Ccd downloadAndSaveIps(Patient patient);

@Transactional(readOnly = true)
void downloadCcdAsPDF(OutputStream stream, Patient patient);
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,6 @@ public Ccd downloadAndSaveCcd(Patient patient) throws XDSException {
return ccd;
}

@Override
public Ccd downloadAndSaveIps(Patient patient) {
Ccd ccd;

shrImportService.setFhirContext(fhirContext);
ccd = shrImportService.retrieveIps(patient);

if (ccd != null) {
ccd = ccdDao.saveOrUpdate(ccd);
}

return ccd;
}

@Override
public void downloadCcdAsPDF(OutputStream stream, Patient patient) {
LOGGER.info("CCD PDF is being downloaded.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,41 +42,28 @@ public void setFhirContext(FhirContext fhirContext) {
@Override
public Ccd retrieveCCD(Patient patient) {
Ccd ccd = null;
Bundle result;
Bundle result = null;
try {
shrRetriever.setFhirContext(this.getFhirContext());
result = shrRetriever.sendRetrieveCCD(patient);
// Prefer the consolidated IPS (server-side aggregation via the SHR IPS mediator) when an
// IPS endpoint is configured; otherwise, or if it yields nothing, fall back to the legacy
// client-side CCD aggregation so existing deployments keep working unchanged.
String ipsEndpoint = config.getIpsEndpoint();
if (ipsEndpoint != null && !ipsEndpoint.isEmpty()) {
result = shrRetriever.fetchIps(patient);
}
if (result == null || !result.hasEntry() || result.getEntry().isEmpty()) {
result = shrRetriever.sendRetrieveCCD(patient);
}
} catch (Exception e) {
LOGGER.error("Unable to load CCD content", e);
LOGGER.error("Unable to load CCD/IPS content", e);
return null;
}

if(result != null && result.hasTotal() && result.getTotal() > 0) {
ccd = new Ccd();
ccd.setPatient(patient);
ccd.setDocument(fhirContext.newJsonParser().encodeResourceToString(result));
}

return ccd;
}

/**
* Retrieve the consolidated IPS document for a patient from the SHR IPS mediator and wrap it as
* a Ccd (raw FHIR JSON), mirroring {@link #retrieveCCD(Patient)}. IPS document bundles carry no
* total, so presence is judged by entries.
*/
public Ccd retrieveIps(Patient patient) {
Ccd ccd = null;
Bundle result;
try {
shrRetriever.setFhirContext(this.getFhirContext());
result = shrRetriever.fetchIps(patient);
} catch (Exception e) {
LOGGER.error("Unable to load IPS content", e);
return null;
}

if (result != null && result.hasEntry() && !result.getEntry().isEmpty()) {
// Legacy CCD search bundles carry a total; IPS document bundles do not, so accept either.
boolean hasData = result != null && ((result.hasTotal() && result.getTotal() > 0)
|| (result.hasEntry() && !result.getEntry().isEmpty()));
if (hasData) {
ccd = new Ccd();
ccd.setPatient(patient);
ccd.setDocument(fhirContext.newJsonParser().encodeResourceToString(result));
Expand Down

This file was deleted.

3 changes: 1 addition & 2 deletions omod/src/main/resources/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@

<globalProperty>
<property>xdssender.ipsEndpoint</property>
<defaultValue>https://openhimcore.sedishtest.live/SHR/ips</defaultValue>
<description>Base URL of the consolidated IPS mediator used to pull a patient's cross-facility summary by CRUID (continuity of care)</description>
<description>Base URL of the consolidated IPS mediator (e.g. https://&lt;openhim&gt;/SHR/ips). When set, patient retrieval (downloadAndSaveCcd) pulls the consolidated IPS by CRUID for continuity of care; when blank, the legacy client-side CCD aggregation is used.</description>
</globalProperty>

<globalProperty>
Expand Down