public async Task <IActionResult> GetAppointmentDoctorDetailAsync([FromQuery] GetAppointmentDoctorScheduleDetailRequest requestDto) { if (requestDto.ScheduleDate.Date < DateTime.Now.Date || requestDto.ScheduleDate.Date > DateTime.Now.Date.AddDays(6)) { return(Failed(ErrorCode.UserData, "排班时间必须在7天内时间查询")); } DoctorAppointmentBiz doctorAppointmentBiz = new DoctorAppointmentBiz(); var response = await doctorAppointmentBiz.GetAppointmentDoctorDetailAsync(requestDto); if (response != null) { foreach (var item in response) { var appointmentEndTime = Convert.ToDateTime($"{item.ScheduleDate.ToString("yyyy-MM-dd")} {item.EndTime.ToString()}"); if (DateTime.Now >= appointmentEndTime) { item.IsOvertime = true; } } } return(Success(response)); }
/// <summary> /// 获取医生排班详情数据 /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <List <GetAppointmentDoctorScheduleDetailResponse> > GetAppointmentDoctorDetailAsync(GetAppointmentDoctorScheduleDetailRequest request) { using (var conn = MySqlHelper.GetConnection()) { var result = await conn.QueryAsync <GetAppointmentDoctorScheduleDetailResponse>($@"SELECT a.schedule_guid, b.workshift_detail_guid, a.schedule_date, a.appointment_limit, a.appointment_quantity, b.workshift_type, DATE_FORMAT(b.start_time, '%H:%i' ) as start_time, DATE_FORMAT(b.end_time, '%H:%i' ) as end_time FROM t_doctor_schedule a LEFT JOIN t_doctor_workshift_detail b ON a.workshift_detail_guid = b.workshift_detail_guid WHERE a.doctor_guid=@DoctorGuid and a.schedule_date=@ScheduleDate and b.workshift_type=@WorkshiftType and a.`enable`=1 order by b.start_time" , new { request.DoctorGuid, request.ScheduleDate, request.WorkshiftType }); return(result?.ToList()); } }