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_ChestPain_FirstMedicalReceptionDB : BaseDB, IT_Service_ChestPain_FirstMedicalReception { public SqlSugarClient db = GetClient(); /// /// 增加一条数据 /// public T_Service_ChestPain_FirstMedicalReception Add(T_Service_ChestPain_FirstMedicalReception model) { return db.Insertable(model).ExecuteReturnEntity(); } /// /// 更新一条数据 /// public bool Update(T_Service_ChestPain_FirstMedicalReception model) { return db.Updateable(model).ExecuteCommand() == 0 ? false : true; } /// /// 只更新指定字段 /// 更新肌钙蛋白cTnI值 患者编号+cTnI值 /// /// /// public int UpdateCTnI(T_Service_ChestPain_FirstMedicalReception model) { return db.Updateable(model).UpdateColumns(it => new { it.CTnI_Value, it.CTnI_Unit, it.CTnI_Status }).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_ChestPain_FirstMedicalReception Get(long ID) { return db.Queryable().First(it => it.ID == ID); } /// /// 根据患者编号(GUID) 获取数据信息 /// /// 病人编号(GUID) /// public TableModel GetByPatientGuid(string patientGuid) { TableModel t = new TableModel(); var listMode = db.Queryable().Where(it => it.PatientGuid == patientGuid && it.DeleteFlag == 0) .Select(it => new T_Service_ChestPain_FirstMedicalReception { ID = it.ID, GUID = it.GUID, PatientGuid = it.PatientGuid, First_Organization = it.First_Organization, First_Organization_Name = it.First_Organization_Name, First_Doctor_Name = it.First_Doctor_Name, First_Organization_Time = it.First_Organization_Time, OutHospital_ECG_Time = it.OutHospital_ECG_Time, InHospital_ECG_Time = it.InHospital_ECG_Time, ECG_Diagnose_Time = it.ECG_Diagnose_Time, Is_Remote_Ecgtran = it.Is_Remote_Ecgtran, Remote_Ecgtran_Time = it.Remote_Ecgtran_Time, Remote_Ecgtran_Type = it.Remote_Ecgtran_Type, Be_Conscious_Of = it.Be_Conscious_Of, Breathe = it.Breathe, Pulse = it.Pulse, Heart_Rate = it.Heart_Rate, Blood_Pressure = it.Blood_Pressure, Killip_Level = it.Killip_Level, Troponin_Sampling_Time = it.Troponin_Sampling_Time, Troponin_Report_Time = it.Troponin_Report_Time, CTnI_Value = it.CTnI_Value, CTnI_Unit = it.CTnI_Unit, CTnI_Status = it.CTnI_Status, CTnT_Value = it.CTnT_Value, CTnT_Unit = it.CTnT_Unit, CTnT_Status = it.CTnT_Status, Cr_Value = it.Cr_Value, Cr_Unit = it.Cr_Unit, Acs_Delivery_Time = it.Acs_Delivery_Time, Aspirin_Dose = it.Aspirin_Dose, Aspirin_Dose_Type = it.Aspirin_Dose_Type, Acs_Drug_Dose = it.Acs_Drug_Dose, Is_Anticoagulation = it.Is_Anticoagulation, Anticoagulation_Time = it.Anticoagulation_Time, Anticoagulation_Drug = it.Anticoagulation_Drug, Anticoagulation_Unit = it.Anticoagulation_Unit, Is_Thrombolytic_Screening = it.Is_Thrombolytic_Screening, Is_Thrombolytic_Therapy = it.Is_Thrombolytic_Therapy, Is_Direct = it.Is_Direct, Thrombolytic_Site = it.Thrombolytic_Site, Start_Agree_Time = it.Start_Agree_Time, Sign_Agree_Time = it.Sign_Agree_Time, Throm_Start_Time = it.Throm_Start_Time, Throm_End_Time = it.Throm_End_Time, Start_Radiography_Time = it.Start_Radiography_Time, Throm_Drug_Type = it.Throm_Drug_Type, Throm_Drug_Code = it.Throm_Drug_Code, Is_Repatency = it.Is_Repatency, Grace_Code = it.Grace_Code, Grace_CodeText = it.Grace_CodeText, Is_Arrest = it.Is_Arrest, Is_Change = it.Is_Change, Is_Rise = it.Is_Rise, Grace_Value = it.Grace_Value, Risk_Lamination = it.Risk_Lamination, DeleteFlag = it.DeleteFlag, CreationDate = it.CreationDate, CreatorID = it.CreatorID, Creator = it.Creator, EditTime = it.EditTime, EditorID = it.EditorID, Editor = it.Editor, }).OrderBy(it => it.ID, OrderByType.Desc).ToList(); t.Code = 0; t.TotalNumber = listMode.Count; t.Data = listMode; t.Msg = "成功"; return t; } /// /// 根据where条件查询列表 /// /// /// public TableModel GetModelByReport(string where) { string sql = "select a.Name,a.CreationDate,b.Is_Remote_Ecgtran from T_Service_Patient a join T_Service_ChestPain_FirstMedicalReception b on a.GUID=b.PatientGuid WHERE a.DeleteFlag = 0 and " + where + ""; List data = db.Ado.SqlQuery(sql); TableModel t = new TableModel(); t.Code = 0; t.PageCount = data.Count; t.TotalNumber = data.Count; t.Data = data; t.Msg = "成功"; return t; } } }