diff --git a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs index eee37b45..382726ec 100644 --- a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs +++ b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs @@ -211,6 +211,10 @@ namespace BMA.EHR.Application.Repositories.Commands .ThenInclude(x => x.PositionMaster) .ThenInclude(x => x.PositionLine) + .Include(x => x.OrganizationPosition) + .ThenInclude(x => x.Organization) + .ThenInclude(x => x.OrganizationOrganization) + .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId); if (placementProfile == null) @@ -233,6 +237,8 @@ namespace BMA.EHR.Application.Repositories.Commands ReligionId = placementProfile.Religion == null ? Guid.Empty : placementProfile.Religion.Id, BloodGroupId = placementProfile.BloodGroup == null ? Guid.Empty : placementProfile.BloodGroup.Id, + DateAppoint = placementProfile.RecruitDate == null ? null : placementProfile.RecruitDate.Value, + DateStart = placementProfile.RecruitDate == null ? null : placementProfile.RecruitDate.Value, RegistrationAddress = placementProfile.RegistAddress, RegistrationSubDistrictId = placementProfile.RegistSubDistrict == null ? Guid.Empty : placementProfile.RegistSubDistrict!.Id, @@ -263,7 +269,11 @@ namespace BMA.EHR.Application.Repositories.Commands PositionPathSideId = placementProfile.PositionPathSide == null ? Guid.Empty : placementProfile.PositionPathSide.Id, PositionType = placementProfile.PositionType, PositionLevel = placementProfile.PositionLevel, + PositionEmployeeLevelId = placementProfile.PositionLevel!.Id, PositionLineId = placementProfile.PositionLine == null ? Guid.Empty : placementProfile.PositionLine.Id, + PositionLine = placementProfile.PositionLine == null ? "" : placementProfile.PositionLine.Name, + PosNo = placementProfile.OrganizationPosition!.PositionNumber, + IsVerified = true, IsProbation = true, Physical = "", @@ -292,6 +302,14 @@ namespace BMA.EHR.Application.Repositories.Commands LastUpdatedAt = DateTime.Now, LastUpdateFullName = FullName ?? "System Administrator", LastUpdateUserId = UserId ?? "", + + // organization + OrganizationShortNameId = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Id, + OrganizationShortName = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Name, + OrganizationOrganizationId = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Id, + OcId = placementProfile.OrganizationPosition!.Organization!.Id, + Oc = _organizationCommonRepository.GetOrganizationNameFullPath(placementProfile.OrganizationPosition!.Organization!.Id, false, false, "/"), + }; // add profile education @@ -1290,7 +1308,7 @@ namespace BMA.EHR.Application.Repositories.Commands Name = $"{x.Profile!.Prefix!.Name}{x.Profile!.FirstName} {x.Profile!.LastName}", PositionName = x.OrganizationPosition!.PositionMaster!.PositionExecutive != null ? x.OrganizationPosition!.PositionMaster!.PositionExecutive!.Name - : + : x.OrganizationPosition!.PositionMaster!.PositionPath == null ? "" : x.OrganizationPosition!.PositionMaster!.PositionPath!.Name }) .ToListAsync(); diff --git a/BMA.EHR.Application/Repositories/OrganizationCommonRepository.cs b/BMA.EHR.Application/Repositories/OrganizationCommonRepository.cs index 1c1621c8..9bbe52a9 100644 --- a/BMA.EHR.Application/Repositories/OrganizationCommonRepository.cs +++ b/BMA.EHR.Application/Repositories/OrganizationCommonRepository.cs @@ -28,7 +28,7 @@ namespace BMA.EHR.Application.Repositories #region " Methods " - public string GetOrganizationNameFullPath(Guid id, bool showRoot = false, bool descending = false) + public string GetOrganizationNameFullPath(Guid id, bool showRoot = false, bool descending = false,string seperator = " ") { try { @@ -39,7 +39,7 @@ namespace BMA.EHR.Application.Repositories var ret = String.Empty; foreach (var oc in ocList) { - ret = oc.Name + " " + ret; + ret = oc.Name + seperator + ret; } if (ret.Length > 2) ret = ret.Substring(0, ret.Length - 1); @@ -65,7 +65,7 @@ namespace BMA.EHR.Application.Repositories { Id = x.Id, Name = x.OrganizationOrganization!.Name, - ParentId = x.Parent!.Id + ParentId = x.Parent == null ? Guid.Empty : x.Parent!.Id }) .FirstOrDefault(x => x.Id == id); @@ -81,7 +81,7 @@ namespace BMA.EHR.Application.Repositories //else // ocList.Add(new OrganizationItem { Id = oc.OCId, Name = oc.OrganizationName }); - if (ocData.ParentId != null) + if (ocData.ParentId != Guid.Empty) { ocList.AddRange(GetOCWithFullPath(ocData.ParentId, showRoot)); } diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs index 365ade86..9c395559 100644 --- a/BMA.EHR.Command.Service/Controllers/OrderController.cs +++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs @@ -270,7 +270,8 @@ namespace BMA.EHR.Command.Service.Controllers FiscalYear = d.CommandYear, OrderDate = d.CommandAffectDate, OrderByOrganization = d.IssuerOrganizationName, - OrderBy = d.IssuerOrganizationId, + OrderBy = d.IssuerOrganizationName, + OrderById = d.IssuerOrganizationId, signatoryBy = d.AuthorizedUserFullName, signatoryPosition = d.AuthorizedPosition, OrderStatusValue = d.CommandStatusId, @@ -387,6 +388,7 @@ namespace BMA.EHR.Command.Service.Controllers PositionName = req.registerPosition, CommandTypeId = req.orderTypeValue, IssuerOrganizationId = req.orderBy, + IssuerOrganizationName = req.orderByOrganizationName, AuthorizedUserFullName = req.signatoryBy, AuthorizedPosition = req.signatoryPosition, PlacementId = req.examRound, @@ -439,6 +441,7 @@ namespace BMA.EHR.Command.Service.Controllers order.PositionName = req.registerPosition; order.CommandType = commandType!; order.IssuerOrganizationId = req.orderBy; + order.IssuerOrganizationName = req.orderByOrganizationName; order.AuthorizedUserFullName = req.signatoryBy; order.AuthorizedPosition = req.signatoryPosition; order.Placement = placement!; diff --git a/BMA.EHR.Command.Service/Requests/CreateCommandRequest.cs b/BMA.EHR.Command.Service/Requests/CreateCommandRequest.cs index 15db35af..f4e6748b 100644 --- a/BMA.EHR.Command.Service/Requests/CreateCommandRequest.cs +++ b/BMA.EHR.Command.Service/Requests/CreateCommandRequest.cs @@ -14,15 +14,17 @@ public Guid orderBy { get; set; } - public string signatoryBy { get; set; } + public string orderByOrganizationName { get; set; } = string.Empty; - public string signatoryPosition { get; set; } + public string signatoryBy { get; set; } = string.Empty; + + public string signatoryPosition { get; set; } = string.Empty; public Guid examRound { get; set; } - public string registerPosition { get; set; } + public string registerPosition { get; set; } = string.Empty; - public string conclusionRegisterNo { get; set; } + public string conclusionRegisterNo { get; set; } = string.Empty; public DateTime conclusionRegisterDate { get; set; }