140 lines
5.7 KiB
C#
140 lines
5.7 KiB
C#
using HL_FristAidPlatform_Help;
|
|
using HL_FristAidPlatform_IDataBase;
|
|
using HL_FristAidPlatform_Models;
|
|
using SqlSugar;
|
|
using System.Collections.Generic;
|
|
namespace HL_FristAidPlatform_DataBase
|
|
{
|
|
/// <summary>
|
|
/// 时间轴排序模板,实现按不同来院方式进行展示
|
|
/// </summary>
|
|
public class T_Base_TimeAxis_TempletDB : BaseDB, IT_Base_TimeAxis_Templet
|
|
{
|
|
public SqlSugarClient db = GetClient();
|
|
|
|
#region 增
|
|
/// <summary>
|
|
/// 增加一条数据
|
|
/// </summary>
|
|
public bool Add(T_Base_TimeAxis_Templet model)
|
|
{
|
|
return db.Insertable(model).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand() == 1 ? true : false;
|
|
}
|
|
#endregion
|
|
|
|
#region 删
|
|
/// <summary>
|
|
/// 删除一条数据
|
|
/// </summary>
|
|
public bool Delete(int id)
|
|
{
|
|
return db.Deleteable<T_Base_TimeAxis_Templet>().Where(new T_Base_TimeAxis_Templet() { ID = id }).ExecuteCommand() == 1 ? true : false;
|
|
}
|
|
#endregion
|
|
|
|
#region 改
|
|
/// <summary>
|
|
/// 更新一条数据
|
|
/// </summary>
|
|
public bool Update(T_Base_TimeAxis_Templet model)
|
|
{
|
|
return db.Updateable(model).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand() == 1 ? true : false;
|
|
}
|
|
#endregion
|
|
|
|
#region 查
|
|
/// <summary>
|
|
/// 获得数据列表
|
|
/// </summary>
|
|
/// <param name="keyWord">关键词</param>
|
|
/// <param name="systemModuleID">模块ID</param>
|
|
/// <param name="hospitalModeValue">来院方式</param>
|
|
/// <returns></returns>
|
|
public TableModel<T_Base_TimeAxis_TempletModel> GetList(string keyWord, long systemModuleID, string hospitalModeValue)
|
|
{
|
|
TableModel<T_Base_TimeAxis_TempletModel> t = new TableModel<T_Base_TimeAxis_TempletModel>();
|
|
|
|
var listMode = db.Queryable<T_Base_TimeAxis_Templet, T_SYS_SystemModule, T_Base_HospitalMode>((a, b, c) => new object[] {
|
|
JoinType.Left,a.SystemModuleID==b.ID,
|
|
JoinType.Left,a.HospitalModeValue==c.Value && a.SystemModuleID==c.SystemModuleID
|
|
}).
|
|
Where((a, b) => a.SystemModuleID == systemModuleID && b.DeleteFlag == 0).
|
|
WhereIF(!string.IsNullOrEmpty(keyWord), (a) => a.TempletName.Contains(keyWord)).
|
|
WhereIF(!string.IsNullOrEmpty(hospitalModeValue), (a) => a.HospitalModeValue == hospitalModeValue).
|
|
Select((a, b, c) => new T_Base_TimeAxis_TempletModel
|
|
{
|
|
ID = a.ID,
|
|
GUID = a.GUID.ToString(),
|
|
SystemModuleID = a.SystemModuleID,
|
|
TempletName = a.TempletName,
|
|
HospitalModeValue = a.HospitalModeValue,
|
|
IsGreenChannel = a.IsGreenChannel,
|
|
TotalPerRow = a.TotalPerRow,
|
|
IncrementalInterval_X = a.IncrementalInterval_X,
|
|
IncrementalInterval_Y = a.IncrementalInterval_Y,
|
|
LocationX_Start = a.LocationX_Start,
|
|
LocationY_Start = a.LocationY_Start,
|
|
Remark = a.Remark,
|
|
DeleteFlag = a.DeleteFlag,
|
|
OrderBy = a.OrderBy,
|
|
CreationDate = a.CreationDate,
|
|
ModificationDate = a.ModificationDate,
|
|
Thrombolysis = a.Thrombolysis,
|
|
Interventional_Therapy = a.Interventional_Therapy,
|
|
SystemModule = b.SystemName.ToString(),
|
|
HospitalModeName = c.Content,
|
|
}).OrderBy((a) => a.OrderBy).ToList();
|
|
|
|
t.Code = 0;
|
|
t.TotalNumber = listMode.Count;
|
|
t.Data = listMode;
|
|
t.Msg = "成功";
|
|
return t;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获得前几行数据
|
|
/// </summary>
|
|
public T_Base_TimeAxis_Templet Get(int id)
|
|
{
|
|
return db.Queryable<T_Base_TimeAxis_Templet>().First(it => it.ID == id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据系统模块编号数据列表
|
|
/// </summary>
|
|
/// <param name="systemModuleID">系统模块编号</param>
|
|
/// <returns></returns>
|
|
public TableModel<T_Base_TimeAxis_Templet> GetListBySystemModuleID(long systemModuleID)
|
|
{
|
|
List<T_Base_TimeAxis_Templet> data = db.Queryable<T_Base_TimeAxis_Templet>().Where(it => it.SystemModuleID == systemModuleID && it.DeleteFlag == 0).ToList();
|
|
TableModel<T_Base_TimeAxis_Templet> list = new TableModel<T_Base_TimeAxis_Templet>();
|
|
list.Code = 0;
|
|
list.TotalNumber = data.Count;
|
|
list.Data = data;
|
|
list.Msg = "成功";
|
|
return list;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断是否存在 存在返回实体
|
|
/// </summary>
|
|
/// <param name="model">实体</param>
|
|
/// <returns></returns>
|
|
public TableModel<T_Base_TimeAxis_Templet> CheckIsExist(T_Base_TimeAxis_Templet model)
|
|
{
|
|
TableModel<T_Base_TimeAxis_Templet> t = new TableModel<T_Base_TimeAxis_Templet>();
|
|
var listMode = db.Queryable<T_Base_TimeAxis_Templet>()
|
|
.Where(a => a.SystemModuleID == model.SystemModuleID && a.HospitalModeValue == model.HospitalModeValue && a.IsGreenChannel == model.IsGreenChannel && a.Thrombolysis == model.Thrombolysis && a.Interventional_Therapy == model.Interventional_Therapy && a.DeleteFlag == 0)
|
|
.WhereIF(model.ID > 0, a => a.ID != model.ID).ToList();
|
|
|
|
t.Code = 0;
|
|
t.PageCount = listMode.Count;
|
|
t.TotalNumber = listMode.Count;
|
|
t.Data = listMode;
|
|
t.Msg = "成功";
|
|
return t;
|
|
}
|
|
#endregion
|
|
}
|
|
} |