public override ExtrinsicObject ToRegistryObject() { var document = new ExtrinsicObject { Id = EntryUuid, Home = HomeCommunityId, Status = AvailabilityStatus, Description = XmlUtil.LocalString(Comments), Name = XmlUtil.LocalString(Title), MimeType = MimeType, ObjectType = DocumentEntryType }; document.Classifications.Add(new Classification { ClassificationScheme = XdsClassification.Document, ClassifiedObject = EntryUuid, }); if (Author != null) { var authorAttribute = Author.ToClassification(XdsClassification.DocumentAuthor, EntryUuid); document.Classifications.Add(authorAttribute); } if (Class != null && !string.IsNullOrEmpty(Class.Value)) { document.Classifications.Add(Class.ToClassification(EntryUuid)); } if (Confidentiality != null && Confidentiality.Any(c => !string.IsNullOrEmpty(c.Value))) { document.Classifications.AddRange( Confidentiality.Select(c => c.ToClassification(EntryUuid))); } if (CreationTime != null) { document.Slots.Add(XmlUtil.SingleSlot("creationTime", _hl7CreationTime.Encode())); } if (EventCodes != null && EventCodes.Any(fc => !string.IsNullOrEmpty(fc.Value))) { document.Classifications.AddRange(EventCodes.Select(fc => fc.ToClassification(EntryUuid))); } if (Format != null && !string.IsNullOrEmpty(Format.Value)) { document.Classifications.Add(Format.ToClassification(EntryUuid)); } if (!string.IsNullOrEmpty(Hash)) { document.Slots.Add(XmlUtil.SingleSlot("hash", Hash)); } if (HealthCareFacilityType != null && !string.IsNullOrEmpty(HealthCareFacilityType.Value)) { document.Classifications.Add(HealthCareFacilityType.ToClassification(EntryUuid)); } if (!string.IsNullOrEmpty(LanguageCode)) { document.Slots.Add(XmlUtil.SingleSlot("languageCode", LanguageCode)); } if (LegalAuthenticator != null) { document.Slots.Add(XmlUtil.SingleSlot("legalAuthenticator", LegalAuthenticator.Hl7Person.Encode())); } string patientId = PatientId != null?PatientId.ToString() : ""; if (!string.IsNullOrEmpty(patientId)) { document.ExternalIdentifiers.Add(new ExternalIdentifier { IdentificationScheme = XdsIdentification.DocumentPatientId, RegistryObject = EntryUuid, Name = XmlUtil.LocalString("XDSFolder.patientId"), Value = patientId }); } if (PracticeSetting != null && !string.IsNullOrEmpty(PracticeSetting.Value)) { document.Classifications.Add(PracticeSetting.ToClassification(EntryUuid)); } if (!string.IsNullOrEmpty(RepositoryUniqueId)) { document.Slots.Add(XmlUtil.SingleSlot("repositoryUniqueId", RepositoryUniqueId)); } if (ServiceStartTime != null) { document.Slots.Add(XmlUtil.SingleSlot("serviceStartTime", _hl7ServiceStartTime.Encode())); } if (ServiceStopTime != null) { document.Slots.Add(XmlUtil.SingleSlot("serviceStopTime", _hl7ServiceStopTime.Encode())); } if (Size != null) { document.Slots.Add(XmlUtil.SingleSlot("size", Size.Value.ToString())); } if (SourcePatientId != null) { document.Slots.Add(XmlUtil.SingleSlot("sourcePatientId", SourcePatientId.Hl7Identifier.Encode())); } if (SourcePatientInfo != null && SourcePatientInfo.Any()) { document.Slots.Add(new Slot { Name = "sourcePatientInfo", Values = SourcePatientInfo }); } if (Type != null) { document.Classifications.Add(Type.ToClassification(EntryUuid)); } if (!string.IsNullOrEmpty(Uri)) { document.Slots.Add(XmlUtil.SingleSlot("URI", Uri)); } if (!string.IsNullOrEmpty(UniqueId)) { document.ExternalIdentifiers.Add(new ExternalIdentifier { IdentificationScheme = XdsIdentification.DocumentUniqueId, RegistryObject = EntryUuid, Name = XmlUtil.LocalString("XDSFolder.uniqueId"), Value = UniqueId }); } if (ReferenceIds != null && ReferenceIds.Any()) { document.Slots.Add(new Slot { Name = "urn:ihe:iti:xds:2013:referenceIdList", Values = ReferenceIds.Select(id => id.Hl7Identifier.Encode()).ToList() }); } if (LimitedMetadata) { document.Classifications.Add(new Classification { ClassificationScheme = XdsClassification.DocumentLimitedMetadata, ClassifiedObject = EntryUuid }); } return(document); }
public override RegistryPackage ToRegistryObject() { var submission = new RegistryPackage { Id = EntryUuid, Home = HomeCommunityId, Status = AvailabilityStatus, Description = XmlUtil.LocalString(Comments), Name = XmlUtil.LocalString(Title) }; submission.Classifications.Add(new Classification { ClassificationScheme = XdsClassification.SubmissionSet, ClassifiedObject = EntryUuid, }); if (Author != null) { var authorAttribute = Author.ToClassification(XdsClassification.SubmissionSetAuthor, EntryUuid); submission.Classifications.Add(authorAttribute); } if (ContentType != null) { submission.Classifications.Add(ContentType.ToClassification(EntryUuid)); } if (IntendedRecipients != null && IntendedRecipients.Any()) { submission.Slots.Add(new Slot { Name = "intendedRecipient", Values = IntendedRecipients.Select(r => r.Encode()).ToList() }); } string patientId = PatientId != null?PatientId.ToString() : ""; if (!string.IsNullOrEmpty(patientId)) { submission.ExternalIdentifiers.Add(new ExternalIdentifier { IdentificationScheme = XdsIdentification.SubmissionSetPatientId, RegistryObject = EntryUuid, Name = XmlUtil.LocalString("XDSSubmissionSet.patientId"), Value = patientId }); } if (!string.IsNullOrEmpty(SourceId)) { submission.ExternalIdentifiers.Add(new ExternalIdentifier { IdentificationScheme = XdsIdentification.SubmissionSetSourceId, RegistryObject = EntryUuid, Name = XmlUtil.LocalString("XDSSubmissionSet.sourceId"), Value = SourceId }); } if (SubmissionTime != null) { submission.Slots.Add(XmlUtil.SingleSlot("submissionTime", _hl7SubmissionTime.Encode())); } if (LimitedMetadata) { submission.Classifications.Add(new Classification { ClassificationScheme = XdsClassification.SubmissionLimitedMetadata, ClassifiedObject = EntryUuid }); } return(submission); }