private void SetNlControl(DateTime csrq) { Age age = DateManager.DateToAge(csrq, InstanceForm.BDatabase); txtnl.Text = age.AgeNum.ToString(); cmbDW.SelectedIndex = (int)age.Unit; }
void txtkh_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { try { string kh = ts_mz_class.Fun.returnKh(Convert.ToInt32(cmbklx.SelectedValue), txtkh.Text); txtkh.Text = kh; decimal kye = 0; YY_BRXX _brxx = mzys.GetBRXX(Convert.ToInt32(cmbklx.SelectedValue), kh, out kye, out this.kdjid, InstanceForm.BDatabase); if (_brxx != null) { this.brxx = _brxx; Age age = DateManager.DateToAge(Convert.ToDateTime(brxx.Csrq), InstanceForm.BDatabase); this.txtage.Text = age.AgeNum.ToString(); this.txtAgeUnit.SelectedValue = (int)age.Unit; this.txtname.Text = brxx.Brxm; this.txtxb.SelectedValue = brxx.Xb; this.txtkye.Text = kye.ToString("0.00"); txtdeptname.Text = InstanceForm.BCurrentDept.DeptName; } } catch (Exception error) { MessageBox.Show(error.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); this.txtage.Text = ""; this.txtname.Text = ""; this.txtxb.SelectedValue = null; this.txtkye.Text = "0.00"; txtdeptname.Text = ""; } } }
public FrmYszGhSelect(int klx, string kh, int ZsID) { //该构造函数仅给医生站刷卡后调用 InitializeComponent(); _ZsID = ZsID; flowType = 0; this.comboBox1.DisplayMember = "级别名称"; this.comboBox1.ValueMember = "挂号级别"; decimal kye = 0M; Guid _kdjid = Guid.Empty; brxx = mzys.GetBRXX(klx, kh, out kye, out _kdjid, InstanceForm.BDatabase); Age age = DateManager.DateToAge(Convert.ToDateTime(brxx.Csrq), InstanceForm.BDatabase); this.txtkh.Text = kh; this.txtkye.Text = kye.ToString("0.00"); this.kdjid = _kdjid; this.txtxb.SelectedValue = brxx.Xb; //如果姓名是空,则表示需要在此界面录入病人信息 this.Load += new EventHandler(FrmYszGhSelect_Load); this.Text = "无号-挂号"; }
private void FrmYszGhSelect_Load(object sender, EventArgs e) { if (this.Wh == true && (cfg3120.Config == "3" || cfg3120.Config == "2")) { //不能选择 this.comboBox1.Enabled = false; } if (flowType == 0) { #region 原来的流程不受3097控制 txtname.Enabled = false; txtxb.Enable = false; txtage.Enabled = false; txtAgeUnit.Enable = false; txtkye.Enabled = false; txtkh.Enabled = false; #endregion } else { #region 点左上的无号按钮流程 医生站无号是否关联卡号 0否,1是 SystemCfg cfg3097 = new SystemCfg(3097, InstanceForm.BDatabase); if (cfg3097.Config == "1") { //txtname.Enabled = false; //txtxb.Enable = false; //txtage.Enabled = false; //txtAgeUnit.Enable = false; txtkye.Enabled = false; txtkh.Enabled = true; cmbklx.Enabled = true; txtkh.KeyPress += new KeyPressEventHandler(txtkh_KeyPress); txtkh.Focus(); } else { //无卡的病人需要录入病人信息 txtname.Enabled = true; txtxb.Enable = true; txtage.Enabled = true; txtAgeUnit.Enable = true; txtkye.Enabled = false; txtkh.Enabled = false; cmbklx.Enabled = false; txtname.KeyPress += delegate(object txt, KeyPressEventArgs args) { if (args.KeyChar == '\r') { txtxb.Focus(); } }; txtxb.AfterSelectedDataRow += delegate(DataRow selectedRow, ref object nextFocus) { txtage.Focus(); }; txtAgeUnit.AfterSelectedDataRow += delegate(DataRow selectedRow, ref object nextFocus) { comboBox1.Focus(); }; txtname.Focus(); } #endregion } ts_mz_class.FunAddComboBox.AddKlx(false, 1, this.cmbklx, InstanceForm.BDatabase); DataTable tbSex = InstanceForm.BDatabase.GetDataTable("select code,name,py_code from jc_sexcode"); txtxb.ShowCardProperty[0].ShowCardDataSource = tbSex; DataTable tbAgeUnit = new DataTable(); tbAgeUnit.Columns.Add("Id", typeof(int)); tbAgeUnit.Columns.Add("Name", typeof(string)); foreach (object obj in Enum.GetValues(typeof(AgeUnit))) { tbAgeUnit.Rows.Add(new object[] { (int)((AgeUnit)obj), ((AgeUnit)obj).ToString() }); } txtAgeUnit.ShowCardProperty[0].ShowCardDataSource = tbAgeUnit; txtAgeUnit.SelectedValue = (int)AgeUnit.岁; if (brxx != null) { Age age = DateManager.DateToAge(Convert.ToDateTime(brxx.Csrq), InstanceForm.BDatabase); this.txtage.Text = age.AgeNum.ToString(); this.txtAgeUnit.SelectedValue = (int)age.Unit; this.txtname.Text = brxx.Brxm; this.txtxb.SelectedValue = brxx.Xb; } txtdeptname.Text = InstanceForm.BCurrentDept.DeptName; DataTable tbDoctorType = mzys.GetDoctorRegisterTypeList(InstanceForm.BCurrentUser.EmployeeId, InstanceForm.BCurrentDept.DeptId, InstanceForm.BDatabase); if (tbDoctorType.Rows.Count == 0) { MessageBox.Show("当前医生没有可用的挂号级别,可能是由于医生级别过低并且不允许挂免费号或简易号", "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.comboBox1.DisplayMember = "级别名称"; this.comboBox1.ValueMember = "挂号级别"; this.comboBox1.DataSource = tbDoctorType; this.comboBox1.SelectedIndex = -1; this.comboBox1.SelectedIndexChanged += new EventHandler(comboBox1_SelectedIndexChanged); try { Doctor doctor = new Doctor(InstanceForm.BCurrentUser.EmployeeId, InstanceForm.BDatabase); object zzjb = InstanceForm.BDatabase.GetDataResult(string.Format("select type_id from jc_doctor_type where zcjb={0}", doctor.TypeID)); comboBox1.SelectedValue = zzjb; } catch { comboBox1.SelectedIndex = 0; } }
/// <summary> /// 验证挂号科室限制条件 /// </summary> /// <param name="xb">性别代码 1-男 2-女</param> /// <param name="bornDay">出生日期</param> /// <param name="regDeptId">挂号科室</param> /// <param name="database"></param> /// <param name="message">验证失败时返回的错误信息</param> /// <returns></returns> public static bool ValidingRestrictiveConditions(int?xb, DateTime?bornDay, int regDeptId, RelationalDatabase database, out string message) { try { message = ""; SystemCfg cfg1141 = new SystemCfg(1141, database); //男性不允许挂号的科室 SystemCfg cfg1142 = new SystemCfg(1142, database); //女性不允许挂号的科室 SystemCfg cfg1143 = new SystemCfg(1143, database); //各年龄段不允许挂号的科室 string[] man = cfg1141.Config.Split(new char[] { ',' }); string[] women = cfg1142.Config.Split(new char[] { ',' }); string[] data = cfg1143.Config.Split(new char[] { '|' }); DataTable dtAge = new DataTable(); dtAge.Columns.Add("AgeFrom", typeof(System.Int32)); dtAge.Columns.Add("AgeTo", typeof(System.Int32)); dtAge.Columns.Add("DeptId", typeof(System.Int32)); foreach (string str in data) { //str: 0-3:xxx,xxx,xxx if (!string.IsNullOrEmpty(str)) { string[] patrs = str.Split(new char[] { ':' }); string[] ages = patrs[0].Split(new char[] { '-' }); int ageFrom = Convert.ToInt32(ages[0]); int ageTo = Convert.ToInt32(ages[1]); string[] depts = patrs[1].Split(new char[] { ',' }); foreach (string strId in depts) { dtAge.Rows.Add(new object[] { ageFrom, ageTo, Convert.ToInt32(strId) }); } } } string deptName = Fun.SeekDeptName(regDeptId, database); if (xb != null) { int index = -1; if (xb.Value == 1) { index = cfg1141.Config.IndexOf(regDeptId.ToString()); if (index > -1) { message = "男性不允许选择[" + deptName + "]科室挂号"; return(false); } } else { index = cfg1142.Config.IndexOf(regDeptId.ToString()); if (index > -1) { message = "女性不允许选择[" + deptName + "]科室挂号"; return(false); } } } if (bornDay != null) { Age age = DateManager.DateToAge(bornDay.Value, database); DataRow[] row = dtAge.Select(string.Format("{0}>=AgeFrom and {0}<=AgeTo and DeptId ={1}", age.AgeNum, regDeptId)); if (row.Length > 0) { message = string.Format("{0}岁不允许选择[{1}]科室挂号", age.AgeNum, Fun.SeekDeptName(Convert.ToInt32(row[0]["DeptId"]), database)); return(false); } } return(true); } catch (Exception error) { message = error.Message; return(true); } }