public async Task <IActionResult> GetDoctorIntegralPageAsync([FromBody] GetDoctorIntegralPageRequestDto request)
        {
            DoctorBiz doctorBiz = new DoctorBiz();
            ScoreBiz  scoreBiz  = new ScoreBiz();
            var       response  = await doctorBiz.GetDoctorIntegralAsync(request);

            if (!response.CurrentPage.Any())
            {
                return(Success(response));
            }
            var users       = response.CurrentPage.Select(a => a.DoctorGuid).ToArray();
            var totalPoints = await scoreBiz.GetUserPointsAsync(users);

            var earnPoints = await scoreBiz.GetUserEarnPointsAsync(users);

            var usePoints = await scoreBiz.GetUserUsePointsAsync(users);

            foreach (var item in response.CurrentPage)
            {
                item.TotalPoints = totalPoints.FirstOrDefault(a => a.UserGuid == item.DoctorGuid)?.Variation ?? 0;
                item.EarnPoints  = earnPoints.FirstOrDefault(a => a.UserGuid == item.DoctorGuid)?.Variation ?? 0;
                item.UsePoints   = usePoints.FirstOrDefault(a => a.UserGuid == item.DoctorGuid)?.Variation ?? 0;
            }
            return(Success(response));
        }
        public async Task <GetDoctorIntegralPageResponseDto> GetDoctorIntegralAsync(GetDoctorIntegralPageRequestDto request)
        {
            var whereSql = $"1=1 and enable=1 and status='{DoctorModel.StatusEnum.Approved.ToString()}'";

            if (!string.IsNullOrWhiteSpace(request.Phone))
            {
                request.Phone = $"{request.Phone}%";
                whereSql      = $"{whereSql} and phone LIKE @Phone ";
            }
            if (!string.IsNullOrWhiteSpace(request.Name))
            {
                request.Name = $"{request.Name}%";
                whereSql     = $"{whereSql} and user_name LIKE @Name ";
            }
            if (request.BeginDate != null)
            {
                request.BeginDate = request.BeginDate?.Date;
                whereSql          = $"{whereSql} AND creation_date > @BeginDate";
            }
            if (request.EndDate != null)
            {
                request.EndDate = request.EndDate?.AddDays(1).Date;
                whereSql        = $"{whereSql} AND creation_date < @EndDate";
            }
            var    orderbySql = "creation_date desc";
            string sql        = $@"
SELECT * FROM(
    SELECT
	a.* ,
    c.user_name,
    c.phone
FROM
	t_doctor a
	LEFT JOIN t_utility_user c ON a.doctor_guid = c.user_guid
)__T
WHERE
    {whereSql}
ORDER BY
    {orderbySql}
";

            return(await MySqlHelper.QueryByPageAsync <GetDoctorIntegralPageRequestDto, GetDoctorIntegralPageResponseDto, GetDoctorIntegralPageItemDto>(sql, request));
        }