public FrmEdit(HIS.Base_BLL.ServiceItem Item, DataGridView grd) { InitializeComponent(); item = Item; grid = grd; this.Text = "修改医疗服务项目--" + item.ITEM_NAME; }
private void btnEdit_Click(object sender, EventArgs e) { int row = dgvItems.CurrentCell.RowIndex; HIS.Base_BLL.ServiceItem item = new HIS.Base_BLL.ServiceItem(Convert.ToInt32(dgvItems["ITEM_ID", row].Value)); FrmEdit frmAdd = new FrmEdit(item, dgvItems); frmAdd.ShowDialog(); }
/// <summary> /// 更新医疗服务项目 /// </summary> /// <param name="Item"></param> public void UpdateServiceItem(ServiceItem Item) { try { //更新记录信息 BindEntity <Model.BASE_SERVICE_ITEMS> .CreateInstanceDAL(oleDb).Update(Item.EntityModel); } catch (Exception err) { throw err; } }
/// <summary> /// 为医院增加一个服务项目 /// </summary> /// <param name="Item"></param> public void AddServiceItemToHospital(ServiceItem Item) { string strWhere = Tables.base_hospital_items.ITEM_ID + oleDb.EuqalTo() + Item.ITEM_ID + oleDb.And() + Tables.base_hospital_items.COMPLEX_ID + oleDb.EuqalTo() + "0"; Model.BASE_HOSPITAL_ITEMS model = BindEntity <Model.BASE_HOSPITAL_ITEMS> .CreateInstanceDAL(oleDb).GetModel(strWhere); if (model == null) { model = new HIS.Model.BASE_HOSPITAL_ITEMS( ); model.ITEM_ID = Item.ITEM_ID; model.COMPLEX_ID = 0; BindEntity <Model.BASE_HOSPITAL_ITEMS> .CreateInstanceDAL(oleDb).Add(model); } }
/// <summary> /// 填充项目的执行科室 /// </summary> public void ServiceItemFillExecDept(ServiceItem Item) { List <Department> lstDept = new List <Department>(); DataRow[] drs = BaseDataReader.Get_Hsitem_ExecDept().Select("COMPLEX_ID=0 and ITEM_ID=" + Item.ITEM_ID); for (int i = 0; i < drs.Length; i++) { Department dept = new Department(); dept.DeptID = Convert.ToInt32(drs[i]["DEPT_ID"]); dept.Name = drs[i]["DEPT_NAME"].ToString().Trim(); lstDept.Add(dept); } Item.ExecDepts = lstDept.ToArray(); }
/// <summary> /// 增加一个医疗服务项目 /// </summary> /// <param name="Item"></param> public void AddServiceItems(ServiceItem Item) { try { //增加数据库记录 int new_item_id = BindEntity <Model.BASE_SERVICE_ITEMS> .CreateInstanceDAL(oleDb).Add(Item.EntityModel); //将返回的新ID值赋给当前对象 Item.EntityModel.ITEM_ID = new_item_id; } catch (Exception err) { throw err; } }
/// <summary> /// 医院移除一个服务项目 /// </summary> /// <param name="Item"></param> public void RemoveServiceItemFromHospital(ServiceItem Item) { //1、从医院项目中移除 string strWhere = Tables.base_hospital_items.ITEM_ID + oleDb.EuqalTo( ) + Item.ITEM_ID + oleDb.And() + Tables.base_hospital_items.COMPLEX_ID + oleDb.EuqalTo( ) + "0"; Model.BASE_HOSPITAL_ITEMS model = BindEntity <Model.BASE_HOSPITAL_ITEMS> .CreateInstanceDAL(oleDb).GetModel(strWhere); if (model != null) { BindEntity <Model.BASE_HOSPITAL_ITEMS> .CreateInstanceDAL(oleDb).Delete(strWhere); //2、删除执行设置的执行科室 strWhere = Tables.base_item_dept.ITEM_ID + oleDb.EuqalTo() + Item.ITEM_ID + oleDb.And() + Tables.base_item_dept.COMPLEX_ID + oleDb.EuqalTo() + "0"; BindEntity <BASE_ITEM_DEPT> .CreateInstanceDAL(oleDb).Delete(strWhere); } }
private void btnNext_Click(object sender, EventArgs e) { int row = grid.CurrentCell.RowIndex; if (row == grid.Rows.Count - 1) { return; } else { row = row + 1; grid.CurrentCell = grid["ITEM_NAME", row]; } int item_id = Convert.ToInt32(grid["ITEM_ID", row].Value); item = new HIS.Base_BLL.ServiceItem(item_id); ShowItemDetail( ); btnSave.Enabled = true; }
/// <summary> /// 移除本院医疗服务项目前的引用检查 /// </summary> /// <param name="Item"></param> /// <param name="message"></param> public bool CheckServiceItemReferencedBeforeRemove(ServiceItem Item, out string message) { string strWhere = ""; //1、检查是否被组合项目引用 strWhere = Tables.base_complex_detail.SERVICE_ITEM_ID + oleDb.EuqalTo() + Item.ITEM_ID; BASE_COMPLEX_DETAIL base_complex_detail = BindEntity <BASE_COMPLEX_DETAIL> .CreateInstanceDAL(oleDb).GetModel(strWhere); if (base_complex_detail != null) { strWhere = Tables.base_complex_item.COMPLEX_ID + oleDb.EuqalTo() + base_complex_detail.COMPLEX_ID; BASE_COMPLEX_ITEM base_complex_item = BindEntity <BASE_COMPLEX_ITEM> .CreateInstanceDAL(oleDb).GetModel(strWhere); message = "【" + Item.ITEM_NAME + "】正在被组合项目【" + base_complex_item.COMPLEX_NAME + "】所引用"; return(false); } //2、检查是否被医嘱项目引用 strWhere = Tables.base_order_items.ITEM_ID + oleDb.EuqalTo() + Item.ITEM_ID + oleDb.And() + Tables.base_order_items.TC_FLAG + oleDb.EuqalTo() + "0"; Base_Order_Items base_order_item = BindEntity <Base_Order_Items> .CreateInstanceDAL(oleDb).GetModel(strWhere); if (base_order_item != null) { message = "【" + Item.ITEM_NAME + "】正在被医嘱项目【" + base_order_item.Order_Name + "】所引用"; return(false); } //3、检查是否被用法引用 strWhere = "HSITEM_ID = " + Item.ITEM_ID; DataTable tb = BindEntity <object> .CreateInstanceDAL(oleDb, "BASE_USEAGE_FEE").GetList(strWhere); if (tb.Rows.Count > 0) { message = "【" + Item.ITEM_NAME + "】正在被用法【" + tb.Rows[0]["USE_NAME"].ToString().Trim() + "】联动"; return(false); } message = null; return(true); }
private void btnSave_Click(object sender, EventArgs e) { if (cboStatItem.MemberValue == null || cboStatItem.Text == "") { MessageBox.Show("请为该项目设置统计大类", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txtPrice.Text.Trim( ) != "") { if (!HIS.SYSTEM.PubicBaseClasses.XcConvert.IsNumeric(txtPrice.Text)) { MessageBox.Show("单价请输入数字", "", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPrice.Focus( ); return; } else { if (Convert.ToDecimal(txtPrice.Text) == 0) { MessageBox.Show("单价不能为0,请重新输入", "", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPrice.Focus( ); return; } } } else { MessageBox.Show("单价没有输入", "", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPrice.Focus( ); return; } //执行保存操作 try { ServiceItemController serviceItemController = new ServiceItemController(); if (item == null) { item = new HIS.Base_BLL.ServiceItem( ); string[] pywb = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.GetPyWbCode(this.txtItemName.Text); item.ITEM_NAME = this.txtItemName.Text; item.PY_CODE = pywb[0]; item.WB_CODE = pywb[1]; item.STD_CODE = this.txtStdCode.Text; item.PRICE = Convert.ToDecimal(this.txtPrice.Text); item.ITEM_UNIT = this.txtUnit.Text; item.STATITEM_CODE = this.cboStatItem.MemberValue.ToString( ); item.NCMS_COMP_RATE = Convert.ToDecimal(this.txtNcmsCompRate.Text); item.INSUR_TYPE = cboInsurType.Text; item.VALID_FLAG = chkValid.Checked ? 1 : 0; serviceItemController.AddServiceItems(item); this.txtStdCode.Text = ""; this.txtItemName.Text = ""; this.txtPrice.Text = ""; this.txtUnit.Text = ""; this.cboStatItem.MemberValue = null; this.cboStatItem.Text = ""; this.chkValid.Checked = true; item = null; MessageBox.Show("保存成功!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); //if ( item.Add( ) ) //{ // this.txtStdCode.Text = ""; // this.txtItemName.Text = ""; // this.txtPrice.Text = ""; // this.txtUnit.Text = ""; // this.cboStatItem.MemberValue = null; // this.cboStatItem.Text = ""; // this.chkValid.Checked = true; // item = null; // MessageBox.Show( "保存成功!" , "" , MessageBoxButtons.OK , MessageBoxIcon.Information ); //} } else { string[] pywb = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.GetPyWbCode(this.txtItemName.Text); item.ITEM_ID = item.ITEM_ID; item.ITEM_NAME = this.txtItemName.Text; item.PY_CODE = pywb[0]; item.WB_CODE = pywb[1]; item.STD_CODE = this.txtStdCode.Text; item.PRICE = Convert.ToDecimal(this.txtPrice.Text); item.ITEM_UNIT = this.txtUnit.Text; item.STATITEM_CODE = this.cboStatItem.MemberValue.ToString( ); item.VALID_FLAG = chkValid.Checked ? 1 : 0; item.NCMS_COMP_RATE = Convert.ToDecimal(this.txtNcmsCompRate.Text); item.INSUR_TYPE = cboInsurType.Text; serviceItemController.UpdateServiceItem(item); btnSave.Enabled = false; //if ( item.Update( ) ) //{ // btnSave.Enabled = false; //} } } catch (Exception err) { MessageBox.Show(err.Message); } }
/// <summary> /// 按ID获得服务项目 /// </summary> /// <param name="ServiceItemId"></param> /// <returns></returns> public ServiceItem GetServiceItemById(int ServiceItemId) { ServiceItem item = new ServiceItem(ServiceItemId); return(item); }