207 lines
11 KiB
C#
207 lines
11 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_EMR_PatientOutcome
|
||
public class T_Service_Apoplexy_PatientOutcomeDB : BaseDB, IT_Service_Apoplexy_PatientOutcome
|
||
{
|
||
public SqlSugarClient db = GetClient();
|
||
|
||
/// <summary>
|
||
/// 增加一条数据
|
||
/// </summary>
|
||
public T_Service_Apoplexy_PatientOutcome Add(T_Service_Apoplexy_PatientOutcome model)
|
||
{
|
||
return db.Insertable(model).ExecuteReturnEntity();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新一条数据
|
||
/// </summary>
|
||
public int Update(T_Service_Apoplexy_PatientOutcome model)
|
||
{
|
||
//脑出血手术数据直报表
|
||
if (model.ReportType == 1)
|
||
{
|
||
return db.Updateable(model).UpdateColumns(it => new { it.GUID, it.PatientGuid, it.CYTime, it.CYLyFs, it.OffHospitalModeText, it.DeathCause2, it.DeathCauseText2, it.CYSwYyOther, it.CYSwSj, it.CYMRSYesNo, it.CYNIHSSYesNo, it.CYDY, it.DischargeWithMedicineText, it.ReportType, it.DeleteFlag, it.EditTime, it.EditorID, it.Editor }).ExecuteCommand();
|
||
}
|
||
//颅内动脉瘤手术数据直报表
|
||
else if (model.ReportType == 2)
|
||
{
|
||
return db.Updateable(model).UpdateColumns(it => new { it.GUID, it.PatientGuid, it.CYTime, it.CYLyFs, it.OffHospitalModeText, it.DeathCause2, it.DeathCauseText2, it.CYSwYyOther, it.CYSwSj, it.CYMRSYesNo, it.CYNIHSSYesNo, it.ZWMPGCYGCSYN, it.CYDY, it.DischargeWithMedicineText, it.ReportType, it.DeleteFlag, it.EditTime, it.EditorID, it.Editor }).ExecuteCommand();
|
||
}
|
||
//CEACAS数据直报表
|
||
else if (model.ReportType == 3)
|
||
{
|
||
return db.Updateable(model).UpdateColumns(it => new { it.GUID, it.PatientGuid, it.CYTime, it.CYLyFs, it.OffHospitalModeText, it.DeathCause2, it.DeathCauseText2, it.CYSwYyOther, it.CYSwSj, it.CYMRSYesNo, it.CYNIHSSYesNo, it.CYDY, it.DischargeWithMedicineText, it.ReportType, it.DeleteFlag, it.EditTime, it.EditorID, it.Editor }).ExecuteCommand();
|
||
}
|
||
//静脉溶栓/血管内介入治疗数据直报表
|
||
else if (model.ReportType == 4)
|
||
{
|
||
return db.Updateable(model).UpdateColumns(it => new { it.GUID, it.PatientGuid, it.CYTime, it.CYLyFs, it.OffHospitalModeText, it.DeathCause2, it.DeathCauseText2, it.CYSwYyOther, it.CYSwSj, it.ReportType, it.DeleteFlag, it.EditTime, it.EditorID, it.Editor }).ExecuteCommand();
|
||
}
|
||
else
|
||
{
|
||
//更新时指定列不更新
|
||
return db.Updateable(model).IgnoreColumns(it => new { it.CreationDate, it.Creator, it.CreatorID }).ExecuteCommand();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除一条数据
|
||
/// </summary>
|
||
public bool Delete(long ID)
|
||
{
|
||
return db.Deleteable<T_Service_Apoplexy_PatientOutcome>(it => it.ID == ID).ExecuteCommand() == 0 ? false : true; ;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获得数据列表
|
||
/// </summary>
|
||
public TableModel<T_Service_Apoplexy_PatientOutcome> GetPageList(int pageIndex, int pageSize)
|
||
{
|
||
int total = 0;
|
||
List<T_Service_Apoplexy_PatientOutcome> data = db.Queryable<T_Service_Apoplexy_PatientOutcome>().Where(it => it.DeleteFlag == 0).ToPageList(pageIndex, pageSize, ref total);
|
||
TableModel<T_Service_Apoplexy_PatientOutcome> t = new TableModel<T_Service_Apoplexy_PatientOutcome>();
|
||
t.Code = 0;
|
||
t.PageCount = data.Count;
|
||
t.TotalNumber = total;
|
||
t.Data = data;
|
||
t.Msg = "成功";
|
||
return t;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获得前几行数据
|
||
/// </summary>
|
||
public T_Service_Apoplexy_PatientOutcome Get(long ID)
|
||
{
|
||
return db.Queryable<T_Service_Apoplexy_PatientOutcome>().First(it => it.ID == ID);
|
||
}
|
||
|
||
|
||
|
||
/// <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_PatientOutcome> GetByPatientGuidAndReportType(string patientGuid, int reportType)
|
||
{
|
||
List<T_Service_Apoplexy_PatientOutcome> data = db.Queryable<T_Service_Apoplexy_PatientOutcome>().Where(it => it.PatientGuid == patientGuid && it.ReportType == reportType && it.DeleteFlag == 0).ToList();
|
||
TableModel<T_Service_Apoplexy_PatientOutcome> t = new TableModel<T_Service_Apoplexy_PatientOutcome>();
|
||
t.Code = 0;
|
||
t.PageCount = data.Count;
|
||
t.TotalNumber = data.Count;
|
||
t.TotalNumber = data.Count;
|
||
t.Data = data;
|
||
t.Msg = "成功";
|
||
return t;
|
||
}
|
||
public TableModel<T_Service_Apoplexy_PatientOutcome> GetModelByReport(string table, string where)
|
||
{
|
||
string sql = "select * from T_Service_EMR_PatientOutcome a " + table + " where a.DeleteFlag= 0 and DeadOrNot = 0 and DeathCause!=1 " + where + "";
|
||
List<T_Service_Apoplexy_PatientOutcome> data = db.Ado.SqlQuery<T_Service_Apoplexy_PatientOutcome>(sql);
|
||
TableModel<T_Service_Apoplexy_PatientOutcome> t = new TableModel<T_Service_Apoplexy_PatientOutcome>();
|
||
t.Code = 0;
|
||
t.PageCount = data.Count;
|
||
t.TotalNumber = data.Count;
|
||
t.Data = data;
|
||
t.Msg = "成功";
|
||
return t;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 患者转归信息
|
||
/// 1.健康教育 2.TOAST 3.康复治疗 4.出院情况 5.出院评估
|
||
/// </summary>
|
||
/// <param name="patientGuid"></param>
|
||
/// <returns></returns>
|
||
public PatientTurnOverModel GetPatientTurnOverInfo(string patientGuid)
|
||
{
|
||
PatientTurnOverModel model = new PatientTurnOverModel();
|
||
|
||
model = db.Queryable<T_Service_Patient, T_Service_Apoplexy_JKJY, T_Service_Apoplexy_KFZL, T_Service_Apoplexy_PatientOutcome>((a, b, c, d) => new JoinQueryInfos(JoinType.Left, a.GUID == b.PatientGuid,
|
||
JoinType.Left, a.GUID == c.PatientGuid,
|
||
JoinType.Left, a.GUID == d.PatientGuid))
|
||
.Where((a, b, c, d) => d.PatientGuid == patientGuid && a.DeleteFlag == 0)
|
||
.Select((a, b, c, d) => new PatientTurnOverModel()
|
||
{
|
||
PatientGuid = a.GUID,
|
||
acZLType = a.acZLType,
|
||
AuditStatus = a.AuditStatus,
|
||
JYEduYN = b.JYEduYN,
|
||
JYEduWays = b.JYEduWays,
|
||
KFZLYN = c.KFZLYN,
|
||
KFWays = c.KFWays,
|
||
KFPlace = c.KFPlace,
|
||
CYTime = d.CYTime,
|
||
CYLyFs = d.CYLyFs,
|
||
CYSwSj = d.CYSwSj,
|
||
CYDY = d.CYDY,
|
||
CYSwYyOther = d.CYSwYyOther,
|
||
CYSwYy = d.CYSwYy,
|
||
CYMRSYesNo = d.CYMRSYesNo,
|
||
CYMRS = d.CYMRS,
|
||
CYNIHSSYesNo = d.CYNIHSSYesNo,
|
||
CYNIHSS = d.CYNIHSS,
|
||
ZWMPGCYGCSYN = d.ZWMPGCYGCSYN,
|
||
ZWMPGCYGCS = d.ZWMPGCYGCS,
|
||
Diagnosis = d.Diagnosis,
|
||
RelatedDiagnosis = d.RelatedDiagnosis,
|
||
Remark = d.Remark,
|
||
HospitalDay = d.HospitalDay,
|
||
AllInCost = d.AllInCost,
|
||
MainDiagnosticName = d.MainDiagnosticName,
|
||
MainDiagnosticCode = d.MainDiagnosticCode,
|
||
OtherDiagnosticName1 = d.OtherDiagnosticName1,
|
||
OtherDiagnosticCode1 = d.OtherDiagnosticCode1,
|
||
OtherDiagnosticName2 = d.OtherDiagnosticName2,
|
||
OtherDiagnosticCode2 = d.OtherDiagnosticCode2,
|
||
OtherDiagnosticName3 = d.OtherDiagnosticName3,
|
||
OtherDiagnosticCode3 = d.OtherDiagnosticCode3,
|
||
OtherDiagnosticName4 = d.OtherDiagnosticName4,
|
||
OtherDiagnosticCode4 = d.OtherDiagnosticCode4,
|
||
OtherDiagnosticName5 = d.OtherDiagnosticName5,
|
||
OtherDiagnosticCode5 = d.OtherDiagnosticCode5,
|
||
OtherDiagnosticName6 = d.OtherDiagnosticName6,
|
||
OtherDiagnosticCode6 = d.OtherDiagnosticCode6,
|
||
OtherDiagnosticName7 = d.OtherDiagnosticName7,
|
||
OtherDiagnosticCode7 = d.OtherDiagnosticCode7,
|
||
OtherDiagnosticName8 = d.OtherDiagnosticName8,
|
||
OtherDiagnosticCode8 = d.OtherDiagnosticCode8,
|
||
OtherDiagnosticName9 = d.OtherDiagnosticName9,
|
||
OtherDiagnosticCode9 = d.OtherDiagnosticCode9,
|
||
OtherDiagnosticName10 = d.OtherDiagnosticName10,
|
||
OtherDiagnosticCode10 = d.OtherDiagnosticCode10,
|
||
OtherDiagnosticName11 = d.OtherDiagnosticName11,
|
||
OtherDiagnosticCode11 = d.OtherDiagnosticCode11,
|
||
OtherDiagnosticName12 = d.OtherDiagnosticName12,
|
||
OtherDiagnosticCode12 = d.OtherDiagnosticCode12,
|
||
OtherDiagnosticName13 = d.OtherDiagnosticName13,
|
||
OtherDiagnosticCode13 = d.OtherDiagnosticCode13,
|
||
OtherDiagnosticName14 = d.OtherDiagnosticName14,
|
||
OtherDiagnosticCode14 = d.OtherDiagnosticCode14,
|
||
OtherDiagnosticName15 = d.OtherDiagnosticName15,
|
||
OtherDiagnosticCode15 = d.OtherDiagnosticCode15,
|
||
DiagnosisTime=d.DiagnosisTime,
|
||
TreatmentEffect=d.TreatmentEffect,
|
||
Comorbidities=d.Comorbidities,
|
||
DVT=d.DVT,
|
||
DischargeDepartment=d.DischargeDepartment,
|
||
DischargeDoctor=d.DischargeDoctor,
|
||
HospitalizationTime=a.HospitalizationTime
|
||
}).First();
|
||
return model;
|
||
}
|
||
|
||
public T_Service_Apoplexy_PatientOutcome GetByPatientGuid(string patientGuid)
|
||
{
|
||
return db.Queryable<T_Service_Apoplexy_PatientOutcome>().First(it => it.PatientGuid == patientGuid && it.DeleteFlag == 0);
|
||
}
|
||
}
|
||
} |