Skip to content

Commit

Permalink
Merge pull request #362 from DBCG/feature-report-add-patient-resource
Browse files Browse the repository at this point in the history
Feature report add patient resource
  • Loading branch information
Rob Reynolds authored Oct 24, 2021
2 parents b6381db + ce1515f commit 016d9da
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -737,12 +737,25 @@ public Parameters report(@OperationParam(name = "periodStart", min = 1, max = 1)
return returnParams;
}

private Patient ensurePatient(String patient) {
String patientId = patient.replace("Patient/", "");
IFhirResourceDao<Patient> patientDao = this.registry.getResourceDao(Patient.class);
Patient patientResource = patientDao.read(new IdType(patientId));
if (patientResource == null) {
throw new RuntimeException("Could not find Patient: " + patientId);
}
return patientResource;
}

private Parameters.ParametersParameterComponent patientReport(Date periodStart, Date periodEnd, String subject) {
final Map<IIdType, IAnyResource> patientResources = new HashMap<>();
Patient patient = ensurePatient(subject);
patientResources.put(patient.getIdElement(), patient);

SearchParameterMap theParams = SearchParameterMap.newSynchronous();
ReferenceParam subjectParam = new ReferenceParam(subject);
theParams.add("subject", subjectParam);
final Map<IIdType, IAnyResource> patientResources = new HashMap<>();


Bundle patientReportBundle = new Bundle();
patientReportBundle.setType(Bundle.BundleType.COLLECTION);
patientReportBundle.setTimestamp(new Date());
Expand Down

0 comments on commit 016d9da

Please sign in to comment.