20231115人员信息与体检关联关联

This commit is contained in:
2023-11-15 16:11:07 +08:00
parent 46752f3351
commit 11e8156f65
10 changed files with 308 additions and 483 deletions
@@ -1,4 +1,8 @@
using System.Linq;
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
@@ -9,6 +13,62 @@ namespace BLL
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.SitePerson_Person> getDataLists = from x in db.SitePerson_Person
select x;
/// <summary>
///
/// </summary>
/// <param name="projectId"></param>
/// <param name="personName"></param>
/// <param name="Grid1"></param>
/// <returns></returns>
public static IEnumerable getListData(string projectId, string personName, Grid Grid1)
{
IQueryable<Model.SitePerson_Person> getDataList = getDataLists;
if (!string.IsNullOrEmpty(projectId))
{
getDataList = getDataList.Where(e => e.ProjectId == projectId);
}
if (!string.IsNullOrEmpty(personName))
{
getDataList = getDataList.Where(e => e.PersonName.Contains(personName));
}
count = getDataList.Count();
if (count == 0)
{
return null;
}
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getDataList
select new
{
x.ProjectId,
ProjectName = db.Base_Project.First(p => p.ProjectId == x.ProjectId).ProjectName,
x.UnitId,
UnitName = db.Base_Unit.First(p => p.UnitId == x.UnitId).UnitName,
x.SitePersonId,
x.PersonId,
x.CardNo,
x.PersonName,
};
}
#endregion
/// <summary>
/// 根据主键获取体检管理
/// </summary>
+12 -8
View File
@@ -1,6 +1,7 @@
namespace BLL
{
using Model;
using NPOI.Util;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -361,17 +362,20 @@
group x by x.ProjectId into g
select new { g.First().ProjectId, count = g.Count() }).Distinct();
List<Model.Base_Project> getList = new List<Base_Project>();
if (getProjects.Count() > 0)
{
getList = (from x in getProjects
join y in pcount on x.ProjectId equals y.ProjectId into PP
from p in PP.DefaultIfEmpty()
orderby p.count descending
select x).ToList();
var getList = (from x in getProjects
join y in pcount on x.ProjectId equals y.ProjectId into PP
from p in PP.DefaultIfEmpty()
orderby p.count descending
select x);
return getList.ToList();
}
return getList;
else
{
return null;
}
}
}