Exemple #1
0
        public async Task <IActionResult> GetMyAppointmentListByCondition([FromBody] GetMyAppointmentListByConditionRequestDto requestDto)
        {
            if (string.IsNullOrWhiteSpace(requestDto.UserGuid))
            {
                requestDto.UserGuid = UserID;
            }
            //var therapistModel = await new TherapistBiz().GetModelAsync(requestDto.UserGuid);
            var result = await new ActuatingStationBiz().GetMyAppointmentListByCondition(requestDto);

            return(Success(result));
        }
        /// <summary>
        ///执行端-获取今日预约列表
        /// </summary>
        /// <param name="targetGuid">目标guid</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">单页条数</param>
        /// <returns></returns>
        public async Task <GetMyAppointmentListByConditionResponseDto> GetMyAppointmentListByCondition(GetMyAppointmentListByConditionRequestDto requestDto)
        {
            using (var conn = MySqlHelper.GetConnection())
            {
                var strWhere = " ";
                if (!string.IsNullOrWhiteSpace(requestDto.SelectStr))
                {
                    strWhere += $" AND u.user_name like '%{requestDto.SelectStr}%'  or u.phone like '%{requestDto.SelectStr}%'   ";
                }
                if (requestDto.IsToday)
                {
                    strWhere += $" AND to_days(csp.appointment_date) = to_days(now())  ";
                }
                var sql = $@"SELECT
	                                    csp.consumption_guid,
	                                    csp.appointment_date,
	                                    u.user_name,
	                                    u.phone,
	                                    tp.therapist_guid,
	                                    tp.therapist_name,
	                                    proj.project_guid,
	                                    proj.project_name,
                                        CONCAT( acc.base_path, acc.relative_path ) AS PortraitUrl,
	                                    csp.consumption_status ,
										s.`name` as member_name,
										s.sex as member_sex,
										s.age_year as member_age_year,
										s.age_month as member_age_month
                                    FROM
	                                    t_consumer_consumption AS csp
	                                    LEFT JOIN t_utility_user AS u ON csp.user_guid = u.user_guid
	                                    LEFT JOIN t_merchant_therapist AS tp ON csp.operator_guid = tp.therapist_guid
	                                    LEFT JOIN t_mall_project AS proj ON csp.project_guid = proj.project_guid 
                                        LEFT JOIN t_utility_accessory acc ON acc.accessory_guid = u.portrait_guid 
	                                    AND acc.`enable` = 1 
																			left join t_consumer_service_member s on s.service_member_guid=csp.service_member_guid
                                    WHERE
	                                    csp.operator_guid = @UserGuid
                                        And   csp.`enable`=@Enable
                                        {strWhere}
                                    ORDER BY
	                                    csp.consumption_status ASC,
                                        csp.appointment_date DESC  ";
                return(await MySqlHelper.QueryByPageAsync <GetMyAppointmentListByConditionRequestDto, GetMyAppointmentListByConditionResponseDto, GetMyAppointmentListByConditionItemDto>(sql, requestDto));
            }
        }