use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project nia-patient-switching-standard-adaptor by NHSDigital.
the class AgentDirectoryMapperTest method mapAgentDirectoryOnlyAgentOrganizationWithValidIdentifier.
@Test
public void mapAgentDirectoryOnlyAgentOrganizationWithValidIdentifier() {
var agentDirectory = unmarshallAgentDirectoryElement("agent_org_valid_identifier_example.xml");
List mappedAgents = agentDirectoryMapper.mapAgentDirectory(agentDirectory);
assertThat(mappedAgents.size()).isEqualTo(1);
var organization = (Organization) mappedAgents.get(0);
assertThat(organization.getId()).isEqualTo("1D9BDC28-50AB-440D-B421-0E5E049526FA");
assertThat(organization.getMeta().getProfile().get(0).getValue()).isEqualTo(ORG_META_PROFILE);
assertThat(organization.getName()).isEqualTo("The Health Centre");
assertThat(organization.getIdentifierFirstRep().getSystem()).isEqualTo(ORG_IDENTIFIER_SYSTEM);
assertThat(organization.getIdentifierFirstRep().getValue()).isEqualTo("A81001");
assertThat(organization.getTelecom().size()).isEqualTo(0);
assertThat(organization.getAddress().size()).isEqualTo(0);
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project nia-patient-switching-standard-adaptor by NHSDigital.
the class AgentDirectoryMapperTest method mapAgentDirectoryOnlyAgentOrganizationNoOptionalFields.
@Test
public void mapAgentDirectoryOnlyAgentOrganizationNoOptionalFields() {
var agentDirectory = unmarshallAgentDirectoryElement("agent_org_only_example.xml");
List mappedAgents = agentDirectoryMapper.mapAgentDirectory(agentDirectory);
assertThat(mappedAgents.size()).isEqualTo(1);
var organization = (Organization) mappedAgents.get(0);
assertThat(organization.getId()).isEqualTo("1D9BDC28-50AB-440D-B421-0E5E049526FA");
assertThat(organization.getMeta().getProfile().get(0).getValue()).isEqualTo(ORG_META_PROFILE);
assertThat(organization.getName()).isEqualTo("The Health Centre");
assertThat(organization.getIdentifier().size()).isEqualTo(0);
assertThat(organization.getTelecom().size()).isEqualTo(0);
assertThat(organization.getAddress().size()).isEqualTo(0);
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project nia-patient-switching-standard-adaptor by NHSDigital.
the class AgentDirectoryMapperTest method mapAgentDirectoryOnlyAgentOrganizationWithWPAddress.
@Test
public void mapAgentDirectoryOnlyAgentOrganizationWithWPAddress() {
var agentDirectory = unmarshallAgentDirectoryElement("agent_org_wp_address_example.xml");
List mappedAgents = agentDirectoryMapper.mapAgentDirectory(agentDirectory);
assertThat(mappedAgents.size()).isEqualTo(1);
var organization = (Organization) mappedAgents.get(0);
assertThat(organization.getId()).isEqualTo("1D9BDC28-50AB-440D-B421-0E5E049526FA");
assertThat(organization.getMeta().getProfile().get(0).getValue()).isEqualTo(ORG_META_PROFILE);
assertThat(organization.getName()).isEqualTo("The Health Centre");
assertThat(organization.getIdentifier().size()).isEqualTo(0);
assertThat(organization.getTelecom().size()).isEqualTo(0);
assertAddress(organization.getAddressFirstRep());
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project gpconnect-demonstrator by nhsconnect.
the class OrganizationResourceProvider method getOrganizationsByODSCode.
@Search
public List<Organization> getOrganizationsByODSCode(@RequiredParam(name = Organization.SP_IDENTIFIER) TokenParam tokenParam, @Sort SortSpec sort, @Count Integer count) {
if (StringUtils.isBlank(tokenParam.getSystem()) || StringUtils.isBlank(tokenParam.getValue())) {
throw OperationOutcomeFactory.buildOperationOutcomeException(new InvalidRequestException("Missing identifier token"), SystemCode.INVALID_PARAMETER, IssueType.INVALID);
}
if (tokenParam.getSystem().equals(SystemURL.ID_ODS_ORGANIZATION_CODE) || tokenParam.getSystem().equals(SystemURL.ID_ODS_OLD_ORGANIZATION_CODE)) {
List<Organization> organizationDetails = convertOrganizaitonDetailsListToOrganizationList(organizationSearch.findOrganizationDetailsByOrgODSCode(tokenParam.getValue()));
if (organizationDetails.isEmpty()) {
return null;
}
if (sort != null && sort.getParamName().equalsIgnoreCase(Location.SP_STATUS)) {
Collections.sort(organizationDetails, (Organization a, Organization b) -> {
String aStatus = a.getName();
String bStatus = b.getName();
if (aStatus == null && bStatus == null) {
return 0;
}
if (aStatus == null && bStatus != null) {
return -1;
}
if (aStatus != null && bStatus == null) {
return 1;
}
return aStatus.compareToIgnoreCase(bStatus);
});
}
// Update startIndex if we do paging
return count != null ? organizationDetails.subList(0, count) : organizationDetails;
} else {
throw OperationOutcomeFactory.buildOperationOutcomeException(new InvalidRequestException("Invalid system code"), SystemCode.INVALID_PARAMETER, IssueType.INVALID);
}
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ORGANIZATION in project gpconnect-demonstrator by nhsconnect.
the class PatientResourceProvider method setStaticPatientData.
private Patient setStaticPatientData(Patient patient) {
patient.setLanguage(("en-GB"));
patient.addExtension(createCodingExtension("CG", "Greek Cypriot", SystemURL.CS_CC_ETHNIC_CATEGORY, SystemURL.SD_CC_EXT_ETHNIC_CATEGORY));
patient.addExtension(createCodingExtension("SomeSnomedCode", "Some Snomed Code", SystemURL.CS_CC_RELIGIOUS_AFFILI, SystemURL.SD_CC_EXT_RELIGIOUS_AFFILI));
patient.addExtension(new Extension(SystemURL.SD_PATIENT_CADAVERIC_DON, new BooleanType(false)));
patient.addExtension(createCodingExtension("H", "UK Resident", SystemURL.CS_CC_RESIDENTIAL_STATUS, SystemURL.SD_CC_EXT_RESIDENTIAL_STATUS));
patient.addExtension(createCodingExtension("3", "To pay hotel fees only", SystemURL.CS_CC_TREATMENT_CAT, SystemURL.SD_CC_EXT_TREATMENT_CAT));
Extension nhsCommExtension = new Extension();
nhsCommExtension.setUrl(SystemURL.SD_CC_EXT_NHS_COMMUNICATION);
nhsCommExtension.addExtension(createCodingExtension("en", "English", SystemURL.CS_CC_HUMAN_LANG, SystemURL.SD_CC_EXT_COMM_LANGUAGE));
nhsCommExtension.addExtension(new Extension(SystemURL.SD_CC_COMM_PREFERRED, new BooleanType(false)));
nhsCommExtension.addExtension(createCodingExtension("RWR", "Received written", SystemURL.CS_CC_LANG_ABILITY_MODE, SystemURL.SD_CC_MODE_OF_COMM));
nhsCommExtension.addExtension(createCodingExtension("E", "Excellent", SystemURL.CS_CC_LANG_ABILITY_PROFI, SystemURL.SD_CC_COMM_PROFICIENCY));
nhsCommExtension.addExtension(new Extension(SystemURL.SD_CC_INTERPRETER_REQUIRED, new BooleanType(false)));
patient.addExtension(nhsCommExtension);
Identifier localIdentifier = new Identifier();
localIdentifier.setUse(IdentifierUse.USUAL);
localIdentifier.setSystem(SystemURL.ID_LOCAL_PATIENT_IDENTIFIER);
localIdentifier.setValue("123456");
CodeableConcept liType = new CodeableConcept();
Coding liTypeCoding = new Coding();
liTypeCoding.setCode("EN");
liTypeCoding.setDisplay("Employer number");
liTypeCoding.setSystem(SystemURL.VS_IDENTIFIER_TYPE);
liType.addCoding(liTypeCoding);
localIdentifier.setType(liType);
localIdentifier.setAssigner(new Reference("Organization/1"));
patient.addIdentifier(localIdentifier);
Calendar calendar = Calendar.getInstance();
calendar.set(2017, 1, 1);
DateTimeDt endDate = new DateTimeDt(calendar.getTime());
calendar.set(2016, 1, 1);
DateTimeDt startDate = new DateTimeDt(calendar.getTime());
Period pastPeriod = new Period().setStart(calendar.getTime()).setEnd(calendar.getTime());
patient.addName().setFamily("AnotherOfficialFamilyName").addGiven("AnotherOfficialGivenName").setUse(NameUse.OFFICIAL).setPeriod(pastPeriod);
patient.addName().setFamily("AdditionalFamily").addGiven("AdditionalGiven").setUse(NameUse.TEMP);
patient.addTelecom(staticElHelper.getValidTelecom());
patient.addAddress(staticElHelper.getValidAddress());
return patient;
}
Aggregations