排序

parent 487cd7d7
......@@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Performance.Api.Controllers
......@@ -67,11 +68,17 @@ public ApiResponse GetCollectSheet(int hospitalId)
if (hospitalId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
var regex = new Regex("^[0-9]");
var userId = claim.GetUserId();
var result = collectService.GetCollectSheet(hospitalId, userId)
?.Select(w => new { w.SheetType, w.SheetName })
.Distinct()
.ToList();
result?.Add(new { SheetType = -1, SheetName = "预留比例" });
result = result.OrderBy(w => regex.IsMatch(w.SheetName) ? w.SheetName : $"0{w.SheetName}")
.ThenBy(w => w.SheetType)
.ToList();
return new ApiResponse(ResponseType.OK, result);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment