/// <summary> /// 收入总积分 /// </summary> /// <param name="userGuid">用户GUID</param> /// <param name="requestDto">查询Dto</param> /// <param name="userType">用户类型</param> /// <returns></returns> private async Task <int?> GetOutlayVariationAll(string userGuid, GetDoctorScoreAllInfoRequestDto requestDto, UserType userType) { StringBuilder sb = new StringBuilder("select sum(variation) from t_utility_score where variation<0 and user_guid=@user_guid and user_type_guid=@userType"); DynamicParameters parameters = new DynamicParameters(); parameters.Add("user_guid", userGuid, System.Data.DbType.String); parameters.Add("userType", userType.ToString(), System.Data.DbType.String); if (requestDto.startTime != null) { sb.Append(" and creation_date>@startTime "); parameters.Add("startTime", requestDto.startTime, System.Data.DbType.DateTime); } if (requestDto.endTime != null) { sb.Append(" and creation_date<@endTime "); parameters.Add("endTime", requestDto.endTime, System.Data.DbType.DateTime); } using (MySql.Data.MySqlClient.MySqlConnection conn = MySqlHelper.GetConnection()) { return(await conn.QueryFirstAsync <int?>(sb.ToString(), parameters)); } }
/// <summary> /// 获取医生积分所有信息 /// </summary> /// <param name="userID">医生GUID</param> /// <param name="requestDto">医生积分查询dto</param> /// <returns></returns> public async Task <GetDoctorScoreAllInfoResponseDto> GetDoctorScoreAllInfo(string userID, GetDoctorScoreAllInfoRequestDto requestDto) { GetDoctorScoreAllInfoResponseDto scoreAll = new GetDoctorScoreAllInfoResponseDto(); requestDto.startTime = GetStartDate(requestDto.startTime); requestDto.endTime = GetEndDate(requestDto.endTime); scoreAll.AllVariation = await GetVariationAll(userID, requestDto, UserType.Doctor) ?? 0; scoreAll.IncomeALLVariation = await GetIncomeVariationAll(userID, requestDto, UserType.Doctor) ?? 0; scoreAll.OutlayALLVariation = await GetOutlayVariationAll(userID, requestDto, UserType.Doctor) ?? 0; return(scoreAll); }
public async Task <IActionResult> GetDoctorScoreAllInfo([FromBody] GetDoctorScoreAllInfoRequestDto requestDto) { return(Success(await new DoctorScoreBiz().GetDoctorScoreAllInfo(this.UserID, requestDto))); }