From b042f471b42fbcceac56a6919d9cebee203a2bf1 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 18 Dec 2024 11:02:24 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B8=A5=E0=B8=B9=E0=B8=81=E0=B8=88=E0=B9=89=E0=B8=B2=E0=B8=87?= =?UTF-8?q?=E0=B8=A7=E0=B8=B4=E0=B8=99=E0=B8=B1=E0=B8=A2=20#874?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DisciplineComplaintController.cs | 12 ++++-- .../DisciplineDisciplinaryController.cs | 12 ++++-- .../DisciplineInvestigateController.cs | 12 ++++-- .../Controllers/DisciplineResultController.cs | 6 ++- .../DisciplineSuspendController.cs | 37 +++++++++++-------- .../Requests/DisciplineComplaintRequest.cs | 1 + .../DisciplineDisciplinaryComplaintRequest.cs | 1 + .../DisciplineInvestigateComplaintRequest.cs | 1 + 8 files changed, 54 insertions(+), 28 deletions(-) diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineComplaintController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineComplaintController.cs index 517b5158..39657c53 100644 --- a/BMA.EHR.Discipline.Service/Controllers/DisciplineComplaintController.cs +++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineComplaintController.cs @@ -171,7 +171,9 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers { Id = x.Id,//id ข้อมูลเรื่องร้องเรียน RespondentType = x.RespondentType,//ผู้ถูกร้องเรียน - Persons = x.DisciplineComplaint_Profiles.Select(p => new + Persons = x.DisciplineComplaint_Profiles + .OrderByDescending(p => p.CreatedAt) + .Select(p => new { Id = p.Id, Idcard = p.CitizenId, @@ -207,6 +209,8 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers posTypeName = p.posTypeName, posLevelId = p.posLevelId, posLevelName = p.posLevelName, + profileType = p.profileType, + CreatedAt = p.CreatedAt }),//รายการข้อมูลบุคลผู้ถูกร้องเรียน Organization = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง @@ -343,7 +347,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers posTypeName = item.posTypeName, posLevelId = item.posLevelId, posLevelName = item.posLevelName, - + profileType = item.profileType, Salary = item.salary, PosNo = item.posNo, Position = item.position, @@ -452,7 +456,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers posTypeName = item.posTypeName, posLevelId = item.posLevelId, posLevelName = item.posLevelName, - + profileType = item.profileType, PosNo = item.posNo, CreatedFullName = FullName ?? "System Administrator", CreatedUserId = UserId ?? "", @@ -625,7 +629,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers posTypeName = item.posTypeName, posLevelId = item.posLevelId, posLevelName = item.posLevelName, - + profileType = item.profileType, Salary = item.Salary, PosNo = item.PosNo, Position = item.Position, diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineDisciplinaryController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineDisciplinaryController.cs index 494b25fe..7cf98db6 100644 --- a/BMA.EHR.Discipline.Service/Controllers/DisciplineDisciplinaryController.cs +++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineDisciplinaryController.cs @@ -480,7 +480,9 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers // Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(), }).ToList(), RespondentType = x.RespondentType,//ผู้ถูกสืบสวน - Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Select(p => new + Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates + .OrderByDescending(p => p.CreatedAt) + .Select(p => new { Id = p.Id, Idcard = p.CitizenId, @@ -516,11 +518,13 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers posTypeName = p.posTypeName, posLevelId = p.posLevelId, posLevelName = p.posLevelName, - + IsSend = p.IsReport, IsSuspend = p.IsSuspend, Status = p.Status, StatusDiscard = p.StatusDiscard, + profileType = p.profileType, + CreatedAt = p.CreatedAt, // Report = p.DisciplineReport_Profiles.Count() > 0 ? true : false, }),//รายการข้อมูลบุคลผู้ถูกสืบสวน Organization = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน @@ -775,7 +779,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers posTypeName = item.posTypeName, posLevelId = item.posLevelId, posLevelName = item.posLevelName, - + profileType = item.profileType, PosNo = item.posNo, Status = isReport == null ? "NEW" : isReport.Status, StatusDiscard = isReport == null ? "NEW" : isReport.StatusDiscard, @@ -1766,7 +1770,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers posTypeName = item.posTypeName, posLevelId = item.posLevelId, posLevelName = item.posLevelName, - + profileType = item.profileType, Salary = item.Salary, PosNo = item.PosNo, Position = item.Position, diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineInvestigateController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineInvestigateController.cs index cfc3d856..3b19b4f1 100644 --- a/BMA.EHR.Discipline.Service/Controllers/DisciplineInvestigateController.cs +++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineInvestigateController.cs @@ -313,7 +313,9 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers // Total = d.DisciplineDirector.DisciplineInvestigate_Directors.Count(), }).ToList(), RespondentType = x.RespondentType,//ผู้ถูกสืบสวน - Persons = x.DisciplineInvestigate_ProfileComplaints.Select(p => new + Persons = x.DisciplineInvestigate_ProfileComplaints + .OrderByDescending(p => p.CreatedAt) + .Select(p => new { Id = p.Id, Idcard = p.CitizenId, @@ -349,9 +351,11 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers posTypeName = p.posTypeName, posLevelId = p.posLevelId, posLevelName = p.posLevelName, - + IsSend = p.IsReport, IsDisciplinary = p.IsDisciplinary, + profileType = p.profileType, + CreatedAt = p.CreatedAt, }),//รายการข้อมูลบุคลผู้ถูกสืบสวน Organization = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน OrganizationId = x.OrganizationId,//id หน่วยงานกรณี type เป็นหน่วยงาน @@ -545,7 +549,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers posTypeName = item.posTypeName, posLevelId = item.posLevelId, posLevelName = item.posLevelName, - + profileType = item.profileType, PosNo = item.posNo, IsDisciplinary = isReport == null ? false : isReport.IsDisciplinary, IsReport = isReport == null ? "NEW" : isReport.IsReport, @@ -705,7 +709,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers posTypeName = item.posTypeName, posLevelId = item.posLevelId, posLevelName = item.posLevelName, - + profileType = item.profileType, Salary = item.Salary, PosNo = item.PosNo, Position = item.Position, diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs index ff5b3af3..741a7eb4 100644 --- a/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs +++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineResultController.cs @@ -147,7 +147,9 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน RespondentType = x.RespondentType,//ผู้ถูกสืบสวน - Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.IsReport == "NEW").Select(p => new + Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.IsReport == "NEW") + .OrderByDescending(p => p.CreatedAt) + .Select(p => new { Id = p.Id, Idcard = p.CitizenId, @@ -184,6 +186,8 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers posLevelName = p.posLevelName, Status = p.Status, StatusDiscard = p.StatusDiscard, + profileType = p.profileType, + CreatedAt = p.CreatedAt }),//รายการข้อมูลบุคลผู้ถูกสืบสวน Organization = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน OrganizationId = x.OrganizationId,//id หน่วยงานกรณี type เป็นหน่วยงาน diff --git a/BMA.EHR.Discipline.Service/Controllers/DisciplineSuspendController.cs b/BMA.EHR.Discipline.Service/Controllers/DisciplineSuspendController.cs index 97d1d51a..716d434d 100644 --- a/BMA.EHR.Discipline.Service/Controllers/DisciplineSuspendController.cs +++ b/BMA.EHR.Discipline.Service/Controllers/DisciplineSuspendController.cs @@ -58,7 +58,7 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers /// ไม่ได้ Login เข้าระบบ /// เมื่อเกิดข้อผิดพลาดในการทำงาน [HttpGet()] - public async Task> GetDisciplineSuspend(int page = 1, int pageSize = 25, string keyword = "") + public async Task> GetDisciplineSuspend(int page = 1, int pageSize = 25, string keyword = "", string profileType = "") { var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_SUSPENDED"); var jsonData = JsonConvert.DeserializeObject(getPermission); @@ -67,18 +67,22 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden); } var data_search = (from x in _context.DisciplineReport_Profiles.Include(x => x.DisciplineDisciplinary) - where (x.CitizenId == null ? false : x.CitizenId.Contains(keyword)) || - //(x.Prefix == null ? false : x.Prefix.Contains(keyword)) || - //(x.FirstName == null ? false : x.FirstName.Contains(keyword)) || - //(x.LastName == null ? false : x.LastName.Contains(keyword)) || - ((x.Prefix ?? "") + (x.FirstName ?? "") + " " + (x.LastName ?? "")).Contains(keyword) || - (x.Organization == null ? false : x.Organization.Contains(keyword)) || - (x.Position == null ? false : x.Position.Contains(keyword)) || - (x.PosNo == null ? false : x.PosNo.Contains(keyword)) || - //(x.posTypeName == null ? false : x.posTypeName.Contains(keyword)) || - //(x.posLevelName == null ? false : x.posLevelName.Contains(keyword)) || - ((x.posTypeName ?? "") + " (" + (x.posLevelName ?? "") + ")").Contains(keyword) || - (x.Title == null ? false : x.Title.Contains(keyword)) + where + ( + (x.CitizenId != null && x.CitizenId.Contains(keyword)) || + ((x.Prefix ?? "") + (x.FirstName ?? "") + " " + (x.LastName ?? "")).Contains(keyword) || + (x.Organization != null && x.Organization.Contains(keyword)) || + (x.Position != null && x.Position.Contains(keyword)) || + (x.PosNo != null && x.PosNo.Contains(keyword)) || + ((x.posTypeName ?? "") + " (" + (x.posLevelName ?? "") + ")").Contains(keyword) || + (x.Title != null && x.Title.Contains(keyword)) + ) + && + ( + string.IsNullOrEmpty(profileType) || + (profileType.ToUpper() == "OFFICER" && x.profileType == "OFFICER") || + (profileType.ToUpper() == "EMPLOYEE" && x.profileType == "EMPLOYEE") + ) select x).ToList(); var data = data_search .Select(x => new @@ -110,7 +114,7 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers posTypeName = x.posTypeName, posLevelId = x.posLevelId, posLevelName = x.posLevelName, - + Position = x.Position, PosNo = x.PosNo, PositionLevel = x.PositionLevel == null ? "" : x.PositionLevel, @@ -124,8 +128,11 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers OffenseDetails = x.DisciplineDisciplinary.OffenseDetails,//ลักษณะความผิด DisciplinaryFaultLevel = x.DisciplineDisciplinary.DisciplinaryFaultLevel,//ระดับโทษความผิด DisciplinaryCaseFault = x.DisciplineDisciplinary.DisciplinaryCaseFault,//กรณีความผิด + profileType = x.profileType, + CreatedAt = x.CreatedAt, }) - .OrderByDescending(x => x.CitizenId) + .OrderByDescending(x => x.CreatedAt) + .ThenByDescending(x => x.CitizenId) .Skip((page - 1) * pageSize) .Take(pageSize) .ToList(); diff --git a/BMA.EHR.Discipline.Service/Requests/DisciplineComplaintRequest.cs b/BMA.EHR.Discipline.Service/Requests/DisciplineComplaintRequest.cs index 5b340410..2b791da1 100644 --- a/BMA.EHR.Discipline.Service/Requests/DisciplineComplaintRequest.cs +++ b/BMA.EHR.Discipline.Service/Requests/DisciplineComplaintRequest.cs @@ -56,5 +56,6 @@ namespace BMA.EHR.Discipline.Service.Requests public string? posTypeName { get; set; } public string? posLevelId { get; set; } public string? posLevelName { get; set; } + public string? profileType { get; set; } } } diff --git a/BMA.EHR.Discipline.Service/Requests/DisciplineDisciplinaryComplaintRequest.cs b/BMA.EHR.Discipline.Service/Requests/DisciplineDisciplinaryComplaintRequest.cs index bad83905..b6ec418b 100644 --- a/BMA.EHR.Discipline.Service/Requests/DisciplineDisciplinaryComplaintRequest.cs +++ b/BMA.EHR.Discipline.Service/Requests/DisciplineDisciplinaryComplaintRequest.cs @@ -42,5 +42,6 @@ namespace BMA.EHR.Discipline.Service.Requests public string? posTypeName { get; set; } public string? posLevelId { get; set; } public string? posLevelName { get; set; } + public string? profileType { get; set; } } } diff --git a/BMA.EHR.Discipline.Service/Requests/DisciplineInvestigateComplaintRequest.cs b/BMA.EHR.Discipline.Service/Requests/DisciplineInvestigateComplaintRequest.cs index 808972f5..73b0098f 100644 --- a/BMA.EHR.Discipline.Service/Requests/DisciplineInvestigateComplaintRequest.cs +++ b/BMA.EHR.Discipline.Service/Requests/DisciplineInvestigateComplaintRequest.cs @@ -42,5 +42,6 @@ namespace BMA.EHR.Discipline.Service.Requests public string? posTypeName { get; set; } public string? posLevelId { get; set; } public string? posLevelName { get; set; } + public string? profileType { get; set; } } }