private void neuSpread1_Sheet1_CellChanged(object sender, FarPoint.Win.Spread.SheetViewEventArgs e) { try { if (e.Column == 0) { Neusoft.HISFC.Models.Order.Frequency f = new Neusoft.HISFC.Models.Order.Frequency(); try { f.ID = this.neuSpread1_Sheet1.Cells[e.Row, e.Column].Text; if (f.Name != "") { this.neuSpread1_Sheet1.Cells[e.Row, 1].Text = f.Name; } } catch { } } else if (e.Column == 3) { //更新用法ID this.neuSpread1_Sheet1.Cells[e.Row, e.Column - 1].Text = GetUsageCode(this.neuSpread1_Sheet1.Cells[e.Row, e.Column].Text); } } catch { } }
/// <summary> /// 根据传入行数返回对应实体 /// </summary> /// <param name="i"></param> /// <returns></returns> private Neusoft.HISFC.Models.Order.Frequency GetObjFromRow(int i) { Neusoft.HISFC.Models.Order.Frequency f = new Neusoft.HISFC.Models.Order.Frequency(); f.ID = this.neuSpread1_Sheet1.Cells[i, 0].Text; //频次编码 f.Name = this.neuSpread1_Sheet1.Cells[i, 1].Text; //频次名称 f.Usage.ID = this.neuSpread1_Sheet1.Cells[i, 2].Text; //使用编码 f.Usage.Name = this.neuSpread1_Sheet1.Cells[i, 3].Text; //使用名称 f.Time = this.neuSpread1_Sheet1.Cells[i, 4].Text; //使用时间 f.Dept.ID = this.DeptCode; /* * [2007/01/31] 原来没有检察. * * decimal a = Convert.ToDecimal(this.neuSpread1_Sheet1.Cells[i, 5].Text); * f.SortID = (int)a; * */ //类型为文本型,所以如果输入的是非数字,那么按0处理 try { decimal a = Convert.ToDecimal(this.neuSpread1_Sheet1.Cells[i, 5].Text); f.SortID = (int)a; } catch { f.SortID = 0; } return(f); }
/// <summary> ///已经使用的频次不能删除 /// </summary> /// <param name="al"></param> /// <returns></returns> public int ExistFrequencyCounts(Neusoft.HISFC.Models.Order.Frequency frequency) { string strSql = ""; if (this.Sql.GetSql("Manager.Frequency.DeleteCheck.1", ref strSql) == -1) { this.Err = "没有找到索引为: Manager.Frequency.DeleteCheck.1的SQL语句!"; return(-1); } try { strSql = string.Format(strSql, frequency.ID); } catch (Exception ex) { this.Err = "赋值时候出错!" + ex.Message; this.WriteErr(); return(-1); } return(Neusoft.FrameWork.Function.NConvert.ToInt32(this.ExecSqlReturnOne(strSql))); }
/// <summary> /// 删除方法 /// </summary> /// <returns></returns> private int Del() { if (this.constantData.Tables[0].Rows.Count <= 0) { return(0); } int index = this.neuSpread1_Sheet1.ActiveRowIndex; if (index < 0) { return(0); } //将当前删除行转换成对象实体 Neusoft.HISFC.Models.Order.Frequency frequency = GetObjFromRow(index); int returnvalue = manager.ExistFrequencyCounts(frequency); if (returnvalue >= 1) { MessageBox.Show("该频次已经使用,不能删除"); return(-1); } if (MessageBox.Show("确认删除" + this.neuSpread1_Sheet1.Cells[index, 0].Text + "?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { ////将当前删除行转换成对象实体 //Neusoft.HISFC.Models.Order.Frequency frequency = GetObjFromRow(index); //if (frequency.ID.Trim() != "" && frequency.ID != string.Empty) //{ // int returnvalue = manager.ExistFrequencyCounts(frequency); //if (returnvalue == 0) //{ delAl.Add(frequency); this.neuSpread1_Sheet1.Rows[index].Remove(); //} //if (returnvalue >= 1) //{ // MessageBox.Show("该频次已经使用,不能删除"); // return -1; //} //} } return(0); }
private ArrayList myList(string sql) { if (this.ExecQuery(sql) == -1) { return(null); } ArrayList al = new ArrayList(); #region "接口" //接口名称 Manager.Frequency.GetList.1 //<!--0 id频次id, 1 name频次名称, 2 deptcode, 3 执行时间点, 4 用法id, 5 用法name,6 SortID, // 7 operator id, 8 operator name,9 operator time --> #endregion try { while (this.Reader.Read()) { Neusoft.HISFC.Models.Order.Frequency obj = new Neusoft.HISFC.Models.Order.Frequency(); obj.ID = this.Reader[0].ToString(); //id频次id obj.Name = this.Reader[1].ToString(); //name频次名称 obj.Dept.ID = this.Reader[2].ToString(); //deptcode obj.Time = this.Reader[3].ToString(); //执行时间点 obj.Usage.ID = this.Reader[4].ToString(); //用法id obj.Usage.Name = this.Reader[5].ToString(); //用法name obj.SortID = FrameWork.Function.NConvert.ToInt32(this.Reader[6].ToString()); //sortid obj.User02 = this.Reader[7].ToString(); //operator id //obj.User02 =this.Reader[8].ToString();//operator name obj.User03 = this.Reader[9].ToString(); //operator time al.Add(obj); } return(al); } catch (Exception ee) { this.Err = ee.Message; return(null); } finally { this.Reader.Close(); } }
/// <summary> /// 获得特殊频次点和时间 /// </summary> /// <param name="moOrder"></param> /// <param name="comNo"></param> /// <returns></returns> public Neusoft.HISFC.Models.Order.Frequency GetDfqspecial(string moOrder, string comNo) { string strSql = ""; Neusoft.HISFC.Models.Order.Frequency info = null; if (this.Sql.GetSql("Order.Dfqspecial.GetDfqspecial", ref strSql) == -1) { return(null); } try { strSql = string.Format(strSql, moOrder, comNo); if (this.ExecQuery(strSql) == -1) { return(null); } if (this.Reader.Read()) { info = new Neusoft.HISFC.Models.Order.Frequency(); info.ID = Reader[0].ToString(); info.Name = Reader[1].ToString(); info.Time = Reader[2].ToString(); info.User01 = Reader[3].ToString(); } else { return(null); } } catch (Exception ee) { this.Err = ee.Message; info = null; } finally { this.Reader.Close(); } return(info); }
/// <summary> /// 获得当前所有行中对应的对象 /// </summary> /// <returns></returns> private ArrayList AddRowDataToObj() { ArrayList al = new ArrayList(); try { for (int i = 0; i < this.neuSpread1_Sheet1.Rows.Count; i++) { Neusoft.HISFC.Models.Order.Frequency frequency = new Neusoft.HISFC.Models.Order.Frequency(); frequency.ID = this.neuSpread1_Sheet1.Cells[i, 0].Text; frequency.Name = this.neuSpread1_Sheet1.Cells[i, 1].Text; frequency.Usage.ID = this.neuSpread1_Sheet1.Cells[i, 2].Text; frequency.Usage.Name = this.neuSpread1_Sheet1.Cells[i, 3].Text; frequency.Time = this.neuSpread1_Sheet1.Cells[i, 4].Text; frequency.Dept.ID = this.DeptCode; /* [2007/01/31] 没有类型检查 * * decimal temp= Convert.ToDecimal(this.neuSpread1_Sheet1.Cells[i, 5].Text); * */ try { decimal temp = Convert.ToDecimal(this.neuSpread1_Sheet1.Cells[i, 5].Text); frequency.SortID = (int)temp; } catch { frequency.SortID = 0; } al.Add(frequency); } } catch (Exception a) { MessageBox.Show(a.Message); } return(al); }
public int Del(object obj) { // TODO: 添加 Frequency.Del 实现 #region "接口" //接口名称 Manager.Frequency.Update.1 //<!--0 id频次id, 1 name频次名称, 2 deptcode, 3 执行时间点, 4 用法id, 5 用法name,6 SortID, // 7 operator id, 8 operator name,9 operator time --> #endregion string strSql = ""; if (this.Sql.GetSql("Manager.Frequency.Delete.1", ref strSql) == -1) { return(-1); } Neusoft.HISFC.Models.Order.Frequency o = obj as Neusoft.HISFC.Models.Order.Frequency; try { string[] s = new string[10]; try { s[0] = o.ID; //id频次id } catch {} try { s[1] = o.Name; //name频次名称 } catch {} try { s[2] = o.Dept.ID; //deptcode } catch {} try { s[3] = o.Time; //执行时间点 } catch {} try { s[4] = o.Usage.ID; //用法id } catch {} try { s[5] = o.Usage.Name; //用法name } catch {} try { s[6] = o.SortID.ToString(); //SortID } catch {} try { s[7] = this.Operator.ID; //operator id } catch {} try { s[8] = this.Operator.Name; //operator name } catch {} try { s[9] = this.GetSysDate(); //operator time } catch {} strSql = string.Format(strSql, s); } catch (Exception ex) { this.Err = "赋值时候出错!" + ex.Message; this.WriteErr(); return(-1); } if (this.ExecQuery(strSql) < 0) { return(-1); } return(0); }
public Neusoft.FrameWork.Models.NeuObject Get(object obj, string DeptCode) { //选择 string sql = ""; Neusoft.HISFC.Models.Order.Frequency f = null; try { f = (Neusoft.HISFC.Models.Order.Frequency)obj; } catch { this.Err = "参数类型不是频次!"; return(null); } if (this.Sql.GetSql("Manager.Frequency.Get.1", ref sql) == -1) { return(null); } try { sql = string.Format(sql, f.ID, f.Usage.ID, f.Dept.ID); } catch (Exception ex) { this.Err = ex.Message; this.WriteErr(); return(null); } ArrayList al = new ArrayList(); al = myList(sql); if (al == null || al.Count == 0) { this.Err = "没有找到频次" + f.ID + "的时间点设置!"; this.WriteErr(); return(null); } if (al.Count == 1) { return(al[0] as Neusoft.FrameWork.Models.NeuObject); //一个返回当前 } int fit = 0; for (int i = 0; i < al.Count; i++) { Neusoft.HISFC.Models.Order.Frequency tmpf = (Neusoft.HISFC.Models.Order.Frequency)al[i]; if (tmpf.Dept.ID == DeptCode) { fit = i; } if (tmpf.Usage.ID == f.Usage.ID) { fit = i; } if (tmpf.Usage.ID == f.Usage.ID && tmpf.Dept.ID == DeptCode) { fit = i; break; } } // TODO: 添加 Frequency.Get 实现 return(al[fit] as Neusoft.FrameWork.Models.NeuObject); //一个返回当前; }
/// <summary> /// 判断组合医嘱 /// </summary> /// <param name="fpSpread1"></param> /// <returns></returns> public int ValidComboOrder(Neusoft.HISFC.BizLogic.Order.Order orderManagement) { Neusoft.HISFC.Models.Order.Frequency frequency = null; Neusoft.FrameWork.Models.NeuObject usage = null; Neusoft.FrameWork.Models.NeuObject exeDept = null; string sample = ""; decimal amount = 0; int sysclass = -1; string sysClassID = string.Empty; DateTime dtBegin = new DateTime(); for (int i = 0; i < fpSpread1.ActiveSheet.Rows.Count; i++) { if (fpSpread1.ActiveSheet.IsSelected(i, 0)) { Neusoft.HISFC.Models.Order.Inpatient.Order o = this.GetObjectFromFarPoint(i, fpSpread1.ActiveSheetIndex, orderManagement); if (o.Status != 0) { MessageBox.Show(string.Format("不符合组合条件,项目{0}状态不允许修改,请重新选择!", o.Item.Name)); return(-1); } if (frequency == null) { frequency = o.Frequency.Clone(); usage = o.Usage.Clone(); sysclass = o.Item.SysClass.ID.GetHashCode(); sysClassID = o.Item.SysClass.ID.ToString(); exeDept = o.ExeDept.Clone(); sample = o.Sample.Name; amount = o.Qty; dtBegin = o.BeginTime; } else { o.BeginTime = dtBegin; if (o.Frequency.ID != frequency.ID) { MessageBox.Show("频次不同,不可以组合用!"); return(-1); } //if (o.Item.IsPharmacy) //只对药品判断用法是否相同 if (o.Item.ItemType == Neusoft.HISFC.Models.Base.EnumItemType.Drug) //只对药品判断用法是否相同 { if (o.Item.SysClass.ID.ToString() != "PCC" && o.Usage.ID != usage.ID) { MessageBox.Show("用法不同,不可以组合用!"); return(-1); } #region {B423CB4A-8E22-4aad-B847-76AAC7F9AD74} if (sysClassID == "PCC") { if (o.Item.SysClass.ID.ToString() != sysClassID) { MessageBox.Show("草药不可以和其他药品组合用!"); return(-1); } } else { if (o.Item.SysClass.ID.ToString() == "PCC") { MessageBox.Show("草药不可以和其他药品组合用!"); return(-1); } } #endregion } else { if (o.Item.SysClass.ID.ToString() == "UL")//检验 { if (o.Qty != amount) { MessageBox.Show("检验数量不同,不可以组合用!"); return(-1); } if (o.Sample.Name != sample) { MessageBox.Show("检验样本不同,不可以组合用!"); return(-1); } } } if (o.ExeDept.ID != exeDept.ID) { MessageBox.Show("执行科室不同,不能组合使用!", "提示"); return(-1); } } } } return(0); }