public string GetMonthData(int year, int month)
        {
            List <HospitalCalendarViewModel> models = new List <HospitalCalendarViewModel>();
            DateTime startTime = new DateTime(year, month, 1);
            DateTime endTime   = startTime.AddMonths(1);

            using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork())
            {
                IList <HospitalCalendar> result = _hospitalCalendarService.GetCalendarData(startTime, endTime);
                foreach (var item in result)
                {
                    IList <CompanySubOrder> subOrders = _companySubOrderService.GetSubOrders(Convert.ToDateTime(item.StartDate), Convert.ToDateTime(item.EndDate));

                    int orderStatus = 0;
                    if (subOrders.Count > 0)
                    {
                        orderStatus = subOrders[0].BookStatus.Name == "已确认" ? 2 : 1;
                    }
                    models.Add(new HospitalCalendarViewModel
                    {
                        Id              = item.Id,
                        CreatedDate     = item.CreatedDate,
                        EndDateString   = Convert.ToDateTime(item.EndDate).ToString("yyyy-MM-dd"),
                        StartDateString = Convert.ToDateTime(item.StartDate).ToString("yyyy-MM-dd"),
                        CreatedBy       = item.CreatedBy,
                        Enabled         = item.Enabled,
                        OrderStatus     = orderStatus
                    });
                }
                if (models.Count == 0)
                {
                    var interval = (endTime - startTime).Days;
                    for (var i = 0; i < interval; i++)
                    {
                        models.Add(new HospitalCalendarViewModel
                        {
                            StartDate       = startTime.AddDays(i),
                            EndDate         = startTime.AddDays(i + 1),
                            StartDateString = startTime.AddDays(i).ToString("yyyy-MM-dd"),
                            EndDateString   = startTime.AddDays(i + 1).ToString("yyyy-MM-dd"),
                        });
                    }
                }
                return(JsonHelper.SerializeToJson(models));
            }
            //return JsonHelper.SerializeToJson(new List<HospitalCalendar>());
        }
        public string GetMonthData(int year, int month, Guid?companyId)
        {
            List <CompanyCalendarViewModel> models = new List <CompanyCalendarViewModel>();
            DateTime startTime = new DateTime(year, month, 1);
            DateTime endTime   = startTime.AddMonths(1);

            using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork())
            {
                IList <HospitalCalendar> result = _hospitalCalendarService.GetCalendarData(startTime, endTime);
                if (companyId == null)
                {
                    companyId = WorkContext.CurrentMembershipUser.Company.Id;
                }
                var company = _companyService.GetById(new Guid(companyId.ToString()));
                foreach (var item in result)
                {
                    IList <CompanySubOrder> subOrders = _companySubOrderService.GetSubOrders(Convert.ToDateTime(item.StartDate), Convert.ToDateTime(item.EndDate));

                    int orderStatus = 0;
                    if (subOrders.Count > 0)
                    {
                        orderStatus = subOrders[0].BookStatus.Name == "已确认" ? 2 : 1;
                    }
                    bool belongCompanyOrder = company.CompanySubOrders
                                              .Where(x => x.StartDate <= item.StartDate && x.EndDate >= item.EndDate).ToList().Count > 0;
                    models.Add(new CompanyCalendarViewModel
                    {
                        Id              = item.Id,
                        CreatedDate     = item.CreatedDate,
                        EndDateString   = Convert.ToDateTime(item.EndDate).ToString("yyyy-MM-dd"),
                        StartDateString = Convert.ToDateTime(item.StartDate).ToString("yyyy-MM-dd"),
                        CreatedBy       = item.CreatedBy,
                        Enabled         = item.Enabled,
                        OrderStatus     = orderStatus,
                        BelongToCompany = belongCompanyOrder
                    });
                }
            }
            return(JsonHelper.SerializeToJson(models));
        }