180 lines
7.2 KiB
C#
180 lines
7.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>
|
|||
|
/// 急救信息 V2.1版
|
|||
|
/// </summary>
|
|||
|
public class T_Service_ChestPain_FirstAIDInfoDB : BaseDB, IT_Service_ChestPain_FirstAIDInfo
|
|||
|
{
|
|||
|
public SqlSugarClient db = GetClient();
|
|||
|
|
|||
|
#region 增
|
|||
|
/// <summary>
|
|||
|
/// 新增
|
|||
|
/// </summary>
|
|||
|
/// <param name="model">实体</param>
|
|||
|
/// <returns></returns>
|
|||
|
public bool Add(T_Service_ChestPain_FirstAIDInfo model)
|
|||
|
{
|
|||
|
return db.Insertable(model).ExecuteCommand() == 0 ? false : true;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 新增 仅更新赋值的字段
|
|||
|
/// </summary>
|
|||
|
/// <param name="model">实体类</param>
|
|||
|
/// <returns></returns>
|
|||
|
public int AddNotNullColumns(T_Service_ChestPain_FirstAIDInfo model)
|
|||
|
{
|
|||
|
//Where(true/* Is no insert null */, true/*off identity*/)
|
|||
|
return db.Insertable(model).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 新增 仅更新赋值的字段
|
|||
|
/// 用于移动端
|
|||
|
/// </summary>
|
|||
|
/// <param name="model">实体类</param>
|
|||
|
/// <returns></returns>
|
|||
|
public int AddForApp(T_Service_ChestPain_FirstAIDInfo model)
|
|||
|
{
|
|||
|
return db.Insertable(model).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 删
|
|||
|
/// <summary>
|
|||
|
/// 删除一条数据
|
|||
|
/// </summary>
|
|||
|
public bool Delete(long ID)
|
|||
|
{
|
|||
|
return db.Deleteable<T_Service_ChestPain_FirstAIDInfo>(it => it.ID == ID).ExecuteCommand() == 0 ? false : true;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 改
|
|||
|
/// <summary>
|
|||
|
/// 更新一条数据
|
|||
|
/// </summary>
|
|||
|
public bool Update(T_Service_ChestPain_FirstAIDInfo model)
|
|||
|
{
|
|||
|
return db.Updateable(model).ExecuteCommand() == 0 ? false : true;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 仅更新赋值的字段
|
|||
|
/// </summary>
|
|||
|
/// <param name="model">实体类</param>
|
|||
|
/// <returns></returns>
|
|||
|
public int UpdateNotNullColumns(T_Service_ChestPain_FirstAIDInfo model)
|
|||
|
{
|
|||
|
return db.Updateable(model).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|||
|
}
|
|||
|
|
|||
|
public int UpdateTime(T_Service_ChestPain_FirstAIDInfo model)
|
|||
|
{
|
|||
|
return db.Updateable(model).UpdateColumns(i => new { i.Attack_Time, i.CW_120_Arrived_Hospital_Time, i.CW_120_First_Doctor_Time, i.CW_120_First_MC_Time, i.CW_120_Help_Time, i.CW_YNFB_Consultation_Time, i.Start_Agree_time, i.CW_ZY_First_MC_Time, i.CW_ZY_Outhospital_Visit_Time, i.CW_ZY_Transfer_Time, i.CW_ZY_Leave_Outhospital_Time, i.CW_ZY_Arrived_Hospital_Time, i.CW_ZY_Admission_Time, i.CW_ZXLY_Arrived_Hospital_Time, i.CW_ZXLY_First_MC_Time, i.CW_ZXLY_First_Doctor_Time, i.CW_YNFB_First_MC_Time, i.CW_YNFB_Leave_Department_Time, i.Throm_Start_Time, i.Sign_Agree_Time, i.Throm_End_Time, i.Start_Radiography_Time, i.Operation_Time }).ExecuteCommand();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 修改--仅更新赋值的字段
|
|||
|
/// 用于移动端
|
|||
|
/// </summary>
|
|||
|
/// <param name="model">实体类</param>
|
|||
|
/// <returns></returns>
|
|||
|
public int UpdateForApp(T_Service_ChestPain_FirstAIDInfo model)
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(model.PatientGuid))
|
|||
|
{
|
|||
|
var patient = db.Queryable<T_Service_Patient>().Where(i => i.GUID == model.PatientGuid).First();
|
|||
|
if (patient != null && model.CW_120_Is_Trans_Hospital == "1")
|
|||
|
{
|
|||
|
patient.Province = model.Province;
|
|||
|
patient.City = model.City;
|
|||
|
patient.Area = model.Area;
|
|||
|
patient.Area = model.Area;
|
|||
|
patient.IsGreenChannel = 3;
|
|||
|
db.Updateable(patient).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|||
|
}
|
|||
|
}
|
|||
|
T_Service_ChestPain_FirstAIDInfo info = db.Queryable<T_Service_ChestPain_FirstAIDInfo>().Where(i => i.PatientGuid == model.PatientGuid).First();
|
|||
|
return db.Updateable(model).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 查
|
|||
|
/// <summary>
|
|||
|
/// 得到一个对象实体
|
|||
|
/// </summary>
|
|||
|
public T_Service_ChestPain_FirstAIDInfo GetModel(long ID)
|
|||
|
{
|
|||
|
return db.Queryable<T_Service_ChestPain_FirstAIDInfo>().First(it => it.ID == ID);
|
|||
|
}
|
|||
|
|
|||
|
public T_Service_ChestPain_FirstAIDInfo GetModelOfPatient(string guid)
|
|||
|
{
|
|||
|
return db.Queryable<T_Service_ChestPain_FirstAIDInfo>().First(it => it.PatientGuid == guid);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获得前几行数据
|
|||
|
/// </summary>
|
|||
|
/// <param name="pageIndex">起始页</param>
|
|||
|
/// <param name="pageSize">每页条数</param>
|
|||
|
/// <returns></returns>
|
|||
|
public TableModel<T_Service_ChestPain_FirstAIDInfo> GetPageList(int pageIndex, int pageSize)
|
|||
|
{
|
|||
|
int total = 0;
|
|||
|
List<T_Service_ChestPain_FirstAIDInfo> data = db.Queryable<T_Service_ChestPain_FirstAIDInfo>().Where(it => it.DeleteFlag == 0).ToPageList(pageIndex, pageSize, ref total);
|
|||
|
TableModel<T_Service_ChestPain_FirstAIDInfo> t = new TableModel<T_Service_ChestPain_FirstAIDInfo>();
|
|||
|
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_ChestPain_FirstAIDInfo> GetByPatientGuid(string patientGuid)
|
|||
|
{
|
|||
|
TableModel<T_Service_ChestPain_FirstAIDInfo> t = new TableModel<T_Service_ChestPain_FirstAIDInfo>();
|
|||
|
List<T_Service_ChestPain_FirstAIDInfo> listMode = db.Queryable<T_Service_ChestPain_FirstAIDInfo>().Where(it => it.PatientGuid == patientGuid && it.DeleteFlag == 0).ToList();
|
|||
|
|
|||
|
t.Code = 0;
|
|||
|
t.TotalNumber = listMode.Count;
|
|||
|
t.Data = listMode;
|
|||
|
t.Msg = "成功";
|
|||
|
return t;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 查--根据患者编号(GUID) 获取数据信息
|
|||
|
/// 用于移动端
|
|||
|
/// </summary>
|
|||
|
/// <param name="patientGuid">病人编号(GUID)</param>
|
|||
|
/// <returns></returns>
|
|||
|
public TableModel<T_Service_ChestPain_FirstAIDInfo> GetByPatientGuidForApp(string patientGuid)
|
|||
|
{
|
|||
|
TableModel<T_Service_ChestPain_FirstAIDInfo> t = new TableModel<T_Service_ChestPain_FirstAIDInfo>();
|
|||
|
List<T_Service_ChestPain_FirstAIDInfo> listMode = db.Queryable<T_Service_ChestPain_FirstAIDInfo>().Where(it => it.PatientGuid == patientGuid && it.DeleteFlag == 0).ToList();
|
|||
|
|
|||
|
t.Code = 0;
|
|||
|
t.TotalNumber = listMode.Count;
|
|||
|
t.Data = listMode;
|
|||
|
t.Msg = "成功";
|
|||
|
return t;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|