/// <summary> /// 查询医生预约号安排 /// </summary> /// <param name="bookingDate"></param> /// <param name="doctID"></param> /// <param name="regType"></param> public void QueryDoctBooking(DateTime bookingDate, string doctID, RegTypeNUM regType) { if (this.fpSpread1_Sheet1.RowCount > 0) { this.fpSpread1_Sheet1.Rows.Remove(0, this.fpSpread1_Sheet1.RowCount); } al = this.SchemaMgr.QueryByDoct(bookingDate.Date, doctID); if (al == null) { MessageBox.Show("查询排班信息时出错!" + this.SchemaMgr.Err, "提示"); return; } DateTime current = this.SchemaMgr.GetDateTimeFromSysDateTime(); foreach (Neusoft.HISFC.Models.Registration.Schema obj in al) { if (!IsMaybeValid(obj, current, regType)) { continue; } this.AddRow(obj); } //this.Span() ; }
/// <summary> /// 从指定的排班信息中,获得一条有效的、最早的、限额未满的排班信息 /// </summary> /// <param name="regType"></param> /// <returns></returns> public Neusoft.HISFC.Models.Registration.Schema GetValidBooking(ArrayList schemaCollection, RegTypeNUM regType) { if (schemaCollection == null) { return(null); } DateTime current = this.SchemaMgr.GetDateTimeFromSysDateTime(); foreach (Neusoft.HISFC.Models.Registration.Schema obj in schemaCollection) { if (!this.IsValid(obj, current, regType)) { continue; } return(obj); } return(null); }
/// <summary> /// 获得一条有效的、最早的、限额未满的排班信息 /// </summary> /// <param name="regType"></param> /// <returns></returns> public Neusoft.HISFC.Models.Registration.Schema GetValidBooking(RegTypeNUM regType) { return(this.GetValidBooking(al, regType)); }
/// <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); }
/* * 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); }