บันทึกสรุปผลวินัย

This commit is contained in:
Kittapath 2023-12-19 21:40:32 +07:00
parent 7c2a4c0280
commit 6b7a5bfa06
15 changed files with 24038 additions and 0 deletions

View file

@ -110,6 +110,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
PersonId = p.PersonId,
PosNo = p.PosNo,
Organization = p.Organization,
IsSend = p.IsReport,
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
@ -189,11 +190,13 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
data.LastUpdateFullName = FullName ?? "System Administrator";
data.LastUpdateUserId = UserId ?? "";
data.LastUpdatedAt = DateTime.Now;
var hisprofile = data.DisciplineInvestigate_ProfileComplaints;
_context.DisciplineInvestigate_ProfileComplaints.RemoveRange(data.DisciplineInvestigate_ProfileComplaints);
if (data.RespondentType.Trim().ToUpper() == "PERSON")
{
foreach (var item in req.persons)
{
var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
data.DisciplineInvestigate_ProfileComplaints.Add(
new DisciplineInvestigate_ProfileComplaint
{
@ -207,6 +210,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
Salary = item.salary,
PersonId = item.personId,
PosNo = item.posNo,
IsReport = isReport == null ? false : isReport.IsReport,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
@ -284,6 +288,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
PersonId = p.PersonId,
PosNo = p.PosNo,
Organization = p.Organization,
IsSend = p.IsReport,
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
DisciplineInvestigateDocs = x.DisciplineInvestigate_Docs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
@ -423,11 +428,13 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
}
data.Organization = req.organizationId;
data.RespondentType = req.respondentType;
var hisprofile = data.DisciplineInvestigate_ProfileComplaints;
_context.DisciplineInvestigate_ProfileComplaints.RemoveRange(data.DisciplineInvestigate_ProfileComplaints);
if (data.RespondentType.Trim().ToUpper() == "PERSON")
{
foreach (var item in req.persons)
{
var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
data.DisciplineInvestigate_ProfileComplaints.Add(
new DisciplineInvestigate_ProfileComplaint
{
@ -441,6 +448,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
Salary = item.salary,
PersonId = item.personId,
PosNo = item.posNo,
IsReport = isReport == null ? false : isReport.IsReport,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
@ -563,6 +571,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
Position = item.Position,
PositionLevel = item.PositionLevel,
Status = "NEW",
IsReport = false,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
@ -939,5 +948,35 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
.ToListAsync();
return Success(data);
}
/// <summary>
/// สั่งรายชื่อไปออกคำสั่งยุตื
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report")]
// [HttpPut("report/{commandTypeId:length(36)}")]
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] DisciplineProfileRequest req)
{
foreach (var item in req.Id)
{
var uppdated = await _context.DisciplineInvestigate_ProfileComplaints
.FirstOrDefaultAsync(x => x.Id == item);
if (uppdated == null)
continue;
// uppdated.CommandTypeId = commandTypeId;
uppdated.IsReport = true;
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
}
await _context.SaveChangesAsync();
return Success();
}
}
}