use of org.hl7.fhir.dstu3.model.Account in project BridgeServer2 by Sage-Bionetworks.
the class CRCControllerTest method createPatientWithOtherGender.
@Test
public void createPatientWithOtherGender() {
Account account = Account.create();
account.setAttributes(ImmutableMap.of("gender", "Other"));
Patient patient = controller.createPatient(account);
assertEquals(patient.getGender(), AdministrativeGender.OTHER);
}
use of org.hl7.fhir.dstu3.model.Account in project BridgeServer2 by Sage-Bionetworks.
the class CRCControllerTest method postAppointmentSkipsLocationIfNotPresent.
@Test
public void postAppointmentSkipsLocationIfNotPresent() throws Exception {
when(mockRequest.getHeader(AUTHORIZATION)).thenReturn(AUTHORIZATION_HEADER_VALUE);
when(mockAccountService.authenticate(any(), any())).thenReturn(account);
when(mockAccountService.getAccount(ACCOUNT_ID)).thenReturn(Optional.of(account));
DateRangeResourceList<? extends ReportData> results = new DateRangeResourceList<>(ImmutableList.of());
doReturn(results).when(mockReportService).getParticipantReport(APP_ID, TEST_USER_ID, APPOINTMENT_REPORT, HEALTH_CODE, JAN1, JAN2);
Appointment appointment = new Appointment();
appointment.setStatus(BOOKED);
addAppointmentSageId(appointment, TEST_USER_ID);
String json = FHIR_CONTEXT.newJsonParser().encodeResourceToString(appointment);
mockRequestBody(mockRequest, json);
controller.postAppointment();
verify(controller, never()).post(any(), any(), any());
verify(mockHealthDataService).submitHealthData(any(), any(), any());
}
use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeAccount.
protected void composeAccount(Complex parent, String parentType, String name, Account element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Account", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Account", "identifier", element.getIdentifier().get(i), i);
if (element.hasNameElement())
composeString(t, "Account", "name", element.getNameElement(), -1);
if (element.hasType())
composeCodeableConcept(t, "Account", "type", element.getType(), -1);
if (element.hasStatusElement())
composeEnum(t, "Account", "status", element.getStatusElement(), -1);
if (element.hasActivePeriod())
composePeriod(t, "Account", "activePeriod", element.getActivePeriod(), -1);
if (element.hasCurrency())
composeCoding(t, "Account", "currency", element.getCurrency(), -1);
if (element.hasBalance())
composeQuantity(t, "Account", "balance", element.getBalance(), -1);
if (element.hasCoveragePeriod())
composePeriod(t, "Account", "coveragePeriod", element.getCoveragePeriod(), -1);
if (element.hasSubject())
composeReference(t, "Account", "subject", element.getSubject(), -1);
if (element.hasOwner())
composeReference(t, "Account", "owner", element.getOwner(), -1);
if (element.hasDescriptionElement())
composeString(t, "Account", "description", element.getDescriptionElement(), -1);
}
use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeEpisodeOfCare.
protected void composeEpisodeOfCare(Complex parent, String parentType, String name, EpisodeOfCare element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "EpisodeOfCare", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "EpisodeOfCare", "identifier", element.getIdentifier().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "EpisodeOfCare", "status", element.getStatusElement(), -1);
for (int i = 0; i < element.getStatusHistory().size(); i++) composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(t, "EpisodeOfCare", "statusHistory", element.getStatusHistory().get(i), i);
for (int i = 0; i < element.getType().size(); i++) composeCodeableConcept(t, "EpisodeOfCare", "type", element.getType().get(i), i);
for (int i = 0; i < element.getDiagnosis().size(); i++) composeEpisodeOfCareDiagnosisComponent(t, "EpisodeOfCare", "diagnosis", element.getDiagnosis().get(i), i);
if (element.hasPatient())
composeReference(t, "EpisodeOfCare", "patient", element.getPatient(), -1);
if (element.hasManagingOrganization())
composeReference(t, "EpisodeOfCare", "managingOrganization", element.getManagingOrganization(), -1);
if (element.hasPeriod())
composePeriod(t, "EpisodeOfCare", "period", element.getPeriod(), -1);
for (int i = 0; i < element.getReferralRequest().size(); i++) composeReference(t, "EpisodeOfCare", "referralRequest", element.getReferralRequest().get(i), i);
if (element.hasCareManager())
composeReference(t, "EpisodeOfCare", "careManager", element.getCareManager(), -1);
for (int i = 0; i < element.getTeam().size(); i++) composeReference(t, "EpisodeOfCare", "team", element.getTeam().get(i), i);
for (int i = 0; i < element.getAccount().size(); i++) composeReference(t, "EpisodeOfCare", "account", element.getAccount().get(i), i);
}
use of org.hl7.fhir.dstu3.model.Account in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeAccount.
protected void composeAccount(Complex parent, String parentType, String name, Account element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Account", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Account", "identifier", element.getIdentifier().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "Account", "status", element.getStatusElement(), -1);
if (element.hasType())
composeCodeableConcept(t, "Account", "type", element.getType(), -1);
if (element.hasNameElement())
composeString(t, "Account", "name", element.getNameElement(), -1);
if (element.hasSubject())
composeReference(t, "Account", "subject", element.getSubject(), -1);
if (element.hasPeriod())
composePeriod(t, "Account", "period", element.getPeriod(), -1);
if (element.hasActive())
composePeriod(t, "Account", "active", element.getActive(), -1);
if (element.hasBalance())
composeMoney(t, "Account", "balance", element.getBalance(), -1);
for (int i = 0; i < element.getCoverage().size(); i++) composeAccountCoverageComponent(t, "Account", "coverage", element.getCoverage().get(i), i);
if (element.hasOwner())
composeReference(t, "Account", "owner", element.getOwner(), -1);
if (element.hasDescriptionElement())
composeString(t, "Account", "description", element.getDescriptionElement(), -1);
for (int i = 0; i < element.getGuarantor().size(); i++) composeAccountGuarantorComponent(t, "Account", "guarantor", element.getGuarantor().get(i), i);
}
Aggregations