บันทึกข้อมูล CommandCode ใน DisciplineDisciplinary_ProfileComplaintInvestigates #2377
All checks were successful
Build & Deploy Discipline Service / build (push) Successful in 2m23s

This commit is contained in:
harid 2026-05-27 17:40:30 +07:00
parent ce4558c240
commit 3f98e07419

View file

@ -968,12 +968,20 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command19/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand19([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportCommand19([FromBody] ReportPersonAndCommandRequest req)
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
// data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
data.ForEach(profile =>
{
profile.Status = !string.IsNullOrEmpty(req.status)
? req.status.Trim().ToUpper() : null;
profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
? cmdTypeId : null;
profile.CommandCode = req.commandCode ?? null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -993,7 +1001,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
data.ForEach(profile => profile.Status = "NEW");
// data.ForEach(profile => profile.Status = "NEW");
data.ForEach(profile =>
{
profile.Status = "NEW";
profile.CommandTypeId = null;
profile.CommandCode = null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -1110,12 +1124,20 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command20/report")]
public async Task<ActionResult<ResponseObject>> PostReportcommand20([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportcommand20([FromBody] ReportPersonAndCommandRequest req)
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
// data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
data.ForEach(profile =>
{
profile.Status = !string.IsNullOrEmpty(req.status)
? req.status.Trim().ToUpper() : null;
profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
? cmdTypeId : null;
profile.CommandCode = req.commandCode ?? null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -1135,7 +1157,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
data.ForEach(profile => profile.Status = "NEW");
// data.ForEach(profile => profile.Status = "NEW");
data.ForEach(profile =>
{
profile.Status = "NEW";
profile.CommandTypeId = null;
profile.CommandCode = null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -1602,14 +1630,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command27/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand27([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportCommand27([FromBody] ReportPersonAndCommandRequest req)
{
try
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
// data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
data.ForEach(profile =>
{
profile.Status = !string.IsNullOrEmpty(req.status)
? req.status.Trim().ToUpper() : null;
profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
? cmdTypeId : null;
profile.CommandCode = req.commandCode ?? null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -1636,7 +1672,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
data.ForEach(profile => profile.Status = "NEW");
// data.ForEach(profile => profile.Status = "NEW");
data.ForEach(profile =>
{
profile.Status = "NEW";
profile.CommandTypeId = null;
profile.CommandCode = null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -1730,14 +1772,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command28/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand28([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportCommand28([FromBody] ReportPersonAndCommandRequest req)
{
try
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
// data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
data.ForEach(profile =>
{
profile.Status = !string.IsNullOrEmpty(req.status)
? req.status.Trim().ToUpper() : null;
profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
? cmdTypeId : null;
profile.CommandCode = req.commandCode ?? null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -1764,7 +1814,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
data.ForEach(profile => profile.Status = "NEW");
// data.ForEach(profile => profile.Status = "NEW");
data.ForEach(profile =>
{
profile.Status = "NEW";
profile.CommandTypeId = null;
profile.CommandCode = null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -1858,14 +1914,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command29/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand29([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportCommand29([FromBody] ReportPersonAndCommandRequest req)
{
try
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
// data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
data.ForEach(profile =>
{
profile.Status = !string.IsNullOrEmpty(req.status)
? req.status.Trim().ToUpper() : null;
profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
? cmdTypeId : null;
profile.CommandCode = req.commandCode ?? null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -1892,7 +1956,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
data.ForEach(profile => profile.Status = "NEW");
// data.ForEach(profile => profile.Status = "NEW");
data.ForEach(profile =>
{
profile.Status = "NEW";
profile.CommandTypeId = null;
profile.CommandCode = null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -1986,14 +2056,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command30/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand30([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportCommand30([FromBody] ReportPersonAndCommandRequest req)
{
try
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
// data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
data.ForEach(profile =>
{
profile.Status = !string.IsNullOrEmpty(req.status)
? req.status.Trim().ToUpper() : null;
profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
? cmdTypeId : null;
profile.CommandCode = req.commandCode ?? null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -2020,7 +2098,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
data.ForEach(profile => profile.Status = "NEW");
// data.ForEach(profile => profile.Status = "NEW");
data.ForEach(profile =>
{
profile.Status = "NEW";
profile.CommandTypeId = null;
profile.CommandCode = null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -2114,14 +2198,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command31/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand31([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportCommand31([FromBody] ReportPersonAndCommandRequest req)
{
try
{
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
// data.ForEach(profile => profile.Status = req.status.Trim().ToUpper());
data.ForEach(profile =>
{
profile.Status = !string.IsNullOrEmpty(req.status)
? req.status.Trim().ToUpper() : null;
profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
? cmdTypeId : null;
profile.CommandCode = req.commandCode ?? null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -2148,7 +2240,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.Status.ToUpper() == "REPORT")
.ToListAsync();
data.ForEach(profile => profile.Status = "NEW");
// data.ForEach(profile => profile.Status = "NEW");
data.ForEach(profile =>
{
profile.Status = "NEW";
profile.CommandTypeId = null;
profile.CommandCode = null;
});
await _context.SaveChangesAsync();
return Success();
}
@ -2242,7 +2340,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command32/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand32([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportCommand32([FromBody] ReportPersonAndCommandRequest req)
{
try
{
@ -2255,7 +2353,15 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
data2.ForEach(profile => profile.IsReport = req.status.Trim().ToUpper());
// data2.ForEach(profile => profile.IsReport = req.status.Trim().ToUpper());
data2.ForEach(profile =>
{
profile.Status = !string.IsNullOrEmpty(req.status)
? req.status.Trim().ToUpper() : null;
profile.CommandTypeId = !string.IsNullOrEmpty(req.commandTypeId) && Guid.TryParse(req.commandTypeId, out var cmdTypeId)
? cmdTypeId : null;
profile.CommandCode = req.commandCode ?? null;
});
await _context.SaveChangesAsync();
return Success();
@ -2290,7 +2396,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
// .Where(x => x.IsReport == "REPORT")
.ToListAsync();
data2.ForEach(profile => profile.IsReport = "NEW");
// data2.ForEach(profile => profile.IsReport = "NEW");
data2.ForEach(profile =>
{
profile.Status = "NEW";
profile.CommandTypeId = null;
profile.CommandCode = null;
});
await _context.SaveChangesAsync();
return Success();