86 lines
3.7 KiB
C#
86 lines
3.7 KiB
C#
using HL_FristAidPlatform_Help;
|
||
using HL_FristAidPlatform_IDataBase;
|
||
using HL_FristAidPlatform_Models;
|
||
using SqlSugar;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
|
||
namespace HL_FristAidPlatform_DataBase
|
||
{
|
||
public class T_Service_Apoplexy_NCXZYJCDB : BaseDB, IT_Service_Apoplexy_NCXZYJC
|
||
{
|
||
public SqlSugarClient db = GetClient();
|
||
public bool Add(T_Service_Apoplexy_NCXZYJC model)
|
||
{
|
||
if (string.IsNullOrEmpty(model.GUID))
|
||
{
|
||
model.GUID = Guid.NewGuid().ToString();
|
||
}
|
||
return db.Insertable(model).ExecuteCommand() == 0 ? false : true;
|
||
}
|
||
|
||
public bool Delete(int ID)
|
||
{
|
||
return db.Deleteable<T_Service_Apoplexy_NCXZYJC>(it => it.ID == ID).ExecuteCommand() == 0 ? false : true; ;
|
||
}
|
||
|
||
public T_Service_Apoplexy_NCXZYJC Get(long ID)
|
||
{
|
||
return db.Queryable<T_Service_Apoplexy_NCXZYJC>().First(it => it.ID == ID);
|
||
}
|
||
|
||
public T_Service_Apoplexy_NCXZYJC Getbypatientguid(string guid)
|
||
{
|
||
return db.Queryable<T_Service_Apoplexy_NCXZYJC>().First(it => it.PatientGuid == guid);
|
||
}
|
||
|
||
public TableModel<T_Service_Apoplexy_NCXZYJC> GetPageList(int pageIndex, int pageSize)
|
||
{
|
||
int total = 0;
|
||
List<T_Service_Apoplexy_NCXZYJC> data = db.Queryable<T_Service_Apoplexy_NCXZYJC>().Where(it => it.DeleteFlag == 0).ToPageList(pageIndex, pageSize, ref total);
|
||
TableModel<T_Service_Apoplexy_NCXZYJC> t = new TableModel<T_Service_Apoplexy_NCXZYJC>();
|
||
t.Code = 0;
|
||
t.PageCount = data.Count;
|
||
t.TotalNumber = total;
|
||
t.Data = data;
|
||
t.Msg = "成功";
|
||
return t;
|
||
}
|
||
|
||
public int Update(T_Service_Apoplexy_NCXZYJC model)
|
||
{
|
||
//脑出血手术数据直报表
|
||
//if (model.ReportType == 1)
|
||
//{
|
||
// return db.Updateable(model).UpdateColumns(it => new { it.GUID, it.PatientGuid, it.NCXLSite, it.BleedingPartLeftText, it.NCXRSite, it.BleedingPartRightText, it.NCXArea, it.YXLNXGCheck, it.IntracranialVesselsText, it.NCXCause, it.EtiologicalDiagnosisText, it.ReportType, it.DeleteFlag }).ExecuteCommand();
|
||
//}
|
||
//else
|
||
//{
|
||
// return db.Updateable(model).ExecuteCommand();
|
||
//}
|
||
return db.Updateable(model).Where(it => it.PatientGuid == model.PatientGuid).IgnoreColumns(it => new { it.ID }).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据患者编号(GUID)+所属报表类型 获取数据信息
|
||
/// </summary>
|
||
/// <param name="patientGuid">病人编号(GUID)</param>
|
||
/// <param name="reportType">所属报表类型0:公用;1:脑出血手术数据直报表;2:颅内动脉瘤手术数据直报表;3:CEACAS数据直报表;4:静脉溶栓血管内介入治疗数据直报表;9:卒中联盟数据报表</param>
|
||
/// <returns></returns>
|
||
///
|
||
///这里删掉了 reportType 云端数据库表添加了 StrokeTeamImageFiles 字段
|
||
|
||
public TableModel<T_Service_Apoplexy_NCXZYJC> GetByPatientGuidAndReportType(string patientGuid)
|
||
{
|
||
List<T_Service_Apoplexy_NCXZYJC> data = db.Queryable<T_Service_Apoplexy_NCXZYJC>().Where(it => it.PatientGuid == patientGuid && it.DeleteFlag == 0).ToList();
|
||
TableModel<T_Service_Apoplexy_NCXZYJC> t = new TableModel<T_Service_Apoplexy_NCXZYJC>();
|
||
t.Code = 0;
|
||
t.PageCount = data.Count;
|
||
t.TotalNumber = data.Count;
|
||
t.Data = data;
|
||
t.Msg = "成功";
|
||
return t;
|
||
}
|
||
}
|
||
}
|