Пример #1
0
        //private void AddButton_OnClick(object sender, RoutedEventArgs e)
        //{
        //    //throw new NotImplementedException();
        //    try
        //    {
        //        if (this.NameTextBox.Text.Equals("") || !CheckNameIsExist(this.NameTextBox.Text))
        //        {
        //            var a = new RemindMessageBox1();
        //            a.remindText.Text = (string)FindResource("Message1001"); ;
        //            a.ShowDialog();
        //            return;
        //        }
        //        using (var treatStatusDao = new TreatStatusDao())
        //        {
        //            var treatStatus = new TreatStatus();
        //            treatStatus.Name = this.NameTextBox.Text;
        //            treatStatus.Activated = (bool) this.CheckBox1.IsChecked;
        //            treatStatus.Description = this.DescriptionTextBox.Text;
        //            int lastInsertId = -1;
        //            treatStatusDao.InsertTreatStatus(treatStatus, ref lastInsertId);
        //            //UI
        //            var treatStatusData = new TreatStatusData();
        //            treatStatusData.Id = treatStatus.Id;
        //            treatStatusData.Name = treatStatus.Name;
        //            treatStatusData.Activated = treatStatus.Activated;
        //            treatStatusData.Description = treatStatus.Description;
        //            Datalist.Add(treatStatusData);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        MainWindow.Log.WriteInfoConsole("In CInfectType.xaml.cs:AddButton_OnClick exception messsage: " + ex.Message);
        //    }
        //}

        //private void UpdateButton_OnClick(object sender, RoutedEventArgs e)
        //{
        //    if (ListViewTreatType.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 treatStatusDao = new TreatStatusDao())
        //    {
        //        var condition = new Dictionary<string, object>();
        //        condition["ID"] = Datalist[ListViewTreatType.SelectedIndex].Id;

        //        var fileds = new Dictionary<string, object>();
        //        fileds["NAME"] = NameTextBox.Text;
        //        fileds["DESCRIPTION"] = DescriptionTextBox.Text;
        //        treatStatusDao.UpdateTreatStatus(fileds, condition);
        //        RefreshData();
        //    }
        //}

        private void RefreshData()
        {
            try
            {
                using (var treatStatusDao = new TreatStatusDao())
                {
                    Datalist.Clear();

                    var condition = new Dictionary <string, object>();
                    var list      = treatStatusDao.SelectTreatStatus(condition);
                    foreach (var pa in list)
                    {
                        var treatStatusData = new TreatStatusData();
                        treatStatusData.Id          = pa.Id;
                        treatStatusData.Name        = pa.Name;
                        treatStatusData.Activated   = pa.Activated;
                        treatStatusData.Description = pa.Description;
                        Datalist.Add(treatStatusData);
                    }
                }
            }
            catch (Exception ex)
            {
                MainWindow.Log.WriteInfoConsole("In CInfectType.xaml.cs:AddButton_OnClick exception messsage: " + ex.Message);
            }
        }
Пример #2
0
 private void ListViewCTreatStatus_OnLoaded(object sender, RoutedEventArgs e)
 {
     //throw new NotImplementedException();
     try
     {
         using (var treatStatusDao = new TreatStatusDao())
         {
             Datalist.Clear();
             var condition = new Dictionary <string, object>();
             var list      = treatStatusDao.SelectTreatStatus(condition);
             foreach (var type in list)
             {
                 var treatStatusData = new TreatStatusData
                 {
                     Id          = type.Id,
                     Activated   = type.Activated,
                     Name        = type.Name,
                     Description = type.Description
                 };
                 Datalist.Add(treatStatusData);
             }
         }
         if (Datalist.Count != 0)
         {
             ListViewTreatType.SelectedIndex = 0;
         }
     }
     catch (Exception ex)
     {
         MainWindow.Log.WriteInfoConsole("In CInfectType.xaml.cs:ListViewCInfectType_OnLoaded exception messsage: " + ex.Message);
     }
 }
Пример #3
0
 private bool CheckNameIsExist(string name)
 {
     using (var bedDao = new TreatStatusDao())
     {
         var condition = new Dictionary <string, object>();
         var list      = bedDao.SelectTreatStatus(condition);
         foreach (var pa in list)
         {
             if (name.Equals(pa.Name))
             {
                 return(false);
             }
         }
         return(true);
     }
 }
Пример #4
0
        private void ButtonApply_OnClick(object sender, RoutedEventArgs e)
        {
            if (ListViewTreatType.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 treatStatusDao = new TreatStatusDao())
            {
                var condition = new Dictionary <string, object>();
                condition["ID"] = Datalist[ListViewTreatType.SelectedIndex].Id;

                var fileds = new Dictionary <string, object>();
                fileds["NAME"] = NameTextBox.Text;
                if ((bool)(this.RadioButton1.IsChecked))
                {
                    fileds["ACTIVATED"] = true;
                }
                else if ((bool)(this.RadioButton2.IsChecked))
                {
                    fileds["ACTIVATED"] = false;
                }

                fileds["DESCRIPTION"] = DescriptionTextBox.Text;
                treatStatusDao.UpdateTreatStatus(fileds, condition);
                int temp = this.ListViewTreatType.SelectedIndex;
                RefreshData();
                this.ListViewTreatType.SelectedIndex = temp;
            }
            this.ButtonApply.IsEnabled = false;
        }
Пример #5
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (tbName.Text.Equals("") || tbUid.Text.Equals(""))
            {
                var a = new RemindMessageBox1();
                a.remindText.Text = "患者名称和唯一识别码不能为空.";
                a.ShowDialog();
                return;
            }

            name = tbName.Text;
            if (rbM.IsChecked == true)
            {
                sex = "男";
            }
            else
            {
                sex = "女";
            }
            birthday = dpBirthday.Text;

            if ((bool)this.rbNegative1.IsChecked)
            {
                infectionTypeId = 0;
            }
            else if ((bool)this.rbNegative2.IsChecked)
            {
                using (InfectTypeDao infectTypeDao = new InfectTypeDao())
                {
                    var condition = new Dictionary <string, object>();
                    condition["Name"] = InfectTypeComboBox.Text;
                    infectionName     = InfectTypeComboBox.Text;
                    var list = infectTypeDao.SelectInfectType(condition);
                    if (list != null)
                    {
                        infectionTypeId = list[0].Id;
                    }
                }
            }

            if ((bool)this.rbTreatStatus1.IsChecked)
            {
                treatmentStatus    = 0;
                treatmentStausName = "在治";
            }
            else if ((bool)this.rbTreatStatus2.IsChecked)
            {
                using (TreatStatusDao treatStatusDao = new TreatStatusDao())
                {
                    var condition = new Dictionary <string, object>();
                    condition["Name"]  = StatusComboBox.Text;
                    treatmentStausName = StatusComboBox.Text;
                    var list = treatStatusDao.SelectTreatStatus(condition);
                    if (list != null)
                    {
                        treatmentStatus = list[0].Id;
                    }
                }
            }

            if ((bool)this.rbFixBed1.IsChecked)
            {
                isFixBed = true;
            }
            else if ((bool)this.rbFixBed2.IsChecked)
            {
                isFixBed = false;
            }

            uid = tbUid.Text;

            using (PatientAreaDao patientAreaDao = new PatientAreaDao())
            {
                var condition = new Dictionary <string, object>();
                condition["Name"] = AreaComboBox.Text;
                areaName          = AreaComboBox.Text;
                var list = patientAreaDao.SelectPatientArea(condition);
                if (list != null)
                {
                    areaId = list[0].Id;
                }
            }

            result = System.Windows.Forms.DialogResult.OK;

            using (PatientDao patientDao = new PatientDao())
            {
                Patient patient = new Patient();
                patient.Name          = name;
                patient.Gender        = sex;
                patient.Dob           = birthday;
                patient.InfectTypeId  = infectionTypeId;
                patient.TreatStatusId = treatmentStatus;
                patient.IsFixedBed    = isFixBed;
                patient.PatientId     = uid;
                patient.AreaId        = areaId;
                patient.BedId         = -1;
                int lastInsertId = -1;
                patientDao.InsertPatient(patient, ref lastInsertId);

                InitMedicalOrderData(lastInsertId);

                Basewindow.initContent.IDTextBox.Text   = lastInsertId.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;
                }
                Basewindow.initContent.DatePicker1.Text = DateTime.Parse(patient.Dob).ToString();

                using (InfectTypeDao infectTypeDao = new InfectTypeDao())
                {
                    var condition = new Dictionary <string, object>();
                    condition["ID"] = patient.InfectTypeId;
                    var list = infectTypeDao.SelectInfectType(condition);
                    if ((list != null) && (list.Count > 0))
                    {
                        Basewindow.initContent.InfectTypeComboBox.Text = list[0].Name;
                    }
                }

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

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

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

            //TODO:判断一下当前添加的患者是否满足当前患者组条件,如果满足需要刷新患者列表
            Basewindow.patientGroupPanel.RefreshData();


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

            this.Close();
        }
Пример #6
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            dpBirthday.Text = DateTime.Now.ToString();

            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();
                    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);
            }
        }
Пример #7
0
        private void FillValues(string key)
        {
            IsEditabel = false;
            using (var patientDao = new PatientDao())
            {
                var            condition    = new Dictionary <string, object>();
                List <Patient> patientslist = patientDao.SelectPatient(condition);
                switch (key)
                {
                case "姓名":
                    IsEditabel = true;

                    /*_details.Clear();
                     * foreach (var patient in patientslist)
                     * {
                     *  _details.Add(patient.Name);
                     * }*/
                    break;

                case "性别":
                    _details.Clear();
                    _details.Add("男");
                    _details.Add("女");
                    break;

                case "血型":
                    _details.Clear();
                    _details.Add("O");
                    _details.Add("A");
                    _details.Add("B");
                    _details.Add("AB");

                    break;

                case "婚姻状况":
                    _details.Clear();
                    _details.Add("已婚");
                    _details.Add("未婚");
                    break;

                case "感染情况":
                    _details.Clear();
                    using (var infectTypeDao = new InfectTypeDao())
                    {
                        condition.Clear();
                        var arealist = infectTypeDao.SelectInfectType(condition);
                        foreach (var infectType in arealist)
                        {
                            _details.Add(infectType.Name);
                        }
                        _details.Add("阴性");
                    }
                    break;

                case "治疗状态":
                    _details.Clear();
                    using (TreatStatusDao treatStatusDao = new TreatStatusDao())
                    {
                        var condition1 = new Dictionary <string, object>();
                        var list1      = treatStatusDao.SelectTreatStatus(condition1);
                        foreach (var treatStatuse in list1)
                        {
                            _details.Add(treatStatuse.Name);
                        }
                        _details.Add("在治");
                    }

                    break;

                case "固定床位":
                    _details.Clear();
                    _details.Add("FALSE");
                    _details.Add("TRUE");
                    break;

                case "所属分区":
                    _details.Clear();
                    using (var patientAreaDao = new PatientAreaDao())
                    {
                        condition.Clear();
                        var list = patientAreaDao.SelectPatientArea(condition);
                        foreach (var type in list)
                        {
                            _details.Add(type.Name);
                        }
                    }

                    break;
                }
            }
        }
        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
                    }
                }
            }
        }
Пример #9
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;
        }
Пример #10
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);
            }
        }