117 lines
3.7 KiB
C#
117 lines
3.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_Service_Trauma_OutComeDB : BaseDB, IT_Service_Trauma_OutCome
|
|||
|
{
|
|||
|
public SqlSugarClient db = GetClient();
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 增加一条数据
|
|||
|
/// </summary>
|
|||
|
public T_Service_Trauma_OutCome Add(T_Service_Trauma_OutCome model)
|
|||
|
{
|
|||
|
return db.Insertable(model).ExecuteReturnEntity();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 更新一条数据
|
|||
|
/// </summary>
|
|||
|
public bool Update(T_Service_Trauma_OutCome model)
|
|||
|
{
|
|||
|
return db.Updateable(model).ExecuteCommand() == 0 ? false : true;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 删除一条数据
|
|||
|
/// </summary>
|
|||
|
public bool Delete(long ID)
|
|||
|
{
|
|||
|
return db.Deleteable<T_Service_Trauma_OutCome>(it => it.ID == ID).ExecuteCommand() == 0 ? false : true; ;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获得数据列表
|
|||
|
/// </summary>
|
|||
|
public TableModel<T_Service_Trauma_OutCome> GetPageList(int pageIndex, int pageSize)
|
|||
|
{
|
|||
|
int total = 0;
|
|||
|
List<T_Service_Trauma_OutCome> data = db.Queryable<T_Service_Trauma_OutCome>().Where(it => it.DeleteFlag == 0).ToPageList(pageIndex, pageSize, ref total);
|
|||
|
TableModel<T_Service_Trauma_OutCome> t = new TableModel<T_Service_Trauma_OutCome>();
|
|||
|
t.Code = 0;
|
|||
|
t.PageCount = data.Count;
|
|||
|
t.TotalNumber = total;
|
|||
|
t.Data = data;
|
|||
|
t.Msg = "成功";
|
|||
|
return t;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获得前几行数据
|
|||
|
/// </summary>
|
|||
|
public T_Service_Trauma_OutCome Get(long ID)
|
|||
|
{
|
|||
|
return db.Queryable<T_Service_Trauma_OutCome>().First(it => it.ID == ID);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
/// <param name="guid"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public T_Service_Trauma_OutCome GetByGuid(string guid)
|
|||
|
{
|
|||
|
return db.Queryable<T_Service_Trauma_OutCome>().Where(it => it.PatientGuid == guid && it.DeleteFlag == 0).First();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 根据患者编号(GUID)+所属报表类型 获取数据信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="patientGuid">病人编号(GUID)</param>
|
|||
|
/// <returns></returns>
|
|||
|
public TableModel<T_Service_Trauma_OutCome> GetByPatientGuid(string patientGuid)
|
|||
|
{
|
|||
|
TableModel<T_Service_Trauma_OutCome> t = new TableModel<T_Service_Trauma_OutCome>();
|
|||
|
|
|||
|
var listMode = db.Queryable<T_Service_Trauma_OutCome>().Where(it => it.PatientGuid == patientGuid && it.DeleteFlag == 0)
|
|||
|
.Select(it => new T_Service_Trauma_OutCome
|
|||
|
{
|
|||
|
ID = it.ID,
|
|||
|
GUID = it.GUID,
|
|||
|
PatientGuid = it.PatientGuid,
|
|||
|
|
|||
|
}).OrderBy(it => it.ID, OrderByType.Desc).ToList();
|
|||
|
|
|||
|
t.Code = 0;
|
|||
|
t.TotalNumber = listMode.Count;
|
|||
|
t.Data = listMode;
|
|||
|
t.Msg = "成功";
|
|||
|
return t;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
/// <param name="GUID"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public GUIDModel GetGUID(string GUID)
|
|||
|
{
|
|||
|
GUIDModel model = new GUIDModel();
|
|||
|
model = db.Queryable<T_Service_Trauma_OutCome>()
|
|||
|
.Where(it => it.PatientGuid == GUID)
|
|||
|
.Select(it => new GUIDModel
|
|||
|
{
|
|||
|
GUID = it.GUID
|
|||
|
}).First();
|
|||
|
|
|||
|
return model;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|