Exemple #1
0
        // XDocument xmlDoc;

        public void Build(MSH __msh, string __org, string __proc)
        {
            if (string.IsNullOrEmpty(__org))
            {
                __org = "Unknown";
            }

            if (string.IsNullOrEmpty(__proc))
            {
                __proc = "Unknown";
            }

            MSH tmpMsh = __msh;

            string __time_stamp = DateTime.Now.ToString("yyyyMMddhh");

            tmpMsh.MessageData["MSH.5"] = tmpMsh.MessageData["MSH.3"];
            tmpMsh.MessageData["MSH.6"] = tmpMsh.MessageData["MSH.4"];

            tmpMsh.MessageData["MSH.3"] = __proc;
            tmpMsh.MessageData["MSH.4"] = __org;

            AckString = '\x0B' +
                        @"MSH|^~\&|" +
                        tmpMsh.MessageData["MSH.3"] + "|" +
                        tmpMsh.MessageData["MSH.4"] + "|" +
                        tmpMsh.MessageData["MSH.5"] + "|" +
                        tmpMsh.MessageData["MSH.6"] + "|" +
                        __time_stamp + "||ACK^" +
                        tmpMsh.MessageData["MSH.9.2"] + "|" +
                        tmpMsh.MessageData["MSH.10"] + "|" +
                        tmpMsh.MessageData["MSH.11"] + "|" +
                        tmpMsh.MessageData["MSH.12"] + "|" +
                        "\r" +
                        @"MSA|AA|" +
                        tmpMsh.MessageData["MSH.10"] + "|" +
                        '\x1C' +
                        '\x0D';

            CleanAckString = @"MSH | ^~\& | " +
                             tmpMsh.MessageData["MSH.3"] + " | " +
                             tmpMsh.MessageData["MSH.4"] + " | " +
                             tmpMsh.MessageData["MSH.5"] + " | " +
                             tmpMsh.MessageData["MSH.6"] + " | " +
                             __time_stamp + "|| ACK^" +
                             tmpMsh.MessageData["MSH.9.2"] + " | " +
                             tmpMsh.MessageData["MSH.10"] + " | " +
                             tmpMsh.MessageData["MSH.11"] + " | " +
                             tmpMsh.MessageData["MSH.12"] + " | " +
                             "\n\tMSA | AA | " +
                             tmpMsh.MessageData["MSH.10"] + "|\n";
        }
Exemple #2
0
        public ADT_A01(XDocument xmlDoc)
        {
            if (xmlDoc == null)
            {
                throw new ArgumentNullException(nameof(xmlDoc));
            }

            // MessageStore = messageStore ?? throw new ArgumentNullException(nameof(messageStore));

            OBX = new List <OBX>();
            AL1 = new List <AL1>();
            DG1 = new List <DG1>();
            ROL = new List <ROL>();
            DB1 = new List <DB1>();
            SFT = new List <SFT>();
            IN1 = new List <IN1>();
            IN2 = new List <IN2>();
            NK1 = new List <NK1>();

            if (xmlDoc.Root == null)
            {
                return;
            }

            foreach (var xElement in xmlDoc.Root.Elements())
            {
                if (xElement != null)
                {
                    switch (xElement.Name.ToString())
                    {
                    case "AL1":
                        AL1.Add(new AL1(xElement));
                        break;

                    case "SFT":
                        SFT.Add(new SFT(xElement));
                        break;

                    case "UAC":
                        UAC = new UAC(xElement);
                        break;

                    case "EVN":
                        EVN = new EVN(xElement);
                        break;

                    case "DG1":
                        DG1.Add(new DG1(xElement));
                        break;

                    case "DB1":
                        DB1.Add(new DB1(xElement));
                        break;

                    case "GT1":
                        GT1 = new GT1(xElement);
                        break;

                    case "IN1":
                        IN1.Add(new IN1(xElement));
                        break;

                    case "IN2":
                        IN2.Add(new IN2(xElement));
                        break;

                    case "MSH":
                        MSH = new MSH(xElement);
                        break;

                    case "NK1":
                        NK1.Add(new NK1(xElement));
                        break;

                    case "OBX":
                        OBX.Add(new OBX(xElement));
                        break;

                    case "PID":
                        PID = new PID(xElement);
                        break;

                    case "PD1":
                        PD1 = new PD1(xElement);
                        break;

                    case "PV1":
                        PV1 = new PV1(xElement);
                        break;

                    case "PV2":
                        PV2 = new PV2(xElement);
                        break;

                    case "ROL":
                        ROL.Add(new ROL(xElement));
                        break;

                    // ReSharper disable once RedundantEmptySwitchSection
                    default:
                        break;
                    }
                }
            }
        }
Exemple #3
0
 public NAK(MSH msh, string errorCode, string org, string proc, string errorMsg = null)
 {
     Build(msh, errorCode, org, proc, errorMsg);
 }
Exemple #4
0
 public NAK(MSH msh, string errorCode, string org)
 {
     Build(msh, errorCode, org, "Medicine-On-Time HL7 Interface");
 }
Exemple #5
0
        public void Build(MSH msh, string errorCode, string org, string proc, string errorMsg = null)
        {
            if (msh == null)
            {
                throw new ArgumentNullException(nameof(msh));
            }


            if (string.IsNullOrEmpty(org))
            {
                org = "Unknown";
            }

            if (string.IsNullOrEmpty(proc))
            {
                proc = "Unknown";
            }

            if (string.IsNullOrEmpty(errorCode))
            {
                errorCode = "AF";
            }

            MSH tmpMsh      = msh;
            var timeStamp   = DateTime.Now.ToString("yyyyMMddhh");
            var errorString = !string.IsNullOrEmpty(errorMsg) ? errorMsg : tmpMsh.MessageData["MSH.10"];

            tmpMsh.MessageData["MSH.5"] = tmpMsh.MessageData["MSH.3"];
            tmpMsh.MessageData["MSH.6"] = tmpMsh.MessageData["MSH.4"];
            tmpMsh.MessageData["MSH.3"] = proc;
            tmpMsh.MessageData["MSH.4"] = org;

            NakString = '\x0B' +
                        @"MSH|^~\&|" +
                        tmpMsh.MessageData["MSH.3"] + "|" +
                        tmpMsh.MessageData["MSH.4"] + "|" +
                        tmpMsh.MessageData["MSH.5"] + "|" +
                        tmpMsh.MessageData["MSH.6"] + "|" +
                        timeStamp + "||NAK^" +
                        tmpMsh.MessageData["MSH.9.3"] + "|" +
                        tmpMsh.MessageData["MSH.10"] + "|" +
                        tmpMsh.MessageData["MSH.11"] + "|" +
                        tmpMsh.MessageData["MSH.12"] + "|" +
                        "\r" +
                        @"MSA|" +
                        errorCode + "|" +                    // MSA.1
                        tmpMsh.MessageData["MSH.10"] + "|" + // MSA.2
                        "PROC ERROR|" +                      // MSA.3
                        "0|" +                               // MSA.4
                        "0|" +                               // MSA.5
                        errorString +                        // MSA.6
                        '\x1C' +
                        '\x0D';

            CleanNakString = @"MSH | ^~\& |" +
                             tmpMsh.MessageData["MSH.3"] + " | " +
                             tmpMsh.MessageData["MSH.4"] + " | " +
                             tmpMsh.MessageData["MSH.5"] + " | " +
                             tmpMsh.MessageData["MSH.6"] + " | " +
                             timeStamp + "| | NAK^" +
                             tmpMsh.MessageData["MSH.9.3"] + " | " +
                             tmpMsh.MessageData["MSH.10"] + " | " +
                             tmpMsh.MessageData["MSH.11"] + " | " +
                             tmpMsh.MessageData["MSH.12"] + " | " +
                             "\n\tMSA | " +
                             errorCode + "|" +
                             tmpMsh.MessageData["MSH.10"] + "|" +
                             "PROC ERROR|" +
                             "0|" +
                             "0|" +
                             errorString + "\n";
        }
Exemple #6
0
 public ACK(MSH msh, string org, string proc)
 {
     Build(msh, org, proc);
 }
Exemple #7
0
 public ACK(MSH msh, string org)
 {
     Build(msh, org, "Medicine-On-Time HL7 Interface");
 }
Exemple #8
0
 public ACK(MSH msh)
 {
     Build(msh, "Medicine-On-Time HL7 Interface", "Medicine-On-Time");
 }