private void FrmKssSpecialApply_Load(object sender, EventArgs e) { //绑定主任医生 try { string sql = string.Format(@"select distinct b.py_code 拼音码, b.name as 姓名, b.wb_code 五笔码,a.doc_id 数字码,b.employee_id from jc_role_doctor a ,jc_employee_property b,jc_EMP_DEPT_ROLE c where a.employee_id=b.employee_id and c.employee_id=b.employee_id and c.dept_id='{0}' and b.delete_bit=0", InstanceForm._currentDept.DeptId); DataTable dt = InstanceForm._database.GetDataTable(sql); cmbDept.DataSource = dt; cmbDept.DisplayMember = "姓名"; cmbDept.ValueMember = "employee_id"; cmbDept.SelectedIndex = 0; } catch { } try { txtZyZd.ReadOnly = false; dataGrid_LongOrder.ReadOnly = true; //初始化申请用药目的控件 ucApplyInfos1.DoIniCt(_dtKss); lblDept.Text = InstanceForm._currentDept.DeptName; txtXm.Text = _patientInfo.lbName.Text; txtZyh.Text = _patientInfo.lbID.Text; txtNn.Text = _patientInfo.lbAge.Text; txtXb.Text = _patientInfo.lbSex.Text; txtCh.Text = _patientInfo.lbBed.Text; txtZyZd.Text = _patientInfo.lbRYZD.Text; txtSqYs.Text = InstanceForm._currentUser.Name; //dataGridView1.DataSource = _dtKss; InitGrd_LongOrder(); //长期医嘱网格 loadGrid_LongOrder(); } catch { } try { //如果是打印界面 if (_isPrint) { myEntity.Clear(); foreach (DataRow dr in _dtKss.Rows) { //特殊级药物 if (!dr["MEMO"].ToString().Equals("3")) { continue; } string id = dr["ID"].ToString(); string grpId = "";// dr[""].ToString(); if (_dtKss.Columns.Contains("嘱号")) { grpId = dr["嘱号"].ToString(); } else if (_dtKss.Columns.Contains("group_id".ToUpper())) { grpId = dr["group_id".ToUpper()].ToString(); } //申请用药理由 UcApplyInfo ucSqly = ucApplyInfos1.myCts[id]; //查询初始化给控件赋值 ucSqly.rbtYfxyy.Checked = dr["purp_1".ToUpper()].ToString().Equals("1"); ucSqly.rbtZlxyy.Checked = dr["purp_1".ToUpper()].ToString().Equals("0"); ucSqly.txtYymdZl.Text = dr["purp_1_memo".ToUpper()].ToString(); ucSqly.rbtByjcYes.Checked = dr["purp_2".ToUpper()].ToString().Equals("1"); ucSqly.rbtByjcNo.Checked = dr["purp_2".ToUpper()].ToString().Equals("0"); ucSqly.rbtXjpyYes.Checked = dr["purp_3".ToUpper()].ToString().Equals("1"); ucSqly.rbtXjpyNo.Checked = dr["purp_3".ToUpper()].ToString().Equals("0"); ucSqly.txtByj.Text = dr["purp_3_memo".ToUpper()].ToString(); ucSqly.rbtYjmgYes.Checked = dr["purp_4".ToUpper()].ToString().Equals("1"); ucSqly.rbtYjmgNo.Checked = dr["purp_4".ToUpper()].ToString().Equals("0"); ucSqly.txtMemo.Text = dr["purp_5_memo".ToUpper()].ToString(); //打印界面初始化参数变量 Entity_KjSq entity = new Entity_KjSq(); entity.drYzInfo = dr; entity.order_id = id; entity.group_id = grpId; //1、用药目的 entity.purp_1 = ucSqly.rbtYfxyy.Checked ? "1" : ucSqly.rbtZlxyy.Checked ? "0" : ""; entity.purp_1_memo = ucSqly.rbtZlxyy.Checked ? ucSqly.txtYymdZl.Text : ""; //2、是否已送病原学检查 entity.purp_2 = ucSqly.rbtByjcYes.Checked ? "1" : ucSqly.rbtByjcNo.Checked ? "0" : ""; entity.purp_2_memo = ""; //3、是否已有细菌培养及药敏结果 entity.purp_3 = ucSqly.rbtXjpyYes.Checked ? "1" : ucSqly.rbtXjpyNo.Checked ? "0" : ""; entity.purp_3_memo = ucSqly.rbtXjpyYes.Checked ? ucSqly.txtByj.Text : ""; //4、所申请药物是否对该病原菌敏感 entity.purp_4 = ucSqly.rbtYjmgYes.Checked ? "1" : ucSqly.rbtYjmgNo.Checked ? "0" : ""; entity.purp_4_memo = ""; //5、其他 entity.purp_5_memo = ucSqly.txtMemo.Text; myEntity.Add(dr["ID"].ToString(), entity); } } } catch { } }
/// <summary> /// 保存 /// </summary> void btnSave_Click(object sender, EventArgs e) { if (_isPrint) { //修改 本界面的 事务中插入数据 } else { //新增yzgl里面的事务中插入数据 try { myEntity.Clear(); foreach (DataRow dr in _dtKss.Rows) { //特殊级药物 if (!dr["MEMO"].ToString().Equals("3")) { continue; } Entity_KjSq entity = new Entity_KjSq(); entity.drYzInfo = dr; entity.DJID = TrasenClasses.GeneralClasses.PubStaticFun.NewGuid().ToString(); entity.INPATIENT_ID = ""; entity.baby_id = ""; entity.order_id = dr["ID"].ToString(); entity.group_id = dr["嘱号"].ToString(); entity.dept_id = InstanceForm._currentDept.DeptId.ToString(); entity.zyzd = txtZyZd.Text; entity.shyj = txtShyj.Text; entity.apply_id = InstanceForm._currentUser.EmployeeId.ToString(); entity.apply_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); entity.shr = cmbDept.SelectedValue == null ? "-1" : cmbDept.SelectedValue.ToString();//审核人未取 entity.shsj = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //申请用药理由 UcApplyInfo ucSqly = ucApplyInfos1.myCts[entity.order_id]; //1、用药目的 entity.purp_1 = ucSqly.rbtYfxyy.Checked ? "1" : ucSqly.rbtZlxyy.Checked ? "0" : ""; entity.purp_1_memo = ucSqly.rbtZlxyy.Checked ? ucSqly.txtYymdZl.Text : ""; //2、是否已送病原学检查 entity.purp_2 = ucSqly.rbtByjcYes.Checked ? "1" : ucSqly.rbtByjcNo.Checked ? "0" : ""; entity.purp_2_memo = ""; //3、是否已有细菌培养及药敏结果 entity.purp_3 = ucSqly.rbtXjpyYes.Checked ? "1" : ucSqly.rbtXjpyNo.Checked ? "0" : ""; entity.purp_3_memo = ucSqly.rbtXjpyYes.Checked ? ucSqly.txtByj.Text : ""; //4、所申请药物是否对该病原菌敏感 entity.purp_4 = ucSqly.rbtYjmgYes.Checked ? "1" : ucSqly.rbtYjmgNo.Checked ? "0" : ""; entity.purp_4_memo = ""; //5、其他 entity.purp_5_memo = ucSqly.txtMemo.Text; myEntity.Add(dr["ID"].ToString(), entity); #region "sql" // string strSql = string.Format(@"insert into zy_kss_sqb(DJID // INPATIENT_ID // baby_id // order_id // group_id // dept_id // zyzd // shyj // apply_id // apply_time // shr // shsj // purp_1 // purp_1_memo // purp_2 // purp_2_memo // purp_3 // purp_3_memo // purp_4 // purp_4_memo // purp_5_memo) VALUES // ('{0}','{1}',{2},'{3}','{4}','{5}',{6},'{7}','{8}','{9}',{10},'{11}','{12}','{13}',{14},'{15}','{16}','{17}',{18},'{19}','{20}')", // entity.DJID, entity.INPATIENT_ID, entity.baby_id, entity.order_id, entity.group_id, entity.dept_id, entity.zyzd, entity.shyj, entity.apply_id, entity.apply_time, // entity.shr, entity.shsj, entity.purp_1, entity.purp_1_memo, entity.purp_2, entity.purp_2_memo, entity.purp_3, entity.purp_3_memo, entity.purp_4, entity.purp_4_memo, entity.purp_5_memo); #endregion } _isOk = true; if (MessageBox.Show("操作成功,是否打印!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { btnPrint_Click(null, null); } } catch { _isOk = false; MessageBox.Show("操作失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } }
public void DoIniCt(DataTable dtYz) { try { _dtYz = dtYz;//抗生素等级放到 该表的Memo字段存储 DataRow[] myDrs = _dtYz.Select("MEMO=3"); //设置属性FurNos/MixNums int iNum = myDrs.Length; tlpYz.ColumnStyles.Clear(); tlpYz.RowStyles.Clear(); int iColNum = 2; //列数 int myRow = iNum % iColNum == 0 ? (iNum / iColNum) : (iNum / iColNum) + 1; //行数 tlpYz.ColumnCount = iColNum; //永远设置两列 //生成所有子控件(并排版布局),默认enable=false;即默认配置控件。 int j = 0; int height = UcApplyInfo._hCtHeight; int weight = UcApplyInfo._wCtWidth; for (int kRow = 0; kRow < myRow; kRow++) { tlpYz.RowStyles.Add(new RowStyle(SizeType.Absolute, height));; //列总长686,高总高694:2列,2行(343,347) for (int kCol = 0; kCol < iColNum; kCol++) { tlpYz.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, weight));//为控件列划分宽度样式 if (!(j < iNum)) { break; } string orderID = myDrs[j]["ID"].ToString().Trim(); //yzid string yppm = myDrs[j]["医嘱内容"].ToString().Trim(); //ypName string cjid = myDrs[j]["HOITEM_ID"].ToString().Trim(); //cjid UcApplyInfo myCt = new UcApplyInfo(yppm, cjid, orderID); //myFur.btnSureClick += new MixFurnace.MySureButtonClick(myFur_btnSureClick); //myFur.btnFinishClick += new MixFurnace.MySureButtonClick(myFur_btnFinishClick); //myFur.btnHandClick += new MixFurnace.MySureButtonClick(myFur_btnHandClick); //myFur.btnRawMtrClick += new MixFurnace.MySureButtonClick(myFur_btnRawMtrClick); //myFur.btnAlLeftClick += new MixFurnace.MySureButtonClick(myFur_btnAlLeftClick); //myFur.LFurNo.Text = allFurNos[j];//标识炉号信息 ////myFur.CFurnaceNo.Text = allFurNos[j];//标识炉号信息 //myFur.Enabled = false;//默认为不可操作 //myFur.LFurNo.ForeColor = Color.Chocolate; tlpYz.Controls.Add(myCt, kCol, kRow); //添加子控件 myCts.Add(orderID, myCt); //暴露属性,提供调用者获取 j++; } } tlpYz.Width = iColNum * UcApplyInfo._wCtWidth; //设置父控件宽度 tlpYz.Height = myRow * UcApplyInfo._hCtHeight; //设置父控件高度 tlpYz.CellBorderStyle = TableLayoutPanelCellBorderStyle.InsetDouble; this.AutoScroll = true; } catch (Exception ex) { MessageBox.Show("生成子控件失败\n" + ex.Message); return; } }