Search in sources :

Example 1 with PN

use of net.ihe.gazelle.hl7v3.datatypes.PN in project MobileAccessGateway by i4mi.

the class PMIRRequestConverter method transform.

public static PN transform(HumanName name) {
    PN nameElement = new PN();
    if (name.hasFamily()) {
        EnFamily family = element(EnFamily.class, name.getFamily());
        if (name.hasUse() && name.getUse().equals(NameUse.MAIDEN))
            family.setQualifier("BR");
        nameElement.addFamily(qualifier(name.getFamilyElement(), family));
    }
    for (StringType given : name.getGiven()) nameElement.addGiven(qualifier(given, element(EnGiven.class, given.getValue())));
    for (StringType prefix : name.getPrefix()) nameElement.addPrefix(qualifier(prefix, element(EnPrefix.class, prefix.getValue())));
    for (StringType suffix : name.getSuffix()) nameElement.addSuffix(qualifier(suffix, element(EnSuffix.class, suffix.getValue())));
    if (name.hasPeriod())
        nameElement.addValidTime(transform(name.getPeriod()));
    return nameElement;
}
Also used : EnPrefix(net.ihe.gazelle.hl7v3.datatypes.EnPrefix) StringType(org.hl7.fhir.r4.model.StringType) EnFamily(net.ihe.gazelle.hl7v3.datatypes.EnFamily) EnGiven(net.ihe.gazelle.hl7v3.datatypes.EnGiven) EnSuffix(net.ihe.gazelle.hl7v3.datatypes.EnSuffix) PN(net.ihe.gazelle.hl7v3.datatypes.PN)

Example 2 with PN

use of net.ihe.gazelle.hl7v3.datatypes.PN in project MobileAccessGateway by i4mi.

the class Iti78ResponseConverter method translateToFhir.

public List<Patient> translateToFhir(byte[] input, Map<String, Object> parameters) {
    try {
        // FIX for xmlns:xmlns
        String content = new String(input);
        content = content.replace("xmlns:xmlns", "xmlns:xxxxx");
        List<Patient> response = new ArrayList<Patient>();
        PRPAIN201306UV02Type msg = HL7V3Transformer.unmarshallMessage(PRPAIN201306UV02Type.class, new ByteArrayInputStream(content.getBytes()));
        PRPAIN201306UV02MFMIMT700711UV01ControlActProcess controlAct = msg.getControlActProcess();
        List<MCCIMT000300UV01Acknowledgement> acks = msg.getAcknowledgement();
        String errtext = "";
        for (MCCIMT000300UV01Acknowledgement ack : acks) {
            for (MCCIMT000300UV01AcknowledgementDetail ackDetail : ack.getAcknowledgementDetail()) {
                if (ackDetail.getText() != null)
                    errtext += toText(ackDetail.getText());
            }
        }
        // OK NF AE
        String queryResponseCode = controlAct.getQueryAck().getQueryResponseCode().getCode();
        if ("NF".equals(queryResponseCode)) {
            throw new ResourceNotFoundException("sourceIdentifier Patient Identifier not found", error(IssueType.NOTFOUND, errtext.length() > 0 ? errtext : "sourceIdentifier Patient Identifier not found"));
        }
        if ("AE".equals(queryResponseCode)) {
            throw new InvalidRequestException("sourceIdentifier Assigning Authority not found", error(IssueType.INVALID, errtext.length() > 0 ? errtext : "sourceIdentifier Assigning Authority not found"));
        }
        List<PRPAIN201306UV02MFMIMT700711UV01Subject1> subjects = controlAct.getSubject();
        for (PRPAIN201306UV02MFMIMT700711UV01Subject1 subject : subjects) {
            PRPAIN201306UV02MFMIMT700711UV01RegistrationEvent registrationEvent = subject.getRegistrationEvent();
            PRPAIN201306UV02MFMIMT700711UV01Subject2 subject1 = registrationEvent.getSubject1();
            PRPAMT201310UV02Patient patient = subject1.getPatient();
            PRPAMT201310UV02Person patientPerson = patient.getPatientPerson();
            if (patient.getId().isEmpty())
                continue;
            Patient result = new Patient();
            boolean idadded = false;
            for (II patientId : patient.getId()) {
                result.addIdentifier().setSystem(getSystem(patientId.getRoot())).setValue(patientId.getExtension());
                if (!idadded) {
                    result.setId(patientRefCreator.createPatientId(patientId.getRoot(), patientId.getExtension()));
                    idadded = true;
                }
            }
            for (PRPAMT201310UV02OtherIDs otherIds : patient.getPatientPerson().getAsOtherIDs()) {
                for (II patientId : otherIds.getId()) {
                    result.addIdentifier().setSystem(getSystem(patientId.getRoot())).setValue(patientId.getExtension());
                }
            }
            CS statusCode = patient.getStatusCode();
            if (statusCode != null && "active".equals(statusCode.getCode()))
                result.setActive(true);
            for (PN name : patientPerson.getName()) {
                HumanName humanName = new HumanName();
                for (EnFamily family : name.getFamily()) {
                    if ("BR".equals(family.getQualifier())) {
                        humanName.setUse(NameUse.MAIDEN);
                    }
                    humanName.setFamily(val(family));
                }
                for (EnGiven given : name.getGiven()) {
                    withQualifier(given, humanName.addGivenElement());
                }
                for (EnPrefix prefix : name.getPrefix()) {
                    withQualifier(prefix, humanName.addPrefixElement());
                }
                for (EnSuffix suffix : name.getSuffix()) {
                    withQualifier(suffix, humanName.addSuffixElement());
                }
                if (name.getValidTime() != null)
                    humanName.setPeriod(transform(name.getValidTime()));
                result.addName(humanName);
            }
            CE gender = patientPerson.getAdministrativeGenderCode();
            if (gender != null) {
                switch(gender.getCode()) {
                    case "M":
                        result.setGender(AdministrativeGender.MALE);
                        break;
                    case "F":
                        result.setGender(AdministrativeGender.FEMALE);
                        break;
                    case "A":
                        result.setGender(AdministrativeGender.OTHER);
                        break;
                    case "U":
                        result.setGender(AdministrativeGender.UNKNOWN);
                        break;
                }
            }
            TS birthTime = patientPerson.getBirthTime();
            if (birthTime != null) {
                result.setBirthDateElement(transform(birthTime));
            }
            for (AD ad : patientPerson.getAddr()) {
                result.addAddress(transform(ad));
            }
            for (TEL tel : patientPerson.getTelecom()) {
                result.addTelecom(transform(tel));
            }
            for (PRPAMT201310UV02LanguageCommunication lang : patientPerson.getLanguageCommunication()) {
                CE langCode = lang.getLanguageCode();
                PatientCommunicationComponent pcc = new PatientCommunicationComponent();
                pcc.setLanguage(transform(langCode));
                BL preferred = lang.getPreferenceInd();
                if (preferred != null && preferred.getValue().booleanValue())
                    pcc.setPreferred(true);
                result.addCommunication(pcc);
            }
            TS deceasedTime = patientPerson.getDeceasedTime();
            if (deceasedTime != null)
                result.setDeceased(transform(deceasedTime));
            else {
                BL deceased = patientPerson.getDeceasedInd();
                if (deceased != null)
                    result.setDeceased(new BooleanType(deceased.getValue().booleanValue()));
            }
            INT multiBirthOrder = patientPerson.getMultipleBirthOrderNumber();
            if (multiBirthOrder != null) {
                result.setMultipleBirth(new IntegerType(multiBirthOrder.getValue()));
            } else {
                BL multipleBirth = patientPerson.getMultipleBirthInd();
                if (multipleBirth != null)
                    result.setMultipleBirth(new BooleanType(multipleBirth.getValue().booleanValue()));
            }
            CE maritalStatus = patientPerson.getMaritalStatusCode();
            result.setMaritalStatus(transform(maritalStatus));
            for (PRPAMT201310UV02PersonalRelationship relationShip : patientPerson.getPersonalRelationship()) {
                CE code = relationShip.getCode();
                if (code != null && "MTH".equals(code.getCode()) && "2.16.840.1.113883.12.63".equals(code.getCodeSystem())) {
                    COCTMT030007UVPerson holder = relationShip.getRelationshipHolder1();
                    if (holder != null && !holder.getName().isEmpty()) {
                        EN name = holder.getName().get(0);
                        if (!name.getFamily().isEmpty()) {
                            String familyName = val(name.getFamily());
                            result.addExtension("http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName", new StringType(familyName));
                        }
                    }
                }
            }
            response.add(result);
        }
        return response;
    } catch (JAXBException e) {
        e.printStackTrace();
        throw new InvalidRequestException("failed parsing response");
    }
}
Also used : StringType(org.hl7.fhir.r4.model.StringType) ArrayList(java.util.ArrayList) PRPAIN201306UV02MFMIMT700711UV01Subject2(net.ihe.gazelle.hl7v3.prpain201306UV02.PRPAIN201306UV02MFMIMT700711UV01Subject2) PRPAIN201306UV02MFMIMT700711UV01Subject1(net.ihe.gazelle.hl7v3.prpain201306UV02.PRPAIN201306UV02MFMIMT700711UV01Subject1) BL(net.ihe.gazelle.hl7v3.datatypes.BL) MCCIMT000300UV01Acknowledgement(net.ihe.gazelle.hl7v3.mccimt000300UV01.MCCIMT000300UV01Acknowledgement) PRPAMT201310UV02Patient(net.ihe.gazelle.hl7v3.prpamt201310UV02.PRPAMT201310UV02Patient) INT(net.ihe.gazelle.hl7v3.datatypes.INT) HumanName(org.hl7.fhir.r4.model.HumanName) COCTMT030007UVPerson(net.ihe.gazelle.hl7v3.coctmt030007UV.COCTMT030007UVPerson) PatientCommunicationComponent(org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent) PRPAMT201310UV02OtherIDs(net.ihe.gazelle.hl7v3.prpamt201310UV02.PRPAMT201310UV02OtherIDs) EnFamily(net.ihe.gazelle.hl7v3.datatypes.EnFamily) PRPAMT201310UV02Person(net.ihe.gazelle.hl7v3.prpamt201310UV02.PRPAMT201310UV02Person) InvalidRequestException(ca.uhn.fhir.rest.server.exceptions.InvalidRequestException) EnSuffix(net.ihe.gazelle.hl7v3.datatypes.EnSuffix) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) PRPAIN201306UV02MFMIMT700711UV01RegistrationEvent(net.ihe.gazelle.hl7v3.prpain201306UV02.PRPAIN201306UV02MFMIMT700711UV01RegistrationEvent) PRPAIN201306UV02Type(net.ihe.gazelle.hl7v3.prpain201306UV02.PRPAIN201306UV02Type) II(net.ihe.gazelle.hl7v3.datatypes.II) PRPAIN201306UV02MFMIMT700711UV01ControlActProcess(net.ihe.gazelle.hl7v3.prpain201306UV02.PRPAIN201306UV02MFMIMT700711UV01ControlActProcess) CE(net.ihe.gazelle.hl7v3.datatypes.CE) EnPrefix(net.ihe.gazelle.hl7v3.datatypes.EnPrefix) AD(net.ihe.gazelle.hl7v3.datatypes.AD) JAXBException(javax.xml.bind.JAXBException) BooleanType(org.hl7.fhir.r4.model.BooleanType) Patient(org.hl7.fhir.r4.model.Patient) PRPAMT201310UV02Patient(net.ihe.gazelle.hl7v3.prpamt201310UV02.PRPAMT201310UV02Patient) EnGiven(net.ihe.gazelle.hl7v3.datatypes.EnGiven) EN(net.ihe.gazelle.hl7v3.datatypes.EN) CS(net.ihe.gazelle.hl7v3.datatypes.CS) IntegerType(org.hl7.fhir.r4.model.IntegerType) PRPAMT201310UV02PersonalRelationship(net.ihe.gazelle.hl7v3.prpamt201310UV02.PRPAMT201310UV02PersonalRelationship) ByteArrayInputStream(java.io.ByteArrayInputStream) TEL(net.ihe.gazelle.hl7v3.datatypes.TEL) MCCIMT000300UV01AcknowledgementDetail(net.ihe.gazelle.hl7v3.mccimt000300UV01.MCCIMT000300UV01AcknowledgementDetail) PRPAMT201310UV02LanguageCommunication(net.ihe.gazelle.hl7v3.prpamt201310UV02.PRPAMT201310UV02LanguageCommunication) PN(net.ihe.gazelle.hl7v3.datatypes.PN) IVXBTS(net.ihe.gazelle.hl7v3.datatypes.IVXBTS) IVLTS(net.ihe.gazelle.hl7v3.datatypes.IVLTS) TS(net.ihe.gazelle.hl7v3.datatypes.TS)

Example 3 with PN

use of net.ihe.gazelle.hl7v3.datatypes.PN in project MobileAccessGateway by i4mi.

the class Iti78RequestConverter method iti78ToIti47Converter.

public String iti78ToIti47Converter(@Header("FhirRequestParameters") Iti78SearchParameters parameters) throws JAXBException {
    PRPAIN201305UV02Type resultMsg = new PRPAIN201305UV02Type();
    resultMsg.setITSVersion("XML_1.0");
    resultMsg.setId(new II(config.getPixQueryOid(), uniqueId()));
    // Now
    resultMsg.setCreationTime(new TS(Timestamp.now().toHL7()));
    resultMsg.setProcessingCode(new CS("T", null, null));
    resultMsg.setProcessingModeCode(new CS("T", null, null));
    resultMsg.setInteractionId(new II("2.16.840.1.113883.1.6", "PRPA_IN201305UV02"));
    resultMsg.setAcceptAckCode(new CS("AL", null, null));
    MCCIMT000100UV01Receiver receiver = new MCCIMT000100UV01Receiver();
    resultMsg.addReceiver(receiver);
    receiver.setTypeCode(CommunicationFunctionType.RCV);
    MCCIMT000100UV01Device receiverDevice = new MCCIMT000100UV01Device();
    receiver.setDevice(receiverDevice);
    receiverDevice.setClassCode(EntityClassDevice.DEV);
    receiverDevice.setDeterminerCode(EntityDeterminer.INSTANCE);
    receiverDevice.setId(Collections.singletonList(new II(config.getPixReceiverOid(), null)));
    MCCIMT000100UV01Sender sender = new MCCIMT000100UV01Sender();
    resultMsg.setSender(sender);
    sender.setTypeCode(CommunicationFunctionType.SND);
    MCCIMT000100UV01Device senderDevice = new MCCIMT000100UV01Device();
    sender.setDevice(senderDevice);
    senderDevice.setClassCode(EntityClassDevice.DEV);
    senderDevice.setDeterminerCode(EntityDeterminer.INSTANCE);
    senderDevice.setId(Collections.singletonList(new II(config.getPixMySenderOid(), null)));
    PRPAIN201305UV02QUQIMT021001UV01ControlActProcess controlActProcess = new PRPAIN201305UV02QUQIMT021001UV01ControlActProcess();
    resultMsg.setControlActProcess(controlActProcess);
    controlActProcess.setClassCode(ActClassControlAct.CACT);
    controlActProcess.setMoodCode(XActMoodIntentEvent.EVN);
    controlActProcess.setCode(new CD("PRPA_TE201305UV02", "2.16.840.1.113883.1.6", null));
    PRPAMT201306UV02QueryByParameter queryByParameter = new PRPAMT201306UV02QueryByParameter();
    controlActProcess.setQueryByParameter(queryByParameter);
    queryByParameter.setQueryId(new II(config.getPixQueryOid(), uniqueId()));
    queryByParameter.setStatusCode(new CS("new", null, null));
    queryByParameter.setResponsePriorityCode(new CS("I", null, null));
    queryByParameter.setResponseModalityCode(new CS("R", null, null));
    PRPAMT201306UV02ParameterList parameterList = new PRPAMT201306UV02ParameterList();
    queryByParameter.setParameterList(parameterList);
    TokenParam id = parameters.get_id();
    if (id != null) {
        String v = id.getValue();
        int idx = v.indexOf("-");
        if (idx > 0) {
            PRPAMT201306UV02LivingSubjectId livingSubjectId = new PRPAMT201306UV02LivingSubjectId();
            livingSubjectId.addValue(new II(v.substring(0, idx), v.substring(idx + 1)));
            livingSubjectId.setSemanticsText(ST("LivingSubject.id"));
            parameterList.addLivingSubjectId(livingSubjectId);
        }
    }
    // active -> patientStatusCode
    TokenParam active = parameters.getActive();
    if (active != null) {
        String activeCode = "active";
        PRPAMT201306UV02PatientStatusCode patientStatusCode = new PRPAMT201306UV02PatientStatusCode();
        patientStatusCode.setValue(new CS(activeCode, null, null));
        parameterList.addPatientStatusCode(patientStatusCode);
    }
    // patientAddress
    StringParam postalCode = parameters.getPostalCode();
    StringParam state = parameters.getState();
    StringParam city = parameters.getCity();
    StringParam country = parameters.getCountry();
    StringParam address = parameters.getAddress();
    if (postalCode != null || state != null || city != null || country != null || address != null) {
        PRPAMT201306UV02PatientAddress patientAddress = new PRPAMT201306UV02PatientAddress();
        AD ad = new AD();
        if (postalCode != null)
            ad.addPostalCode(element(AdxpPostalCode.class, postalCode.getValue()));
        if (state != null)
            ad.addState(element(AdxpState.class, state.getValue()));
        if (city != null)
            ad.addCity(element(AdxpCity.class, city.getValue()));
        if (country != null)
            ad.addCountry(element(AdxpCountry.class, country.getValue()));
        // TODO How to support address filter?
        patientAddress.addValue(ad);
        patientAddress.setSemanticsText(ST("Patient.addr"));
        parameterList.addPatientAddress(patientAddress);
    }
    // livingSubjectBirthTime
    DateAndListParam birthdate = parameters.getBirthDate();
    if (birthdate != null) {
        IVLTS ivlts = new IVLTS();
        for (DateOrListParam birthdateOr : birthdate.getValuesAsQueryTokens()) {
            for (DateParam birthdateParam : birthdateOr.getValuesAsQueryTokens()) {
                Date lDate = null;
                Date hDate = null;
                TemporalPrecisionEnum precision = birthdateParam.getPrecision();
                ParamPrefixEnum prefix = birthdateParam.getPrefix();
                if (prefix == null)
                    prefix = ParamPrefixEnum.EQUAL;
                Calendar cal = Calendar.getInstance();
                cal.setTime(birthdateParam.getValue());
                switch(precision) {
                    case SECOND:
                        cal.set(Calendar.MILLISECOND, 0);
                        lDate = cal.getTime();
                        cal.set(Calendar.MILLISECOND, 1000);
                        hDate = cal.getTime();
                        break;
                    case MINUTE:
                        cal.set(Calendar.MILLISECOND, 0);
                        cal.set(Calendar.SECOND, 0);
                        lDate = cal.getTime();
                        cal.add(Calendar.MINUTE, 1);
                        hDate = cal.getTime();
                        break;
                    case DAY:
                        cal.set(Calendar.MILLISECOND, 0);
                        cal.set(Calendar.SECOND, 0);
                        cal.set(Calendar.MINUTE, 0);
                        cal.set(Calendar.HOUR_OF_DAY, 0);
                        lDate = cal.getTime();
                        cal.add(Calendar.DAY_OF_MONTH, 1);
                        hDate = cal.getTime();
                        break;
                    case MONTH:
                        int month = cal.get(Calendar.MONTH);
                        int year = cal.get(Calendar.YEAR);
                        cal.set(year, month, 1, 0, 0, 0);
                        lDate = cal.getTime();
                        cal.add(Calendar.MONTH, 1);
                        hDate = cal.getTime();
                        break;
                    case YEAR:
                        year = cal.get(Calendar.YEAR);
                        cal.set(year, 0, 1, 0, 0, 0);
                        lDate = cal.getTime();
                        cal.add(Calendar.YEAR, 1);
                        hDate = cal.getTime();
                        break;
                    case MILLI:
                    default:
                        lDate = cal.getTime();
                        cal.add(Calendar.MILLISECOND, 1);
                        hDate = cal.getTime();
                        break;
                }
                switch(prefix) {
                    case GREATERTHAN:
                        ivlts.setLow(transform(hDate));
                        break;
                    case LESSTHAN:
                        ivlts.setHigh(transform(lDate));
                        break;
                    case GREATERTHAN_OR_EQUALS:
                        ivlts.setLow(transform(lDate));
                        break;
                    case LESSTHAN_OR_EQUALS:
                        ivlts.setHigh(transform(hDate));
                        break;
                    case STARTS_AFTER:
                        ivlts.setLow(transform(hDate));
                        break;
                    case ENDS_BEFORE:
                        ivlts.setHigh(transform(lDate));
                        break;
                    case EQUAL:
                    case APPROXIMATE:
                        ivlts.setLow(transform(lDate));
                        ivlts.setHigh(transform(hDate));
                        break;
                    // 
                    default:
                        throw new InvalidRequestException("Date operation not supported.");
                }
            }
        }
        PRPAMT201306UV02LivingSubjectBirthTime livingSubjectBirthTime = new PRPAMT201306UV02LivingSubjectBirthTime();
        livingSubjectBirthTime.addValue(ivlts);
        livingSubjectBirthTime.setSemanticsText(ST("LivingSubject.birthTime"));
        parameterList.addLivingSubjectBirthTime(livingSubjectBirthTime);
    }
    // given, family -> livingSubjectName
    StringAndListParam given = parameters.getGiven();
    StringAndListParam family = parameters.getFamily();
    StringParam givenElem = given != null ? given.getValuesAsQueryTokens().get(0).getValuesAsQueryTokens().get(0) : null;
    StringParam familyElem = family != null ? family.getValuesAsQueryTokens().get(0).getValuesAsQueryTokens().get(0) : null;
    if (givenElem != null || familyElem != null) {
        PRPAMT201306UV02LivingSubjectName livingSubjectName = new PRPAMT201306UV02LivingSubjectName();
        livingSubjectName.setSemanticsText(ST("Patient.name"));
        EN name = new EN();
        if (familyElem != null) {
            name.addFamily(element(EnFamily.class, familyElem.getValue()));
            if (!familyElem.isExact())
                name.setUse("SRCH");
        }
        if (givenElem != null) {
            name.addGiven(element(EnGiven.class, givenElem.getValue()));
            if (!givenElem.isExact())
                name.setUse("SRCH");
        }
        livingSubjectName.addValue(name);
        livingSubjectName.setSemanticsText(ST("LivingSubject.name"));
        parameterList.addLivingSubjectName(livingSubjectName);
    }
    // gender -> livingSubjectAdministrativeGender
    TokenParam gender = parameters.getGender();
    if (gender != null) {
        PRPAMT201306UV02LivingSubjectAdministrativeGender livingSubjectAdministrativeGender = new PRPAMT201306UV02LivingSubjectAdministrativeGender();
        switch(gender.getValue().toUpperCase()) {
            case "MALE":
                livingSubjectAdministrativeGender.addValue(new CE("M", "Male", "2.16.840.1.113883.12.1"));
                break;
            case "FEMALE":
                livingSubjectAdministrativeGender.addValue(new CE("F", "Female", "2.16.840.1.113883.12.1"));
                break;
            case "OTHER":
                livingSubjectAdministrativeGender.addValue(new CE("A", "Ambiguous", "2.16.840.1.113883.12.1"));
                break;
            case "UNKNOWN":
                livingSubjectAdministrativeGender.addValue(new CE("U", "Unknown", "2.16.840.1.113883.12.1"));
                break;
            default:
                throw new InvalidRequestException("Unknown gender query parameter value");
        }
        livingSubjectAdministrativeGender.setSemanticsText(ST("LivingSubject.administrativeGender"));
        parameterList.addLivingSubjectAdministrativeGender(livingSubjectAdministrativeGender);
    }
    // identifiers -> livingSubjectId or otherIDsScopingOrganization
    TokenAndListParam identifiers = parameters.getIdentifiers();
    if (identifiers != null) {
        for (TokenOrListParam idOr : identifiers.getValuesAsQueryTokens()) {
            for (TokenParam identifier : idOr.getValuesAsQueryTokens()) {
                if (identifier.getValue() == null || identifier.getValue().length() == 0) {
                    PRPAMT201306UV02OtherIDsScopingOrganization otherIDsScopingOrganization = new PRPAMT201306UV02OtherIDsScopingOrganization();
                    otherIDsScopingOrganization.addValue(new II(getScheme(identifier.getSystem()), null));
                    otherIDsScopingOrganization.setSemanticsText(ST("OtherIDs.scopingOrganization.id"));
                    parameterList.addOtherIDsScopingOrganization(otherIDsScopingOrganization);
                } else {
                    PRPAMT201306UV02LivingSubjectId livingSubjectId = new PRPAMT201306UV02LivingSubjectId();
                    livingSubjectId.addValue(new II(getScheme(identifier.getSystem()), identifier.getValue()));
                    livingSubjectId.setSemanticsText(ST("LivingSubject.id"));
                    parameterList.addLivingSubjectId(livingSubjectId);
                }
            }
        }
    }
    // mothersMaidenName -> mothersMaidenName
    StringParam mmn = parameters.getMothersMaidenName();
    if (mmn != null) {
        PRPAMT201306UV02MothersMaidenName mothersMaidenName = new PRPAMT201306UV02MothersMaidenName();
        PN mothersMaidenNamePN = new PN();
        mothersMaidenNamePN.addGiven(element(EnGiven.class, mmn.getValue()));
        mothersMaidenName.addValue(mothersMaidenNamePN);
        mothersMaidenName.setSemanticsText(ST("Person.MothersMaidenName"));
        parameterList.addMothersMaidenName(mothersMaidenName);
    }
    // telecom -> patientTelecom
    StringParam telecom = parameters.getTelecom();
    if (telecom != null) {
        PRPAMT201306UV02PatientTelecom patientTelecom = new PRPAMT201306UV02PatientTelecom();
        TEL tel = new TEL();
        tel.setValue(telecom.getValue());
        patientTelecom.addValue(tel);
        parameterList.addPatientTelecom(patientTelecom);
    }
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    HL7V3Transformer.marshallMessage(PRPAIN201305UV02Type.class, out, resultMsg);
    String outArray = new String(out.toByteArray());
    return outArray;
}
Also used : PRPAMT201306UV02MothersMaidenName(net.ihe.gazelle.hl7v3.prpamt201306UV02.PRPAMT201306UV02MothersMaidenName) PRPAMT201306UV02PatientStatusCode(net.ihe.gazelle.hl7v3.prpamt201306UV02.PRPAMT201306UV02PatientStatusCode) ParamPrefixEnum(ca.uhn.fhir.rest.param.ParamPrefixEnum) DateOrListParam(ca.uhn.fhir.rest.param.DateOrListParam) IVLTS(net.ihe.gazelle.hl7v3.datatypes.IVLTS) PRPAMT201306UV02QueryByParameter(net.ihe.gazelle.hl7v3.prpamt201306UV02.PRPAMT201306UV02QueryByParameter) PRPAMT201306UV02PatientTelecom(net.ihe.gazelle.hl7v3.prpamt201306UV02.PRPAMT201306UV02PatientTelecom) TemporalPrecisionEnum(ca.uhn.fhir.model.api.TemporalPrecisionEnum) EnFamily(net.ihe.gazelle.hl7v3.datatypes.EnFamily) PRPAMT201306UV02ParameterList(net.ihe.gazelle.hl7v3.prpamt201306UV02.PRPAMT201306UV02ParameterList) PRPAMT201306UV02LivingSubjectBirthTime(net.ihe.gazelle.hl7v3.prpamt201306UV02.PRPAMT201306UV02LivingSubjectBirthTime) InvalidRequestException(ca.uhn.fhir.rest.server.exceptions.InvalidRequestException) PRPAIN201305UV02Type(net.ihe.gazelle.hl7v3.prpain201305UV02.PRPAIN201305UV02Type) StringParam(ca.uhn.fhir.rest.param.StringParam) MCCIMT000100UV01Device(net.ihe.gazelle.hl7v3.mccimt000100UV01.MCCIMT000100UV01Device) TokenAndListParam(ca.uhn.fhir.rest.param.TokenAndListParam) PRPAIN201305UV02QUQIMT021001UV01ControlActProcess(net.ihe.gazelle.hl7v3.prpain201305UV02.PRPAIN201305UV02QUQIMT021001UV01ControlActProcess) DateParam(ca.uhn.fhir.rest.param.DateParam) II(net.ihe.gazelle.hl7v3.datatypes.II) CD(net.ihe.gazelle.hl7v3.datatypes.CD) PRPAMT201306UV02PatientAddress(net.ihe.gazelle.hl7v3.prpamt201306UV02.PRPAMT201306UV02PatientAddress) CE(net.ihe.gazelle.hl7v3.datatypes.CE) AD(net.ihe.gazelle.hl7v3.datatypes.AD) DateAndListParam(ca.uhn.fhir.rest.param.DateAndListParam) StringAndListParam(ca.uhn.fhir.rest.param.StringAndListParam) Calendar(java.util.Calendar) EN(net.ihe.gazelle.hl7v3.datatypes.EN) EnGiven(net.ihe.gazelle.hl7v3.datatypes.EnGiven) PRPAMT201306UV02OtherIDsScopingOrganization(net.ihe.gazelle.hl7v3.prpamt201306UV02.PRPAMT201306UV02OtherIDsScopingOrganization) ByteArrayOutputStream(java.io.ByteArrayOutputStream) MCCIMT000100UV01Sender(net.ihe.gazelle.hl7v3.mccimt000100UV01.MCCIMT000100UV01Sender) PRPAMT201306UV02LivingSubjectName(net.ihe.gazelle.hl7v3.prpamt201306UV02.PRPAMT201306UV02LivingSubjectName) Date(java.util.Date) PRPAMT201306UV02LivingSubjectAdministrativeGender(net.ihe.gazelle.hl7v3.prpamt201306UV02.PRPAMT201306UV02LivingSubjectAdministrativeGender) CS(net.ihe.gazelle.hl7v3.datatypes.CS) TokenOrListParam(ca.uhn.fhir.rest.param.TokenOrListParam) TokenParam(ca.uhn.fhir.rest.param.TokenParam) PRPAMT201306UV02LivingSubjectId(net.ihe.gazelle.hl7v3.prpamt201306UV02.PRPAMT201306UV02LivingSubjectId) MCCIMT000100UV01Receiver(net.ihe.gazelle.hl7v3.mccimt000100UV01.MCCIMT000100UV01Receiver) TEL(net.ihe.gazelle.hl7v3.datatypes.TEL) PN(net.ihe.gazelle.hl7v3.datatypes.PN) IVXBTS(net.ihe.gazelle.hl7v3.datatypes.IVXBTS) IVLTS(net.ihe.gazelle.hl7v3.datatypes.IVLTS) TS(net.ihe.gazelle.hl7v3.datatypes.TS)

Example 4 with PN

use of net.ihe.gazelle.hl7v3.datatypes.PN in project ipf by oehf.

the class PixV3QueryResponseTransformerTest method getSampleResponse.

public static PixV3QueryResponse getSampleResponse() {
    final PixV3QueryResponse response = PixV3QueryResponse.fromQuery(getSampleQuery());
    response.setDataFound();
    response.setTargetMessageId(new II("m1", "1.3.5"));
    response.setMessageId(new II("m2", "1.3.5"));
    response.getPatientIds().addAll(List.of(new II("9810", "2.16.756.5.30.1.127")));
    response.setCustodianOid("1.4.2");
    response.setProviderOrganization(new COCTMT150003UV03Organization());
    response.getProviderOrganization().getName().add(new ON());
    response.getProviderOrganization().getName().get(0).mixed = List.of("Provider Organization");
    response.setPersonName(new PN());
    response.getPersonName().mixed = List.of("Person Name");
    response.getPersonIds().add(new II("76133761", "1.3.6.1.4.1.12559.11.25.1.19"));
    response.getAsOtherIDs().add(new PRPAMT201304UV02OtherIDs());
    response.getAsOtherIDs().get(0).setId(List.of(new II("1.2.840.114350.1.13", "38273N237")));
    final MCCIMT000300UV01AcknowledgementDetail ad = new MCCIMT000300UV01AcknowledgementDetail();
    ad.setCode(new CE("204", null, null));
    ad.getLocation().add(new ST());
    ad.getLocation().get(0).mixed = List.of("/hl7:PRPA_IN201309UV02/hl7:controlActProcess");
    ad.setText(new ED());
    ad.getText().mixed = List.of("Requested record not found");
    response.getAcknowledgementDetails().add(ad);
    return response;
}
Also used : COCTMT150003UV03Organization(net.ihe.gazelle.hl7v3.coctmt150003UV03.COCTMT150003UV03Organization) PRPAMT201304UV02OtherIDs(net.ihe.gazelle.hl7v3.prpamt201304UV02.PRPAMT201304UV02OtherIDs) PixV3QueryResponse(org.openehealth.ipf.commons.ihe.hl7v3.core.responses.PixV3QueryResponse) MCCIMT000300UV01AcknowledgementDetail(net.ihe.gazelle.hl7v3.mccimt000300UV01.MCCIMT000300UV01AcknowledgementDetail)

Aggregations

EnFamily (net.ihe.gazelle.hl7v3.datatypes.EnFamily)3 EnGiven (net.ihe.gazelle.hl7v3.datatypes.EnGiven)3 PN (net.ihe.gazelle.hl7v3.datatypes.PN)3 InvalidRequestException (ca.uhn.fhir.rest.server.exceptions.InvalidRequestException)2 AD (net.ihe.gazelle.hl7v3.datatypes.AD)2 CE (net.ihe.gazelle.hl7v3.datatypes.CE)2 CS (net.ihe.gazelle.hl7v3.datatypes.CS)2 EN (net.ihe.gazelle.hl7v3.datatypes.EN)2 EnPrefix (net.ihe.gazelle.hl7v3.datatypes.EnPrefix)2 EnSuffix (net.ihe.gazelle.hl7v3.datatypes.EnSuffix)2 II (net.ihe.gazelle.hl7v3.datatypes.II)2 IVLTS (net.ihe.gazelle.hl7v3.datatypes.IVLTS)2 IVXBTS (net.ihe.gazelle.hl7v3.datatypes.IVXBTS)2 TEL (net.ihe.gazelle.hl7v3.datatypes.TEL)2 TS (net.ihe.gazelle.hl7v3.datatypes.TS)2 MCCIMT000300UV01AcknowledgementDetail (net.ihe.gazelle.hl7v3.mccimt000300UV01.MCCIMT000300UV01AcknowledgementDetail)2 StringType (org.hl7.fhir.r4.model.StringType)2 TemporalPrecisionEnum (ca.uhn.fhir.model.api.TemporalPrecisionEnum)1 DateAndListParam (ca.uhn.fhir.rest.param.DateAndListParam)1 DateOrListParam (ca.uhn.fhir.rest.param.DateOrListParam)1