using HL_FristAidPlatform_Help; using HL_FristAidPlatform_IDataBase; using HL_FristAidPlatform_Models; using SqlSugar; using System.Collections.Generic; namespace HL_FristAidPlatform_DataBase { /// /// 院前部分信息表 /// public class T_Service_Apoplexy_PrehospitalDB : BaseDB, IT_Service_Apoplexy_Prehospital { public SqlSugarClient db = GetClient(); /// /// 增加一条数据 /// public T_Service_Apoplexy_Prehospital Add(T_Service_Apoplexy_Prehospital model) { return db.Insertable(model).ExecuteReturnEntity(); } /// /// 更新一条数据 /// 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(); } /// /// 增加一条数据 /// public T_Service_Apoplexy_EmergencyRoom Add(T_Service_Apoplexy_EmergencyRoom model) { return db.Insertable(model).ExecuteReturnEntity(); } /// /// 更新一条数据 /// public int Update(T_Service_Apoplexy_EmergencyRoom model) { return db.Updateable(model).UpdateColumns(it => new { it.Diagnose, it.Remark }).ExecuteCommand(); } /// /// 仅更新赋值的字段 /// /// 实体类 /// public int UpdateNotNullColumns(T_Service_Apoplexy_Prehospital model) { return db.Updateable(model).Where(it => it.PatientGuid == model.PatientGuid).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); } /// /// 删除一条数据 /// public bool Delete(long ID) { return db.Deleteable(it => it.ID == ID).ExecuteCommand() == 0 ? false : true; ; } /// /// 获得数据列表 /// public TableModel GetPageList(int pageIndex, int pageSize) { int total = 0; List data = db.Queryable().Where(it => it.DeleteFlag == 0).ToPageList(pageIndex, pageSize, ref total); TableModel t = new TableModel(); t.Code = 0; t.PageCount = data.Count; t.TotalNumber = total; t.Data = data; t.Msg = "成功"; return t; } /// /// 获得前几行数据 /// public T_Service_Apoplexy_Prehospital Get(long ID) { return db.Queryable().First(it => it.ID == ID); } /// /// 根据患者GUID查询既往病史及检查信息 /// /// /// public T_Service_Apoplexy_EmergencyRoom GetEmergencyRoomByPatient(string guid) { return db.Queryable().First(it => it.PatientGuid == guid); } /// /// 根据患者GUID查询院前信息 /// /// /// public T_Service_Apoplexy_Prehospital GetOfPatient(string guid) { return db.Queryable().First(it => it.PatientGuid == guid); } /// /// 根据患者编号(GUID)+所属报表类型 获取数据信息 /// /// 病人编号(GUID) /// 所属报表类型0:公用;1:脑出血手术数据直报表;2:颅内动脉瘤手术数据直报表;3:CEACAS数据直报表;4:静脉溶栓血管内介入治疗数据直报表;9:卒中联盟数据报表 /// public TableModel GetByPatientGuidAndReportType(string patientGuid) { TableModel t = new TableModel(); var listMode = db.Queryable((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().First(it => it.PatientGuid == guid); } } }