เก็บประวัติการขยายเวลา
This commit is contained in:
parent
8dae449c62
commit
0c1ae31b22
12 changed files with 11898 additions and 0 deletions
|
|
@ -246,6 +246,13 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
InvestigationCauseText = x.InvestigationCauseText,
|
||||
InvestigationExtendStatus = x.InvestigationExtendStatus,
|
||||
InvestigationDaysExtend = x.InvestigationDaysExtend,
|
||||
InvestigationExtendHistory = x.DisciplineInvestigateExtends.Select(e => new
|
||||
{
|
||||
Name = e.Name,
|
||||
Num = e.Num,
|
||||
DateStart = e.DateStart,
|
||||
DateEnd = e.DateEnd,
|
||||
}),
|
||||
Status = x.Status,//สถานะเรื่องสืบสวน
|
||||
Result = x.Result,//ผลการตรวจสอบ
|
||||
Director = x.DisciplineInvestigate_Directors.Select(d => new
|
||||
|
|
@ -322,6 +329,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
_data.InvestigationCauseText,
|
||||
_data.InvestigationExtendStatus,
|
||||
_data.InvestigationDaysExtend,
|
||||
_data.InvestigationExtendHistory,
|
||||
_data.Status,
|
||||
_data.Result,
|
||||
_data.Director,
|
||||
|
|
@ -346,6 +354,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
public async Task<ActionResult<ResponseObject>> UpdateDisciplineInvestigate([FromBody] DisciplineInvestigateRequest req, Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineInvestigates
|
||||
.Include(x => x.DisciplineInvestigateExtends)
|
||||
.Include(x => x.DisciplineInvestigate_ProfileComplaints)
|
||||
.Include(x => x.DisciplineInvestigate_Directors)
|
||||
.ThenInclude(x => x.DisciplineDirector)
|
||||
|
|
@ -355,6 +364,8 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
if (data.Status.Trim().ToUpper() != "NEW")
|
||||
return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), StatusCodes.Status500InternalServerError);
|
||||
var editExtend = false;
|
||||
if (data.InvestigationDateEnd != req.investigationDateEnd) editExtend = true;
|
||||
|
||||
data.InvestigationDetail = req.investigationDetail.Trim().ToUpper();
|
||||
data.InvestigationDetailOther = req.investigationDetailOther;
|
||||
|
|
@ -369,6 +380,24 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
data.LastUpdateUserId = UserId ?? "";
|
||||
data.LastUpdatedAt = DateTime.Now;
|
||||
if (editExtend == true)
|
||||
{
|
||||
var sumExtend = data.DisciplineInvestigateExtends.Count();
|
||||
data.DisciplineInvestigateExtends.Add(
|
||||
new DisciplineInvestigateExtend
|
||||
{
|
||||
Name = sumExtend > 0 ? "ขยายครั้งที่" + sumExtend : "วันที่สืบสวน",
|
||||
Num = sumExtend,
|
||||
DateStart = sumExtend > 0 ? data.InvestigationDateEnd.Value.AddDays(data.InvestigationDaysExtend == null ? 0 : -(double)data.InvestigationDaysExtend) : data.InvestigationDateStart,
|
||||
DateEnd = data.InvestigationDateEnd,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
_context.DisciplineInvestigate_Directors.RemoveRange(data.DisciplineInvestigate_Directors);
|
||||
foreach (var item in req.directors)
|
||||
{
|
||||
|
|
@ -881,5 +910,32 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
return Error(new Exception("ไม่พบไฟล์นี้ในระบบ"), (int)StatusCodes.Status404NotFound);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ปฏิทินรายการวินัยเรื่องสืบสวน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("calendar")]
|
||||
public async Task<ActionResult<ResponseObject>> GetCalendarDisciplineInvestigate([FromBody] DisciplineCalendarRequest req)
|
||||
{
|
||||
var data = await _context.DisciplineInvestigates
|
||||
.Where(x => x.InvestigationDateStart != null)
|
||||
.Where(x => x.InvestigationDateEnd != null)
|
||||
.Where(x => x.InvestigationDateStart.Value.Year == req.year || x.InvestigationDateEnd.Value.Year == req.year || x.InvestigationDateStart.Value.Month == req.month || x.InvestigationDateEnd.Value.Month == req.month)
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,//id ข้อมูลเรื่องสืบสวน
|
||||
Title = x.Title,//ชื่อเรื่อง
|
||||
InvestigationDateStart = x.InvestigationDateStart,//
|
||||
InvestigationDateEnd = x.InvestigationDateEnd,//
|
||||
})
|
||||
.OrderBy(d => d.InvestigationDateStart.Value.Date)
|
||||
.ToListAsync();
|
||||
return Success(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue