|
@@ -362,7 +362,7 @@ namespace Hotline.Api.Controllers
|
|
|
/// <param name="OrgCode"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet("enforcement_departmental_processing_statistics_child")]
|
|
|
- public async Task<object> GetDepartmentalProcessingStatisticsAsync(DateTime StartDate, DateTime EndDate, string OrgCode)
|
|
|
+ public async Task<object> GetDepartmentalProcessingStatisticsChildAsync(DateTime StartDate, DateTime EndDate, string OrgCode)
|
|
|
{
|
|
|
|
|
|
EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
@@ -373,7 +373,8 @@ namespace Hotline.Api.Controllers
|
|
|
.Includes(x => x.Order)
|
|
|
.Where(d => d.Order.Id != null)
|
|
|
.Where(d => d.Order.CreationTime >= StartDate && d.Order.CreationTime <= EndDate)
|
|
|
- .Where(d => d.Order.ActualHandleOrgCode.StartsWith(OrgCode))
|
|
|
+ .WhereIF(OrgCode == "001", d => d.Order.ActualHandleOrgCode == OrgCode)
|
|
|
+ .WhereIF(OrgCode != "001", d => d.Order.ActualHandleOrgCode.StartsWith(OrgCode))
|
|
|
.GroupBy(d => new
|
|
|
{
|
|
|
OrgCode = d.Order.ActualHandleOrgCode,
|
|
@@ -543,6 +544,75 @@ namespace Hotline.Api.Controllers
|
|
|
};
|
|
|
|
|
|
|
|
|
+ return new { DataList = list, SumModel = sumModel };
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 部门满意度统计----子级
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="StartDate"></param>
|
|
|
+ /// <param name="EndDate"></param>
|
|
|
+ /// <param name="TypeId">1:办件结果 2:办件态度</param>
|
|
|
+ /// <param name="OrgCode"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("enforcement_visit_org_satisfaction_statistics_child")]
|
|
|
+ public async Task<object> GetVisitAndOrgSatisfactionStatisticsChildAsync(DateTime StartDate, DateTime EndDate, int TypeId, string OrgCode)
|
|
|
+ {
|
|
|
+ EndDate = EndDate.AddDays(1).AddSeconds(-1);
|
|
|
+
|
|
|
+ var list = await _enforcementOrdersRepository.Queryable()
|
|
|
+ .LeftJoin<OrderVisit>((x, o) => x.Id == o.OrderId)
|
|
|
+ .LeftJoin<OrderVisitDetail>((x, o, p) => o.Id == p.VisitId)
|
|
|
+ .Where((x, o, p) => o.VisitTime >= StartDate && o.VisitTime <= EndDate && p.VisitTarget == EVisitTarget.Org && o.VisitState == EVisitState.Visited && !string.IsNullOrEmpty(p.VisitOrgCode))
|
|
|
+ .GroupBy((x, o, p) => new
|
|
|
+ {
|
|
|
+ VisitOrgCode = p.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))
|
|
|
+ })
|
|
|
+ .Select((x, o, p) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgCode = p.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6")),
|
|
|
+ TotalSumCount = SqlFunc.AggregateCount(p.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))),
|
|
|
+ VerySatisfiedCount = SqlFunc.IIF(TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgProcessingResults, "Key") == "5", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgHandledAttitude, "Key") == "5", 1, 0))),//非常满意数
|
|
|
+ SatisfiedCount = SqlFunc.IIF(TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgProcessingResults, "Key") == "4", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgHandledAttitude, "Key") == "4", 1, 0))), //满意数
|
|
|
+ RegardedAsSatisfiedCount = SqlFunc.IIF(TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgProcessingResults, "Key") == "-1", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgHandledAttitude, "Key") == "-1", 1, 0))),//视为满意
|
|
|
+ DefaultSatisfiedCount = SqlFunc.IIF(TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgProcessingResults, "Key") == "0", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgHandledAttitude, "Key") == "0", 1, 0))),//默认满意
|
|
|
+ NoSatisfiedCount = SqlFunc.IIF(TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgProcessingResults, "Key") == "2", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgHandledAttitude, "Key") == "2", 1, 0))),//不满意
|
|
|
+ NoEvaluateCount = SqlFunc.IIF(TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgProcessingResults, "Key") == "7", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgHandledAttitude, "Key") == "7", 1, 0))),//未做评价
|
|
|
+ NoPutThroughCount = SqlFunc.IIF(TypeId == 1, SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgProcessingResults, "Key") == "6", 1, 0)), SqlFunc.AggregateSum(SqlFunc.IIF(SqlFunc.JsonField(p.OrgHandledAttitude, "Key") == "6", 1, 0))),//未接通
|
|
|
+ })
|
|
|
+ .MergeTable()
|
|
|
+ .LeftJoin<SystemOrganize>((it, o) => it.OrgCode == o.Id)
|
|
|
+ .Select((it, o) => new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgName = o.Name,
|
|
|
+ OrgCode = it.OrgCode,
|
|
|
+ OrgType = o.OrgType,
|
|
|
+ TotalSumCount = it.TotalSumCount,
|
|
|
+ VerySatisfiedCount = it.VerySatisfiedCount,//非常满意数
|
|
|
+ SatisfiedCount = it.SatisfiedCount, //满意数
|
|
|
+ RegardedAsSatisfiedCount = it.RegardedAsSatisfiedCount,//视为满意
|
|
|
+ DefaultSatisfiedCount = it.DefaultSatisfiedCount,//默认满意
|
|
|
+ NoSatisfiedCount = it.NoSatisfiedCount,//不满意
|
|
|
+ NoEvaluateCount = it.NoEvaluateCount,//未做评价
|
|
|
+ NoPutThroughCount = it.NoPutThroughCount,//未接通
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+
|
|
|
+ var sumModel = new VisitAndOrgSatisfactionStatisticsDto()
|
|
|
+ {
|
|
|
+ OrgName = "总计",
|
|
|
+ TotalSumCount = list.Sum(x => x.TotalSumCount),
|
|
|
+ VerySatisfiedCount = list.Sum(x => x.VerySatisfiedCount),
|
|
|
+ SatisfiedCount = list.Sum(x => x.SatisfiedCount),
|
|
|
+ RegardedAsSatisfiedCount = list.Sum(x => x.RegardedAsSatisfiedCount),
|
|
|
+ DefaultSatisfiedCount = list.Sum(x => x.DefaultSatisfiedCount),
|
|
|
+ NoSatisfiedCount = list.Sum(x => x.NoSatisfiedCount),
|
|
|
+ NoEvaluateCount = list.Sum(x => x.NoEvaluateCount),
|
|
|
+ NoPutThroughCount = list.Sum(x => x.NoPutThroughCount),
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
return new { DataList = list, SumModel = sumModel };
|
|
|
}
|
|
|
|