Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature report add patient resource #362

Merged
merged 2 commits into from
Oct 24, 2021
Merged
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 @@ -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