ส่งรายชื่อไปออกคำสั่ง C-PM-25, C-PM-26 ให้ปั๊ม commandCode #2377
This commit is contained in:
parent
bf92f6933e
commit
874bce9e90
2 changed files with 42 additions and 6 deletions
|
|
@ -1242,14 +1242,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPost("command25/report")]
|
[HttpPost("command25/report")]
|
||||||
public async Task<ActionResult<ResponseObject>> PostReportCommand25([FromBody] ReportPersonRequest req)
|
public async Task<ActionResult<ResponseObject>> PostReportCommand25([FromBody] ReportPersonAndCommandRequest req)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var data = await _context.DisciplineReport_Profiles
|
var data = await _context.DisciplineReport_Profiles
|
||||||
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
.ToListAsync();
|
.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();
|
await _context.SaveChangesAsync();
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
@ -1276,7 +1284,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
||||||
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
// .Where(x => x.Status.ToUpper() == "REPORT")
|
// .Where(x => x.Status.ToUpper() == "REPORT")
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
data.ForEach(profile => profile.Status = "PENDING");
|
// data.ForEach(profile => profile.Status = "PENDING");
|
||||||
|
data.ForEach(profile =>
|
||||||
|
{
|
||||||
|
profile.Status = "PENDING";
|
||||||
|
profile.CommandTypeId = null;
|
||||||
|
profile.CommandCode = null;
|
||||||
|
});
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
@ -1429,14 +1443,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPost("command26/report")]
|
[HttpPost("command26/report")]
|
||||||
public async Task<ActionResult<ResponseObject>> PostReportCommand26([FromBody] ReportPersonRequest req)
|
public async Task<ActionResult<ResponseObject>> PostReportCommand26([FromBody] ReportPersonAndCommandRequest req)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var data = await _context.DisciplineReport_Profiles
|
var data = await _context.DisciplineReport_Profiles
|
||||||
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
.ToListAsync();
|
.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();
|
await _context.SaveChangesAsync();
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
@ -1463,7 +1485,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
||||||
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||||
// .Where(x => x.Status.ToUpper() == "REPORT")
|
// .Where(x => x.Status.ToUpper() == "REPORT")
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
data.ForEach(profile => profile.Status = "PENDING");
|
// data.ForEach(profile => profile.Status = "PENDING");
|
||||||
|
data.ForEach(profile =>
|
||||||
|
{
|
||||||
|
profile.Status = "PENDING";
|
||||||
|
profile.CommandTypeId = null;
|
||||||
|
profile.CommandCode = null;
|
||||||
|
});
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,12 @@ namespace BMA.EHR.Discipline.Service.Requests
|
||||||
public string[] refIds { get; set; }
|
public string[] refIds { get; set; }
|
||||||
public string? status { get; set; }
|
public string? status { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ReportPersonAndCommandRequest
|
||||||
|
{
|
||||||
|
public string[] refIds { get; set; }
|
||||||
|
public string? status { get; set; }
|
||||||
|
public string? commandTypeId { get; set; }
|
||||||
|
public string? commandCode { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue