267 lines
12 KiB
C#
267 lines
12 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_PrehospitalDB : BaseDB, IT_Service_Apoplexy_Prehospital
|
||
{
|
||
public SqlSugarClient db = GetClient();
|
||
|
||
/// <summary>
|
||
/// 增加一条数据
|
||
/// </summary>
|
||
public T_Service_Apoplexy_Prehospital Add(T_Service_Apoplexy_Prehospital model)
|
||
{
|
||
return db.Insertable(model).ExecuteReturnEntity();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新一条数据
|
||
/// </summary>
|
||
public int Update(T_Service_Apoplexy_Prehospital model)
|
||
{
|
||
////脑出血手术数据直报表
|
||
//if (model.ReportType == 1)
|
||
//{
|
||
// return db.Updateable(model).UpdateColumns(it => new { it.GUID, it.PatientGuid, it.BCRyType, it.BCLyType, it.IsNetworkCollaboration, it.NGSJZZyCz, it.HEHeight, it.HEWeight, it.HEBMI, it.HESsy, it.HESzy, it.HeartRate, it.RYMRSYN, it.Glasgow, it.ZWMPGNaoShanYN, it.RYTunYanYN, it.RYTunYan, it.ReportType, it.PeopleImageFiles,it.ADoctorImageFiles, it.DeleteFlag }).ExecuteCommand();
|
||
//}
|
||
////颅内动脉瘤手术数据直报表
|
||
//else if (model.ReportType == 2)
|
||
//{
|
||
// return db.Updateable(model).UpdateColumns(it => new { it.GUID, it.PatientGuid, it.BCRyType, it.BCLyType, it.IsNetworkCollaboration, it.HeartRate, it.HEHeight, it.HEWeight, it.HEBMI, it.HESsy, it.HESzy, it.DMLLCType, it.AneurysmsClassText, it.DMLPastYN, it.RYMRSYN, it.RYNIHSSYN, it.Glasgow, it.DMLHessYN, it.ZWMPGFisherYN, it.ZWMPGNaoShanYN, it.ReportType, it.PeopleImageFiles, it.ADoctorImageFiles, it.DeleteFlag }).ExecuteCommand();
|
||
//}
|
||
////CEACAS数据直报表
|
||
//else if (model.ReportType == 3)
|
||
//{
|
||
// return db.Updateable(model).UpdateColumns(it => new { it.GUID, it.PatientGuid, it.BCRyType, it.BCLyType, it.IsNetworkCollaboration, it.HeartRate, it.HEHeight, it.HEWeight, it.HEBMI, it.HESsy, it.HESzy, it.RYMRSYN, it.RYNIHSSYN, it.ZWMPGNaoShanYN, it.RYTunYanYN, it.RYTunYan, it.IsSymptom, it.YXJbXgChecx, it.CervicalVascularExaminationText, it.IsStenosisSite, it.PeopleImageFiles, it.ADoctorImageFiles, it.ReportType, it.DeleteFlag }).ExecuteCommand();
|
||
//}
|
||
////静脉溶栓/血管内介入治疗数据直报表
|
||
//else if (model.ReportType == 4)
|
||
//{
|
||
// return db.Updateable(model).UpdateColumns(it => new { it.GUID, it.PatientGuid, it.BCRyType, it.BCLyType, it.IsNetworkCollaboration, it.HeartRate, it.HEHeight, it.HEWeight, it.HEBMI, it.HESsy, it.HESzy, it.RYMRSYN, it.Glasgow, it.PeopleImageFiles, it.ADoctorImageFiles, it.RYTunYanYN, it.RYTunYan, it.ReportType, it.DeleteFlag }).ExecuteCommand();
|
||
//}
|
||
//else
|
||
//{
|
||
return db.Updateable(model).IgnoreColumns(it => new { it.ID }).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
||
//}
|
||
}
|
||
|
||
public int UpdateForScreen(T_Service_Apoplexy_Prehospital model)
|
||
{
|
||
return db.Updateable(model).IgnoreColumns(it => new { it.ID }).IgnoreColumns(ignoreAllNullColumns: true).Where(i => i.PatientGuid == model.PatientGuid).ExecuteCommand();
|
||
}
|
||
/// <summary>
|
||
/// 增加一条数据
|
||
/// </summary>
|
||
public T_Service_Apoplexy_EmergencyRoom Add(T_Service_Apoplexy_EmergencyRoom model)
|
||
{
|
||
return db.Insertable(model).ExecuteReturnEntity();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新一条数据
|
||
/// </summary>
|
||
public int Update(T_Service_Apoplexy_EmergencyRoom model)
|
||
{
|
||
return db.Updateable(model).UpdateColumns(it => new { it.Diagnose, it.Remark }).ExecuteCommand();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 仅更新赋值的字段
|
||
/// </summary>
|
||
/// <param name="model">实体类</param>
|
||
/// <returns></returns>
|
||
public int UpdateNotNullColumns(T_Service_Apoplexy_Prehospital model)
|
||
{
|
||
return db.Updateable(model).Where(it => it.PatientGuid == model.PatientGuid).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除一条数据
|
||
/// </summary>
|
||
public bool Delete(long ID)
|
||
{
|
||
return db.Deleteable<T_Service_Apoplexy_Prehospital>(it => it.ID == ID).ExecuteCommand() == 0 ? false : true; ;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获得数据列表
|
||
/// </summary>
|
||
public TableModel<T_Service_Apoplexy_Prehospital> GetPageList(int pageIndex, int pageSize)
|
||
{
|
||
int total = 0;
|
||
List<T_Service_Apoplexy_Prehospital> data = db.Queryable<T_Service_Apoplexy_Prehospital>().Where(it => it.DeleteFlag == 0).ToPageList(pageIndex, pageSize, ref total);
|
||
TableModel<T_Service_Apoplexy_Prehospital> t = new TableModel<T_Service_Apoplexy_Prehospital>();
|
||
t.Code = 0;
|
||
t.PageCount = data.Count;
|
||
t.TotalNumber = total;
|
||
t.Data = data;
|
||
t.Msg = "成功";
|
||
return t;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获得前几行数据
|
||
/// </summary>
|
||
public T_Service_Apoplexy_Prehospital Get(long ID)
|
||
{
|
||
return db.Queryable<T_Service_Apoplexy_Prehospital>().First(it => it.ID == ID);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据患者GUID查询既往病史及检查信息
|
||
/// </summary>
|
||
/// <param name="guid"></param>
|
||
/// <returns></returns>
|
||
public T_Service_Apoplexy_EmergencyRoom GetEmergencyRoomByPatient(string guid)
|
||
{
|
||
return db.Queryable<T_Service_Apoplexy_EmergencyRoom>().First(it => it.PatientGuid == guid);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据患者GUID查询院前信息
|
||
/// </summary>
|
||
/// <param name="guid"></param>
|
||
/// <returns></returns>
|
||
public T_Service_Apoplexy_Prehospital GetOfPatient(string guid)
|
||
{
|
||
return db.Queryable<T_Service_Apoplexy_Prehospital>().First(it => it.PatientGuid == guid);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据患者编号(GUID)+所属报表类型 获取数据信息
|
||
/// </summary>
|
||
/// <param name="patientGuid">病人编号(GUID)</param>
|
||
/// <param name="reportType">所属报表类型0:公用;1:脑出血手术数据直报表;2:颅内动脉瘤手术数据直报表;3:CEACAS数据直报表;4:静脉溶栓血管内介入治疗数据直报表;9:卒中联盟数据报表</param>
|
||
/// <returns></returns>
|
||
public TableModel<T_Service_Apoplexy_PrehospitalModel> GetByPatientGuidAndReportType(string patientGuid)
|
||
{
|
||
TableModel<T_Service_Apoplexy_PrehospitalModel> t = new TableModel<T_Service_Apoplexy_PrehospitalModel>();
|
||
|
||
var listMode = db.Queryable<T_Service_Apoplexy_Prehospital, T_Service_Apoplexy_EmergencyRoom>((it, a) => new JoinQueryInfos(JoinType.Left, it.PatientGuid == a.PatientGuid))
|
||
.Where((it, a) => it.PatientGuid == patientGuid && it.DeleteFlag == 0)
|
||
.Select((it, a) => new T_Service_Apoplexy_PrehospitalModel
|
||
{
|
||
ID = it.ID,
|
||
GUID = it.GUID,
|
||
PatientGuid = it.PatientGuid,
|
||
DiseaseRecord = it.DiseaseRecord,
|
||
TimeOfOnset = it.TimeOfOnset,
|
||
OnsetTimeInterval = it.OnsetTimeInterval,
|
||
IsCallHelp = it.IsCallHelp,
|
||
CallHelpWay = it.CallHelpWay,
|
||
BCRyType = it.BCRyType,
|
||
BCLyType = it.BCLyType,
|
||
IsNetworkCollaboration = it.IsNetworkCollaboration,
|
||
NGSJZZyCz = it.NGSJZZyCz,
|
||
WakeApoplexy = it.WakeApoplexy,
|
||
BCWyzyType = it.BCWyzyType,
|
||
AttendingDoctor = it.AttendingDoctor,
|
||
Nurse = it.Nurse,
|
||
FirstDoctorName = it.FirstDoctorName,
|
||
Breathing = it.Breathing,
|
||
HeartRate = it.HeartRate,
|
||
HEHeight = it.HEHeight,
|
||
HEWeight = it.HEWeight,
|
||
HEBMI = it.HEBMI,
|
||
HESsy = it.HESsy,
|
||
HESzy = it.HESzy,
|
||
//Temperature = it.Temperature,
|
||
//BloodSugar = it.BloodSugar,
|
||
//SPOZ = it.SPOZ,
|
||
DMLLCType = it.DMLLCType,
|
||
AneurysmsClassText = it.AneurysmsClassText,
|
||
DMLPastYN = it.DMLPastYN,
|
||
RYMRSYN = it.RYMRSYN,
|
||
Glasgow = it.Glasgow,
|
||
RYNIHSSYN = it.RYNIHSSYN,
|
||
DMLHessYN = it.DMLHessYN,
|
||
ZWMPGFisherYN = it.ZWMPGFisherYN,
|
||
CPSS = it.CPSS,
|
||
ZWMPGNaoShanYN = it.ZWMPGNaoShanYN,
|
||
RYTunYanYN = it.RYTunYanYN,
|
||
RYTunYan = it.RYTunYan,
|
||
IsSymptom = it.IsSymptom,
|
||
YXJbXgCheck = it.YXJbXgCheck,
|
||
CervicalVascularExaminationText = it.CervicalVascularExaminationText,
|
||
IsStenosisSite = it.IsStenosisSite,
|
||
Hypertension = it.Hypertension,
|
||
Diabetes = it.Diabetes,
|
||
Smoke = it.Smoke,
|
||
DrinkWine = it.DrinkWine,
|
||
Hyperlipidemia = it.Hyperlipidemia,
|
||
CoronaryHeartDisease = it.CoronaryHeartDisease,
|
||
AtrialFibrillation = it.AtrialFibrillation,
|
||
Gastrohelcoma = it.Gastrohelcoma,
|
||
HemorrhagicDisorders = it.HemorrhagicDisorders,
|
||
Tumour = it.Tumour,
|
||
Aneurysm = it.Aneurysm,
|
||
ArteryDissection = it.ArteryDissection,
|
||
Anticoagulation = it.Anticoagulation,
|
||
PlateletAaggregation = it.PlateletAaggregation,
|
||
PrimaryDiagnosis = it.PrimaryDiagnosis,
|
||
AllergicHistory = it.AllergicHistory,
|
||
Nimodipine = it.Nimodipine,
|
||
//ReportType = it.ReportType,
|
||
DeleteFlag = it.DeleteFlag,
|
||
PeopleImageFiles = it.PeopleImageFiles,
|
||
ADoctorImageFiles = it.ADoctorImageFiles,
|
||
HEBPulse = it.HEBPulse,
|
||
NGSJZDaoYuanTime = it.NGSJZDaoYuanTime,
|
||
NCXJZFBSJ = it.NCXJZFBSJ,
|
||
RYMRS = it.RYMRS,
|
||
YXXzCheck = it.YXXzCheck,
|
||
YXXzLJz = it.YXXzLJz,
|
||
YXXzLQb = it.YXXzLQb,
|
||
YXXzLJn = it.YXXzLJn,
|
||
YXXzRJz = it.YXXzRJz,
|
||
YXXzRQb = it.YXXzRQb,
|
||
YXXzRJn = it.YXXzRJn,
|
||
NGSJZFaBingTime = it.NGSJZFaBingTime,
|
||
NCXJZZyCz = it.NCXJZZyCz,
|
||
NCXJZFaBingTime = it.NCXJZFaBingTime,
|
||
NCXJZDaoYuanTime = it.NCXJZDaoYuanTime,
|
||
CEAZz = it.CEAZz,
|
||
ZWMPGNimodipineYN = it.ZWMPGNimodipineYN,
|
||
ZWMPGFisher = it.ZWMPGFisher,
|
||
DMLHess = it.DMLHess,
|
||
RYNIHSS = it.RYNIHSS,
|
||
ZWMPGGCSYN = it.ZWMPGGCSYN,
|
||
ZWMPGGCS = it.ZWMPGGCS,
|
||
Temperature = it.Temperature,
|
||
BloodSugar = it.BloodSugar,
|
||
SPOZ = it.SPOZ,
|
||
NGSJZFBSJ = it.NGSJZFBSJ,
|
||
Diagnose = a.Diagnose,
|
||
Remark = a.Remark,
|
||
ArrivalEmergencyDepartmentTime = it.ArrivalEmergencyDepartmentTime,
|
||
DoctorVisitTime = it.DoctorVisitTime,
|
||
PhysicalExamination = it.PhysicalExamination,
|
||
DiagnoseTime = it.DiagnoseTime,
|
||
EmergencyDoctor = it.EmergencyDoctor,
|
||
OnsetToDiagnosisTime = it.OnsetToDiagnosisTime,
|
||
EmergencyTreatment = it.EmergencyTreatment,
|
||
ArteryStenosis = it.ArteryStenosis,
|
||
VascularOcclusion = it.VascularOcclusion,
|
||
StrokeDoctor = it.StrokeDoctor,
|
||
PhysicalTime = it.PhysicalTime
|
||
}).OrderBy(it => it.ID, OrderByType.Desc).ToList();
|
||
|
||
t.Code = 0;
|
||
t.TotalNumber = listMode.Count;
|
||
t.Data = listMode;
|
||
t.Msg = "成功";
|
||
return t;
|
||
}
|
||
|
||
public T_Service_Apoplexy_Prehospital GetByPatientGuid(string guid)
|
||
{
|
||
return db.Queryable<T_Service_Apoplexy_Prehospital>().First(it => it.PatientGuid == guid);
|
||
}
|
||
}
|
||
} |