private void adjustAccessionNumber(Attributes attrs, Issuer destIssuer) {
    if (!attrs.containsValue(Tag.AccessionNumber)) return;

    Issuer issuer = Issuer.valueOf(attrs.getNestedDataset(Tag.IssuerOfAccessionNumberSequence));
    if (issuer == null) return;

    if (!issuer.matches(destIssuer)) {
      attrs.setNull(Tag.AccessionNumber, VR.SH);
      attrs.remove(Tag.IssuerOfAccessionNumberSequence);
    }
  }
Exemple #2
0
  private boolean matchIssuerOfPatientID(String remoteAET, Attributes rqAttrs) {
    Issuer issuer = Issuer.issuerOfPatientID(rqAttrs);
    if (issuer == null) return true;

    try {
      ApplicationEntity remoteAE = Archive.getInstance().findApplicationEntity(remoteAET);
      return issuer.matches(remoteAE.getDevice().getIssuerOfPatientID());
    } catch (ConfigurationException e) {
      return true;
    }
  }
  private IDWithIssuer pidWithMatchingIssuer(IDWithIssuer[] pids, Issuer issuer) {
    if (issuer == null) return pids[0];

    for (IDWithIssuer pid : pids) if (issuer.matches(pid.issuer)) return pid;

    return null;
  }
  private void adjustPatientID(Attributes attrs) {
    IDWithIssuer pid = IDWithIssuer.pidWithIssuer(attrs, null);
    if (pid == null) return;

    if (pids.length == 0) {
      pids = pixConsumer.pixQuery((ArchiveApplicationEntity) as.getApplicationEntity(), pid);
    }

    IDWithIssuer issuer = pidWithMatchingIssuer(pids, requestedIssuerOfPatientID);
    if (issuer != null) {
      issuer.toPIDWithIssuer(attrs);
    } else {
      attrs.setNull(Tag.PatientID, VR.LO);
      requestedIssuerOfPatientID.toIssuerOfPatientID(attrs);
    }
    if (returnOtherPatientIDs && pids.length > 0) IDWithIssuer.addOtherPatientIDs(attrs, pids);
    if (returnOtherPatientNames && hasPatientNames(attrs))
      attrs.setString(Tag.OtherPatientNames, VR.PN, patientNames);
  }