示例#1
0
        private void CreateObxSegment()
        {
            var ourOrderObservation = _oruR01Message.GetPATIENT_RESULT().GetORDER_OBSERVATION();
            var observationSegment  = ourOrderObservation.GetOBSERVATION(0);
            var obxSegment          = observationSegment.OBX;

            obxSegment.SetIDOBX.Value = "0";
            //see HL7 table for list of permitted values here. We will use "Encapsulated Data" here
            obxSegment.ValueType.Value = "ED";
            obxSegment.ObservationIdentifier.Identifier.Value = "Report";

            //"Varies" is a NHAPI class to handle data where the appropriate
            //data type is not known until run-time (e.g. OBX-5)
            var varies           = obxSegment.GetObservationValue(0);
            var encapsulatedData = new ED(_oruR01Message, "PDF Report Content");

            encapsulatedData.SourceApplication.NamespaceID.Value = "Our .NET Application";
            encapsulatedData.TypeOfData.Value  = "AP"; //see HL7 table 0191: Type of referenced data
            encapsulatedData.DataSubtype.Value = "PDF";
            encapsulatedData.Encoding.Value    = "Base64";

            var base64EncodedStringOfPdfReport = _Base64Helper.ConvertToBase64String(new FileInfo(_pdfFilePath));

            encapsulatedData.Data.Value = base64EncodedStringOfPdfReport;

            varies.Data = encapsulatedData;
        }