コード例 #1
0
ファイル: PacsInteraction.cs プロジェクト: top501/DicomPACS
        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);
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            string MSH  = "MSH|^~\\&|NES|NINTENDO|TESTSYSTEM|TESTFACILITY|20010101000000||ADT^A04|Q123456789T123456789X123456|P|2.3.1";
            string EVN  = "EVN|A04|20010101000000|||^KOOPA^BOWSER^^^^^^^CURRENT";
            string PID  = "PID|1||583070^^^ADT1|0123456789^AA^^JP|BLACK^CHARLES||19780214|M||WH|16 ARUNDEL PL^^ST. LOUIS^MO^63105|1234|(555)555-0123^HOME^JP:1234567|||S|MSH|12345678|||||||0|||||N";
            string NK11 = "NK1|1|PEACH^PRINCESS^^^^|SO|ANOTHER CASTLE^^TOADSTOOL KINGDOM^NES^^JP|(123)555-1234|(123)555-2345|NOK|||||||||||||";
            string NK12 = "NK1|2|TOADSTOOL^PRINCESS^^^^|SO|YET ANOTHER CASTLE^^TOADSTOOL KINGDOM^NES^^JP|(123)555-3456|(123)555-4567|EMC|||||||||||||";
            string PV1  = "PV1|1|E|ABCD^EFGH^|||^^||5101^NELL^FREDERICK^P^^DR||CRD||||||||AO|0123456789|1|||||||||||||||||||MSH||A|||20010101000000";
            string IN11 = "IN1|1|PAR^PARENT||||LUIGI";
            string IN12 = "IN1|2|FRI^FRIEND||||PRINCESS";
            string msg  = MSH + "\x0d" + EVN + "\x0d" + PID + "\x0d" + NK11 + "\x0d" + NK12 + "\x0d" + PV1 + "\x0d" + IN11 + "\x0d" + IN12 + "\x0d";

            hL7Client.SendMessage(msg);
        }