StableVersion4.3/HL_FristAidPlatform_DataBase/Service/T_Service_Trauma_Prehospita...

95 lines
3.5 KiB
C#
Raw Permalink Normal View History

2024-03-11 09:47:34 +08:00
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_PrehospitalDB : BaseDB, IT_Service_Trauma_Prehospital
{
public SqlSugarClient db = GetClient();
/// <summary>
/// 增加一条数据
/// </summary>
public T_Service_Trauma_Prehospital Add(T_Service_Trauma_Prehospital model)
{
return db.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 更新一条数据
/// </summary>
public int Update(T_Service_Trauma_Prehospital model)
{
return db.Updateable(model).ExecuteCommand();
}
/// <summary>
/// 删除一条数据
/// </summary>
public bool Delete(long ID)
{
return db.Deleteable<T_Service_Trauma_Prehospital>(it => it.ID == ID).ExecuteCommand() == 0 ? false : true; ;
}
/// <summary>
/// 获得数据列表
/// </summary>
public TableModel<T_Service_Trauma_Prehospital> GetPageList(int pageIndex, int pageSize)
{
int total = 0;
List<T_Service_Trauma_Prehospital> data = db.Queryable<T_Service_Trauma_Prehospital>().Where(it => it.DeleteFlag == 0).ToPageList(pageIndex, pageSize, ref total);
TableModel<T_Service_Trauma_Prehospital> t = new TableModel<T_Service_Trauma_Prehospital>();
t.Code = 0;
t.PageCount = data.Count;
t.TotalNumber = total;
t.Data = data;
t.Msg = "成功";
return t;
}
/// <summary>
/// 获得前几行数据
/// </summary>
public T_Service_Trauma_Prehospital Get(long ID)
{
return db.Queryable<T_Service_Trauma_Prehospital>().First(it => it.ID == ID);
}
/// <summary>
/// 根据患者编号(GUID)+所属报表类型 获取数据信息
/// </summary>
/// <param name="patientGuid">病人编号(GUID)</param>
/// <param name="reportType">所属报表类型0公用1脑出血手术数据直报表2颅内动脉瘤手术数据直报表3CEACAS数据直报表4静脉溶栓血管内介入治疗数据直报表9卒中联盟数据报表</param>
/// <returns></returns>
public TableModel<T_Service_Trauma_Prehospital> GetByPatientGuidAndReportType(string patientGuid, int reportType)
{
TableModel<T_Service_Trauma_Prehospital> t = new TableModel<T_Service_Trauma_Prehospital>();
var listMode = db.Queryable<T_Service_Trauma_Prehospital>().Where(it => it.PatientGuid == patientGuid && it.DeleteFlag == 0)
.Select(it => new T_Service_Trauma_Prehospital
{
ID = it.ID,
GUID = it.GUID,
PatientGuid = it.PatientGuid,
IsCallHelp = it.IsCallHelp,
CallHelpWay = it.CallHelpWay,
HospitalMode = it.HospitalMode,
IsNetworkCollaboration = it.IsNetworkCollaboration,
Temperature = it.Temperature,
BloodSugar = it.BloodSugar,
DeleteFlag = it.DeleteFlag,
}).OrderBy(it => it.ID, OrderByType.Desc).ToList();
t.Code = 0;
t.TotalNumber = listMode.Count;
t.Data = listMode;
t.Msg = "成功";
return t;
}
}
}