示例#1
0
        public static HL7Message getMessage(string hl7Input)
        {
            HL7Message hl7 = new HL7Message();

            HL7Message.Parse(hl7, hl7Input);

            return(hl7);
        }
        /// <summary>
        /// Parses a pipe delimetered HL7 v2 pathology into a message model.
        /// </summary>
        /// <param name="payload">HL7 message.</param>
        /// <returns>HL7 pathology message model.</returns>
        /// <exception cref="ArgumentNullException">payload</exception>
        /// <exception cref="ArgumentException">Message is not a HL7 result message (ORU_R01)</exception>
        public HL7GenericMessage ParseHl7Message(string payload)
        {
            if (string.IsNullOrWhiteSpace(payload))
            {
                throw new ArgumentNullException(nameof(payload));
            }

            HL7GenericMessage message = (HL7GenericMessage)HL7Message.Parse(payload);

            if (!(message.MessageHeader.MessageType.messagetype == TransformerConstants.Hl7PathologyMessage &&
                  message.MessageHeader.MessageType.triggerevent == TransformerConstants.Hl7PathologyMessageType))
            {
                throw new ArgumentException("Message is not a HL7 result message (ORU_R01)");
            }

            return(message);
        }