예제 #1
0
        public string InsertWorkList(WorkList wrklst)
        {
            try
            {
                DatabaseOpen();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "INSERT INTO worklist(patname,patid,patotherid,patbirthdate,patbirthtime,patsex,pataddresse,patmedicalalerts,patethnicgroup,patcontrastallergies,patpregnancystatus,pathistory,patcomments,specialneeds,patstate,patconfidentialconstraint,accessionnumber,referringpysician,requestingservice,requestingphysician,sstationaetitle,spstartdate,spstarttime,modatity,sperformingphysician,spstepdescription,spstepid,sstationname,spsteplocation,premedication,requestedcontrastagent,requestedprocedureid,proceduredescription,studyinstanceuid,requestedprocedurepriority,patienttransportarrangements,readingphysician,currentlocation,resultsphysician,procedurecomments,imagingcomments,admissionid,admittingdiagnosisdescription,itp_appstatus) VALUES(@patname,@patid,@patotherid,@patbirthdate,@patbirthtime,@patsex,@pataddresse,@patmedicalalerts,@patethnicgroup,@patcontrastallergies,@patpregnancystatus,@pathistory,@patcomments,@specialneeds,@patstate,@patconfidentialconstraint,@accessionnumber,@referringpysician,@requestingservice,@requestingphysician,@sstationaetitle,@spstartdate,@spstarttime,@modatity,@sperformingphysician,@spstepdescription,@spstepid,@sstationname,@spsteplocation,@premedication,@requestedcontrastagent,@requestedprocedureid,@proceduredescription,@studyinstanceuid,@requestedprocedurepriority,@patienttransportarrangements,@readingphysician,@currentlocation,@resultsphysician,@procedurecomments,@imagingcomments,@admissionid,@admittingdiagnosisdescription,@itp_appstatus)";

                ITPSystem.Log("worklist için veriler ekleniyor.");


                //  cmd.Parameters.AddWithValue("@Status", wrklst.Status);
                cmd.Parameters.AddWithValue("@patname", wrklst.patname);
                cmd.Parameters.AddWithValue("@patid", wrklst.patid);
                cmd.Parameters.AddWithValue("@patotherid", wrklst.patotherid);
                cmd.Parameters.AddWithValue("@patbirthdate", wrklst.patbirthdate);
                cmd.Parameters.AddWithValue("@patbirthtime", wrklst.patbirthtime);
                cmd.Parameters.AddWithValue("@patsex", wrklst.patsex);
                cmd.Parameters.AddWithValue("@pataddresse", wrklst.pataddresse);
                cmd.Parameters.AddWithValue("@patmedicalalerts", wrklst.patmedicalalerts);
                cmd.Parameters.AddWithValue("@patethnicgroup", wrklst.patethnicgroup);
                cmd.Parameters.AddWithValue("@patcontrastallergies", wrklst.patcontrastallergies);
                cmd.Parameters.AddWithValue("@patpregnancystatus", wrklst.patpregnancystatus);
                cmd.Parameters.AddWithValue("@pathistory", " ");
                cmd.Parameters.AddWithValue("@patcomments", wrklst.patcomments);
                cmd.Parameters.AddWithValue("@specialneeds", " ");
                cmd.Parameters.AddWithValue("@patstate", wrklst.patstate);
                cmd.Parameters.AddWithValue("@patconfidentialconstraint", wrklst.patconfidentialconstraint);
                cmd.Parameters.AddWithValue("@accessionnumber", wrklst.accessionnumber);
                cmd.Parameters.AddWithValue("@referringpysician", wrklst.referringpysician);
                cmd.Parameters.AddWithValue("@requestingservice", " ");
                cmd.Parameters.AddWithValue("@requestingphysician", wrklst.requestingphysician);
                cmd.Parameters.AddWithValue("@sstationaetitle", wrklst.sstationaetitle);
                cmd.Parameters.AddWithValue("@spstartdate", wrklst.spstartdate);
                cmd.Parameters.AddWithValue("@spstarttime", wrklst.spstarttime);
                cmd.Parameters.AddWithValue("@modatity", wrklst.modatity);
                cmd.Parameters.AddWithValue("@sperformingphysician", wrklst.sperformingphysician);
                cmd.Parameters.AddWithValue("@spstepdescription", " ");
                cmd.Parameters.AddWithValue("@spstepid", wrklst.spstepid);
                cmd.Parameters.AddWithValue("@sstationname", " ");
                cmd.Parameters.AddWithValue("@spsteplocation", " ");
                cmd.Parameters.AddWithValue("@premedication", " ");
                cmd.Parameters.AddWithValue("@requestedcontrastagent", " ");
                cmd.Parameters.AddWithValue("@requestedprocedureid", wrklst.requestedprocedureid);
                cmd.Parameters.AddWithValue("@proceduredescription", wrklst.proceduredescription);
                cmd.Parameters.AddWithValue("@studyinstanceuid", " ");
                cmd.Parameters.AddWithValue("@requestedprocedurepriority", " ");
                cmd.Parameters.AddWithValue("@patienttransportarrangements", wrklst.patienttransportarrangements);
                cmd.Parameters.AddWithValue("@readingphysician", " ");
                cmd.Parameters.AddWithValue("@currentlocation", wrklst.currentlocation);
                cmd.Parameters.AddWithValue("@resultsphysician", " ");
                cmd.Parameters.AddWithValue("@procedurecomments", " ");
                cmd.Parameters.AddWithValue("@imagingcomments", " ");
                cmd.Parameters.AddWithValue("@admissionid", wrklst.admissionid);
                cmd.Parameters.AddWithValue("@admittingdiagnosisdescription", " ");
                cmd.Parameters.AddWithValue("@itp_appstatus", " ");



                cmd.ExecuteNonQuery();
                DatabaseClose();

                return("worklist kaydı başarılı bir şekilde yapıldı.");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
예제 #2
0
        private void HandleClientComm(object client) //clienttan gelen mesajları burada alıyor.Okuyor.
        {
            TcpClient     tcpClient    = (TcpClient)client;
            NetworkStream clientStream = tcpClient.GetStream();
            StreamWriter  sw           = new StreamWriter(clientStream);

            byte[] message = new byte[4096];
            int    bytesRead;

            while (true)
            {
                bytesRead = 0;
                message   = new byte[4096];
                try
                {
                    bytesRead = clientStream.Read(message, 0, 4096);
                }
                catch (Exception Err)
                {
                }

                if (bytesRead == 0)
                {
                    //the client has disconnected from the server
                    break;
                }

                //message has successfully been received
                Encoding encoder = Encoding.UTF8;
                string   str     = encoder.GetString(message, 0, bytesRead); //gelen mesajı stringe çeviriyor.

                if (str.Contains("ORU^R01"))
                {
                    var oru_r01 = new ORU_R01(str);


                    //   oru_r01.Parse(str);

                    //string MSH = str.Substring(0, (str.IndexOf("PID") - 0)); //ilk elemandan PID ye kadar olan kısmı alır.

                    //if (MSH.Substring(1, 3) == "MSH") //MSH ın 1.indexinden sonra 3 char kontrolünü yapıyor.
                    //{
                    //    msh.Parse(MSH);
                    //    msh.save();
                    //}

                    //int a = str.IndexOf("PID"); //PID nin kaçıncı indexte olduğunu gösteriyor.

                    //string PID = str.Substring(a, (str.IndexOf("PV1") - a)); //PID nin başladığı yerden PV1 in bittiği yere kadar olan kısmı alıyor.

                    //if (PID.Substring(0, 3) == "PID") //PID stringinin ilk 3 karakterini kontrol ediyor.
                    //{
                    //    pid.Parse(PID);
                    //    pid.Save();
                    //}

                    //int b = str.IndexOf("PV1"); //PV1 in hangi indexte olduğunu buluyor.

                    //string PV1 = str.Substring(b, (str.IndexOf("AL1") - b)); //PV1 in başladığı yerden ORC nin bittiği yere kadar olan kısım

                    //if (PV1.Substring(0, 3) == "PV1")
                    //{
                    //    pv1.Parse(PV1);
                    //    pv1.Save();
                    //}

                    //int c = str.IndexOf("AL1"); //AL1 in hangi indexte olduğunu buluyor.

                    //string AL1 = str.Substring(c, (str.IndexOf("ORC") - c));

                    //if (AL1.Substring(0, 3) == "AL1")
                    //{
                    //    al1.Parse(AL1);
                    //    al1.Save();
                    //}

                    //int i = str.IndexOf("ORC");  //ORC nin kaçıncı indexte olduğunu gösteriyor.
                    //string ORC = str.Substring(i); //str stringinin i. indexten sonrasını alıyor.

                    //if (ORC.Substring(0, 3) == "ORC")
                    //{
                    //    orc.Parse(ORC);
                    //    orc.save();
                    //}
                    if (oru_r01.ORC.Order_Control == "NW")
                    {
                        WorkList wrklst = new WorkList();

                        wrklst.Status = null;
                        if (oru_r01.PID.Patient_Name != "")
                        {
                            wrklst.patname = oru_r01.PID.Patient_Name;
                        }
                        else
                        {
                            bodymessage = bodymessage + "Hasta ismi boş olamaz" + "/n";
                        }
                        if (oru_r01.PID.Patient_ID != "")
                        {
                            wrklst.patid = oru_r01.PID.Patient_ID;
                        }
                        else
                        {
                            bodymessage = bodymessage + "Hasta ID girilmek zorundadır." + "/n";
                        }

                        wrklst.patotherid       = oru_r01.PID.Alternate_Patient_ID;
                        wrklst.patbirthdate     = oru_r01.PID.Date_Time_Of_Birth;
                        wrklst.patbirthtime     = oru_r01.PID.Date_Time_Of_Birth;
                        wrklst.patsex           = oru_r01.PID.Sex;
                        wrklst.pataddresse      = oru_r01.PID.Patient_Address;
                        wrklst.patmedicalalerts = oru_r01.OBR.Relevant_Clinical_Info;
                        wrklst.patethnicgroup   = oru_r01.PID.Race;
                        if (oru_r01.AL1.Allergy_Code_Mnemonic_Description != "")
                        {
                            wrklst.patcontrastallergies = oru_r01.AL1.Allergy_Code_Mnemonic_Description;
                        }
                        else
                        {
                            bodymessage = bodymessage + "Hastanın alerji durumunu belirtiniz." + "/n";
                        }
                        wrklst.patpregnancystatus        = oru_r01.PV1.Ambulatory_Status;
                        wrklst.patcomments               = oru_r01.NTE.Comment;
                        wrklst.patstate                  = oru_r01.OBR.Danger_Code;
                        wrklst.patconfidentialconstraint = oru_r01.PV1.VIP_Indicator;
                        wrklst.accessionnumber           = oru_r01.OBR.Placer_Field_1;
                        wrklst.referringpysician         = oru_r01.PV1.Referring_Doctor;
                        wrklst.requestingphysician       = oru_r01.OBR.Ordering_Provider;
                        wrklst.sstationaetitle           = oru_r01.OBR.Filler_Field_2;
                        wrklst.spstartdate               = oru_r01.OBR.Quantity_Timing;
                        wrklst.spstarttime               = oru_r01.OBR.Quantity_Timing;
                        wrklst.modatity                  = oru_r01.OBR.Diagnostic_Serv_Sect_ID;
                        wrklst.sperformingphysician      = oru_r01.OBR.Technician;
                        wrklst.spstepid                  = oru_r01.OBR.Filler_Field_1;
                        wrklst.requestedprocedureid      = oru_r01.OBR.Placer_Field_2;
                        wrklst.proceduredescription      = oru_r01.OBR.Ordering_Provider;
                        // wrklst.studyinstanceuid=ZDS tablosu yok.
                        wrklst.patienttransportarrangements = oru_r01.OBR.Transportation_Mode;
                        wrklst.currentlocation = oru_r01.PV1.Assigned_Patient_Location;
                        wrklst.admissionid     = oru_r01.PID.Patient_Account_Number;

                        if (bodymessage == null)
                        {
                            string donus = InsWrklst.InsertWorkList(wrklst);
                        }
                        else
                        {
                            MailSender.Sent(kimden, kime, konu, bodymessage);
                        }
                    }
                }
            }
            sw.Dispose();
            clientStream.Dispose();
            tcpClient.Close();
        }