protected void addPatientIdMatch(BooleanBuilder builder, StoredQueryParam pid) throws XDSException { if (pid.isMultiValue()) throw new XDSException( XDSException.XDS_ERR_STORED_QUERY_PARAM_NUMBER, this.getClass().getSimpleName() + " - " + pid.getName() + " only accepts a single value but is coded with multiple values!", null); try { XADPatient qryPat = new XADPatient(pid.getStringValue()); patID = qryPat.getCXPatientID(); builder.and(QXADPatient.xADPatient.patientID.eq(qryPat.getPatientID())); builder.and( QXADIssuer.xADIssuer.universalID.eq(qryPat.getIssuerOfPatientID().getUniversalID())); builder.and(QXADPatient.xADPatient.linkedPatient.isNull()); } catch (Exception x) { throw new XDSException( XDSException.XDS_ERR_PATID_DOESNOT_MATCH, "PatientID is not correct! " + x.getMessage(), null); } }