StableVersion4.3/HL_FristAidPlatform_DataBase/Service/T_Service_Apoplexy_DRAGONDB.cs

97 lines
3.2 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_Service_Apoplexy_DRAGONDB : BaseDB, IT_Service_Apoplexy_DRAGON
{
public SqlSugarClient db = GetClient();
/// <summary>
/// 增加一条数据
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int Add(T_Service_Apoplexy_DRAGON model)
{
return db.Insertable(model).IgnoreColumns(it => it.ID).ExecuteCommand();
}
/// <summary>
/// 更新一条数据
/// </summary>
public int Update(T_Service_Apoplexy_DRAGON model)
{
return db.Updateable(model).Where(it => it.ID == model.ID).ExecuteCommand();
}
/// <summary>
/// 删除一条数据
/// </summary>
public bool Delete(long ID)
{
return db.Deleteable<T_Service_Apoplexy_DRAGON>(it => it.ID == ID).ExecuteCommand() == 0 ? false : true; ;
}
/// <summary>
/// 获得前几行数据
/// </summary>
public T_Service_Apoplexy_DRAGON Get(long ID)
{
return db.Queryable<T_Service_Apoplexy_DRAGON>().First(it => it.ID == ID);
}
/// <summary>
/// 获得数据列表
/// </summary>
public TableModel<T_Service_Apoplexy_DRAGON> GetPageList(int pageIndex, int pageSize)
{
int total = 0;
List<T_Service_Apoplexy_DRAGON> data = db.Queryable<T_Service_Apoplexy_DRAGON>().Where(it => it.DeleteFlag == 0).ToPageList(pageIndex, pageSize, ref total);
TableModel<T_Service_Apoplexy_DRAGON> t = new TableModel<T_Service_Apoplexy_DRAGON>();
t.Code = 0;
t.PageCount = data.Count;
t.TotalNumber = total;
t.Data = data;
t.Msg = "成功";
return t;
}
/// <summary>
/// 根据患者编号(GUID)+所属报表类型 获取数据信息
/// </summary>
/// <param name="patientGuid">病人编号(GUID)</param>
/// <returns></returns>
public TableModel<T_Service_Apoplexy_DRAGON> GetByPatientGuid(string patientGuid)
{
List<T_Service_Apoplexy_DRAGON> data = db.Queryable<T_Service_Apoplexy_DRAGON>().Where(it => it.PatientGuid == patientGuid && it.DeleteFlag == 0).ToList();
TableModel<T_Service_Apoplexy_DRAGON> t = new TableModel<T_Service_Apoplexy_DRAGON>();
t.Code = 0;
t.PageCount = data.Count;
t.TotalNumber = data.Count;
t.Data = data;
t.Msg = "成功";
return t;
}
public int GetIDByPatientGuid(string patientGuid)
{
T_Service_Apoplexy_DRAGON data = db.Queryable<T_Service_Apoplexy_DRAGON>().Where(it => it.PatientGuid == patientGuid && it.DeleteFlag == 0).First();
if (data == null)
{
return 0;
}
else
{
return data.ID;
}
}
}
}