use of org.hl7.fhir.dstu3.model.Organization in project gpconnect-demonstrator by nhsconnect.
the class MedicationRequestResourceProvider method getDispenseRequestComponent.
private MedicationRequestDispenseRequestComponent getDispenseRequestComponent(MedicationRequestDetail requestDetail) {
MedicationRequestDispenseRequestComponent dispenseRequest = new MedicationRequestDispenseRequestComponent();
Period period = new Period().setStart(requestDetail.getDispenseRequestStartDate());
if (requestDetail.getDispenseRequestEndDate() != null) {
period.setEnd(requestDetail.getDispenseRequestEndDate());
}
dispenseRequest.setValidityPeriod(period);
setDispenseQuantity(dispenseRequest, requestDetail);
Duration duration = new Duration();
duration.setSystem(SystemURL.CS_UNITS_OF_MEASURE);
duration.setCode("d");
duration.setValue(requestDetail.getExpectedSupplyDuration());
duration.setUnit("day");
// TODO - spec needs to clarify whether this should be populated or not
dispenseRequest.setExpectedSupplyDuration(duration);
dispenseRequest.setPerformer(new Reference(new IdType("Organization", requestDetail.getDispenseRequestOrganizationId())));
return dispenseRequest;
}
use of org.hl7.fhir.dstu3.model.Organization in project gpconnect-demonstrator by nhsconnect.
the class MedicationRequestResourceProvider method getRequesterComponent.
// TODO - spec needs to clarify whether this should be populated or not
private MedicationRequestRequesterComponent getRequesterComponent(MedicationRequestDetail requestDetail) {
MedicationRequestRequesterComponent requesterComponent = new MedicationRequestRequesterComponent();
switch(requestDetail.getRequesterUrl()) {
case (SystemURL.SD_GPC_PATIENT):
requesterComponent.setAgent(new Reference(new IdType("Patient", requestDetail.getRequesterId())));
break;
case (SystemURL.SD_GPC_PRACTITIONER):
requesterComponent.setAgent(new Reference(new IdType("Practitioner", requestDetail.getRequesterId())));
break;
case (SystemURL.SD_GPC_ORGANIZATION):
requesterComponent.setAgent(new Reference(new IdType("Organization", requestDetail.getRequesterId())));
break;
default:
break;
}
requesterComponent.setOnBehalfOf(new Reference(new IdType("Organization", requestDetail.getDispenseRequestOrganizationId())));
return requesterComponent;
}
use of org.hl7.fhir.dstu3.model.Organization in project gpconnect-demonstrator by nhsconnect.
the class OrganizationResourceProvider method convertOrganizationDetailsToOrganization.
public Organization convertOrganizationDetailsToOrganization(OrganizationDetails organizationDetails) {
String mapKey = String.format("%s", organizationDetails.getOrgCode());
Identifier identifier = new Identifier().setSystem(SystemURL.ID_ODS_ORGANIZATION_CODE).setValue(organizationDetails.getOrgCode());
Organization organization = new Organization().setName(organizationDetails.getOrgName()).addIdentifier(identifier);
String resourceId = String.valueOf(organizationDetails.getId());
String versionId = String.valueOf(organizationDetails.getLastUpdated().getTime());
String resourceType = organization.getResourceType().toString();
IdType id = new IdType(resourceType, resourceId, versionId);
organization.setId(id);
organization.getMeta().setVersionId(versionId);
organization.getMeta().setLastUpdated(organizationDetails.getLastUpdated());
organization.getMeta().addProfile(SystemURL.SD_GPC_ORGANIZATION);
organization = addAdditionalProperties(organization);
return organization;
}
use of org.hl7.fhir.dstu3.model.Organization in project gpconnect-demonstrator by nhsconnect.
the class OrganizationResourceProvider method addAdditionalProperties.
// Adding in additional properties manually for now so we can test in the
// Test Suite
private Organization addAdditionalProperties(Organization organization) {
Coding orgTypeCode = new Coding();
orgTypeCode.setCode("dept");
orgTypeCode.setDisplay("Hospital Department");
orgTypeCode.setSystem(SystemURL.VS_CC_ORGANISATION_TYPE);
organization.addTelecom(getValidTelecom());
organization.addAddress(getValidAddress());
// organization.addContact(getValidContact());
CodeableConcept orgType = new CodeableConcept();
orgType.addCoding(orgTypeCode);
organization.addType(orgType);
organization.addExtension().setUrl(SystemURL.SD_EXTENSION_CC_MAIN_LOCATION);
return organization;
}
use of org.hl7.fhir.dstu3.model.Organization in project gpconnect-demonstrator by nhsconnect.
the class OrganizationResourceProvider method convertOrganizaitonDetailsListToOrganizationList.
private List<Organization> convertOrganizaitonDetailsListToOrganizationList(List<OrganizationDetails> organizationDetails) {
Map<String, Organization> map = new HashMap<>();
for (OrganizationDetails organizationDetail : organizationDetails) {
String mapKey = String.format("%s", organizationDetail.getOrgCode());
if (map.containsKey(mapKey)) {
continue;
}
Identifier identifier = new Identifier().setSystem(SystemURL.ID_ODS_ORGANIZATION_CODE).setValue(organizationDetail.getOrgCode());
Organization organization = new Organization().setName(organizationDetail.getOrgName()).addIdentifier(identifier);
String resourceId = String.valueOf(organizationDetail.getId());
String versionId = String.valueOf(organizationDetail.getLastUpdated().getTime());
String resourceType = organization.getResourceType().toString();
IdType id = new IdType(resourceType, resourceId, versionId);
organization.setId(id);
organization.getMeta().setVersionId(versionId);
organization.getMeta().setLastUpdated(organizationDetail.getLastUpdated());
organization.getMeta().addProfile(SystemURL.SD_GPC_ORGANIZATION);
organization = addAdditionalProperties(organization);
map.put(mapKey, organization);
}
return new ArrayList<>(map.values());
}
Aggregations