diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs
index e5be6189..85388209 100644
--- a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs
+++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs
@@ -1242,14 +1242,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpPost("command25/report")]
- public async Task> PostReportCommand25([FromBody] ReportPersonRequest req)
+ public async Task> PostReportCommand25([FromBody] ReportPersonAndCommandRequest req)
{
try
{
var data = await _context.DisciplineReport_Profiles
.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();
}
@@ -1276,7 +1284,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 = "PENDING");
+ // data.ForEach(profile => profile.Status = "PENDING");
+ data.ForEach(profile =>
+ {
+ profile.Status = "PENDING";
+ profile.CommandTypeId = null;
+ profile.CommandCode = null;
+ });
await _context.SaveChangesAsync();
return Success();
}
@@ -1429,14 +1443,22 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpPost("command26/report")]
- public async Task> PostReportCommand26([FromBody] ReportPersonRequest req)
+ public async Task> PostReportCommand26([FromBody] ReportPersonAndCommandRequest req)
{
try
{
var data = await _context.DisciplineReport_Profiles
.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();
}
@@ -1463,7 +1485,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 = "PENDING");
+ // data.ForEach(profile => profile.Status = "PENDING");
+ data.ForEach(profile =>
+ {
+ profile.Status = "PENDING";
+ profile.CommandTypeId = null;
+ profile.CommandCode = null;
+ });
await _context.SaveChangesAsync();
return Success();
}
diff --git a/BMA.EHR.Discipline.Service/Requests/ReportPersonRequest.cs b/BMA.EHR.Discipline.Service/Requests/ReportPersonRequest.cs
index 1bd61c56..f7a16efc 100644
--- a/BMA.EHR.Discipline.Service/Requests/ReportPersonRequest.cs
+++ b/BMA.EHR.Discipline.Service/Requests/ReportPersonRequest.cs
@@ -8,4 +8,12 @@ namespace BMA.EHR.Discipline.Service.Requests
public string[] refIds { 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; }
+ }
}