private void ButtonApply_OnClick(object sender, RoutedEventArgs e)
        {
            if (isNew)
            {
                //throw new NotImplementedException();
                try
                {
                    if (this.NameTextBox.Text.Equals("") || !CheckNameIsExist(this.NameTextBox.Text) || SeqTextBox.Text.Equals(""))
                    {
                        var a = new RemindMessageBox1();
                        a.remindText.Text = "请完善信息!";
                        a.ShowDialog();
                        return;
                    }

                    using (PatientAreaDao patientAreaDao = new PatientAreaDao())
                    {
                        PatientArea patientArea = new PatientArea();
                        patientArea.Name = this.NameTextBox.Text;
                        var condition = new Dictionary <string, object>();
                        using (var infectTypeDao = new InfectTypeDao())
                        {
                            condition.Clear();
                            condition["Name"] = InfectionComboBox.Text;
                            var arealist = infectTypeDao.SelectInfectType(condition);
                            if (arealist.Count == 1)
                            {
                                patientArea.InfectTypeId = arealist[0].Id;
                            }
                            else
                            {
                                patientArea.InfectTypeId = 1;
                            }
                        }
                        if ((bool)this.RadioButton1.IsChecked)
                        {
                            patientArea.Type = "0";
                        }
                        else if ((bool)this.RadioButton2.IsChecked)
                        {
                            patientArea.Type = "1";
                        }
                        patientArea.Description = this.DescriptionTextBox.Text;
                        patientArea.Position    = this.PositionTextBox.Text;
                        patientArea.Seq         = int.Parse(this.SeqTextBox.Text);
                        int lastInsertId = -1;
                        patientAreaDao.InsertPatientArea(patientArea, ref lastInsertId);
                        //UI
                        PatientAreaData patientAreaData = new PatientAreaData();
                        patientAreaData.Name = patientArea.Name;
                        if ((bool)this.RadioButton1.IsChecked)
                        {
                            patientAreaData.InfectionType = "阴性";
                            patientAreaData.Type          = "0";
                        }

                        else if ((bool)this.RadioButton2.IsChecked)
                        {
                            patientAreaData.Type = "1";
                        }

                        patientAreaData.Description = patientArea.Description;
                        patientAreaData.Position    = patientArea.Position;
                        patientAreaData.Seq         = patientArea.Seq;

                        Datalist.Add(patientAreaData);
                    }
                }
                catch (Exception ex)
                {
                    MainWindow.Log.WriteInfoConsole("In CPatientArea.xaml.cs:ButtonApply_OnClick exception messsage: " + ex.Message);
                    return;
                }
                this.ButtonNew.IsEnabled    = true;
                this.ButtonDelete.IsEnabled = true;
                this.ButtonApply.IsEnabled  = true;
                this.ButtonCancel.IsEnabled = true;
            }
            else
            {
                if (ListViewPatientArea.SelectedIndex == -1)
                {
                    return;
                }

                if (this.NameTextBox.Text.Equals(""))
                {
                    var a = new RemindMessageBox1();
                    a.remindText.Text = (string)FindResource("Message1001");;
                    a.ShowDialog();
                    return;
                }

                //throw new NotImplementedException();
                using (var patientAreaDao = new PatientAreaDao())
                {
                    var condition = new Dictionary <string, object>();
                    condition["ID"] = Datalist[ListViewPatientArea.SelectedIndex].Id;

                    var fileds = new Dictionary <string, object>();
                    fileds["NAME"] = NameTextBox.Text;
                    var condition2 = new Dictionary <string, object>();
                    using (var infectTypeDao = new InfectTypeDao())
                    {
                        condition2.Clear();
                        condition2["NAME"] = InfectionComboBox.Text;
                        var arealist = infectTypeDao.SelectInfectType(condition2);
                        if (arealist.Count == 1)
                        {
                            fileds["INFECTTYPEID"] = arealist[0].Id;
                        }
                        else
                        {
                            fileds["INFECTTYPEID"] = 1;
                        }
                    }
                    if ((bool)this.RadioButton1.IsChecked)
                    {
                        fileds["TYPE"] = "0";
                    }
                    else if ((bool)this.RadioButton2.IsChecked)
                    {
                        fileds["TYPE"] = "1";
                    }
                    fileds["SEQ"]         = SeqTextBox.Text;
                    fileds["POSITION"]    = PositionTextBox.Text;
                    fileds["DESCRIPTION"] = DescriptionTextBox.Text;
                    patientAreaDao.UpdatePatientArea(fileds, condition);
                    int temp = this.ListViewPatientArea.SelectedIndex;
                    RefreshData();
                    this.ListViewPatientArea.SelectedIndex = temp;
                }
                isNew = false;
            }
            this.ButtonApply.IsEnabled  = false;
            this.ButtonCancel.IsEnabled = false;
        }
        private void ListViewCPatientArea_OnLoaded(object sender, RoutedEventArgs e)
        {
            //throw new NotImplementedException();
            try
            {
                using (PatientAreaDao patientAreaDao = new PatientAreaDao())
                {
                    Datalist.Clear();
                    Dictionary <string, object> condition = new Dictionary <string, object>();
                    var list = patientAreaDao.SelectPatientArea(condition);
                    foreach (PatientArea pa in list)
                    {
                        PatientAreaData patientAreaData = new PatientAreaData();
                        patientAreaData.Id       = pa.Id;
                        patientAreaData.Name     = pa.Name;
                        patientAreaData.Type     = pa.Type;
                        patientAreaData.Position = pa.Position;
                        patientAreaData.Seq      = pa.Seq;
                        {
                            using (var infectTypeDao = new InfectTypeDao())
                            {
                                condition.Clear();
                                condition["ID"] = pa.InfectTypeId;
                                var arealist = infectTypeDao.SelectInfectType(condition);
                                if (arealist.Count == 1)
                                {
                                    patientAreaData.InfectionType = arealist[0].Name;
                                }
                            }
                        }
                        if (patientAreaData.Type.Equals("0"))
                        {
                            this.InfectionComboBox.IsEnabled = false;
                            this.RadioButton1.IsChecked      = true;
                            patientAreaData.InfectionType    = "阴性";
                        }

                        else if (patientAreaData.Type.Equals("1"))
                        {
                            this.InfectionComboBox.IsEnabled = true;
                            this.RadioButton2.IsChecked      = true;
                        }
                        patientAreaData.Description = pa.Description;
                        Datalist.Add(patientAreaData);
                    }
                }
                if (Datalist.Count != 0)
                {
                    ListViewPatientArea.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MainWindow.Log.WriteInfoConsole("In CPatientArea.xaml.cs:AddButton_OnClick exception messsage: " + ex.Message);
            }
            InfectionComboBox.Items.Clear();
            try
            {
                using (var infectTypeDao = new InfectTypeDao())
                {
                    //Datalist1.Clear();
                    var condition = new Dictionary <string, object>();
                    var list      = infectTypeDao.SelectInfectType(condition);
                    foreach (var type in list)
                    {
                        InfectionComboBox.Items.Add(type.Name);
                    }
                }
            }
            catch (Exception ex)
            {
                MainWindow.Log.WriteInfoConsole("In CPatientArea.xaml.cs:ListViewCInfectType_OnLoaded exception messsage: " + ex.Message);
            }
        }
示例#3
0
        private void ListViewCBed_OnLoaded(object sender, RoutedEventArgs e)
        {
            //throw new NotImplementedException();
            #region refresh data list
            try
            {
                using (var bedDao = new BedDao())
                {
                    Datalist.Clear();
                    var condition = new Dictionary <string, object>();
                    var list      = bedDao.SelectBed(condition);
                    foreach (var pa in list)
                    {
                        var bedData = new BedData();
                        bedData.Id   = pa.Id;
                        bedData.Name = pa.Name;
                        {
                            using (var patientAreaDao = new PatientAreaDao())
                            {
                                condition.Clear();
                                condition["ID"] = pa.PatientAreaId;
                                var arealist = patientAreaDao.SelectPatientArea(condition);
                                if (arealist.Count == 1)
                                {
                                    bedData.PatientArea = arealist[0].Name;
                                }
                            }
                        }

                        //{
                        //    using (var machineTypeDao = new MachineTypeDao())
                        //    {
                        //        condition.Clear();
                        //        condition["ID"] = pa.MachineTypeId;
                        //        var arealist = machineTypeDao.SelectMachineType(condition);
                        //        if (arealist.Count == 1)
                        //        {
                        //            bedData.MachineType = arealist[0].Name;
                        //        }
                        //    }

                        //}

                        if (pa.MachineTypeId == 0)
                        {
                            bedData.MachineType = "单泵机";
                        }
                        else if (pa.MachineTypeId == 1)
                        {
                            bedData.MachineType = "双泵机";
                        }

                        {
                            using (var treatMethodDao = new TreatTypeDao())
                            {
                                condition.Clear();
                                condition["ID"] = pa.TreatTypeId;
                                var arealist = treatMethodDao.SelectTreatType(condition);
                                if (arealist.Count == 1)
                                {
                                    bedData.TreatType = arealist[0].Name;
                                }
                            }
                            using (var infectTypeDao = new InfectTypeDao())
                            {
                                condition.Clear();
                                condition["ID"] = pa.InfectTypeId;
                                var arealist = infectTypeDao.SelectInfectType(condition);
                                if (arealist.Count == 1)
                                {
                                    bedData.InfectType = arealist[0].Name;
                                }
                            }
                        }
                        bedData.IsAvailable = pa.IsAvailable;
                        bedData.IsOccupy    = pa.IsOccupy;
                        bedData.IsTemp      = pa.IsTemp;
                        bedData.Description = pa.Description;
                        Datalist.Add(bedData);
                    }
                }
            }
            catch (Exception ex)
            {
                MainWindow.Log.WriteInfoConsole("In CBed.xaml.cs:ListViewCPatientRoom_OnLoaded 3 exception messsage: " + ex.Message);
            }
            #endregion
        }
示例#4
0
        private void RefreshData()
        {
            try
            {
                using (var bedDao = new BedDao())
                {
                    Datalist.Clear();
                    var condition = new Dictionary <string, object>();
                    var list      = bedDao.SelectBed(condition);
                    foreach (DAOModule.Bed pa in list)
                    {
                        var bedData = new BedData();
                        bedData.Id   = pa.Id;
                        bedData.Name = pa.Name;
                        {
                            /* using (var patientRoomDao = new PatientRoomDao())
                             * {
                             *   condition.Clear();
                             *   condition["ID"] = pa.PatientRoomId;
                             *   var arealist = patientRoomDao.SelectPatientRoom(condition);
                             *   if (arealist.Count == 1)
                             *   {
                             *       bedData.PatientRoom = arealist[0].Name;
                             *   }
                             * }*/

                            using (var patientAreaDao = new PatientAreaDao())
                            {
                                condition.Clear();
                                condition["ID"] = pa.PatientAreaId;
                                var arealist = patientAreaDao.SelectPatientArea(condition);
                                if (arealist.Count == 1)
                                {
                                    bedData.PatientArea = arealist[0].Name;
                                }
                            }

                            using (var infectTypeDao = new InfectTypeDao())
                            {
                                condition.Clear();
                                condition["ID"] = pa.InfectTypeId;
                                var arealist = infectTypeDao.SelectInfectType(condition);
                                if (arealist.Count == 1)
                                {
                                    bedData.InfectType = arealist[0].Name;
                                }
                            }
                        }
                        //{
                        //    using (var machineTypeDao = new MachineTypeDao())
                        //    {
                        //        condition.Clear();
                        //        condition["ID"] = pa.MachineTypeId;
                        //        var arealist = machineTypeDao.SelectMachineType(condition);
                        //        if (arealist.Count == 1)
                        //        {
                        //            bedData.MachineType = arealist[0].Name;
                        //        }
                        //    }
                        //}
                        if (pa.MachineTypeId == 0)
                        {
                            bedData.MachineType = "单泵机";
                        }
                        else if (pa.MachineTypeId == 1)
                        {
                            bedData.MachineType = "双泵机";
                        }
                        bedData.IsAvailable = pa.IsAvailable;
                        bedData.IsOccupy    = pa.IsOccupy;
                        bedData.IsTemp      = pa.IsTemp;
                        bedData.Description = pa.Description;
                        Datalist.Add(bedData);
                    }
                }
            }
            catch (Exception ex)
            {
                MainWindow.Log.WriteInfoConsole("In CBed.xaml.cs:AddButton_OnClick exception messsage: " + ex.Message);
            }
        }
        private void ListBoxPatient_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.ListBoxPatient.SelectedIndex != -1)
            {
                using (PatientDao patientDao = new PatientDao())
                {
                    var condition = new Dictionary <string, object>();
                    condition["ID"] = Datalist[this.ListBoxPatient.SelectedIndex].Id;
                    var list = patientDao.SelectPatient(condition);
                    if ((list != null) && (list.Count > 0))
                    {
                        Patient patient = list[0];
                        Basewindow.initContent.IDTextBox.Text   = patient.PatientId.ToString();
                        Basewindow.initContent.NameTextBox.Text = patient.Name;
                        if (patient.Gender.Equals("男"))
                        {
                            Basewindow.initContent.RadioButton1.IsChecked = true;
                        }
                        else if (patient.Gender.Equals("女"))
                        {
                            Basewindow.initContent.RadioButton2.IsChecked = true;
                        }
                        try
                        {
                            Basewindow.initContent.DatePicker1.Text = DateTime.Parse(patient.Dob).ToString();
                        }
                        catch (Exception)
                        {
                            Basewindow.initContent.DatePicker1.Text = "";
                        }

                        Basewindow.initContent.NationalityTextBox.Text = patient.Nationality;

                        if (patient.Gender.Equals("未婚"))
                        {
                            Basewindow.initContent.MarriageComboBox.SelectedIndex = 0;
                        }
                        else if (patient.Gender.Equals("已婚"))
                        {
                            Basewindow.initContent.MarriageComboBox.SelectedIndex = 1;
                        }

                        Basewindow.initContent.HeightTextBox.Text    = patient.Height;
                        Basewindow.initContent.BloodTypeTextBox.Text = patient.BloodType;

                        if (patient.InfectTypeId == 0)
                        {
                            Basewindow.initContent.RadioButton5.IsChecked = true;
                        }
                        else
                        {
                            Basewindow.initContent.RadioButton6.IsChecked = true;
                            using (InfectTypeDao infectTypeDao = new InfectTypeDao())
                            {
                                var condition1 = new Dictionary <string, object>();
                                condition1["ID"] = patient.InfectTypeId;
                                var list1 = infectTypeDao.SelectInfectType(condition1);
                                if ((list1 != null) && (list1.Count > 0))
                                {
                                    Basewindow.initContent.InfectTypeComboBox.Text = list1[0].Name;
                                }
                            }
                        }
                        if (patient.TreatStatusId == 0)
                        {
                            Basewindow.initContent.rbTreatStatus1.IsChecked = true;
                        }
                        else
                        {
                            Basewindow.initContent.rbTreatStatus2.IsChecked = true;
                            using (TreatStatusDao treatStatusDao = new TreatStatusDao())
                            {
                                var condition1 = new Dictionary <string, object>();
                                condition1["ID"] = patient.TreatStatusId;
                                var list1 = treatStatusDao.SelectTreatStatus(condition1);
                                if ((list1 != null) && (list1.Count > 0))
                                {
                                    Basewindow.initContent.StatusComboBox.Text = list1[0].Name;
                                }
                            }
                        }

                        if (patient.IsFixedBed)
                        {
                            Basewindow.initContent.RadioButton3.IsChecked = true;
                        }
                        else
                        {
                            Basewindow.initContent.RadioButton4.IsChecked = true;
                        }

                        using (PatientAreaDao patientAreaDao = new PatientAreaDao())
                        {
                            var condition1 = new Dictionary <string, object>();
                            condition1["ID"] = patient.AreaId;
                            var list1 = patientAreaDao.SelectPatientArea(condition1);
                            if ((list1 != null) && (list1.Count > 0))
                            {
                                Basewindow.initContent.AreaComboBox.Text = list1[0].Name;
                            }
                        }

                        Basewindow.initContent.PatientIDTextBox.Text = patient.Id.ToString();
                        Basewindow.initContent.MobileTextBox.Text    = patient.Mobile;
                        Basewindow.initContent.WeixinhaoTextBox.Text = patient.WeiXinHao;
                        Basewindow.initContent.PaymentTextBox.Text   = patient.Payment;
                        Basewindow.initContent.Discription.Text      = patient.Description;

                        Basewindow.initContent.ButtonApply.IsEnabled  = false;
                        Basewindow.initContent.ButtonCancel.IsEnabled = false;
                        Basewindow.initContent.ButtonDelete.IsEnabled = true;

                        #region orderContent
                        Basewindow.orderContent.IDTextBox.Text   = patient.PatientId.ToString();
                        Basewindow.orderContent.NameTextBox.Text = patient.Name;
                        if (patient.Gender.Equals("男"))
                        {
                            Basewindow.orderContent.RadioButton1.IsChecked = true;
                        }
                        else if (patient.Gender.Equals("女"))
                        {
                            Basewindow.orderContent.RadioButton2.IsChecked = true;
                        }
                        try
                        {
                            Basewindow.orderContent.DatePicker1.Text = DateTime.Parse(patient.Dob).ToString();
                        }
                        catch (Exception)
                        {
                            Basewindow.orderContent.DatePicker1.Text = "";
                        }

                        Basewindow.orderContent.NationalityTextBox.Text = patient.Nationality;

                        if (patient.Gender.Equals("未婚"))
                        {
                            Basewindow.orderContent.MarriageComboBox.SelectedIndex = 0;
                        }
                        else if (patient.Gender.Equals("已婚"))
                        {
                            Basewindow.orderContent.MarriageComboBox.SelectedIndex = 1;
                        }

                        Basewindow.orderContent.HeightTextBox.Text    = patient.Height;
                        Basewindow.orderContent.BloodTypeTextBox.Text = patient.BloodType;

                        if (patient.InfectTypeId == 0)
                        {
                            Basewindow.orderContent.RadioButton5.IsChecked = true;
                        }
                        else
                        {
                            Basewindow.orderContent.RadioButton6.IsChecked = true;
                            using (InfectTypeDao infectTypeDao = new InfectTypeDao())
                            {
                                var condition1 = new Dictionary <string, object>();
                                condition1["ID"] = patient.InfectTypeId;
                                var list1 = infectTypeDao.SelectInfectType(condition1);
                                if ((list1 != null) && (list1.Count > 0))
                                {
                                    Basewindow.orderContent.InfectTypeComboBox.Text = list1[0].Name;
                                }
                            }
                        }

                        using (TreatStatusDao treatStatusDao = new TreatStatusDao())
                        {
                            var condition1 = new Dictionary <string, object>();
                            condition1["ID"] = patient.TreatStatusId;
                            var list1 = treatStatusDao.SelectTreatStatus(condition1);
                            if ((list1 != null) && (list1.Count > 0))
                            {
                                Basewindow.orderContent.StatusComboBox.Text = list1[0].Name;
                            }
                        }

                        if (patient.IsFixedBed)
                        {
                            Basewindow.orderContent.RadioButton3.IsChecked = true;
                        }
                        else
                        {
                            Basewindow.orderContent.RadioButton4.IsChecked = true;
                        }

                        using (PatientAreaDao patientAreaDao = new PatientAreaDao())
                        {
                            var condition1 = new Dictionary <string, object>();
                            condition1["ID"] = patient.AreaId;
                            var list1 = patientAreaDao.SelectPatientArea(condition1);
                            if ((list1 != null) && (list1.Count > 0))
                            {
                                Basewindow.orderContent.AreaComboBox.Text = list1[0].Name;
                            }
                        }
                        Basewindow.orderContent.RefreshData();

                        Basewindow.orderContent.PatientIDTextBox.Text = patient.PatientId;
                        Basewindow.orderContent.MobileTextBox.Text    = patient.Mobile;
                        Basewindow.orderContent.WeixinhaoTextBox.Text = patient.WeiXinHao;
                        Basewindow.orderContent.PaymentTextBox.Text   = patient.Payment;
                        #endregion
                    }
                }
            }
        }
示例#6
0
        public void ReLoad()
        {
            try
            {
                using (InfectTypeDao infectTypeDao = new InfectTypeDao())
                {
                    Dictionary <string, object> condition = new Dictionary <string, object>();
                    var list = infectTypeDao.SelectInfectType(condition);
                    InfectTypeComboBox.Items.Clear();
                    //InfectTypeComboBox.Items.Add("所有");
                    //InfectTypeComboBox.Items.Add("");
                    foreach (InfectType type in list)
                    {
                        InfectTypeComboBox.Items.Add(type.Name);
                    }
                    InfectTypeComboBox.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MainWindow.Log.WriteInfoConsole("In Init.xaml.cs:Init_OnLoaded InfectType ComboxItem exception messsage: " + ex.Message);
            }


            try
            {
                using (var treatStatusDao = new TreatStatusDao())
                {
                    var condition = new Dictionary <string, object>();
                    condition["Activated"] = true;
                    var list = treatStatusDao.SelectTreatStatus(condition);
                    StatusComboBox.Items.Clear();
                    //StatusComboBox.Items.Add("在治");
                    foreach (var type in list)
                    {
                        StatusComboBox.Items.Add(type.Name);
                    }
                    StatusComboBox.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MainWindow.Log.WriteInfoConsole("In Init.xaml.cs:Init_OnLoaded TreatStatus ComboxItem exception messsage: " + ex.Message);
            }

            try
            {
                using (var patientAreaDao = new PatientAreaDao())
                {
                    var condition = new Dictionary <string, object>();
                    var list      = patientAreaDao.SelectPatientArea(condition);
                    AreaComboBox.Items.Clear();
                    foreach (var type in list)
                    {
                        AreaComboBox.Items.Add(type.Name);
                    }
                    AreaComboBox.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MainWindow.Log.WriteInfoConsole("In Init.xaml.cs:Init_OnLoaded TreatStatus ComboxItem exception messsage: " + ex.Message);
            }

            this.MarriageComboBox.Items.Clear();
            this.MarriageComboBox.Items.Add("未婚");
            this.MarriageComboBox.Items.Add("已婚");
            MarriageComboBox.SelectedIndex = 0;
        }
示例#7
0
        //private void AddNewPatient()
        //{
        //    using (PatientDao patientDao = new PatientDao())
        //    {
        //        Patient patient = new Patient();

        //        patient.Name = NameTextBox.Text;

        //        if ((bool)RadioButton1.IsChecked)
        //            patient.Gender = "男";
        //        else if ((bool)RadioButton2.IsChecked)
        //            patient.Gender = "女";

        //        patient.Dob = DatePicker1.Text;
        //        patient.Nationality= NationalityTextBox.Text;
        //        patient.Marriage  = MarriageComboBox.Text;
        //        patient.Height  = HeightTextBox.Text;
        //        patient.BloodType  = BloodTypeTextBox.Text;


        //        if ((bool)RadioButton5.IsChecked)
        //        {
        //            patient.InfectTypeId = 0;
        //        }
        //        else if ((bool)RadioButton6.IsChecked)
        //        {

        //            using (InfectTypeDao infectTypeDao = new InfectTypeDao())
        //            {
        //                var condition1 = new Dictionary<string, object>();
        //                condition1["NAME"] = InfectTypeComboBox.Text;
        //                var list1 = infectTypeDao.SelectInfectType(condition1);
        //                if ((list1 != null) && (list1.Count > 0))
        //                {
        //                    patient.InfectTypeId = list1[0].Id;
        //                }
        //            }
        //        }

        //        using (TreatStatusDao treatStatusDao = new TreatStatusDao())
        //        {
        //            var condition1 = new Dictionary<string, object>();
        //            condition1["NAME"] = StatusComboBox.Text;
        //            var list1 = treatStatusDao.SelectTreatStatus(condition1);
        //            if ((list1 != null) && (list1.Count > 0))
        //            {
        //                patient.TreatStatusId  = list1[0].Id;
        //            }
        //        }

        //        if ((bool)RadioButton3.IsChecked)
        //            patient.IsFixedBed = true;
        //        else if ((bool)RadioButton4.IsChecked)
        //            patient.IsFixedBed = false;

        //        using (PatientAreaDao patientAreaDao = new PatientAreaDao())
        //        {
        //            var condition1 = new Dictionary<string, object>();
        //            condition1["NAME"] = AreaComboBox.Text;
        //            var list1 = patientAreaDao.SelectPatientArea(condition1);
        //            if ((list1 != null) && (list1.Count > 0))
        //            {
        //                patient.AreaId = list1[0].Id;
        //            }
        //        }
        //        patient.PatientId = PatientIDTextBox.Text;
        //        patient.Mobile = MobileTextBox.Text;
        //        patient.WeiXinHao = WeixinhaoTextBox.Text;
        //        patient.Payment = PaymentTextBox.Text;
        //        int lastInsertId = -1;
        //        patientDao.InsertPatient(patient, ref lastInsertId);

        //    }
        //}

        //private bool CheckInfo()
        //{
        //    if (
        //        MobileTextBox.Text == ""
        //        )
        //        return false;
        //    else return true;
        //}


        private void ButtonApply_OnClick(object sender, RoutedEventArgs e)
        {
            //if (CheckInfo() == false)
            //{
            //    System.Windows.Forms.MessageBox.Show("请完善信息,*必填!");
            //    return;
            //}

            //if (isNewAdded == true)
            //{
            //    AddNewPatient();
            //    isNewAdded = false;
            //    return;
            //}
            if (Basewindow.patientGroupPanel.ListBoxPatient.SelectedIndex == -1)
            {
                return;
            }



            this.ButtonNew.IsEnabled    = true;
            this.ButtonDelete.IsEnabled = true;
            this.ButtonApply.IsEnabled  = false;

            using (PatientDao patientDao = new PatientDao())
            {
                var condition = new Dictionary <string, object>();
                condition["ID"] = Basewindow.patientGroupPanel.Datalist[Basewindow.patientGroupPanel.ListBoxPatient.SelectedIndex].Id;

                var fileds = new Dictionary <string, object>();

                fileds["NAME"] = NameTextBox.Text;

                if ((bool)RadioButton1.IsChecked)
                {
                    fileds["GENDER"] = "男";
                }
                else if ((bool)RadioButton2.IsChecked)
                {
                    fileds["GENDER"] = "女";
                }

                fileds["DOB"]         = DatePicker1.Text;
                fileds["NATIONALITY"] = NationalityTextBox.Text;
                fileds["MARRIAGE"]    = MarriageComboBox.Text;
                fileds["HEIGHT"]      = HeightTextBox.Text;
                fileds["BLOODTYPE"]   = BloodTypeTextBox.Text;


                if ((bool)RadioButton5.IsChecked)
                {
                    fileds["INFECTTYPEID"] = 0;
                }
                else if ((bool)RadioButton6.IsChecked)
                {
                    using (InfectTypeDao infectTypeDao = new InfectTypeDao())
                    {
                        var condition1 = new Dictionary <string, object>();
                        condition1["NAME"] = InfectTypeComboBox.Text;
                        var list1 = infectTypeDao.SelectInfectType(condition1);
                        if ((list1 != null) && (list1.Count > 0))
                        {
                            fileds["INFECTTYPEID"] = list1[0].Id;
                        }
                    }
                }

                if ((bool)rbTreatStatus1.IsChecked)
                {
                    fileds["TREATSTATUSID"] = 0;
                }
                else if ((bool)rbTreatStatus2.IsChecked)
                {
                    using (TreatStatusDao treatStatusDao = new TreatStatusDao())
                    {
                        var condition1 = new Dictionary <string, object>();
                        condition1["NAME"] = StatusComboBox.Text;
                        var list1 = treatStatusDao.SelectTreatStatus(condition1);
                        if ((list1 != null) && (list1.Count > 0))
                        {
                            fileds["TREATSTATUSID"] = list1[0].Id;
                        }
                    }
                }


                if ((bool)RadioButton3.IsChecked)
                {
                    fileds["ISFIXEDBED"] = true;
                }
                else if ((bool)RadioButton4.IsChecked)
                {
                    fileds["ISFIXEDBED"] = false;
                }

                using (PatientAreaDao patientAreaDao = new PatientAreaDao())
                {
                    var condition1 = new Dictionary <string, object>();
                    condition1["NAME"] = AreaComboBox.Text;
                    var list1 = patientAreaDao.SelectPatientArea(condition1);
                    if ((list1 != null) && (list1.Count > 0))
                    {
                        fileds["AREAID"] = list1[0].Id;
                    }
                }

                fileds["PATIENTID"]   = IDTextBox.Text;
                fileds["MOBILE"]      = MobileTextBox.Text;
                fileds["WEIXINHAO"]   = WeixinhaoTextBox.Text;
                fileds["PAYMENT"]     = PaymentTextBox.Text;
                fileds["DESCRIPTION"] = Discription.Text;


                patientDao.UpdatePatient(fileds, condition);
            }
        }