Search in sources :

Example 16 with Code

use of org.openehealth.ipf.commons.ihe.xds.core.metadata.Code in project ipf by oehf.

the class CodeTransformerTestBase method baseSetUp.

@BeforeEach
public final void baseSetUp() {
    var factory = createFactory();
    transformer = new CodeTransformer(factory);
    objectLibrary = factory.createObjectLibrary();
    var displayName = new LocalizedString();
    displayName.setCharset("charset");
    displayName.setLang("lang");
    displayName.setValue("value");
    code = new Code();
    code.setCode("code");
    code.setDisplayName(displayName);
    code.setSchemeName("schemeName");
}
Also used : LocalizedString(org.openehealth.ipf.commons.ihe.xds.core.metadata.LocalizedString) Code(org.openehealth.ipf.commons.ihe.xds.core.metadata.Code) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 17 with Code

use of org.openehealth.ipf.commons.ihe.xds.core.metadata.Code in project MobileAccessGateway by i4mi.

the class Iti65RequestConverter method transformToIdentifiable.

/**
 * FHIR CodeableConcept -> XDS Identifiable
 * @param cc
 * @return
 */
public Identifiable transformToIdentifiable(CodeableConcept cc) {
    Code code = transform(cc);
    String system = code.getSchemeName();
    return new Identifiable(code.getCode(), new AssigningAuthority(system));
}
Also used : LocalizedString(org.openehealth.ipf.commons.ihe.xds.core.metadata.LocalizedString) AssigningAuthority(org.openehealth.ipf.commons.ihe.xds.core.metadata.AssigningAuthority) CXiAssigningAuthority(org.openehealth.ipf.commons.ihe.xds.core.metadata.CXiAssigningAuthority) Code(org.openehealth.ipf.commons.ihe.xds.core.metadata.Code) Identifiable(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable)

Example 18 with Code

use of org.openehealth.ipf.commons.ihe.xds.core.metadata.Code in project MobileAccessGateway by i4mi.

the class Pharm5RequestConverter method operationFindMedicationListToFindMedicationListQuery.

/**
 * convert PHARM-5 request to CMPD Pharm-1
 *
 * @param searchParameter
 * @return
 */
public QueryRegistry operationFindMedicationListToFindMedicationListQuery(@Body Parameters searchParameter) {
    boolean getLeafClass = true;
    FindMedicationListQuery query = new FindMedicationListQuery();
    // status --> $XDSDocumentEntryStatus
    List<Type> statusTypes = searchParameter.getParameters(Pharm5Constants.PHARM5_STATUS);
    if (statusTypes != null) {
        List<AvailabilityStatus> availabilites = new ArrayList<AvailabilityStatus>();
        for (Type status : statusTypes) {
            String tokenValue = status.primitiveValue();
            if (tokenValue.equals("current"))
                availabilites.add(AvailabilityStatus.APPROVED);
            else if (tokenValue.equals("superseded"))
                availabilites.add(AvailabilityStatus.DEPRECATED);
        }
        query.setStatus(availabilites);
    }
    // patient or patient.identifier --> $XDSDocumentEntryPatientId
    Type patientIdentifier = searchParameter.getParameter(Pharm5Constants.PHARM5_PATIENT_IDENTIFIER);
    if (patientIdentifier != null) {
        Identifier patIdentifier = (Identifier) patientIdentifier;
        String system = patIdentifier.getSystem();
        if (system == null || !system.startsWith("urn:oid:"))
            throw new InvalidRequestException("Missing OID for patient");
        query.setPatientId(new Identifiable(patIdentifier.getValue(), new AssigningAuthority(system.substring(8))));
    }
    // patient or patient.identifier --> $XDSDocumentEntryPatientId
    Type serviceStartFrom = searchParameter.getParameter(Pharm5Constants.PHARM5_SERVICE_START_FROM);
    if (serviceStartFrom != null) {
        query.getServiceStart().setFrom(timestampFromDate(serviceStartFrom));
    }
    Type serviceStartTo = searchParameter.getParameter(Pharm5Constants.PHARM5_SERVICE_START_TO);
    if (serviceStartTo != null) {
        query.getServiceStart().setTo(timestampFromDate(serviceStartTo));
    }
    Type serviceEndFrom = searchParameter.getParameter(Pharm5Constants.PHARM5_SERVICE_END_FROM);
    if (serviceEndFrom != null) {
        query.getServiceEnd().setFrom(timestampFromDate(serviceEndFrom));
    }
    Type serviceEndTo = searchParameter.getParameter(Pharm5Constants.PHARM5_SERVICE_END_TO);
    if (serviceEndTo != null) {
        query.getServiceEnd().setTo(timestampFromDate(serviceEndTo));
    }
    List<Type> formatTypes = searchParameter.getParameters(Pharm5Constants.PHARM5_FORMAT);
    if (formatTypes != null && formatTypes.size() > 0) {
        List<Code> formatCodes = new ArrayList<Code>();
        for (Type format : formatTypes) {
            Coding formatCoding = (Coding) format;
            Code formatCode = new Code();
            formatCode.setCode(formatCoding.getCode());
            String system = formatCoding.getSystem();
            if (system.startsWith("urn:oid:")) {
                system = system.substring(8);
            }
            formatCode.setSchemeName(system);
            formatCodes.add(formatCode);
        }
        query.setFormatCodes(formatCodes);
    }
    List<DocumentEntryType> documentEntryTypes = new ArrayList<DocumentEntryType>();
    documentEntryTypes.add(DocumentEntryType.ON_DEMAND);
    documentEntryTypes.add(DocumentEntryType.STABLE);
    query.setDocumentEntryTypes(documentEntryTypes);
    final QueryRegistry queryRegistry = new QueryRegistry(query);
    queryRegistry.setReturnType((getLeafClass) ? QueryReturnType.LEAF_CLASS : QueryReturnType.OBJECT_REF);
    return queryRegistry;
}
Also used : QueryRegistry(org.openehealth.ipf.commons.ihe.xds.core.requests.QueryRegistry) FindMedicationListQuery(org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindMedicationListQuery) ArrayList(java.util.ArrayList) AssigningAuthority(org.openehealth.ipf.commons.ihe.xds.core.metadata.AssigningAuthority) Code(org.openehealth.ipf.commons.ihe.xds.core.metadata.Code) Identifiable(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable) DocumentEntryType(org.openehealth.ipf.commons.ihe.xds.core.metadata.DocumentEntryType) Type(org.hl7.fhir.r4.model.Type) DocumentEntryType(org.openehealth.ipf.commons.ihe.xds.core.metadata.DocumentEntryType) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) QueryReturnType(org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryReturnType) Identifier(org.hl7.fhir.r4.model.Identifier) AvailabilityStatus(org.openehealth.ipf.commons.ihe.xds.core.metadata.AvailabilityStatus) Coding(org.hl7.fhir.r4.model.Coding) InvalidRequestException(ca.uhn.fhir.rest.server.exceptions.InvalidRequestException)

Aggregations

Code (org.openehealth.ipf.commons.ihe.xds.core.metadata.Code)18 BeforeEach (org.junit.jupiter.api.BeforeEach)12 AssigningAuthority (org.openehealth.ipf.commons.ihe.xds.core.metadata.AssigningAuthority)12 Identifiable (org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable)12 EbXMLFactory30 (org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLFactory30)11 QueryList (org.openehealth.ipf.commons.ihe.xds.core.requests.query.QueryList)5 Test (org.junit.jupiter.api.Test)3 InvalidRequestException (ca.uhn.fhir.rest.server.exceptions.InvalidRequestException)2 ArrayList (java.util.ArrayList)2 AvailabilityStatus (org.openehealth.ipf.commons.ihe.xds.core.metadata.AvailabilityStatus)2 LocalizedString (org.openehealth.ipf.commons.ihe.xds.core.metadata.LocalizedString)2 QueryRegistry (org.openehealth.ipf.commons.ihe.xds.core.requests.QueryRegistry)2 DateParam (ca.uhn.fhir.rest.param.DateParam)1 DateRangeParam (ca.uhn.fhir.rest.param.DateRangeParam)1 ReferenceParam (ca.uhn.fhir.rest.param.ReferenceParam)1 StringParam (ca.uhn.fhir.rest.param.StringParam)1 TokenOrListParam (ca.uhn.fhir.rest.param.TokenOrListParam)1 TokenParam (ca.uhn.fhir.rest.param.TokenParam)1 Coding (org.hl7.fhir.r4.model.Coding)1 DateTimeType (org.hl7.fhir.r4.model.DateTimeType)1