Exemple #1
0
        /// <summary>
        /// Helper method to generate the request object.
        /// </summary>
        /// <param name="cdaPackageContent">Byte content of the CDA package.</param>
        /// <param name="formatCode">Format code.</param>
        /// <param name="formatCodeName">Format code name.</param>
        /// <param name="healthcareFacilityTypeCode">Healthcare facility type code.</param>
        /// <param name="practiceSetting">Practice setting code.</param>
        /// <param name="uuidOfDocumentToReplace">UUID of document to replace. NULL for new documents.</param>
        /// <returns>The populated request object.</returns>
        internal ProvideAndRegisterDocumentSetRequestType CreateRequest(
            byte[] cdaPackageContent,
            string formatCode,
            string formatCodeName,
            HealthcareFacilityTypeCodes healthcareFacilityTypeCode,
            PracticeSettingTypes practiceSetting,
            string uuidOfDocumentToReplace)
        {
            Validation.ValidateArgumentRequired("cdaPackageContent", cdaPackageContent);
            Validation.ValidateArgumentRequired("formatCode", formatCodeName);
            Validation.ValidateArgumentRequired("formatCodeName", formatCodeName);

            var cdaFile = GetCdaDocument(cdaPackageContent);
            var cdaDoc  = new XmlDocument();

            cdaDoc.Load(new MemoryStream(cdaFile));

            var metadata = new XdsMetadata(
                cdaDoc,
                null,
                formatCode,
                formatCodeName,
                healthcareFacilityTypeCode,
                practiceSetting,
                null,
                null,
                false,
                uuidOfDocumentToReplace
                );
            var sor = metadata.CreateSubmitObjectsRequest();

            var request = new ProvideAndRegisterDocumentSetRequestType();

            request.Document = new ProvideAndRegisterDocumentSetRequestTypeDocument[]
            {
                new ProvideAndRegisterDocumentSetRequestTypeDocument()
                {
                    id    = "DOCUMENT_SYMBOLICID_01",
                    Value = cdaPackageContent
                }
            };
            request.SubmitObjectsRequest = sor;

            return(request);
        }
        /// <summary>
        /// Helper method to generate the request object.
        /// </summary>
        /// <param name="cdaPackageContent">Byte content of the CDA package.</param>
        /// /// <param name="uniqueRepositoryId">Repository ID.</param>
        /// <param name="formatCode">Format code.</param>
        /// <param name="formatCodeName">Format code name.</param>
        /// <param name="healthcareFacilityTypeCode">Healthcare facility type code.</param>
        /// <param name="practiceSetting">Practice setting code.</param>
        /// <param name="uuidOfDocumentToReplace">UUID of document to replace. NULL for new documents.</param>
        /// <returns>The populated request object.</returns>
        internal SubmitObjectsRequest CreateRequest(
            byte[] cdaPackageContent,
            string uniqueRepositoryId,
            string formatCode,
            string formatCodeName,
            HealthcareFacilityTypeCodes healthcareFacilityTypeCode,
            PracticeSettingTypes practiceSetting,
            string uuidOfDocumentToReplace)
        {
            Validation.ValidateArgumentRequired("cdaPackageContent", cdaPackageContent);
            Validation.ValidateArgumentRequired("uniqueRepositoryId", uniqueRepositoryId);
            Validation.ValidateArgumentRequired("formatCode", formatCodeName);
            Validation.ValidateArgumentRequired("formatCodeName", formatCodeName);

            var cdaFile = GetCdaDocument(cdaPackageContent);
            var cdaDoc  = new XmlDocument();

            cdaDoc.Load(new MemoryStream(cdaFile));

            var metadata = new XdsMetadata(
                cdaDoc,
                uniqueRepositoryId,
                formatCode,
                formatCodeName,
                healthcareFacilityTypeCode,
                practiceSetting,
                cdaPackageContent.Length,
                CalculateSHA1(cdaPackageContent),
                true,
                uuidOfDocumentToReplace
                );

            var sor           = metadata.CreateSubmitObjectsRequest();
            var serializedSor = sor.SerializeToXml();

            return(serializedSor.Deserialize <SubmitObjectsRequest>());
        }