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
{
///
/// 医生基本信息 、工作信息 专业信息、审核状态
///
[Route("doctor")]
[ApiController, Authorize, ApiExplorerSettings(GroupName = "Reviewer")]
public class DoctorController : ControllerBase
{
private readonly IDoctorService _doctorService;
public DoctorController(IDoctorService doctorService)
{
_doctorService = doctorService;
}
#region 医生列表查询接口
///
/// 分页获取医生列表 (带查询条件)
///
//
[HttpPost, Route("getDoctorSearchList")]
public IResponseOutput> GetDoctorList([FromServices] IDoctorListQueryService _doctorListQueryService, DoctorSearchDTO doctorSearchModel)
{
var userId = Guid.Parse(User.FindFirst("id").Value);
return ResponseOutput.Ok(_doctorListQueryService.GetReviewerList(doctorSearchModel, userId)) ;
}
#endregion
#region 医生基本信息管理
///
///详情、编辑-获取 医生基本信息 BasicInfo
///
/// ReviewerID
///
[HttpGet, Route("getBasicInfo/{doctorId:guid}")]
public IResponseOutput GetDoctorBasicInfoById(Guid doctorId)
{
var doctorInfo = _doctorService.GetDoctorBasicInfo(doctorId);
return ResponseOutput.Ok(doctorInfo);
}
///
/// Get Statement of Work list.[New]
///
///
///
[HttpGet, Route("getDoctorSowList/{doctorId:guid}")]
public IResponseOutput> GetDoctorSow(Guid doctorId)
{
var list = _doctorService.GetDoctorSow(doctorId);
return ResponseOutput.Ok(list);
}
///
/// Get Ack Statement of Work[New]
///
///
///
[HttpGet, Route("getDoctorAckSowList/{doctorId:guid}")]
public IResponseOutput> GetDoctorAckSow(Guid doctorId)
{
var list = _doctorService.GetDoctorAckSow(doctorId);
return ResponseOutput.Ok(list);
}
///
/// 添加/更新 医生基本信息 BasicInfo
///
[HttpPost, Route("addOrUpdateDoctorBasicInfo")]
public IResponseOutput AddOrUpdateDoctorBasicInfo(DoctorBasicInfoCommand addBasicInfoViewModel)
{
var userId = Guid.Parse(User.FindFirst("id").Value);
return _doctorService.AddOrUpdateDoctorBasicInfo(addBasicInfoViewModel, userId);
}
#endregion
#region 医生工作信息 Employment
///
/// 详情、编辑-获取医生工作信息 Employment
///
///
///
[HttpGet, Route("getEmploymentInfo/{doctorId:Guid}")]
public IResponseOutput GetDoctorWorkInfoById(Guid doctorId)
{
var doctorInfo = _doctorService.GetEmploymentInfo(doctorId);
return ResponseOutput.Ok(doctorInfo);
}
/// 更新-医生工作信息 WorkInfo
[HttpPost, Route("updateEmploymentInfo")]
public IResponseOutput UpdateEmploymentInfoInfo(EmploymentCommand updateEmploymentInfoViewModel)
{
return _doctorService.UpdateDoctorEmploymentInfo(updateEmploymentInfoViewModel);
}
#endregion
#region Reviewer 专业信息
/// 获取医生专业信息
[HttpGet, Route("getSpecialtyInfo/{doctorId:Guid}")]
public IResponseOutput GetDoctorSpecialty(Guid doctorId)
{
var doctorInfo = _doctorService.GetDoctorSpecialty(doctorId);
return ResponseOutput.Ok(doctorInfo);
}
/// 更新专业信息
[HttpPost, Route("updateSpecialtyInfo")]
public IResponseOutput UpdateDoctorSpecialty(SpecialtyCommand specialtyUpdateModel)
{
return _doctorService.UpdateDoctorSpecialty(specialtyUpdateModel);
//return new IResponseOutput()
//{
// IsSuccess = success,
// ErrorMessage = success ? "Update Successfully." : "Update Failed."
//};
}
#endregion
#region Reviewer 状态
/// 获取医生审核状态
[HttpGet, Route("getAuditState/{doctorId:guid}")]
public IResponseOutput GetResumeAuditState([FromServices] IVacationService _vacationService, Guid doctorId)
{
var result = _doctorService.GetDoctorAuditStatus(doctorId);
result.InHoliday = _vacationService.OnVacation(doctorId).IsSuccess;
return ResponseOutput.Ok(result);
}
///
/// 审核简历状态
///
/// 复审状态ReviewStatus 0-未复审,1-复审通过,2-未通过
///
[LogFilter]
[HttpPost, Route("updateAuditResume")]
public IResponseOutput AuditResume(ResumeConfirmCommand auditResumeParam)
{
var userId = Guid.Parse(User.FindFirst("id").Value);
return _doctorService.AuditResume(auditResumeParam, userId);
}
///
/// 获取医生入组信息 正在提交的数量 已同意入组项目个数 正在读的
///
[HttpPost, Route("getDoctorIntoGroupInfo/{doctorId:guid}")]
public IResponseOutput GetDoctorEnrollInfo(Guid doctorId)
{
return ResponseOutput.Ok(_doctorService.GetDoctorEnrollInfo(doctorId));
}
#endregion
#region 医生详情
///
/// 获取医生详情
///
///
/// 医生Id
///
///
///
///
///
[HttpGet, Route("getDetail/{doctorId:guid}")]
public IResponseOutput GetDoctorDetail([FromServices] IAttachmentService attachmentService, [FromServices] IEducationService _educationService, [FromServices] ITrialExperienceService _trialExperienceService, [FromServices] IResearchPublicationService _researchPublicationService, [FromServices] IVacationService _vacationService, Guid doctorId)
{
var education = _educationService.GetEducation(doctorId);
var sowList = _doctorService.GetDoctorSow(doctorId);
var ackSowList = _doctorService.GetDoctorAckSow(doctorId);
var doctorDetail = new DoctorDetailDTO
{
AuditView = _doctorService.GetDoctorAuditStatus(doctorId),
BasicInfoView = _doctorService.GetDoctorBasicInfo(doctorId),
EmploymentView = _doctorService.GetEmploymentInfo(doctorId),
AttachmentList = attachmentService.GetAttachments(doctorId),
EducationList = education.EducationList,
PostgraduateList = education.PostgraduateList,
TrialExperienceView = _trialExperienceService.GetTrialExperience(doctorId),
ResearchPublicationView = _researchPublicationService.GetResearchPublication(doctorId),
SpecialtyView = _doctorService.GetDoctorSpecialty(doctorId),
InHoliday = _vacationService.OnVacation(doctorId).IsSuccess,
IntoGroupInfo = _doctorService.GetDoctorEnrollInfo(doctorId),
SowList = sowList,
AckSowList = ackSowList
};
return ResponseOutput.Ok(doctorDetail);
}
#endregion
}
}