using System; using System.Collections.Generic; using IRaCIS.Api.Filter; using IRaCIS.Application.Interfaces; using IRaCIS.Application.ViewModels; using IRaCIS.Core.Application.Contracts.RequestAndResponse; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace IRaCIS.Api.Controllers.Pay { /// /// Financial 支撑信息---职称付费价格 /// [Route("rankPrice")] [ApiController, Authorize, ApiExplorerSettings(GroupName = "Financial")] public class RankPriceController : ControllerBase { private readonly IRankPriceService _rankPriceService; private readonly ICalculateService _calculateService; private readonly IReviewerPayInfoService _reviewerPayInfoService; public RankPriceController(IRankPriceService rankPriceService, ICalculateService calculateService, IReviewerPayInfoService reviewerPayInfoService) { _rankPriceService = rankPriceService; _calculateService = calculateService; _reviewerPayInfoService = reviewerPayInfoService; } /// /// 添加或更新 职称单价[AUTH] /// [LogFilter] [HttpPost, Route("addOrUpdateRankPrice")] public IResponseOutput AddOrUpdateRankPrice(RankPriceCommand addOrUpdateModel) { if (addOrUpdateModel.Id != Guid.Empty&& addOrUpdateModel.Id !=null) { var needCalReviewerIds = _reviewerPayInfoService.GetReviewerIdByRankId(Guid.Parse(addOrUpdateModel.Id.ToString())); var calcList = _calculateService.GetNeedCalculateReviewerList(Guid.Empty, string.Empty); foreach (var item in calcList) { if (item != null && needCalReviewerIds.Contains(item.DoctorId)) { _calculateService.CalculateMonthlyPayment(new CalculateDoctorAndMonthDTO() { NeedCalculateReviewers = new List() { item.DoctorId }, CalculateMonth = DateTime.Parse(item.YearMonth) }, User.FindFirst("id").Value); } } } var userId = Guid.Parse(User.FindFirst("id").Value); return _rankPriceService.AddOrUpdateRankPrice(addOrUpdateModel, userId); } /// /// 获取职称单价列表 /// [HttpPost, Route("getRankPriceList")] public IResponseOutput> GetRankPriceList(RankPriceQueryDTO queryParam) { return ResponseOutput.Ok(_rankPriceService.GetRankPriceList(queryParam)); } /// /// 删除职称单价记录 /// [HttpDelete, Route("deleteRankPrice/{id:guid}")] public IResponseOutput DeleteRankPrice(Guid id) { return _rankPriceService.DeleteRankPrice(id); } /// /// 获取职称字典数据 /// [HttpGet, Route("getRankDic")] public IResponseOutput> GetRankDic() { return ResponseOutput.Ok(_rankPriceService.GetRankDic()); } } }