private void RefreshData() { try { using (var infectTypeDao = new InfectTypeDao()) { Datalist.Clear(); var condition = new Dictionary <string, object>(); var list = infectTypeDao.SelectInfectType(condition); foreach (var pa in list) { var infectTypeData = new InfectTypeData(); infectTypeData.Id = pa.Id; infectTypeData.Name = pa.Name; infectTypeData.Description = pa.Description; Datalist.Add(infectTypeData); } } } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In CInfectType.xaml.cs:AddButton_OnClick exception messsage: " + ex.Message); } }
private void CPatientArea_OnLoaded(object sender, RoutedEventArgs e) { #region fill infecttype combox items this.InfectionComboBox.Items.Clear(); try { using (var infectTypeDao = new InfectTypeDao()) { var condition = new Dictionary <string, object>(); var list = infectTypeDao.SelectInfectType(condition); foreach (var pa in list) { this.InfectionComboBox.Items.Add(pa.Name); } if (list.Count > 0) { this.InfectionComboBox.SelectedIndex = 0; } } } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In CPatientArea.xaml.cs:ListViewCPatientRoom_OnLoaded 2 exception messsage: " + ex.Message); } #endregion }
private void ListViewInfectType_OnLoaded(object sender, RoutedEventArgs e) { //throw new NotImplementedException(); try { using (var infectTypeDao = new InfectTypeDao()) { Datalist.Clear(); var infectType = new InfectType(); var condition = new Dictionary <string, object>(); var list = infectTypeDao.SelectInfectType(condition); foreach (var type in list) { var infectTypeData = new InfectTypeData { Id = type.Id, Name = type.Name, Description = type.Description }; Datalist.Add(infectTypeData); } } if (Datalist.Count != 0) { ListViewInfectType.SelectedIndex = 0; } } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In CInfectType.xaml.cs:ListViewCInfectType_OnLoaded exception messsage: " + ex.Message); } }
private void RefreshData() { 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); } } } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In CPatientArea.xaml.cs:AddButton_OnClick exception messsage: " + ex.Message); } }
private void ListViewCPatientRoom_OnLoaded(object sender, RoutedEventArgs e) { #region refresh data list try { using (var patientRoomDao = new PatientRoomDao()) { Datalist.Clear(); var condition = new Dictionary <string, object>(); var list = patientRoomDao.SelectPatientRoom(condition); foreach (var pa in list) { var patientRoomData = new PatientRoomData(); patientRoomData.Id = pa.Id; patientRoomData.Name = pa.Name; { using (var patientAreaDao = new PatientAreaDao()) { condition.Clear(); condition["ID"] = pa.PatientAreaId; var arealist = patientAreaDao.SelectPatientArea(condition); if (arealist.Count == 1) { patientRoomData.PatientArea = arealist[0].Name; } } } { using (var infectTypeDao = new InfectTypeDao()) { condition.Clear(); condition["ID"] = pa.InfectTypeId; var arealist = infectTypeDao.SelectInfectType(condition); if (arealist.Count == 1) { patientRoomData.InfectType = arealist[0].Name; } } } patientRoomData.Description = pa.Description; Datalist.Add(patientRoomData); } } } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In CPatientRoom.xaml.cs:ListViewCPatientRoom_OnLoaded 3 exception messsage: " + ex.Message); } #endregion }
private void AddButton_OnClick(object sender, RoutedEventArgs e) { //throw new NotImplementedException(); try { using (var patientRoomDao = new PatientRoomDao()) { var patientRoom = new PatientRoom(); patientRoom.Name = this.NameTextBox.Text; var condition = new Dictionary <string, object>(); using (var patientAreaDao = new PatientAreaDao()) { condition.Clear(); condition["Name"] = ComboBoxPatientArea.Text; var arealist = patientAreaDao.SelectPatientArea(condition); if (arealist.Count == 1) { patientRoom.PatientAreaId = arealist[0].Id; } } using (var infectTypeDao = new InfectTypeDao()) { condition.Clear(); condition["Name"] = ComboBoxInfectType.Text; var arealist = infectTypeDao.SelectInfectType(condition); if (arealist.Count == 1) { patientRoom.InfectTypeId = arealist[0].Id; } } patientRoom.Description = this.DescriptionTextBox.Text; int lastInsertId = -1; patientRoomDao.InsertPatientRoom(patientRoom, ref lastInsertId); //UI PatientRoomData patientRoomData = new PatientRoomData(); patientRoomData.Id = patientRoom.Id; patientRoomData.Name = patientRoom.Name; patientRoomData.PatientArea = ComboBoxPatientArea.Text; patientRoomData.InfectType = ComboBoxInfectType.Text; patientRoomData.Description = patientRoom.Description; Datalist.Add(patientRoomData); } } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In CPatientRoom.xaml.cs:AddButton_OnClick exception messsage: " + ex.Message); } }
private void RefreshData() { try { using (var patientRoomDao = new PatientRoomDao()) { Datalist.Clear(); Dictionary <string, object> condition = new Dictionary <string, object>(); var list = patientRoomDao.SelectPatientRoom(condition); foreach (PatientRoom pa in list) { var patientRoomData = new PatientRoomData(); patientRoomData.Id = pa.Id; patientRoomData.Name = pa.Name; { using (var patientAreaDao = new PatientAreaDao()) { condition.Clear(); condition["ID"] = pa.PatientAreaId; var arealist = patientAreaDao.SelectPatientArea(condition); if (arealist.Count == 1) { patientRoomData.PatientArea = arealist[0].Name; } } } { using (var infectTypeDao = new InfectTypeDao()) { condition.Clear(); condition["ID"] = pa.InfectTypeId; var arealist = infectTypeDao.SelectInfectType(condition); if (arealist.Count == 1) { patientRoomData.InfectType = arealist[0].Name; } } } patientRoomData.Description = pa.Description; Datalist.Add(patientRoomData); } } } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In CPatientArea.xaml.cs:AddButton_OnClick exception messsage: " + ex.Message); } }
private bool CheckNameIsExist(string name) { using (var bedDao = new InfectTypeDao()) { var condition = new Dictionary <string, object>(); var list = bedDao.SelectInfectType(condition); foreach (var pa in list) { if (name.Equals(pa.Name)) { return(false); } } return(true); } }
private void ButtonDelete_OnClick(object sender, RoutedEventArgs e) { if (ListViewInfectType.SelectedIndex == -1) { return; } //throw new NotImplementedException(); using (var infectTypeDao = new InfectTypeDao()) { infectTypeDao.DeleteInfectType(Datalist[ListViewInfectType.SelectedIndex].Id); RefreshData(); } this.ButtonDelete.IsEnabled = false; this.ButtonApply.IsEnabled = false; this.ButtonCancel.IsEnabled = false; isNew = false; }
private void UpdateButton_OnClick(object sender, RoutedEventArgs e) { //throw new NotImplementedException(); using (var patientRoomDao = new PatientRoomDao()) { var condition = new Dictionary <string, object>(); condition["ID"] = Datalist[ListView1.SelectedIndex].Id; var fileds = new Dictionary <string, object>(); fileds["NAME"] = NameTextBox.Text; var condition2 = new Dictionary <string, object>(); using (var patientAreaDao = new PatientAreaDao()) { condition2.Clear(); condition2["Name"] = ComboBoxPatientArea.Text; var arealist = patientAreaDao.SelectPatientArea(condition2); if (arealist.Count == 1) { fileds["PATIENTAREAID"] = arealist[0].Id; } } using (var infectTypeDao = new InfectTypeDao()) { condition2.Clear(); condition2["Name"] = ComboBoxInfectType.Text; var arealist = infectTypeDao.SelectInfectType(condition2); if (arealist.Count == 1) { fileds["INFECTTYPEID"] = arealist[0].Id; } } fileds["DESCRIPTION"] = DescriptionTextBox.Text; patientRoomDao.UpdatePatientRoom(fileds, condition); RefreshData(); } }
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 } } } }
//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); } }
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 ButtonApply_OnClick(object sender, RoutedEventArgs e) { if (isNew) { //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 infectTypeDao = new InfectTypeDao()) { var infectType = new InfectType(); infectType.Name = this.NameTextBox.Text; infectType.Description = this.DescriptionTextBox.Text; int lastInsertId = -1; infectTypeDao.InsertInfectType(infectType, ref lastInsertId); //UI var infectTypeData = new InfectTypeData(); infectTypeData.Id = infectType.Id; infectTypeData.Name = infectType.Name; infectTypeData.Description = infectType.Description; Datalist.Add(infectTypeData); } } catch (Exception ex) { MainWindow.Log.WriteInfoConsole("In CInfectType.xaml.cs:AddButton_OnClick exception messsage: " + ex.Message); } } else { if (ListViewInfectType.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 infectTypeDao = new InfectTypeDao()) { var condition = new Dictionary <string, object>(); condition["ID"] = Datalist[ListViewInfectType.SelectedIndex].Id; var fileds = new Dictionary <string, object>(); fileds["NAME"] = NameTextBox.Text; fileds["DESCRIPTION"] = DescriptionTextBox.Text; infectTypeDao.UpdateInfectType(fileds, condition); int temp = this.ListViewInfectType.SelectedIndex; RefreshData(); this.ListViewInfectType.SelectedIndex = temp; } isNew = false; } this.ButtonApply.IsEnabled = false; }
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(); }
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 }
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); } }
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); } }
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; } } }
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; }