เพิ่ม api ผลตรวจเลือด
This commit is contained in:
parent
060765d373
commit
4a17aef039
18 changed files with 27329 additions and 562 deletions
|
|
@ -36,9 +36,9 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
}
|
||||
|
||||
[HttpGet("{type}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetInsigniaList(string type, Guid ocId)
|
||||
public async Task<ActionResult<ResponseObject>> GetInsigniaList(string type, Guid id, Guid ocId)
|
||||
{
|
||||
var result = _repository.GetInsigniaRequest(type, ocId);
|
||||
var result = _repository.GetInsigniaRequest(id, ocId);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -78,10 +78,172 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
#region " จัดทำรายชื่อครูที่มีสิทธิในการยืนขอเครื่องราชฯ "
|
||||
|
||||
[HttpGet("old/{role}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetInsignaiRequest(Guid ocId, string role)
|
||||
// [HttpGet("old/{role}/{ocId:length(36)}")]
|
||||
// public async Task<ActionResult<ResponseObject>> GetInsignaiRequest(Guid id, Guid ocId, string role)
|
||||
// {
|
||||
// var result = await _repository.GetInsigniaRequest(id, ocId);
|
||||
// if (result != null)
|
||||
// {
|
||||
// Guid period = result.PeriodId;
|
||||
// string periodName = result.Name;
|
||||
// string requestStatus = result.RequestStatus;
|
||||
// var resend = new InsigniaResults
|
||||
// {
|
||||
// PeriodId = period,
|
||||
// Year = result.Year,
|
||||
// Name = periodName,
|
||||
// RequestStatus = requestStatus,
|
||||
// OrganizationName = result.OrganizationName,
|
||||
// Items = new List<dynamic>()
|
||||
// };
|
||||
// var candidate = await _repository.GetInsigniaCandidate(period, ocId);
|
||||
|
||||
// // ตรวจสอบว่ารายการอยู่ใน table insignia_request_new
|
||||
// if (requestStatus == null)
|
||||
// {
|
||||
// // บันทึกรายชื่อ
|
||||
// _repository.InsertCandidate(period, ocId, candidate);
|
||||
// }
|
||||
// if (role == "officer")
|
||||
// {
|
||||
// resend.Items = await _repository.InsigniaHasProfile(period, ocId);
|
||||
// return Success(resend);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var passData = _context.InsigniaRequests.AsQueryable()
|
||||
// .Include(x => x.Organization)
|
||||
// .Include(x => x.RequestProfiles)
|
||||
// .Where(x => x.Organization.Id == ocId)
|
||||
// .Where(x => x.Period.Id == period)
|
||||
// .Select(ir => new
|
||||
// {
|
||||
// requstID = ir.Id,
|
||||
// requstStatus = ir.RequestStatus,
|
||||
// requstStatusName = GetRequestlStatusText(ir.RequestStatus),
|
||||
// fkInstituteId = -1,
|
||||
// // fkDivisionId = ir.Organization.Id,
|
||||
// // fkDivision = ir.Organization.Name,
|
||||
// fkInstitute = "",
|
||||
// fkPeriodId = ir.Period.Id,
|
||||
// insigniaRequestHasProfile = ir.RequestProfiles.AsQueryable()
|
||||
// .Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.Position)
|
||||
// .Include(x => x.Profile)
|
||||
// // .ThenInclude(x => x.PositionNumber)
|
||||
// .Include(x => x.Profile)
|
||||
// // .ThenInclude(x => x.AcademicStanding)
|
||||
// .Include(x => x.RequestInsignia)
|
||||
// .ThenInclude(x => x.InsigniaType)
|
||||
// .Select(irp => new
|
||||
// {
|
||||
// request_id = irp.Request.Id,
|
||||
// isApprove = irp.IsApprove,
|
||||
// statusInstitute = irp.IsApprove.ToString(),
|
||||
// request_date = irp.RequestDate,
|
||||
// profileId = irp.Profile.Id,
|
||||
// // prefix = irp.Profile.Prefix,
|
||||
// firstname = irp.Profile.FirstName,
|
||||
// lastname = irp.Profile.LastName,
|
||||
// // posno = irp.Profile.PositionNumber.Id,
|
||||
// type = irp.Profile.ProfileType,
|
||||
// // position = irp.Profile.Position.Name,
|
||||
// // rank = irp.Profile.AcademicStanding.Name,
|
||||
// instituteName = "",
|
||||
// instituteId = -1,
|
||||
// // divisionName = irp.Profile.OrganizationOrganization.Name,
|
||||
// // divisionId = irp.Profile.OrganizationOrganization.Id,
|
||||
// lastInsigniaName = "",
|
||||
// requestInsigniaLevel = irp.RequestInsignia.InsigniaType == null ? null : irp.RequestInsignia.InsigniaType.Name,
|
||||
// requestInsigniaName = irp.RequestInsignia.Name,
|
||||
// requestQua = irp.QualificationStatus,
|
||||
// requestDoc = irp.DocumentStatus,
|
||||
// requestNote = irp.Note,
|
||||
// requestSalary = irp.Salary,
|
||||
// })
|
||||
// .Where(x => x.isApprove)
|
||||
// .OrderBy(y => y.profileId)
|
||||
// .ToList()
|
||||
// })
|
||||
// .ToList()
|
||||
// .FirstOrDefault();
|
||||
|
||||
// var failData = _context.InsigniaRequests.AsQueryable()
|
||||
// .Include(x => x.Organization)
|
||||
// .Include(x => x.RequestProfiles)
|
||||
// .Where(x => x.Organization.Id == ocId)
|
||||
// .Where(x => x.Period.Id == period)
|
||||
// .Select(ir => new
|
||||
// {
|
||||
// requstID = ir.Id,
|
||||
// requstStatus = ir.RequestStatus,
|
||||
// requstStatusName = GetRequestlStatusText(ir.RequestStatus),
|
||||
// fkInstituteId = -1,
|
||||
// // fkDivisionId = ir.Organization.Id,
|
||||
// // fkDivision = ir.Organization.Name,
|
||||
// fkInstitute = "",
|
||||
// fkPeriodId = ir.Period.Id,
|
||||
// insigniaRequestHasProfile = ir.RequestProfiles.AsQueryable()
|
||||
// .Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.Position)
|
||||
// .Include(x => x.Profile)
|
||||
// // .ThenInclude(x => x.PositionNumber)
|
||||
// .Include(x => x.Profile)
|
||||
// // .ThenInclude(x => x.AcademicStanding)
|
||||
// .Include(x => x.RequestInsignia)
|
||||
// .ThenInclude(x => x.InsigniaType)
|
||||
// .Select(irp => new
|
||||
// {
|
||||
// request_id = irp.Request.Id,
|
||||
// isApprove = irp.IsApprove,
|
||||
// statusInstitute = irp.IsApprove.ToString(),
|
||||
// request_date = irp.RequestDate,
|
||||
// profileId = irp.Profile.Id,
|
||||
// // prefix = irp.Profile.Prefix,
|
||||
// firstname = irp.Profile.FirstName,
|
||||
// lastname = irp.Profile.LastName,
|
||||
// // posno = irp.Profile.PositionNumber.Id,
|
||||
// type = irp.Profile.ProfileType,
|
||||
// // position = irp.Profile.Position.Name,
|
||||
// // rank = irp.Profile.AcademicStanding.Name,
|
||||
// instituteName = "",
|
||||
// instituteId = -1,
|
||||
// // divisionName = irp.Profile.OrganizationOrganization.Name,
|
||||
// // divisionId = irp.Profile.OrganizationOrganization.Id,
|
||||
// lastInsigniaName = "",
|
||||
// requestInsigniaLevel = irp.RequestInsignia.InsigniaType == null ? null : irp.RequestInsignia.InsigniaType.Name,
|
||||
// requestInsigniaName = irp.RequestInsignia.Name,
|
||||
// requestQua = irp.QualificationStatus,
|
||||
// requestDoc = irp.DocumentStatus,
|
||||
// requestNote = irp.Note,
|
||||
// requestSalary = irp.Salary,
|
||||
// })
|
||||
// .Where(x => !x.isApprove)
|
||||
// .OrderBy(y => y.profileId)
|
||||
// .ToList()
|
||||
// })
|
||||
// .ToList()
|
||||
// .FirstOrDefault();
|
||||
|
||||
// var period_data = (from p in _context.InsigniaPeriods.AsQueryable()
|
||||
// where p.Id == period
|
||||
// select new
|
||||
// {
|
||||
// periodName = p.Name,
|
||||
// periodYear = p.Year,
|
||||
// }).FirstOrDefault();
|
||||
|
||||
// return Success(new { passData = passData, failData = failData, period = period_data });
|
||||
// }
|
||||
// // select data to display
|
||||
// }
|
||||
// return Success();
|
||||
// }
|
||||
|
||||
[HttpGet("{id:length(36)}/{role}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetInsignaiRequestBkk(Guid id, Guid ocId, string role)
|
||||
{
|
||||
var result = await _repository.GetInsigniaRequest(Royal_Type, ocId);
|
||||
var result = await _repository.GetInsigniaRequest(id, ocId);
|
||||
if (result != null)
|
||||
{
|
||||
Guid period = result.PeriodId;
|
||||
|
|
@ -94,169 +256,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
Name = periodName,
|
||||
RequestStatus = requestStatus,
|
||||
OrganizationName = result.OrganizationName,
|
||||
Items = new List<dynamic>()
|
||||
};
|
||||
var candidate = await _repository.GetInsigniaCandidate(period, ocId);
|
||||
|
||||
// ตรวจสอบว่ารายการอยู่ใน table insignia_request_new
|
||||
if (requestStatus == null)
|
||||
{
|
||||
// บันทึกรายชื่อ
|
||||
_repository.InsertCandidate(period, ocId, candidate);
|
||||
}
|
||||
if (role == "officer")
|
||||
{
|
||||
resend.Items = await _repository.InsigniaHasProfile(period, ocId);
|
||||
return Success(resend);
|
||||
}
|
||||
else
|
||||
{
|
||||
var passData = _context.InsigniaRequests.AsQueryable()
|
||||
.Include(x => x.Organization)
|
||||
.Include(x => x.RequestProfiles)
|
||||
.Where(x => x.Organization.Id == ocId)
|
||||
.Where(x => x.Period.Id == period)
|
||||
.Select(ir => new
|
||||
{
|
||||
requstID = ir.Id,
|
||||
requstStatus = ir.RequestStatus,
|
||||
requstStatusName = GetRequestlStatusText(ir.RequestStatus),
|
||||
fkInstituteId = -1,
|
||||
// fkDivisionId = ir.Organization.Id,
|
||||
// fkDivision = ir.Organization.Name,
|
||||
fkInstitute = "",
|
||||
fkPeriodId = ir.Period.Id,
|
||||
insigniaRequestHasProfile = ir.RequestProfiles.AsQueryable()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Position)
|
||||
.Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.PositionNumber)
|
||||
.Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.AcademicStanding)
|
||||
.Include(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.Select(irp => new
|
||||
{
|
||||
request_id = irp.Request.Id,
|
||||
isApprove = irp.IsApprove,
|
||||
statusInstitute = irp.IsApprove.ToString(),
|
||||
request_date = irp.RequestDate,
|
||||
profileId = irp.Profile.Id,
|
||||
// prefix = irp.Profile.Prefix,
|
||||
firstname = irp.Profile.FirstName,
|
||||
lastname = irp.Profile.LastName,
|
||||
// posno = irp.Profile.PositionNumber.Id,
|
||||
type = irp.Profile.ProfileType,
|
||||
// position = irp.Profile.Position.Name,
|
||||
// rank = irp.Profile.AcademicStanding.Name,
|
||||
instituteName = "",
|
||||
instituteId = -1,
|
||||
// divisionName = irp.Profile.OrganizationOrganization.Name,
|
||||
// divisionId = irp.Profile.OrganizationOrganization.Id,
|
||||
lastInsigniaName = "",
|
||||
requestInsigniaLevel = irp.RequestInsignia.InsigniaType == null ? null : irp.RequestInsignia.InsigniaType.Name,
|
||||
requestInsigniaName = irp.RequestInsignia.Name,
|
||||
requestQua = irp.QualificationStatus,
|
||||
requestDoc = irp.DocumentStatus,
|
||||
requestNote = irp.Note,
|
||||
requestSalary = irp.Salary,
|
||||
})
|
||||
.Where(x => x.isApprove)
|
||||
.OrderBy(y => y.profileId)
|
||||
.ToList()
|
||||
})
|
||||
.ToList()
|
||||
.FirstOrDefault();
|
||||
|
||||
var failData = _context.InsigniaRequests.AsQueryable()
|
||||
.Include(x => x.Organization)
|
||||
.Include(x => x.RequestProfiles)
|
||||
.Where(x => x.Organization.Id == ocId)
|
||||
.Where(x => x.Period.Id == period)
|
||||
.Select(ir => new
|
||||
{
|
||||
requstID = ir.Id,
|
||||
requstStatus = ir.RequestStatus,
|
||||
requstStatusName = GetRequestlStatusText(ir.RequestStatus),
|
||||
fkInstituteId = -1,
|
||||
// fkDivisionId = ir.Organization.Id,
|
||||
// fkDivision = ir.Organization.Name,
|
||||
fkInstitute = "",
|
||||
fkPeriodId = ir.Period.Id,
|
||||
insigniaRequestHasProfile = ir.RequestProfiles.AsQueryable()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Position)
|
||||
.Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.PositionNumber)
|
||||
.Include(x => x.Profile)
|
||||
// .ThenInclude(x => x.AcademicStanding)
|
||||
.Include(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.Select(irp => new
|
||||
{
|
||||
request_id = irp.Request.Id,
|
||||
isApprove = irp.IsApprove,
|
||||
statusInstitute = irp.IsApprove.ToString(),
|
||||
request_date = irp.RequestDate,
|
||||
profileId = irp.Profile.Id,
|
||||
// prefix = irp.Profile.Prefix,
|
||||
firstname = irp.Profile.FirstName,
|
||||
lastname = irp.Profile.LastName,
|
||||
// posno = irp.Profile.PositionNumber.Id,
|
||||
type = irp.Profile.ProfileType,
|
||||
// position = irp.Profile.Position.Name,
|
||||
// rank = irp.Profile.AcademicStanding.Name,
|
||||
instituteName = "",
|
||||
instituteId = -1,
|
||||
// divisionName = irp.Profile.OrganizationOrganization.Name,
|
||||
// divisionId = irp.Profile.OrganizationOrganization.Id,
|
||||
lastInsigniaName = "",
|
||||
requestInsigniaLevel = irp.RequestInsignia.InsigniaType == null ? null : irp.RequestInsignia.InsigniaType.Name,
|
||||
requestInsigniaName = irp.RequestInsignia.Name,
|
||||
requestQua = irp.QualificationStatus,
|
||||
requestDoc = irp.DocumentStatus,
|
||||
requestNote = irp.Note,
|
||||
requestSalary = irp.Salary,
|
||||
})
|
||||
.Where(x => !x.isApprove)
|
||||
.OrderBy(y => y.profileId)
|
||||
.ToList()
|
||||
})
|
||||
.ToList()
|
||||
.FirstOrDefault();
|
||||
|
||||
var period_data = (from p in _context.InsigniaPeriods.AsQueryable()
|
||||
where p.Id == period
|
||||
select new
|
||||
{
|
||||
periodName = p.Name,
|
||||
periodYear = p.Year,
|
||||
}).FirstOrDefault();
|
||||
|
||||
return Success(new { passData = passData, failData = failData, period = period_data });
|
||||
}
|
||||
// select data to display
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
[HttpGet("{role}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetInsignaiRequestBkk(Guid ocId, string role)
|
||||
{
|
||||
var result = await _repository.GetInsigniaRequest(Royal_Type, ocId);
|
||||
if (result != null)
|
||||
{
|
||||
Guid period = result.PeriodId;
|
||||
string periodName = result.Name;
|
||||
string requestStatus = result.RequestStatus;
|
||||
var resend = new InsigniaResults
|
||||
{
|
||||
PeriodId = period,
|
||||
Year = result.Year,
|
||||
Name = periodName,
|
||||
RequestStatus = requestStatus,
|
||||
OrganizationName = result.OrganizationName,
|
||||
Items = new List<dynamic>()
|
||||
Items = new List<InsigniaRequestItem>()
|
||||
};
|
||||
var candidate = await _repository.GetInsigniaCandidateBKK(period, ocId);
|
||||
|
||||
|
|
@ -270,7 +270,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
{
|
||||
resend.Items = await _repository.InsigniaHasProfile(period, ocId);
|
||||
return Success(resend);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -427,9 +426,9 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
#region " บันทึกรายชื่อครูในการขอยื่นเครื่องราชฯ เเต่ยังไม่ส่งไปยัง ผอ.โรงเรียน "
|
||||
|
||||
[HttpPut("approve/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> SaveRequestList(Guid ocId, InsigniaApproveRequest items)
|
||||
public async Task<ActionResult<ResponseObject>> SaveRequestList(Guid id, Guid ocId, InsigniaApproveRequest items)
|
||||
{
|
||||
var result = await _repository.GetInsigniaRequest(Royal_Type, ocId);
|
||||
var result = await _repository.GetInsigniaRequest(id, ocId);
|
||||
if (result != null)
|
||||
await _repository.SaveAprove(result.PeriodId, ocId, items);
|
||||
return Success();
|
||||
|
|
@ -440,9 +439,9 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
#region " เปลี่ยน status เป็น st2 รอ ผอ.สำนักรับรอง "
|
||||
|
||||
[HttpPost("status/officer/send/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> ChangeStatusToSt2(Guid ocId, InsigniaApproveRequest items)
|
||||
public async Task<ActionResult<ResponseObject>> ChangeStatusToSt2(Guid id, Guid ocId, InsigniaApproveRequest items)
|
||||
{
|
||||
var result = await _repository.GetInsigniaRequest(Royal_Type, ocId);
|
||||
var result = await _repository.GetInsigniaRequest(id, ocId);
|
||||
|
||||
if (items != null)
|
||||
{
|
||||
|
|
@ -465,9 +464,9 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
#region " เปลี่ยน status สำหรับ ผอ.สำนัก "
|
||||
|
||||
[HttpPost("status/director/approve/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> ChangeStatusToSt5p(Guid ocId)
|
||||
public async Task<ActionResult<ResponseObject>> ChangeStatusToSt5p(Guid id, Guid ocId)
|
||||
{
|
||||
var result = await _repository.GetInsigniaRequest(Royal_Type, ocId);
|
||||
var result = await _repository.GetInsigniaRequest(id, ocId);
|
||||
if (result == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
var requestId = await _repository.GetRequestId(result.PeriodId, ocId);
|
||||
|
|
@ -485,9 +484,9 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
}
|
||||
|
||||
[HttpPost("status/director/reject/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> ChangeStatusToSt1(Guid ocId)
|
||||
public async Task<ActionResult<ResponseObject>> ChangeStatusToSt1(Guid id, Guid ocId)
|
||||
{
|
||||
var result = await _repository.GetInsigniaRequest(Royal_Type, ocId);
|
||||
var result = await _repository.GetInsigniaRequest(id, ocId);
|
||||
if (result == null)
|
||||
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||
var requestId = await _repository.GetRequestId(result.PeriodId, ocId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue