Files
jinko.yikatong/Src/Dlhis.Basic/Appointment/Controllers/AppointmentsController.cs

75 lines
2.3 KiB
C#

using System.ComponentModel.DataAnnotations;
using Dlhis.Basic.Appointment.Request;
using Dlhis.Basic.Appointment.Response;
using Dlhis.Basic.Appointment.Services;
using Kurisu.AspNetCore.DataAccess.Dto;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Dlhis.Basic.Appointment.Controllers;
/// <summary>
/// 预约
/// </summary>
[Authorize]
[ApiController]
[Route("api/[controller]")]
public class AppointmentsController : ControllerBase
{
private readonly IAppointmentService _appointmentService;
public AppointmentsController(IAppointmentService appointmentService)
{
_appointmentService = appointmentService;
}
/// <summary>
/// 预约申请分页
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpGet("page")]
public async Task<Pagination<AppointmentPageResponse>> GetPageAsync([FromQuery] AppointmentPageRequest request)
{
return await _appointmentService.GetPageAsync(request);
}
/// <summary>
/// 确认到达
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost("confirm")]
[Transactional]
public async Task ConfirmAsync(AppointmentConfirmRequest request)
{
await _appointmentService.ConfirmAsync(request);
}
/// <summary>
/// 根据身份证获取当天预约信息
/// </summary>
/// <param name="idNo"></param>
/// <returns></returns>
[AllowAnonymous]
[HttpGet("today")]
public async Task<AppointmentDetailResponse> GetTodayByIdNoAsync(
[FromQuery] [StringLength(18, MinimumLength = 18, ErrorMessage = "身份证有误")] [Required(ErrorMessage = "身份证有误")]
string idNo)
{
return await _appointmentService.GetTodayByIdNoAsync(idNo);
}
/// <summary>
/// 根据身份证获取预约信息分页
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[AllowAnonymous]
[HttpGet("idno/page")]
public async Task<Pagination<AppointmentDetailResponse>> GetRecordPageByIdNoAsync([FromQuery] AppointmentIdNoPageRequest request)
{
return await _appointmentService.GetRecordPageByIdNoAsync(request);
}
}