public void GetPatient(Syspatient obj) { if (obj != null) { this.lblPatient.Text = obj.UserName; ModuleConstant.PatientId = obj.Id; ModuleConstant.PatientName = obj.UserName; } else { this.lblPatient.Text = null; ModuleConstant.PatientId = null; ModuleConstant.PatientName = null; } }
public void GetPatient(Syspatient obj) { if (obj != null) { if (tabChoose.SelectedIndex == -1) { tabChoose.SelectedIndex = 0; } patientInfo = obj; ModuleConstant.PatientId = obj.Id; ModuleConstant.PatientName = obj.UserName; ModuleConstant.Syspatient = obj; BindDayReport(ModuleConstant.PatientId); BindModeReport(ModuleConstant.PatientId); BindPrescription(ModuleConstant.PatientId); if (tabChoose.SelectedIndex == 2) { this.BeginTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.EndTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); BindExerciserecord(ModuleConstant.PatientId); } } else { patientInfo = null; ModuleConstant.PatientId = null; ModuleConstant.PatientName = null; ModuleConstant.Syspatient = null; BindDayReport(""); BindModeReport(""); BindPrescription(""); } listResult.Clear(); CboAction.SelectedIndex = 0; CboMode.SelectedIndex = 0; this.setControlSpeed.Value = 2; this.setControlForce.Value = 3; this.setControlMinAngle.Value = -20; this.setControlMaxAngle.Value = 20; this.setControlTimes.Value = 5; this.setControlPosition.Value = 0; this.setControlGroup.Value = 1; CourseListBox.SelectedIndex = -1; }
private void btnStart_Click(object sender, RoutedEventArgs e) { ThreadPool.QueueUserWorkItem(new WaitCallback((obj) => { lock (objLock) { Application.Current.Dispatcher.Invoke(new Action(() => { //SelectPatientEvent.Instance.Subscribe(GetPatient); if (patientInfo == null) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "请选择病人!"; dialog.ShowDialog(); } else { //&& MyActionListBox.SelectedIndex>=0 //if (listResult.Count > MyActionListBox.SelectedIndex && MyActionListBox.SelectedIndex != -1 && listResult.Count > 0) //{ // WPFMessageBox msgBox = new WPFMessageBox(); // msgBox.lblMsg.Text = "是否修改!"; // msgBox.lblTitle.Text = "提示信息"; // msgBox.ShowDialog(); // if (msgBox.IsFlag) // { // ComboBoxItem cbi = (ComboBoxItem)this.CboAction.SelectedItem; // ComboBoxItem cbiMode = (ComboBoxItem)this.CboMode.SelectedItem; // if (MyActionListBox.SelectedIndex != -1) // { // if (listResult.Count > 0) // { // new Thread(() => // { // this.Dispatcher.Invoke(new Action(() => // { // int testIndex = MyActionListBox.SelectedIndex; // ItemDemo item = listResult[MyActionListBox.SelectedIndex] as ItemDemo; // item.ActionName = cbi.Content.ToString(); // item.ActionId = CboAction.SelectedIndex; // ItemDemo changeItem = new ItemDemo(); // SetItem(item, changeItem); // listResult.RemoveAt(MyActionListBox.SelectedIndex); // listResult.Insert(testIndex, changeItem); // MyActionListBox.DataContext = listResult; // MyActionListBox.SelectedIndex = testIndex; // })); // }).Start(); // } // } // } //ItemDemo item = listResult[MyActionListBox.SelectedIndex]; //item.Force = this.setControlForce.Value; //item.MaxAngle = this.setControlMaxAngle.Value; //item.MinAngle = this.setControlMinAngle.Value; //item.Speed = this.setControlSpeed.Value; //item.ActionId = this.CboAction.SelectedIndex; //item.Mode = this.CboMode.SelectedIndex; //item.Times = this.setControlTimes.Value; //item.Position = this.setControlPosition.Value; //item.GroupTimes = this.setControlGroup.Value; //} if (listResult.Count > 0) { if (ControlDialog == null) { Syspatient syspatient = new Syspatient(); syspatient = MySession.Session.Get<Syspatient>(ModuleConstant.PatientId); syspatient.LastTime = DateTime.Now; MySession.Session.SaveOrUpdate(syspatient); MySession.Session.Flush(); ControlDialog = new ActionControlDialog(); ControlDialog.Parent = this; ActionControl child = new ActionControl(listResult); //child.ActionList = listResult; child.Close += new EventHandler(child_Close); ControlDialog.Content = child; ControlDialog.Show(); } } else { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "请选择训练动作及模式!"; dialog.ShowDialog(); } //else //{ // AlarmDialog dialog = new AlarmDialog(); // dialog.lblTitle.Text = "提示信息"; // dialog.lblMsg.Text = "请选择训练动作!"; // dialog.ShowDialog(); // //if (MessageBox.Show("请选择训练动作!", "提示信息", MessageBoxButton.OK, MessageBoxImage.Error) == MessageBoxResult.OK) // //{ // //} //} } })); } })); }
private void btnSaveDoc_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(this.txtName.Text.Trim())) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "用户名不能为空!"; dialog.ShowDialog(); //if (MessageBox.Show("用户名不能为空!", "提示信息", MessageBoxButton.OK, MessageBoxImage.Error) == MessageBoxResult.OK) //{ //} } else if (!string.IsNullOrEmpty(this.txtWeight.Text) && !Machine.ISNumber(this.txtWeight.Text)) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "输入有效体重!"; dialog.ShowDialog(); this.txtWeight.Text = ""; this.txtWeight.Focus(); } else if (!string.IsNullOrEmpty(this.txtHeight.Text) && !Machine.ISNumber(this.txtHeight.Text)) { AlarmDialog dialog = new AlarmDialog(); dialog.lblTitle.Text = "提示信息"; dialog.lblMsg.Text = "输入有效身高!"; dialog.ShowDialog(); this.txtHeight.Text = ""; this.txtHeight.Focus(); } else { if (IsAdd) { Sysuserinfo user = new Sysuserinfo(); string userid = Guid.NewGuid().ToString("N"); user.Id = userid;//用户ID user.UserType = "2";//用户类型 病人 user.UserName = txtName.Text.Trim(); //病人名字 user.SysPassWord = "******"; //密码 user.UserCode = ""; user.LastTime = DateTime.Now; //最后时间 MySession.Session.Save(user); Syspatient info = new Syspatient(); info.DoctorID = ModuleConstant.UserID; info.UserId = userid; info.PinYin = PinYinConverter.GetFirst(info.UserName); info.DiagnoseTypeId = (Convert.ToInt32(this.cbodiagnoseTypeId.SelectedIndex) + 1).ToString(); //info.AfftectedHand = (Convert.ToInt32(this.cboArm.SelectedIndex) + 1).ToString(); info.Sex = (Convert.ToInt32(this.cboSex.SelectedIndex) + 1).ToString(); info.Id = System.Guid.NewGuid().ToString("N"); info.LastTime = DateTime.Now; if (!string.IsNullOrEmpty(this.txtWeight.Text) && Machine.ISNumber(this.txtWeight.Text)) { info.Weight = Convert.ToInt32(this.txtWeight.Text); } if (!string.IsNullOrEmpty(this.txtHeight.Text) && Machine.ISNumber(this.txtHeight.Text)) { info.BodyHeight = Convert.ToInt32(this.txtHeight.Text); } info.Note = this.txtNode.Text; info.PatientCarNo = this.txtPatientCarNo.Text; info.OpDate = DateTime.Now; info.BirthDay = Convert.ToDateTime(this.birthday.Text); info.UserName = txtName.Text.Trim(); MySession.Session.Save(info); MySession.Session.Flush(); } else { Syspatient info = MySession.Session.Get<Syspatient>(ModuleConstant.PatientId); Sysuserinfo user = MySession.Session.Get<Sysuserinfo>(info.UserId); user.UserName = txtName.Text.Trim(); //病人名字 user.LastTime = DateTime.Now; //最后时间 MySession.Session.SaveOrUpdate(user); info.DiagnoseTypeId = (Convert.ToInt32(this.cbodiagnoseTypeId.SelectedIndex) + 1).ToString(); // info.AfftectedHand = (Convert.ToInt32(this.cboArm.SelectedIndex) + 1).ToString(); info.Sex = (Convert.ToInt32(this.cboSex.SelectedIndex) + 1).ToString(); info.LastTime = DateTime.Now; info.PinYin = PinYinConverter.GetFirst(txtName.Text.Trim()); if (!string.IsNullOrEmpty(this.txtWeight.Text) && Machine.ISNumber(this.txtWeight.Text)) { info.Weight = Convert.ToInt32(this.txtWeight.Text); } if (!string.IsNullOrEmpty(this.txtHeight.Text) && Machine.ISNumber(this.txtHeight.Text)) { info.BodyHeight = Convert.ToInt32(this.txtHeight.Text); } info.Note = this.txtNode.Text; info.PatientCarNo = this.txtPatientCarNo.Text; info.BirthDay = Convert.ToDateTime(this.birthday.Text); info.UserName = txtName.Text.Trim(); MySession.Session.SaveOrUpdate(info); MySession.Session.Flush(); } Machine.ClosedTabtip(); this.Close(sender, e); IsRefreshEvent.Instance.Publish(true); } }