/// <summary>
        /// 增加排班记录
        /// </summary>
        /// <param name="schema"></param>
        /// <returns></returns>
        public int Insert(neusoft.HISFC.Object.Registration.DoctSchema schema)
        {
            string sql = "";

            if (this.Sql.GetSql("Registration.DoctSchema.Insert.1", ref sql) == -1)
            {
                return(-1);
            }

            try
            {
                sql = string.Format(sql, schema.SeeDate, schema.Week, schema.NoonID, schema.Doctor.ID,
                                    schema.Doctor.Name, schema.Dept, schema.Room.ID, schema.Room.Name,
                                    schema.Estrade, schema.DoctType, schema.RegLevel, schema.RegLimit,
                                    schema.PreRegLimit, neusoft.neuFC.Function.NConvert.ToInt32(schema.IsValid), schema.StopReason.ID, schema.StopReason.Name,
                                    schema.StopID, schema.StopDate, schema.Memo, schema.OperID,
                                    schema.ID);


                return(this.ExecNoQuery(sql));
            }
            catch (Exception e)
            {
                this.Err     = "插入医生出诊信息表出错!" + e.Message;
                this.ErrCode = e.Message;
                return(-1);
            }
        }
        /// <summary>
        /// 按sql查询排班信息
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        private ArrayList QuerySchema(string sql)
        {
            al = new ArrayList();
            try
            {
                if (this.ExecQuery(sql) == -1)
                {
                    return(null);
                }
                while (this.Reader.Read())
                {
                    schema         = new neusoft.HISFC.Object.Registration.DoctSchema();
                    schema.SeeDate = DateTime.Parse(this.Reader[2].ToString()); //出诊时间

                    schema.NoonID      = this.Reader[4].ToString();             //午别
                    schema.Doctor.ID   = this.Reader[5].ToString();             //医生代码
                    schema.Doctor.Name = this.Reader[6].ToString();             //医生名称
                    schema.Dept        = this.Reader[7].ToString();             //出诊科室
                    schema.Room.Name   = this.Reader[9].ToString();             //诊室
                    schema.Estrade     = this.Reader[10].ToString();            //诊台
                    schema.DoctType    = this.Reader[11].ToString();            //医生类别
                    schema.RegLevel    = this.Reader[12].ToString();            //挂号级别

                    if (this.Reader.IsDBNull(13) == false)
                    {
                        schema.RegLimit = int.Parse(this.Reader[13].ToString());                      //挂号限额
                    }
                    if (this.Reader.IsDBNull(14) == false)
                    {
                        schema.PreRegLimit = int.Parse(this.Reader[14].ToString()); //预约挂号限额
                    }
                    schema.HasReg          = int.Parse(this.Reader[16].ToString()); //已挂
                    schema.HasPreReg       = int.Parse(this.Reader[17].ToString()); //预约已挂
                    schema.IsValid         = neusoft.neuFC.Function.NConvert.ToBoolean(this.Reader[20].ToString());
                    schema.StopReason.ID   = this.Reader[21].ToString();
                    schema.StopReason.Name = this.Reader[22].ToString();         //停诊原因
                    schema.StopID          = this.Reader[23].ToString();         //停止人

                    if (this.Reader.IsDBNull(24) == false)
                    {
                        schema.StopDate = DateTime.Parse(this.Reader[24].ToString());
                    }
                    schema.Memo     = this.Reader[25].ToString();              //备注
                    schema.OperID   = this.Reader[26].ToString();              //操作时间
                    schema.OperDate = DateTime.Parse(this.Reader[27].ToString());
                    schema.ID       = this.Reader[28].ToString();

                    al.Add(schema);
                }
                this.Reader.Close();
            }
            catch (Exception e)
            {
                this.Err     = "获取医生出诊排班信息出错!" + e.Message;
                this.ErrCode = e.Message;
                return(null);
            }
            return(al);
        }
        /// <summary>
        /// 删除排班记录
        /// </summary>
        /// <param name="schema"></param>
        /// <returns></returns>
        public int Delete(neusoft.HISFC.Object.Registration.DoctSchema schema)
        {
            string sql = "";

            if (this.Sql.GetSql("Registration.DoctSchema.Delete.1", ref sql) == -1)
            {
                return(-1);
            }

            try
            {
                sql = string.Format(sql, schema.ID);

                return(this.ExecNoQuery(sql));
            }
            catch (Exception e)
            {
                this.Err     = "删除医生出诊排班信息时出错!" + e.Message;
                this.ErrCode = e.Message;
                return(-1);
            }
        }
        /// <summary>
        /// 更新排班记录
        /// </summary>
        /// <param name="schema"></param>
        /// <returns></returns>
        public int Update(neusoft.HISFC.Object.Registration.DoctSchema schema)
        {
            string sql = "";

            if (this.Sql.GetSql("Registration.DoctSchema.Update.1", ref sql) == -1)
            {
                return(-1);
            }

            try
            {
                sql = string.Format(sql, schema.ID, schema.RegLimit, schema.PreRegLimit, neusoft.neuFC.Function.NConvert.ToInt32(schema.IsValid),
                                    schema.StopReason.ID, schema.StopReason.Name, schema.StopID, schema.StopDate.ToString());

                return(this.ExecNoQuery(sql));
            }
            catch (Exception e)
            {
                this.Err     = "更新医生出诊排班信息时出错!" + e.Message;
                this.ErrCode = e.Message;
                return(-1);
            }
        }