//4每个医生医生具体的签到列表,按时间段排列 public List <DoctorRegisterDetailInformatonForPast> GetDoctorRegisterDetailInformatonForPast(string timeType, string userID) { List <DoctorRegisterDetailInformatonForPast> list_model = new List <DoctorRegisterDetailInformatonForPast>(); String command = GetCommandForDetailedDoctorRegisteredTime(timeType, userID); DbCommand queryCommand = db.GetSqlStringCommand(command); using (IDataReader reader = db.ExecuteReader(queryCommand)) { while (reader.Read()) { DoctorRegisterDetailInformatonForPast model = new DoctorRegisterDetailInformatonForPast(); if (reader["ArrangeTime"] is DBNull) { model.ArrangeWorkTime = null; } else { model.ArrangeWorkTime = Convert.ToDateTime(reader["ArrangeTime"].ToString()); } if (reader["RegisterTime"] is DBNull) { model.RegisterTime = null; } else { model.RegisterTime = Convert.ToDateTime(reader["RegisterTime"].ToString()); } //model.DoctorName = reader["DoctorName"] is DBNull ? string.Empty: reader["DoctorName"].ToString(); model.RegisterTime = null; model.TimeType = reader["TimeType"] is DBNull ? string.Empty : reader["TimeType"].ToString(); list_model.Add(model); } } return(list_model); }
public List <DoctorRegisterDetailInformatonForPast> GetDoctorRegisterDetailInformatonForPast(string timeType, string userID) { List <DoctorRegisterDetailInformatonForPast> list_model = new List <DoctorRegisterDetailInformatonForPast>(); #region 测试数据1 DateTime today = DateTime.Now.Date; today = today.AddHours(8); // string todayStr = today.ToString("yyyy-MM-dd hh:mm:ss"); int number = int.Parse(userID); if (number % 2 == 1) { for (int i = 6; i > -1; i--) { DoctorRegisterDetailInformatonForPast modelTemp = new DoctorRegisterDetailInformatonForPast(); if (i % 2 == 1) { modelTemp.TimeType = modelTemp.TimeType = "1"; modelTemp.ArrangeWorkTime = today.AddDays(-i); modelTemp.RegisterTime = today.AddDays(-i).AddMinutes(-30 * i + 50); } else if (i % 2 == 0) { modelTemp.TimeType = modelTemp.TimeType = "2"; modelTemp.ArrangeWorkTime = today.AddDays(-i).AddHours(5).AddMinutes(30); modelTemp.RegisterTime = today.AddDays(-i).AddHours(5).AddMinutes(30).AddMinutes(-10 * i); } else { modelTemp.TimeType = modelTemp.TimeType = "1"; modelTemp.ArrangeWorkTime = today.AddDays(-i); modelTemp.RegisterTime = today.AddDays(-i).AddMinutes(-10 * i); } list_model.Add(modelTemp); } return(list_model); } #endregion #region 测试数据2 else { for (int i = 7; i > 0; i--) { DoctorRegisterDetailInformatonForPast modelTemp = new DoctorRegisterDetailInformatonForPast(); if (i % 2 == 1) { modelTemp.TimeType = modelTemp.TimeType = "1"; modelTemp.ArrangeWorkTime = today.AddDays(-i + 1); modelTemp.RegisterTime = today.AddDays(-i + 1).AddMinutes(-20 + 5 * i); } else if (i % 2 == 0) { modelTemp.TimeType = modelTemp.TimeType = "2"; modelTemp.ArrangeWorkTime = today.AddDays(-i + 1).AddHours(5).AddMinutes(30); modelTemp.RegisterTime = today.AddDays(-i + 1).AddHours(5).AddMinutes(30).AddMinutes(-30 - 5 * i); } else { modelTemp.TimeType = modelTemp.TimeType = "1"; modelTemp.ArrangeWorkTime = today.AddDays(-i + 1); modelTemp.RegisterTime = today.AddDays(-i + 1).AddMinutes(-10 * i); } list_model.Add(modelTemp); } return(list_model); } #endregion }