private DataRow CreateRow(ReportsDataSet.ReacardPrescriptionsDataTable dtReacardPrescriptions, string productName, DateTime startDate, DateTime endDate, DateTime dateTime)
        {
            DataRow dr = dtReacardPrescriptions.NewRow();

            dr[0] = productName;
            bool first = true;

            for (int col = 1; col <= 24; col++)
            {
                DateTime dt = reacard.date.Date + TimeSpan.FromHours(col + 8);
                if (startDate <= dt && dt < endDate)
                {
                    if (first)
                    {
                        TimeSpan ts = dt - startDate;
                        first = ts.TotalHours < 1;
                    }
                    dr[col] = first ? "+" : ">";
                    if (first)
                    {
                        first = false;
                    }
                }
            }
            dtReacardPrescriptions.Rows.Add(dr);
            return(dr);
        }
        public ReportsDataSet.ReacardPrescriptionsDataTable GetReacardPrescriptionsTable(ConnectionFactory factory)
        {
            DataTable dataTable = new DataTable();
            string    cmdText   = @"select Prescriptions.*, Products.Name as ProductName, BaseUnits.Name as BaseUnitName, UnitCount, PrescriptionTypes.ShortName
from Prescriptions 
left join StoreProducts on StoreProducts.Id=StoreProductId
left join Products on Products.Id=ProductId
left join BaseUnits on BaseUnits.Id=BaseUnitId
left join PrescriptionTypes on PrescriptionTypes.Id=PrescriptionTypeId
where PatientId=@PatientId 
and StartDate<@EndTime
and EndDate>@StartTime
and ReanimationFlag=1
order by PrescriptionTypeId, StartDate";
//and PrescriptionTypeId=@PrescriptionTypeId
            DateTime startTime = reacard.date.Date + TimeSpan.FromHours(9);
            DateTime endTime   = startTime + TimeSpan.FromHours(24);

            using (GmConnection conn = factory.CreateConnection())
            {
                GmCommand cmd = conn.CreateCommand(cmdText);
                cmd.AddInt("PatientId", patient.Id);
                cmd.AddDateTime("StartTime", startTime);
                cmd.AddDateTime("EndTime", endTime);
//				cmd.AddInt("PrescriptionTypeId", PrescriptionTypeId.IntravenousInjection);
                conn.Fill(dataTable, cmd);
            }
            ReportsDataSet.ReacardPrescriptionsDataTable dtReacardPrescriptions = new ReportsDataSet.ReacardPrescriptionsDataTable();
            foreach (DataRow dr in dataTable.Rows)
            {
                string   productName = string.Format("{0} {1}{2} {3}", dr["ProductName"], dr["UnitCount"], dr["BaseUnitName"], dr["ShortName"]);
                DateTime startDate   = (DateTime)dr["StartDate"];
                DateTime endDate     = (DateTime)dr["EndDate"];
                CreateRow(dtReacardPrescriptions, productName, startDate, endDate, reacard.date);
            }
            return(dtReacardPrescriptions);
        }