Beispiel #1
0
        public Teshis GetTeshisByID(int teshisID)
        {
            Teshis teshis = _teshisDAL.GetDiagnosticByID(teshisID);

            if (teshis == null)
            {
                throw new IDBulunamadi("Teshis");
            }

            return(teshis);
        }
Beispiel #2
0
        public Teshis GetDiagnosticByID(int teshisID)
        {
            Teshis diagnostic = new Teshis();

            query = "SELECT * FROM Teshis WHERE teshisID=@teshisID";
            SqlParameter id = new SqlParameter("@teshisID", teshisID);

            helper.AddParameter(id);
            DataRow row = helper.FillDataTable(query).Rows[0];

            diagnostic.TeshisID = teshisID;
            diagnostic.Aciklama = row["TeshisAdi"].ToString();

            return(diagnostic);
        }
Beispiel #3
0
        public List <Teshis> GetAllDiagnostics()
        {
            List <Teshis> diagnostics = new List <Teshis>();

            query = "SELECT * FROM Teshis";
            Teshis diagnostic = null;

            foreach (DataRow item in helper.FillDataTable(query).Rows)
            {
                diagnostic          = new Teshis();
                diagnostic.TeshisID = (int)item["TeshisID"];
                diagnostic.Aciklama = item["TeshisAdi"].ToString();
                diagnostics.Add(diagnostic);
            }
            return(diagnostics);
        }
        public List <Teshis> TumTeshisleriGetir()
        {
            List <Teshis> teshisler = new List <Teshis>();
            SqlCommand    cmd       = new SqlCommand("sp_TeshisleriGetir", DBConnection.Conn);

            cmd.CommandType = CommandType.StoredProcedure;
            try
            {
                if (DBConnection.Conn.State != System.Data.ConnectionState.Open)
                {
                    DBConnection.Conn.Open();
                }
                rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    Teshis teshis;
                    while (rdr.Read())
                    {
                        teshis = new Teshis()
                        {
                            ID  = Convert.ToInt32(rdr["ID"]),
                            Adi = rdr["Ad"].ToString()
                        };
                        teshisler.Add(teshis);
                    }
                }
                return(teshisler);
            }
            catch (Exception)
            {
                return(null);
            }
            finally
            {
                rdr.Close();
                DBConnection.Conn.Close();
            }
        }
        private void btnReceteOlustur_Click(object sender, EventArgs e)
        {
            try
            {
                Teshis teshis = cmbTeshisler.SelectedItem as Teshis;

                Recete recete = new Recete()
                {
                    HastaID  = Convert.ToInt32(dgwGununRandevulari.CurrentRow.Cells["HastaID"].Value),
                    DoktorID = Convert.ToInt32(lblDoktorUnvanAdSoyad.Tag),
                    TeshisID = teshis.ID,
                    Tarih    = DateTime.Now, //Gerekirse DateTime formatı değiştirebiliriz.
                };

                recete.ReceteNumarasi = receteBLL.ReceteEkle(recete);


                if (recete.ReceteNumarasi > 0)
                {
                    MessageBox.Show("Reçete oluşturuldu");
                    ListeyiYenile();
                }
                else
                {
                    MessageBox.Show("Reçete oluşturulamadı");
                }

                frmReceteOlusturmaEkrani frm = new frmReceteOlusturmaEkrani();
                frm.txtReceteNumarasi.Text = recete.ReceteNumarasi.ToString();
                frm.ShowDialog();
            }
            catch (Exception)
            {
                MessageBox.Show("Randevu seçimi yapmadan reçete oluşturamazsınız");
            }
        }
        private void DoktoraTeshisAktar()
        {
            if (bstumtani.Current != null)
            {
                long   teshisId          = (bstumtani.Current as Teshis).Id;
                Teshis aktarilacakteshis = teshisler.Find(delegate(Teshis teshis)
                {
                    return(teshis.Id == teshisId);
                }
                                                          );

                //eski kod=if (aktarilacakteshis.Id > 0 && !aktarilacakteshis.Tasiyicimi)
                if (aktarilacakteshis.Id > 0 && !aktarilacakteshis.Kodu.Contains("-"))
                {
                    DoktorTeshis doktorteshis = new DoktorTeshis();
                    doktorteshis.Doktor.Id = Current.AktifDoktorId;
                    doktorteshis.Doktor    = Current.AktifDoktor;
                    doktorteshis.Teshis.Id = aktarilacakteshis.Id;
                    doktorteshis.Teshis    = aktarilacakteshis;
                    doktorteshis.Aktif     = true;

                    bool varmi = doktorteshislistesi.Exists(delegate(DoktorTeshis dteshis)
                    {
                        if (dteshis.Teshis.Id == aktarilacakteshis.Id)
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                                                            );

                    if (varmi)
                    {
                        MessageBox.Show("Bu Teshis listede mevcut.");
                        return;
                    }
                    try
                    {
                        doktorteshis.Insert();
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Hata:" + ex.Message);
                    }

                    doktorteshislistesi.Add(doktorteshis);

                    DoktorTeshisBindGrids();
                }
                else
                {
                    MessageBox.Show("Üst Başlıklar teşhis olarak aktarılamaz");
                }
            }
            else
            {
                MessageBox.Show("Teşhis ilaç aktarmak için ilaç seçmediniz");
            }
        }
        void frmTaniAta_Load(object sender, EventArgs e)
        {
            #region eski kodlar
            //bstumtani.DataSource =Transaction.Instance.ExecuteSql(
            //    "select Id,UstTeshis_Id,Adi Tani,Kodu from teshis where aktif=1 order by adi");
            //trltum.DataSource = bstumtani;
            //if (hastalikmi)
            //    bshastatani.DataSource = Transaction.Instance.ExecuteSql(
            //        "select t.Id,t.UstTeshis_Id,t.Adi Tani,t.Kodu,h.Alerjikmi Alerjik,h.Kronikmi Kronik " +
            //        "    from MuayeneTeshis h " +
            //        "    join muayene m on m.Id=h.muayene_Id" +
            //        "    join teshis t on t.Id=h.teshis_Id" +
            //        "    where h.aktif=1 and (h.Kronikmi=1 or h.Alerjikmi=1) and m.hasta_Id=" + hastaId);
            //else
            //    bshastatani.DataSource = Transaction.Instance.ExecuteSql(
            //    "select t.Id,t.UstTeshis_Id,t.Adi Tani,t.Kodu,h.Alerjikmi Alerjik,h.Kronikmi Kronik " +
            //    "    from MuayeneTeshis h " +
            //    "    join teshis t on t.Id=h.teshis_Id" +
            //    "    where h.aktif=1 and h.muayene_Id=" + muayeneId);
            #endregion

            #region Teshisler doluyor

            Teshis[] teshislistesi = new Teshis[Current.aktifteshisler.Values.Count];
            Current.aktifteshisler.Values.CopyTo(teshislistesi, 0);
            if (teshislistesi != null && teshislistesi.Length > 0)
            {
                teshisler.AddRange(teshislistesi);
            }

            TeshisBind();

            #region GridStyle

            Utility.SetGridStyle(trltum);
            for (int i = 0; i < trltum.Columns.Count; i++)
            {
                if (trltum.Columns[i].Name.Contains("AsiTanim") ||
                    trltum.Columns[i].Name.Contains("UstTeshis") ||
                    trltum.Columns[i].Name.Contains("BildirimiZorunlumu") ||
                    trltum.Columns[i].Name.Contains("Tasiyicimi") ||
                    trltum.Columns[i].Name.Contains("OlumNedenimi"))
                {
                    trltum.Columns[i].Visible = false;
                }
            }
            trltum.Columns[0].Width = 400;
            #endregion

            #endregion

            #region doktorteshisdoluyor

            DoktorTeshis[] doktorteshisleri = Persistence.ReadList <DoktorTeshis>("Select * from DoktorTeshis where Doktor_Id=@prm0 and aktif=1", new object[] { Current.AktifDoktorId });
            if (doktorteshisleri != null && doktorteshisleri.Length > 0)
            {
                doktorteshislistesi.AddRange(doktorteshisleri);
            }

            foreach (DoktorTeshis dentity in doktorteshislistesi)
            {
                dentity.Teshis = Current.GetTeshis(dentity.Teshis.Id);
            }

            DoktorTeshisBind();

            #region GridStyle
            Utility.SetGridStyle(treeListDoktorTeshis);
            for (int i = 0; i < treeListDoktorTeshis.Columns.Count; i++)
            {
                if (treeListDoktorTeshis.Columns[i].Name.Contains("Doktor"))
                {
                    treeListDoktorTeshis.Columns[i].Visible = false;
                }
            }
            treeListDoktorTeshis.Columns[1].Width = 400;
            #endregion

            #endregion

            #region MuayeneTeshis

            MuayeneTeshis[] MuayeneTeshisleri = Persistence.ReadDetail <MuayeneTeshis>("Muayene_Id", Current.AktifMuayeneId);
            if (MuayeneTeshisleri != null && MuayeneTeshisleri.Length > 0)
            {
                muayeneteshislistesi.AddRange(MuayeneTeshisleri);
                foreach (MuayeneTeshis mentity in muayeneteshislistesi)
                {
                    mentity.Teshis = Current.GetTeshis(mentity.Teshis.Id);
                }
            }


            MuayeneTeshisBind();

            #region GridStyle
            Utility.SetGridStyle(trlhasta);
            for (int i = 0; i < trlhasta.Columns.Count; i++)
            {
                if (!trlhasta.Columns[i].Name.Contains("colTeshis") &&
                    !trlhasta.Columns[i].Name.Contains("colTeshisKodu")
                    )
                {
                    trlhasta.Columns[i].Visible = false;
                }
            }
            trlhasta.Columns[0].Width = 250;
            #endregion

            #endregion

            #region eventler

            btnaktarnormal.Click += new EventHandler(btnaktar_Click);
            btnkronik.Click      += new EventHandler(btnkronik_Click);
            btnalerjik.Click     += new EventHandler(btnalerjik_Click);
            btniptal.Click       += new EventHandler(btniptal_Click);
            btntamam.Click       += new EventHandler(btntamam_Click);

            trltum.MouseDoubleClick               += new MouseEventHandler(trltum_MouseDoubleClick);
            trlhasta.MouseDoubleClick             += new MouseEventHandler(trlhasta_MouseDoubleClick);
            simpleButtondoktoraAta.Click          += new EventHandler(simpleButtondoktoraAta_Click);
            simpleButtonDoktordancikar.Click      += new EventHandler(simpleButtonDoktordancikar_Click);
            treeListDoktorTeshis.MouseDoubleClick += new MouseEventHandler(treeListDoktorTeshis_MouseDoubleClick);
            //if(this.formState==myenum.EditMode.emIncele)
            //simpleButtonDoktordancikar.Enabled = false;
            #endregion
            simpleButtondoktoraAta.Enabled = false;
        }
        private void TeshisAktar(object gonderen, Teshis aktarilacakteshis)
        {
            //eskikod=if (aktarilacakteshis != null && aktarilacakteshis.Id > 0 && !aktarilacakteshis.Tasiyicimi
            if (aktarilacakteshis != null && aktarilacakteshis.Id > 0 && !aktarilacakteshis.Kodu.Contains("-"))
            {
                string aktarmatipi = string.Empty;

                if (gonderen != null)
                {
                    aktarmatipi = ((DevExpress.XtraEditors.SimpleButton)(gonderen)).Text;
                }


                MuayeneTeshis doktorteshis = new MuayeneTeshis();
                //doktorteshis.Aciklama = Convert.ToInt16(edtadet.Text);
                if (aktarmatipi == "Kronik Aktar")
                {
                    doktorteshis.Kronikmi  = true;
                    doktorteshis.Alerjikmi = false;
                }
                else
                if (aktarmatipi == "Alerjik Aktar")
                {
                    doktorteshis.Alerjikmi = true;
                    doktorteshis.Kronikmi  = false;
                }
                else
                {
                    doktorteshis.Alerjikmi = false;
                    doktorteshis.Kronikmi  = false;
                }


                doktorteshis.Muayene.Id = Current.AktifMuayeneId;
                doktorteshis.Muayene    = Current.AktifMuayene;
                doktorteshis.Teshis.Id  = aktarilacakteshis.Id;
                doktorteshis.Teshis     = aktarilacakteshis;
                doktorteshis.Aktif      = true;

                ///aynı hasta Kronik ve normal alerjik olabilir bunların validasoyonunu kaldıralım.
                bool varmi = muayeneteshislistesi.Exists(delegate(MuayeneTeshis mteshis)
                {
                    if (mteshis.Teshis.Id == doktorteshis.Teshis.Id)
                    {
                        if (mteshis.Alerjikmi == doktorteshis.Alerjikmi && mteshis.Kronikmi == doktorteshis.Kronikmi)
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }

                                                         );

                if (varmi)
                {
                    MessageBox.Show("Bu Teshis listede mevcut. Aynı teşhis birden fazla aktarılamaz.");
                    return;
                }


                muayeneteshislistesi.Add(doktorteshis);

                HastaTeshisBindGrids();
            }
            else
            {
                MessageBox.Show("Üst Başlıklar teşhis olarak aktarılamaz");
            }
        }
        private void HastaTeshisAktar(object gonderen, TeshisAktarmaTipi aktarimtipi)
        {
            Teshis aktarilacakteshis = null;

            if (aktarimtipi == TeshisAktarmaTipi.TeshisListesindenAktar)
            {
                if (bstumtani.Current == null)
                {
                    MessageBox.Show(" Teşhis seçmediniz !");
                    return;
                }


                long teshisId = (bstumtani.Current as Teshis).Id;
                aktarilacakteshis = teshisler.Find(delegate(Teshis teshis)
                {
                    return(teshis.Id == teshisId);
                }
                                                   );
                TeshisAktar(gonderen, aktarilacakteshis);
            }
            else
            if (aktarimtipi == TeshisAktarmaTipi.DoktorTeshisListesindenAktar)
            {
                bool secerekaktarim = false;
                long teshisId       = 0;
                for (int i = 0; i < treeListDoktorTeshis.Nodes.Count; i++)
                {
                    if (!treeListDoktorTeshis.Nodes[i].HasChildren)
                    {
                        if (treeListDoktorTeshis.Nodes[i].Checked)
                        {
                            secerekaktarim = true;
                            teshisId       = ((Teshis)(treeListDoktorTeshis.Nodes[i][1])).Id; //(bsdoktortani.Current as DoktorTeshis).Teshis.Id;
                            DoktorTeshis doktorteshis = doktorteshislistesi.Find(delegate(DoktorTeshis dteshis)
                            {
                                return(dteshis.Teshis.Id == teshisId);
                            }
                                                                                 );

                            aktarilacakteshis = doktorteshis.Teshis;
                            treeListDoktorTeshis.Nodes[i].Checked = false;
                            TeshisAktar(gonderen, aktarilacakteshis);
                        }
                    }
                }

                if (!secerekaktarim)
                {
                    if (bsdoktortani.Current == null)
                    {
                        MessageBox.Show(" Teşhis seçmediniz !");
                        return;
                    }
                    teshisId = (bsdoktortani.Current as DoktorTeshis).Teshis.Id;
                    DoktorTeshis doktorteshis = doktorteshislistesi.Find(delegate(DoktorTeshis dteshis)
                    {
                        return(dteshis.Teshis.Id == teshisId);
                    }
                                                                         );

                    aktarilacakteshis = doktorteshis.Teshis;
                    TeshisAktar(gonderen, aktarilacakteshis);
                }
            }
        }