บันทึกผลการสอบสวนวินัย
This commit is contained in:
parent
e510639947
commit
3d8d65f21f
16 changed files with 33949 additions and 25 deletions
|
|
@ -260,7 +260,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
Email = d.DisciplineDirector.Email,
|
||||
Duty = "",
|
||||
Phone = d.DisciplineDirector.Phone,
|
||||
Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
||||
// Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
||||
}).ToList(),
|
||||
DisciplineDisciplinaryDocInvestigates = x.DisciplineDisciplinary_DocInvestigates.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
DisciplineDisciplinaryDocInvestigateRelevants = x.DisciplineDisciplinary_DocInvestigateRelevants.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
|
|
@ -397,6 +397,16 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
DisciplinaryCaseFault = x.DisciplinaryCaseFault,
|
||||
DisciplinaryDateEvident = x.DisciplinaryDateEvident,
|
||||
DisciplinaryDateAllegation = x.DisciplinaryDateAllegation,
|
||||
|
||||
DisciplinaryDateStart = x.DisciplinaryDateStart,
|
||||
DisciplinaryDateEnd = x.DisciplinaryDateEnd,
|
||||
DaysExtend = x.DisciplinaryDaysExtend,
|
||||
DisciplinaryDateInvestigation = x.DisciplinaryDateInvestigation,
|
||||
DisciplinaryDateResult = x.DisciplinaryDateResult,
|
||||
DisciplinaryStatusResult = x.DisciplinaryStatusResult,
|
||||
DisciplinaryCauseText = x.DisciplinaryCauseText,
|
||||
DisciplinaryResult = x.DisciplinaryResult,
|
||||
Status = x.Status,
|
||||
Result = x.Result,
|
||||
Director = x.DisciplineDisciplinary_DirectorInvestigates.Select(d => new
|
||||
{
|
||||
|
|
@ -409,7 +419,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
Email = d.DisciplineDirector.Email,
|
||||
Duty = "",
|
||||
Phone = d.DisciplineDirector.Phone,
|
||||
Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
||||
// Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
||||
}).ToList(),
|
||||
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||
Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Select(p => new
|
||||
|
|
@ -428,6 +438,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
Organization = p.Organization,
|
||||
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
||||
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
||||
DisciplineDisciplinary_DocRelevants = x.DisciplineDisciplinary_DocRelevants.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
DisciplineDisciplinary_DocSummaryEvidences = x.DisciplineDisciplinary_DocSummaryEvidences.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
DisciplineDisciplinary_DocRecordAccusers = x.DisciplineDisciplinary_DocRecordAccusers.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
DisciplineDisciplinary_DocWitnessess = x.DisciplineDisciplinary_DocWitnessess.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
|
|
@ -438,6 +449,17 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
if (_data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
|
||||
var disciplineDisciplinary_DocRelevants = new List<dynamic>();
|
||||
foreach (var doc in _data.DisciplineDisciplinary_DocRelevants)
|
||||
{
|
||||
var _doc = new
|
||||
{
|
||||
doc.Id,
|
||||
doc.FileName,
|
||||
PathName = await _documentService.ImagesPath(doc.Id)
|
||||
};
|
||||
disciplineDisciplinary_DocRelevants.Add(_doc);
|
||||
}
|
||||
var disciplineDisciplinary_DocSummaryEvidences = new List<dynamic>();
|
||||
foreach (var doc in _data.DisciplineDisciplinary_DocSummaryEvidences)
|
||||
{
|
||||
|
|
@ -496,11 +518,21 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
_data.DisciplinaryCaseFault,
|
||||
_data.DisciplinaryDateEvident,
|
||||
_data.DisciplinaryDateAllegation,
|
||||
_data.DisciplinaryDateStart,
|
||||
_data.DisciplinaryDateEnd,
|
||||
_data.DaysExtend,
|
||||
_data.DisciplinaryDateInvestigation,
|
||||
_data.DisciplinaryDateResult,
|
||||
_data.DisciplinaryStatusResult,
|
||||
_data.DisciplinaryCauseText,
|
||||
_data.DisciplinaryResult,
|
||||
_data.Status,
|
||||
_data.Result,
|
||||
_data.Director,
|
||||
_data.RespondentType,
|
||||
_data.Persons,
|
||||
_data.OrganizationId,
|
||||
disciplineDisciplinary_DocRelevants,
|
||||
disciplineDisciplinary_DocSummaryEvidences,
|
||||
disciplineDisciplinary_DocRecordAccusers,
|
||||
disciplineDisciplinary_DocWitnessess,
|
||||
|
|
@ -523,6 +555,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
var data = await _context.DisciplineDisciplinarys
|
||||
.Include(x => x.DisciplineDisciplinary_DirectorInvestigates)
|
||||
.ThenInclude(x => x.DisciplineDirector)
|
||||
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
|
|
@ -539,6 +572,14 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
data.DisciplinaryCaseFault = req.DisciplinaryCaseFault;
|
||||
data.DisciplinaryDateEvident = req.DisciplinaryDateEvident;
|
||||
data.DisciplinaryDateAllegation = req.DisciplinaryDateAllegation;
|
||||
data.DisciplinaryDateStart = req.DisciplinaryDateStart;
|
||||
data.DisciplinaryDateEnd = req.DisciplinaryDateEnd;
|
||||
data.DisciplinaryDaysExtend = req.DaysExtend;
|
||||
data.DisciplinaryDateInvestigation = req.DisciplinaryDateInvestigation;
|
||||
data.DisciplinaryDateResult = req.DisciplinaryDateResult;
|
||||
data.DisciplinaryStatusResult = req.DisciplinaryStatusResult;
|
||||
data.DisciplinaryCauseText = req.DisciplinaryCauseText;
|
||||
data.DisciplinaryResult = req.DisciplinaryResult;
|
||||
data.Result = req.Result;
|
||||
data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
data.LastUpdateUserId = UserId ?? "";
|
||||
|
|
@ -861,7 +902,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("relevant/file/{id:guid}")]
|
||||
[HttpPut("investigate/relevant/file/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> UploadFileDisciplineDisciplinaryInvestigateRelevant([FromForm] DisciplineFileRequest req, Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
|
|
@ -909,7 +950,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpDelete("relevant/file/{id:guid}/{docId:guid}")]
|
||||
[HttpDelete("investigate/relevant/file/{id:guid}/{docId:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> DeleteFileDisciplineDisciplinaryInvestigateRelevant(Guid id, Guid docId)
|
||||
{
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
|
|
@ -943,6 +984,89 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัพไฟล์เอกสารที่เกี่ยวข้องกับการสอบสวน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("relevant/file/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> UploadFileDisciplineDisciplinaryRelevants([FromForm] DisciplineFileRequest req, Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
if (data.Status.Trim().ToUpper() != "NEW")
|
||||
return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
|
||||
|
||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
{
|
||||
foreach (var file in Request.Form.Files)
|
||||
{
|
||||
var fileExtension = Path.GetExtension(file.FileName);
|
||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
var _doc = await _context.Documents.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||
if (_doc != null)
|
||||
{
|
||||
var disciplineDisciplinary_DocRelevant = new DisciplineDisciplinary_DocRelevant
|
||||
{
|
||||
DisciplineDisciplinary = data,
|
||||
Document = _doc,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.DisciplineDisciplinary_DocRelevants.AddAsync(disciplineDisciplinary_DocRelevant);
|
||||
}
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ลบเอกสารที่เกี่ยวข้องกับการสอบสวน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpDelete("relevant/file/{id:guid}/{docId:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> DeleteFileDisciplineDisciplinaryRelevants(Guid id, Guid docId)
|
||||
{
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
.Include(x => x.DisciplineDisciplinary_DocRelevants)
|
||||
.ThenInclude(x => x.Document)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
if (data.Status.Trim().ToUpper() != "NEW")
|
||||
return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
|
||||
var dataDoc = data.DisciplineDisciplinary_DocRelevants.Where(x => x.Document.Id == docId).FirstOrDefault();
|
||||
if (dataDoc != null)
|
||||
{
|
||||
_context.DisciplineDisciplinary_DocRelevants.Remove(dataDoc);
|
||||
await _context.SaveChangesAsync();
|
||||
await _documentService.DeleteFileAsync(docId);
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Error(new Exception("ไม่พบไฟล์นี้ในระบบ"), (int)StatusCodes.Status404NotFound);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัพไฟล์หลักฐานสนับสนุนข้อกล่าวหา
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue