|
@@ -75,9 +75,18 @@ namespace Hotline.Application.Orders
|
|
|
public async Task AddAsync(AddOrderSecondaryHandlingDto dto, CancellationToken cancellationToken)
|
|
|
{
|
|
|
var model = _mapper.Map<OrderSecondaryHandling>(dto);
|
|
|
+ if (string.IsNullOrEmpty(dto.Id))
|
|
|
+ {
|
|
|
+ model.InitId();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ model = await _orderSecondaryHandlingRepository.GetAsync(dto.Id , cancellationToken);
|
|
|
+ model.Content = dto.Content;
|
|
|
+ }
|
|
|
model.State = ESecondaryHandlingState.Apply;
|
|
|
model.ApplyOrgId = _sessionContext.OrgId;
|
|
|
model.ApplyOrgName = _sessionContext.OrgName;
|
|
|
+
|
|
|
if (dto.Files.Any())
|
|
|
model.FileJson = await _fileRepository.AddFileAsync(dto.Files, model.Id, "", cancellationToken);
|
|
|
|
|
@@ -88,9 +97,34 @@ namespace Hotline.Application.Orders
|
|
|
visit.VisitState = EVisitState.None;
|
|
|
await _orderVisitRepository.UpdateAsync(visit, cancellationToken);
|
|
|
}
|
|
|
- await _orderSecondaryHandlingRepository.AddAsync(model, cancellationToken);
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(dto.Id))
|
|
|
+ {
|
|
|
+ await _orderSecondaryHandlingRepository.UpdateAsync(model, cancellationToken);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ await _orderSecondaryHandlingRepository.AddAsync(model, cancellationToken);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ public async Task SendBackAsync(SendBackOrderSecondaryHandlingDto dto, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var model =await _orderSecondaryHandlingRepository.GetAsync(dto.Id, cancellationToken);
|
|
|
+ model.State = ESecondaryHandlingState.NotApply;
|
|
|
+ model.SendBackContent = dto.SendBackContent;
|
|
|
+ model.AuditUser = _sessionContext.UserName;
|
|
|
+ model.AuditTime = DateTime.Now;
|
|
|
+ model.SendBackNum++;
|
|
|
+ await _orderSecondaryHandlingRepository.UpdateAsync(model, cancellationToken);
|
|
|
+ var visit = await _orderVisitRepository.GetAsync(x => x.Id == model.VisitId , cancellationToken);
|
|
|
+ if (visit != null)
|
|
|
+ {
|
|
|
+ visit.VisitState = model.VisitState;
|
|
|
+ await _orderVisitRepository.UpdateAsync(visit, cancellationToken);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 二次办理审批
|
|
|
/// </summary>
|
|
@@ -170,8 +204,9 @@ namespace Hotline.Application.Orders
|
|
|
.Includes(x => x.OrderVisit)
|
|
|
.Includes(x => x.OrderVisit, y => y.Order)
|
|
|
.Includes(x => x.OrderVisit, y => y.Employee)
|
|
|
- .LeftJoin<OrderScreen>((x, s) => x.Id == s.VisitDetailId && (int)s.Status < 2 && s.IsDeleted == false)
|
|
|
- .Where((x, s) => s.Id == null)
|
|
|
+ .Includes(x => x.SecondaryHandling)
|
|
|
+ .LeftJoin<OrderScreen>((x, s) => x.Id == s.VisitDetailId && s.Status < EScreenStatus.End && s.IsDeleted == false)
|
|
|
+ .Where((x, s) => s.Id == null && (x.SecondaryHandling.State == ESecondaryHandlingState.NotApply || x.SecondaryHandling.Id == null))
|
|
|
.WhereIF(dto.IsHomePage.HasValue && dto.IsHomePage == true, x => x.OrderVisit.VisitTime < dto.CreationTimeEnd && x.OrderVisit.VisitTime > dto.CreationTimeStart)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.No), x => x.OrderVisit.Order!.No!.Contains(dto.No!))
|
|
|
.WhereIF(dto.IsProvince.HasValue, x => x.OrderVisit.Order!.IsProvince == dto.IsProvince)
|
|
@@ -189,7 +224,8 @@ namespace Hotline.Application.Orders
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.OrgProcessingResults), x => SqlFunc.JsonField(x.OrgProcessingResults, "Key") == dto.OrgProcessingResults)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.OrgHandledAttitude), x => SqlFunc.JsonListObjectAny(x.OrgHandledAttitude, "Key", dto.OrgHandledAttitude))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.OrgNoSatisfiedReason), x => SqlFunc.JsonField(x.OrgNoSatisfiedReason, "Key") == dto.OrgNoSatisfiedReason)
|
|
|
- .Where((x, s) => x.OrderVisit.VisitState != EVisitState.None && x.OrderVisit.IsCanHandle);
|
|
|
+ .Where((x, s) => x.OrderVisit.VisitState != EVisitState.None && x.OrderVisit.IsCanHandle)
|
|
|
+ .Where((x, s) => x.OrderVisit.Order.CounterSignType == null && x.OrderVisit.Order.ActualHandleOrgCode == _sessionContext.OrgId) ;
|
|
|
if (_sessionContext.OrgId != null && !_sessionContext.OrgIsCenter)
|
|
|
{
|
|
|
query.WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
@@ -228,6 +264,7 @@ namespace Hotline.Application.Orders
|
|
|
.Includes(x => x.Order)
|
|
|
.Includes(x => x.VisitDetail)
|
|
|
.Includes(x => x.Visit, d => d.Order)
|
|
|
+ .Where(x=>x.State> ESecondaryHandlingState.NotApply)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
x => x.Visit.Order.Title.Contains(dto.Keyword!) || x.Visit.Order.No.Contains(dto.Keyword!))
|
|
|
.WhereIF(dto.Status is ESecondaryHandlingState.Apply, x => x.State == ESecondaryHandlingState.Apply)
|