public void ParseORFR04ToXmlNoOCR()
        {
            string message = @"MSH|^~\&|Query Result Locator|Query Facility Name|Query Application Name|ST ELSEWHERE HOSPITAL|20051024074506||ORF^R04|432|P|2.3|
MSA|AA|123456789|
QRD|20060228160421|R|I||||10^RD&Records&0126|38923^^^^^^^^&TCH|||
QRF||20050101000000||
PID|||38923^^^ST ELSEWHERE HOSPITAL Medical Record Numbers&              MEDIC              AL RECORD NUMBER&ST ELSEWHERE HOSPITAL^MR^ST ELSEWHERE HOSPITAL||Bombadill^Tom||19450605|M|||1&Main Street^^Littleton^CO^80122||^^^^^303^4376329^22|
OBR|1|0015566|DH2211223|83036^HEMOGLOBIN A1C^^83036^HEMOGLOBIN A1C|||20040526094000|||||||20040526094000||J12345^JENS^JENNY^^^DR^MD^^^^^^^112233&TCH|||||          TP QUEST DIAGNOSTICS-TAMPA 4225 E. FOWLER AVE TAMPA          FL 33617|20030622070400|||F|
OBX|1|NM|50026400^HEMOGLOBIN A1C^^50026400^HEMOGLOBIN A1C||12|^% TOTAL HGB|4.0 - 6.0|H|||F|||20040510094000|TP^^L|";

            ca.uhn.hl7v2.parser.PipeParser parser = new ca.uhn.hl7v2.parser.PipeParser();

            ca.uhn.hl7v2.model.Message m = parser.parse(message);

            ca.uhn.hl7v2.model.v23.message.ORF_R04 orfR04 = m as ca.uhn.hl7v2.model.v23.message.ORF_R04;

            Assert.IsNotNull(orfR04);

            ca.uhn.hl7v2.parser.XMLParser xmlParser = new ca.uhn.hl7v2.parser.DefaultXMLParser();

            string recoveredMessage = xmlParser.encode(orfR04);

            Assert.IsNotNull(recoveredMessage);
            Assert.IsFalse(recoveredMessage.IndexOf("ORC") > -1, "Returned message added ORC segment.");
        }
        public void ParseQRYR02()
        {
            string message = @"MSH|^~\&|CohieCentral|COHIE|Clinical Data Provider|TCH|20060228155525||QRY^R02^QRY_R02|1|P|2.3|
QRD|20060228155525|R|I||||10^RD&Records&0126|38923^^^^^^^^&TCH|||";

            ca.uhn.hl7v2.parser.PipeParser parser = new ca.uhn.hl7v2.parser.PipeParser();

            ca.uhn.hl7v2.model.Message m = parser.parse(message);

            ca.uhn.hl7v2.model.v23.message.QRY_R02 qryR02 = m as ca.uhn.hl7v2.model.v23.message.QRY_R02;

            Assert.IsNotNull(qryR02);
            Assert.AreEqual("38923", qryR02.QRD.getWhoSubjectFilter(0).IDNumber.Value);
        }
        public void ParseXMLToHL7()
        {
            string message = GetQRYR02XML();

            ca.uhn.hl7v2.parser.XMLParser xmlParser = new ca.uhn.hl7v2.parser.DefaultXMLParser();
            ca.uhn.hl7v2.model.Message    m         = xmlParser.parse(message);

            ca.uhn.hl7v2.model.v23.message.QRY_R02 qryR02 = m as ca.uhn.hl7v2.model.v23.message.QRY_R02;

            Assert.IsNotNull(qryR02);

            ca.uhn.hl7v2.parser.PipeParser pipeParser = new ca.uhn.hl7v2.parser.PipeParser();

            string pipeOutput = pipeParser.encode(qryR02);

            Assert.IsNotNull(pipeOutput);
            Assert.IsFalse(string.Empty.Equals(pipeOutput));
        }
        public void ParseORFR04()
        {
            string message = @"MSH|^~\&|Query Result Locator|Query Facility Name|Query Application Name|ST ELSEWHERE HOSPITAL|20051024074506||ORF^R04|432|P|2.3|
MSA|AA|123456789|
QRD|20060228160421|R|I||||10^RD&Records&0126|38923^^^^^^^^&TCH|||
QRF||20050101000000||
PID|||38923^^^ST ELSEWHERE HOSPITAL Medical Record Numbers&              MEDIC              AL RECORD NUMBER&ST ELSEWHERE HOSPITAL^MR^ST ELSEWHERE HOSPITAL||Bombadill^Tom||19450605|M|||1&Main Street^^Littleton^CO^80122||^^^^^303^4376329^22|
OBR|1|0015566|DH2211223|83036^HEMOGLOBIN A1C^^83036^HEMOGLOBIN A1C|||20040526094000|||||||20040526094000||J12345^JENS^JENNY^^^DR^MD^^^^^^^112233&TCH|||||          TP QUEST DIAGNOSTICS-TAMPA 4225 E. FOWLER AVE TAMPA          FL 33617|20030622070400|||F|
OBX|1|NM|50026400^HEMOGLOBIN A1C^^50026400^HEMOGLOBIN A1C||12|^% TOTAL HGB|4.0 - 6.0|H|||F|||20040510094000|TP^^L|";

            ca.uhn.hl7v2.parser.PipeParser parser = new ca.uhn.hl7v2.parser.PipeParser();

            ca.uhn.hl7v2.model.Message m = parser.parse(message);

            ca.uhn.hl7v2.model.v23.message.ORF_R04 orfR04 = m as ca.uhn.hl7v2.model.v23.message.ORF_R04;
            Assert.IsNotNull(orfR04);
            Assert.AreEqual("12", orfR04.getQUERY_RESPONSE().getORDER().getOBSERVATION().OBX.getObservationValue()[0].Data.ToString());
        }