Пример #1
0
        public IList <AppointmentResult> GetListAppointment(FilterAppointmentModel model)
        {
            var url  = ApiUrl.Default.RootApi + ApiUrl.Default.GetListAppointmentsOfDoctor;
            var data = Restful.Post(url, null, model);

            _total = data["Total"].ToObject <int>();
            return(data.GetList <AppointmentResult>(ApiKeyData.ListAppointment));
        }
Пример #2
0
        public ActionResult GetAppointment(JQueryDataTableParamModel param, string status, string doctorId, string selectDate, string keyword)
        {
            try
            {
                var authInfo = (AuthInfo)Session["auth_info"];
                if (authInfo == null)
                {
                    return(Json(new KeyValueResult(false, GlobalConstant.SessionExpired), JsonRequestBehavior.AllowGet));
                }
                var timeZone = Request.Cookies["TimeZone"].Value;

                var filter = new FilterAppointmentModel
                {
                    ClinicId             = authInfo.CurrentSelectedClinic.ClinicId,
                    DoctorId             = string.IsNullOrEmpty(doctorId) ? "all" : doctorId,
                    SelectDate           = string.IsNullOrEmpty(selectDate) ? "all" : selectDate,
                    Type                 = status,
                    Start                = param.iDisplayStart,
                    Limit                = param.iDisplayLength,
                    FromTime             = string.IsNullOrEmpty(selectDate) ? Utils.GetMidnightCurrentDateTimeSpan(timeZone) : Utils.GetMidnightBeginDateTimeSpan(DateTime.Parse(selectDate), timeZone),
                    ToTime               = string.IsNullOrEmpty(selectDate) ? 0 : Utils.GetMidnightEndDateTimeSpan(DateTime.Parse(selectDate), timeZone),
                    OrderByStartDateTime = string.IsNullOrEmpty(param.sSortDir_0) ? "ASC" : param.sSortDir_0.ToUpper(),
                    Keywords             = string.IsNullOrEmpty(keyword) ? "" : keyword
                };
                var appointments = _appointmentService.GetListAppointment(filter);
                var index        = 1;
                if (param.iDisplayStart > 0)
                {
                    index += param.iDisplayStart;
                }
                var appointmentListViewModel = new List <AppointmentListViewModel>();
                foreach (var item in appointments)
                {
                    var dateTime       = Utils.FromUnixTime(item.ExpectedStartDateTime, timeZone);
                    var actualDateTime = (item.ActualStartDateTime == null)
                        ? (DateTime?)null
                        : Utils.FromUnixTime((long)item.ActualStartDateTime, timeZone);
                    //if (item.CallLog != null)
                    //{
                    //    foreach (var call in item.CallLog)
                    //    {

                    //        call.StrStatus = ((CallStatus)call.Status).DescriptionAttr();
                    //        var sDate = Utils.UnixTimeStampToDateTime(Int64.Parse(call.StartDate),
                    //            BaseApiHeader.TimeOffset);
                    //        call.StrStartDate = sDate.ToString(GlobalConstant.DateTimeFormat);
                    //    }
                    //}

                    appointmentListViewModel.Add(new AppointmentListViewModel
                    {
                        Id                    = item.AppointmentId,
                        Duration              = item.ExpectedDuration,
                        Status                = item.Status,
                        Date                  = dateTime.ToString(GlobalConstant.DateFormat),
                        No                    = index,
                        DoctorName            = item.Doctor.FullName,
                        PatientName           = item.Patient.FullName,
                        Time                  = dateTime.ToString("HH:mm"),
                        Phone                 = item.Patient.Phone,
                        SipUriMeeting         = item.MeetingUri,
                        ActualDuration        = (item.ActualDuration == null) ? "-" : item.ActualDuration.ToString(),
                        ActualFee             = item.ActualFee == 0 ? "-" : "$" + item.ActualFee,
                        ActualStart           = actualDateTime?.ToString("HH:mm") ?? "-",
                        ActualStatus          = ((AppointmentStatus)item.Status).DescriptionAttr(),
                        AppointmentDate       = dateTime.ToString(GlobalConstant.DateFormat),
                        Fee                   = "$" + item.ExpectedFee,
                        OtherFamilyMember     = item.PatientFullName,
                        HasCarer              = !string.IsNullOrEmpty(item.PatientFirstName),
                        FirstName             = item.Patient.FirstName,
                        LastName              = item.Patient.LastName,
                        OtherFirstName        = item.PatientFirstName,
                        OtherLastName         = item.PatientLastName,
                        IsFloating            = item.Patient.IsFoalting == 1,
                        Email                 = item.Patient.Email,
                        DoctorId              = item.Doctor.DoctorId,
                        PatientId             = item.Patient.PatientId,
                        UrlJoinMeeting        = item.JoinMettingUrl,
                        ExpectedStartDateTime = item.ExpectedStartDateTime,
                        PatientAvatar         = item.Patient.PatientAvatar
                    });

                    index++;
                }
                var list = (from appointment in appointmentListViewModel
                            select new
                {
                    appointment
                }).ToList();
                return(Json(new
                {
                    draw = param.sEcho,
                    recordsTotal = list.Count,
                    recordsFiltered = _appointmentService.Total(),
                    data = list
                }, JsonRequestBehavior.AllowGet));
            }
            catch (ApiException)
            {
                var appointmentListViewModel = new List <AppointmentListViewModel>();
                return(Json(new
                {
                    draw = param.sEcho,
                    recordsTotal = appointmentListViewModel.Count,
                    recordsFiltered = _appointmentService.Total(),
                    data = appointmentListViewModel
                }, JsonRequestBehavior.AllowGet));
            }
        }