using System; using System.Collections.Generic; 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 { /// /// Financial 支撑信息---医生付费信息及支付标准配置 /// [Route("reviewerPayInfomation")] [ApiController, Authorize, ApiExplorerSettings(GroupName = "Financial")] public class ReviewerPayInfomationController : ControllerBase { private IReviewerPayInfoService _doctorPayInfoService; private readonly ICalculateService _calculateService; public ReviewerPayInfomationController(IReviewerPayInfoService doctorPayInfoService, ICalculateService calculateService) { _doctorPayInfoService = doctorPayInfoService; _calculateService = calculateService; } /// /// 添加或更新(替换)医生支付展信息[AUTH] /// [HttpPost, Route("addOrUpdateReviewerPayInfo")] public IResponseOutput AddOrUpdateReviewerPayInfo(ReviewerPayInfoCommand addOrUpdateModel) { var userId = Guid.Parse(User.FindFirst("id").Value); var result = _doctorPayInfoService.AddOrUpdateReviewerPayInfo(addOrUpdateModel, userId); var calcList = _calculateService.GetNeedCalculateReviewerList(addOrUpdateModel.DoctorId, string.Empty); foreach (var item in calcList) { if (item != null) { _calculateService.CalculateMonthlyPayment(new CalculateDoctorAndMonthDTO() { NeedCalculateReviewers = new List() { item.DoctorId }, CalculateMonth = DateTime.Parse(item.YearMonth) }, User.FindFirst("id").Value); } } return result; } /// /// 获取医生支付信息列表 /// [HttpPost, Route("getReviewerPayInfoList")] public IResponseOutput> GetReviewerPayInfoList(DoctorPaymentInfoQueryDTO queryParam) { return ResponseOutput.Ok(_doctorPayInfoService.GetDoctorPayInfoList(queryParam)) ; } /// /// 根据医生Id获取支付信息 /// /// 医生Id /// [HttpGet, Route("getReviewerPayInfo/{doctorId:guid}")] public IResponseOutput GetReviewerPayInfo(Guid doctorId) { return ResponseOutput.Ok(_doctorPayInfoService.GetReviewerPayInfo(doctorId)) ; } } }