/// <summary> /// add object to farpoint /// </summary> /// <param name="schema"></param> private void AddRow(Neusoft.HISFC.Models.Registration.Schema schema) { this.fpSpread1_Sheet1.Rows.Add(this.fpSpread1_Sheet1.RowCount, 1); int Index = this.fpSpread1_Sheet1.RowCount - 1; this.fpSpread1_Sheet1.SetValue(Index, 0, schema.SeeDate.ToString("yyyy-MM-dd") + this.getWeek(schema.SeeDate), false); this.fpSpread1_Sheet1.SetValue(Index, 1, this.GetNoonNameByID(schema.Templet.Noon.ID), false); //开始时间、结束时间 if (schema.Templet.IsAppend) { this.fpSpread1_Sheet1.SetValue(Index, 2, "加号", false); this.fpSpread1_Sheet1.SetValue(Index, 3, "加号", false); } else { this.fpSpread1_Sheet1.SetValue(Index, 2, schema.Templet.Begin.ToString("HH:mm"), false); this.fpSpread1_Sheet1.SetValue(Index, 3, schema.Templet.End.ToString("HH:mm"), false); } //来人设号 this.fpSpread1_Sheet1.SetValue(Index, 4, schema.Templet.RegQuota, false); //来人取号 this.fpSpread1_Sheet1.SetValue(Index, 5, schema.RegedQTY, false); //来电 this.fpSpread1_Sheet1.SetValue(Index, 6, schema.Templet.TelQuota, false); this.fpSpread1_Sheet1.SetValue(Index, 7, schema.TelingQTY, false); this.fpSpread1_Sheet1.SetValue(Index, 8, schema.TeledQTY, false); //特诊 this.fpSpread1_Sheet1.SetValue(Index, 9, schema.Templet.SpeQuota, false); this.fpSpread1_Sheet1.SetValue(Index, 10, schema.SpedQTY, false); this.fpSpread1_Sheet1.Rows[Index].Tag = schema; }
/// <summary> /// 取得最有效的一条出诊记录 /// </summary> /// <param name="obj"></param> /// <param name="current"></param> /// <param name="regType"></param> /// <returns></returns> private bool IsValid(Neusoft.HISFC.Models.Registration.Schema obj, DateTime current, RegTypeNUM regType) { if (this.IsMaybeValid(obj, current, regType) == false) { return(false); } //判断是否超限额 if (!obj.Templet.IsAppend) { if (regType == RegTypeNUM.Booking) { //中山特诊不预约,但是排班时特诊和其他科作为两条排班记录,预约挂号时只选择教授,默认检索一条符合条件的排班记录 //这时就会经常带出特诊科室,没法看到另外科室的排班信息,在这里限制一下 bool found = false; foreach (Neusoft.HISFC.Models.Base.Const con in this.alSpecialDepts) { if (obj.Templet.Dept.ID == con.ID) { found = true; break; } } if (found) { return(false); } if (obj.Templet.TelQuota <= obj.TelingQTY) { return(false); //超限额 } } else if (regType == RegTypeNUM.Expert) { if (obj.Templet.RegQuota <= obj.RegedQTY) { return(false); } } else if (regType == RegTypeNUM.Faculty) { if (obj.Templet.RegQuota <= obj.RegedQTY) { return(false); } } else if (regType == RegTypeNUM.Special) { if (obj.Templet.SpeQuota <= obj.SpedQTY) { return(false); } } } return(true); }
/// <summary> /// 登记一条排班记录 /// </summary> /// <param name="schema"></param> /// <returns></returns> public int Insert(Neusoft.HISFC.Models.Registration.Schema schema) { string sql = ""; if (this.Sql.GetSql("Registration.Schema.Insert", ref sql) == -1) { return(-1); } try { sql = string.Format(sql, schema.Templet.ID, (int)schema.Templet.EnumSchemaType, schema.SeeDate.ToString(), (int)schema.Templet.Week, schema.Templet.Noon.ID, schema.Templet.Dept.ID, schema.Templet.Dept.Name, schema.Templet.Doct.ID, schema.Templet.Doct.Name, schema.Templet.DoctType.ID, schema.Templet.RegQuota, schema.RegedQTY, Neusoft.FrameWork.Function.NConvert.ToInt32(schema.Templet.IsValid), schema.Templet.StopReason.ID, schema.Templet.StopReason.Name, schema.Templet.Stop.ID, schema.Templet.Stop.OperTime.ToString(), schema.Templet.Memo, schema.Templet.Oper.ID, schema.Templet.Oper.OperTime.ToString(), schema.Templet.Begin.ToString(), schema.Templet.End.ToString(), schema.Templet.TelQuota, schema.TeledQTY, schema.TelingQTY, schema.Templet.SpeQuota, schema.SpedQTY, Neusoft.FrameWork.Function.NConvert.ToInt32(schema.Templet.IsAppend), schema.Templet.RegLevel.ID, schema.Templet.RegLevel.Name, schema.FromTempletID); } catch (Exception e) { this.Err = "[Registration.Schema.Insert]格式不匹配!" + e.Message; this.ErrCode = e.Message; return(-1); } return(this.ExecNoQuery(sql)); }
/// <summary> /// 根据ID修改一条排班记录(已使用的) /// </summary> /// <param name="schema"></param> /// <returns></returns> public int Update(Neusoft.HISFC.Models.Registration.Schema schema) { string sql = ""; if (this.Sql.GetSql("Registration.Schema.Update", ref sql) == -1) { return(-1); } try { sql = string.Format(sql, schema.Templet.RegQuota, Neusoft.FrameWork.Function.NConvert.ToInt32(schema.Templet.IsValid), schema.Templet.StopReason.ID, schema.Templet.StopReason.Name, schema.Templet.Stop.ID, schema.Templet.Stop.OperTime.ToString(), schema.Templet.Memo, schema.Templet.Oper.ID, schema.Templet.Oper.OperTime.ToString(), schema.Templet.TelQuota, schema.Templet.SpeQuota, schema.Templet.ID, schema.Templet.RegLevel.ID, schema.Templet.RegLevel.Name); } catch (Exception e) { this.Err = "[Registration.Schema.Update]格式不匹配!" + e.Message; this.ErrCode = e.Message; return(-1); } return(this.ExecNoQuery(sql)); }
/* * private void Span() * { * int rowLastDate = 0, rowLastNoon = 0 ; * int rowCnt = this.fpSpread1_Sheet1.RowCount ; * for( int i = 0 ;i < rowCnt ; i++) * { * if( i > 0 && this.fpSpread1_Sheet1.GetText(i,0) != this.fpSpread1_Sheet1.GetText(i-1,0)) * { * if( i - rowLastDate > 1 ) * { * this.fpSpread1_Sheet1.Models.Span.Add(rowLastDate,0 , i - rowLastDate ,1) ; * } * * rowLastDate = i ; * } * * //最后一行处理 * if(i > 0&& i == rowCnt -1 && this.fpSpread1_Sheet1.GetText(i,0) == this.fpSpread1_Sheet1.GetText(i-1,0)) * { * this.fpSpread1_Sheet1.Models.Span.Add(rowLastDate,0, i - rowLastDate + 1,1) ; * } * * ///午别 * /// * if( i > 0 && * (this.fpSpread1_Sheet1.GetText(i,0) != this.fpSpread1_Sheet1.GetText(i-1,0)|| * this.fpSpread1_Sheet1.GetText(i,1) != this.fpSpread1_Sheet1.GetText(i-1,1))) * * { * if(i - rowLastNoon >1 ) * { * this.fpSpread1_Sheet1.Models.Span.Add(rowLastNoon,1, i - rowLastNoon,1) ; * } * rowLastNoon = i ; * } * //最后一行 * if( i > 0 && i == rowCnt - 1 && * (this.fpSpread1_Sheet1.GetText(i,1) == this.fpSpread1_Sheet1.GetText(i-1,1)|| * this.fpSpread1_Sheet1.GetText(i,0) == this.fpSpread1_Sheet1.GetText(i-1,0))) * { * this.fpSpread1_Sheet1.Models.Span.Add(rowLastNoon,1, i - rowLastNoon + 1,1) ; * } * } * } */ #endregion /// <summary> /// 判断一条出诊信息是否有效(超出限额的为判断,所以用了Maybe, HaHa ~~ :)) /// </summary> /// <param name="obj"></param> /// <param name="current"></param> /// <param name="regType"></param> /// <returns></returns> private bool IsMaybeValid(Neusoft.HISFC.Models.Registration.Schema obj, DateTime current, RegTypeNUM regType) { //无效 if (obj.Templet.IsValid == false) { return(false); } //不是加号 // if(!obj.Templet.IsAppend) // { // if(regType == RegTypeNUM.Booking) // { // if(obj.Templet.TelLmt == 0) return false ;//没有预约安排,不显示 // } // else if(regType == RegTypeNUM.Expert) // { // if(obj.Templet.RegLmt ==0) return false ; // } // else if(regType == RegTypeNUM.Faculty) // { // if(obj.Templet.RegLmt ==0) return false ; // } // else if(regType == RegTypeNUM.Special) // { // if(obj.Templet.SpeLmt == 0) return false ; // } // } // //只有日期相同,才判断时间是否超时,否则就是预约到以后日期,时间不用判断,(出诊时间一定是>=当前时间) // if (current.Date == obj.SeeDate.Date) { if (obj.Templet.End.TimeOfDay < current.TimeOfDay) { return(false); //时间小于当前时间,不显示 } } return(true); }
/// <summary> /// 判断超出挂号限额是否允许挂号 /// </summary> /// <param name="schMgr"></param> /// <param name="regType"></param> /// <param name="schemaID"></param> /// <param name="level"></param> /// <param name="seeNo"></param> /// <param name="Err"></param> /// <returns></returns> private int IsPermitOverrun(Neusoft.HISFC.Models.Base.EnumRegType regType, string schemaID, Neusoft.HISFC.Models.Registration.RegLevel level, ref int seeNo, ref string Err) { bool isOverrun = false;//是否超额 Neusoft.HISFC.Models.Registration.Schema schema = this.SchemaMgr.GetByID(schemaID); if (schema == null || schema.Templet.ID == "") { Err = "查询排班信息出错!" + SchemaMgr.Err; return(-1); } if (level.IsExpert || level.IsFaculty)//专家、专科判断限额是否大于已挂号 { if (schema.Templet.RegQuota - schema.RegedQTY < 0) { isOverrun = true; } seeNo = schema.SeeNO; } else if (level.IsSpecial)//特诊判断特诊限额是否超表 { if (schema.Templet.SpeQuota - schema.SpedQTY < 0) { isOverrun = true; } seeNo = schema.SeeNO; } if (isOverrun) { //加号不用提示 if (schema.Templet.IsAppend) { return(0); } Err = "已经超出出诊排班限额,不能挂号!"; return(-1); } return(0); }
/// <summary> /// 查询 /// </summary> /// <param name="sql"></param> /// <returns></returns> public ArrayList QueryBase(string sql) { if (this.ExecQuery(sql) == -1) { return(null); } this.al = new ArrayList(); try { while (this.Reader.Read()) { this.objSchema = new Neusoft.HISFC.Models.Registration.Schema(); this.objSchema.Templet.ID = this.Reader[2].ToString(); this.objSchema.Templet.EnumSchemaType = (Neusoft.HISFC.Models.Base.EnumSchemaType)(Neusoft.FrameWork.Function.NConvert.ToInt32(this.Reader[3].ToString())); this.objSchema.SeeDate = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.Reader[4].ToString()); this.objSchema.Templet.Week = (DayOfWeek)(Neusoft.FrameWork.Function.NConvert.ToInt32(this.Reader[5].ToString())); this.objSchema.Templet.Noon.ID = this.Reader[6].ToString(); this.objSchema.Templet.Dept.ID = this.Reader[7].ToString(); this.objSchema.Templet.Dept.Name = this.Reader[8].ToString(); this.objSchema.Templet.Doct.ID = this.Reader[9].ToString(); this.objSchema.Templet.Doct.Name = this.Reader[10].ToString(); this.objSchema.Templet.DoctType.ID = this.Reader[11].ToString(); this.objSchema.Templet.RegQuota = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.Reader[12].ToString()); this.objSchema.RegedQTY = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.Reader[13].ToString()); this.objSchema.Templet.IsValid = Neusoft.FrameWork.Function.NConvert.ToBoolean(this.Reader[14].ToString()); this.objSchema.Templet.StopReason.ID = this.Reader[15].ToString(); this.objSchema.Templet.StopReason.Name = this.Reader[16].ToString(); this.objSchema.Templet.Stop.ID = this.Reader[17].ToString(); this.objSchema.Templet.Stop.OperTime = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.Reader[18].ToString()); this.objSchema.Templet.Memo = this.Reader[19].ToString(); this.objSchema.Templet.Oper.ID = this.Reader[20].ToString(); this.objSchema.Templet.Oper.OperTime = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.Reader[21].ToString()); this.objSchema.Templet.Begin = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.Reader[22].ToString()); this.objSchema.Templet.End = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.Reader[23].ToString()); this.objSchema.Templet.TelQuota = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.Reader[24].ToString()); this.objSchema.TeledQTY = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.Reader[25].ToString()); this.objSchema.TelingQTY = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.Reader[26].ToString()); this.objSchema.Templet.SpeQuota = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.Reader[27].ToString()); this.objSchema.SpedQTY = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.Reader[28].ToString()); this.objSchema.Templet.IsAppend = Neusoft.FrameWork.Function.NConvert.ToBoolean(this.Reader[29].ToString()); this.objSchema.SeeNO = Neusoft.FrameWork.Function.NConvert.ToInt32(this.Reader[30].ToString()); this.objSchema.Templet.RegLevel.ID = this.Reader[31].ToString(); this.objSchema.Templet.RegLevel.Name = this.Reader[32].ToString(); this.objSchema.FromTempletID = this.Reader[33].ToString(); this.al.Add(this.objSchema); } this.Reader.Close(); } catch (Exception e) { this.Err = "查询排班信息出错!" + e.Message; this.ErrCode = e.Message; return(null); } return(al); }