Exemple #1
0
        public static bool SendOrder(Presc presc)
        {
            string session = Guid.NewGuid().ToString();

            SQL.DoLog("SendOrder", presc.Lpu.Oid, presc.Oid.ToString(), session, presc.ToString());
            Logger.Trace("SendOrder: Presc=[{0}]", presc);

            try
            {
                Message  message = HL7Methods.CreateMessage(presc);
                HostPort hp      = GetHostPortForLpu(presc.Lpu.Oid);

                using (var client = new HL7Client())
                {
                    client.Connect(hp.Host, hp.Port);
                    var ackMessage = client.SendMessage(message.ToString());

                    return(true);
                }
            }
            catch (Exception e)
            {
                Logger.ErrorSoap(e);
                SQL.DoLog("SendOrder", presc.Lpu.Oid, presc.Oid.ToString(), session, e.Message);
            }

            return(false);
        }
Exemple #2
0
        public static Message CreateMessage(Presc presc)
        {
            var message = new Message();

            message.Segments.Add(new Segment(message, "MSH"));
            message.Segments.Add(new Segment(message, "PID"));
            message.Segments.Add(new Segment(message, "PV1"));
            message.Segments.Add(new Segment(message, "ORC"));
            message.Segments.Add(new Segment(message, "OBR"));
            Initialize(message, "ORM^O01");
            FillORM(message, presc);
            return(message);
        }
Exemple #3
0
        private static void FillORM(Message message, Presc presc)
        {
            message["PID"][3]    = "1234";                                                  // Patient ID
            message["PID"][5, 1] = "Пациентов";                                             // Patient name
            message["PID"][5, 2] = "Иван";
            message["PID"][7]    = StringConverter.FromDateTime(new DateTime(2000, 1, 25)); // Patient DOB
            message["PID"][8]    = "M";                                                     // Patient sex

            message["PV1"][8, 2] = "Лекарь";                                                // Physician name
            message["PV1"][8, 3] = "Николай";

            message["ORC"][1] = "NW";                                                       // New order
            message["ORC"][5] = "SC";                                                       // Status changed

            message["OBR"][4]  = "Общее CT-исследование";                                   // Study description
            message["OBR"][7]  = StringConverter.FromDateTime(DateTime.Today.AddHours(8));  // Study date/time
            message["OBR"][18] = "78482374";                                                // Order ID
            message["OBR"][24] = "CT";                                                      // Modality
        }