120 lines
4.9 KiB
C#
120 lines
4.9 KiB
C#
|
using HL_FristAidPlatform_Help;
|
|||
|
using HL_FristAidPlatform_IDataBase;
|
|||
|
using HL_FristAidPlatform_Models;
|
|||
|
using SqlSugar;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
namespace HL_FristAidPlatform_DataBase
|
|||
|
{
|
|||
|
//T_Service_Apoplexy_RSZL 静脉溶栓
|
|||
|
public class T_Service_Apoplexy_RSZLDB : BaseDB, IT_Service_Apoplexy_RSZL
|
|||
|
{
|
|||
|
public SqlSugarClient db = GetClient();
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 增加一条数据
|
|||
|
/// </summary>
|
|||
|
/// <param name="model"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public T_Service_Apoplexy_RSZL Add(T_Service_Apoplexy_RSZL model)
|
|||
|
{
|
|||
|
return db.Insertable(model).ExecuteReturnEntity();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 更新一条数据
|
|||
|
/// </summary>
|
|||
|
public int Update(T_Service_Apoplexy_RSZL model)
|
|||
|
{
|
|||
|
return db.Updateable(model).Where(it => it.PatientGuid == model.PatientGuid).ExecuteCommand();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 删除一条数据
|
|||
|
/// </summary>
|
|||
|
public bool Delete(long ID)
|
|||
|
{
|
|||
|
return db.Deleteable<T_Service_Apoplexy_RSZL>(it => it.ID == ID).ExecuteCommand() == 0 ? false : true; ;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获得前几行数据
|
|||
|
/// </summary>
|
|||
|
public T_Service_Apoplexy_RSZL Get(string PatientGuid)
|
|||
|
{
|
|||
|
return db.Queryable<T_Service_Apoplexy_RSZL>().First(it => it.PatientGuid == PatientGuid);
|
|||
|
}
|
|||
|
|
|||
|
public T_Service_Apoplexy_RSZL GetByPatientGuid(string PatientGuid)
|
|||
|
{
|
|||
|
return db.Queryable<T_Service_Apoplexy_RSZL>().First(it => it.PatientGuid == PatientGuid);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 根据患者GUID获取患者溶栓治疗信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="PatientGuid"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public RSZLModel GetRSZLByPatientGuid(string PatientGuid)
|
|||
|
{
|
|||
|
RSZLModel model = new RSZLModel();
|
|||
|
var oneClass = db.Queryable<T_Service_Apoplexy_RSZL>().First(it => it.PatientGuid == PatientGuid);
|
|||
|
if (oneClass != null)
|
|||
|
{
|
|||
|
System.Reflection.PropertyInfo[] cfgItemProperties = oneClass.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
|
|||
|
|
|||
|
foreach (System.Reflection.PropertyInfo item in cfgItemProperties)
|
|||
|
{
|
|||
|
string name = item.Name;
|
|||
|
object value = item.GetValue(oneClass, null);
|
|||
|
//string 或 值属性,且value 不为 null
|
|||
|
if ((item.PropertyType.IsValueType || item.PropertyType.Name.StartsWith("String")) && value != null && !string.IsNullOrEmpty(value.ToString()))
|
|||
|
{
|
|||
|
#region
|
|||
|
System.Reflection.PropertyInfo[] list2 = model.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
|
|||
|
foreach (System.Reflection.PropertyInfo i2 in list2)
|
|||
|
{
|
|||
|
//两者 PropertyType.Name 要相等
|
|||
|
if (item.Name == i2.Name && item.PropertyType.Name == i2.PropertyType.Name)
|
|||
|
{
|
|||
|
i2.SetValue(model, value, null);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
model.InformedConsent = oneClass.InformedConsent;
|
|||
|
model.ThrombolysisDoctorImageFiles = oneClass.ThrombolysisDoctorImageFiles;
|
|||
|
}
|
|||
|
var twoClass = db.Queryable<T_Service_Patient>().Where(i => i.GUID == PatientGuid && i.DeleteFlag == 0).Select(i => new { i.TimeOfOnset, i.ArrivalHospitalTime }).First();
|
|||
|
if (twoClass != null)
|
|||
|
{
|
|||
|
model.TimeOfOnset = twoClass.TimeOfOnset;
|
|||
|
model.ArrivalHospitalTime = twoClass.ArrivalHospitalTime;
|
|||
|
}
|
|||
|
var threeClass = db.Queryable<T_Service_Apoplexy_EmergencyRoom>().Where(i => i.PatientGuid == PatientGuid && i.DeleteFlag == 0).Select(i => new { i.CTExaminationCompletionTime }).First();
|
|||
|
if (threeClass != null)
|
|||
|
model.CTExaminationCompletionTime = threeClass.CTExaminationCompletionTime;
|
|||
|
|
|||
|
return model;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获得数据列表
|
|||
|
/// </summary>
|
|||
|
public TableModel<T_Service_Apoplexy_RSZL> GetPageList(int pageIndex, int pageSize)
|
|||
|
{
|
|||
|
int total = 0;
|
|||
|
List<T_Service_Apoplexy_RSZL> data = db.Queryable<T_Service_Apoplexy_RSZL>().Where(it => it.DeleteFlag == 0).ToPageList(pageIndex, pageSize, ref total);
|
|||
|
TableModel<T_Service_Apoplexy_RSZL> t = new TableModel<T_Service_Apoplexy_RSZL>();
|
|||
|
t.Code = 0;
|
|||
|
t.PageCount = data.Count;
|
|||
|
t.TotalNumber = total;
|
|||
|
t.Data = data;
|
|||
|
t.Msg = "成功";
|
|||
|
return t;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|