745 lines
44 KiB
C#
745 lines
44 KiB
C#
using HL_FristAidPlatform_Help;
|
||
using HL_FristAidPlatform_IDataBase;
|
||
using HL_FristAidPlatform_Models;
|
||
using Newtonsoft.Json;
|
||
using SqlSugar;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Globalization;
|
||
|
||
namespace HL_FristAidPlatform_DataBase
|
||
{
|
||
public class T_Service_ChestPain_PatientsTimeAxisDB : BaseDB, IT_Service_ChestPain_PatientsTimeAxis
|
||
{
|
||
public SqlSugarClient db = GetClient();
|
||
|
||
#region 增
|
||
/// <summary>
|
||
/// 批量新增 根据病人编号新增所有时间节点业务记录
|
||
/// </summary>
|
||
/// <param name="model">必须传病人编号+所属系统模块编号</param>
|
||
/// <returns></returns>
|
||
public bool Add(T_Service_ChestPain_PatientsTimeAxis model)
|
||
{
|
||
//增加对应模块的时间节点记录业务 且排除已存在的记录
|
||
string Url = string.Format("SELECT ID FROM T_Base_TimeAxis WHERE SystemModuleID={0} AND IsDisplayTimeAxis=0 AND DeleteFlag=0 AND ID NOT IN(SELECT TimeAxisID FROM T_Service_ChestPain_PatientsTimeAxis WHERE PatientGuid='{1}' AND DeleteFlag=0) ORDER BY OrderBy", model.SystemModuleID, model.PatientGuid);
|
||
DataTable dataTable = db.Ado.GetDataTable(Url);
|
||
|
||
int number = 0;
|
||
if (dataTable.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow item in dataTable.Rows)
|
||
{
|
||
T_Service_ChestPain_PatientsTimeAxis InsertModel = new T_Service_ChestPain_PatientsTimeAxis();
|
||
InsertModel.GUID = Guid.NewGuid().ToString();
|
||
InsertModel.PatientGuid = model.PatientGuid;
|
||
InsertModel.TimeAxisID = Convert.ToInt32(item["ID"] + "");
|
||
InsertModel.DeleteFlag = 0;
|
||
InsertModel.IsAutoForRFID = 0;
|
||
InsertModel.SystemModuleID = model.SystemModuleID;
|
||
number = db.Insertable(InsertModel).InsertColumns(it => new { it.GUID, it.PatientGuid, it.TimeAxisID, it.DeleteFlag, it.IsAutoForRFID, it.SystemModuleID }).ExecuteReturnIdentity();
|
||
}
|
||
}
|
||
|
||
return number > 0 ? true : false;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 直接新增有值的数据
|
||
/// </summary>
|
||
/// <param name="model"></param>
|
||
/// <returns></returns>
|
||
public bool DirectAdd(T_Service_ChestPain_PatientsTimeAxis model)
|
||
{
|
||
return db.Insertable(model).ExecuteCommand() == 0 ? false : true;
|
||
}
|
||
#endregion
|
||
|
||
#region 删
|
||
public bool Dels(string GUID)
|
||
{
|
||
return db.Deleteable<T_Service_ChestPain_PatientsTimeAxis>().Where(it => it.GUID == GUID).ExecuteCommand() == 0 ? false : true;
|
||
}
|
||
|
||
public bool DeleteForPatientGuid(string GUID)
|
||
{
|
||
return db.Deleteable<T_Service_ChestPain_PatientsTimeAxis>().Where(it => it.PatientGuid == GUID).ExecuteCommand() == 0 ? false : true;
|
||
}
|
||
#endregion
|
||
|
||
#region 改
|
||
public bool Update(T_Service_ChestPain_PatientsTimeAxis menu)
|
||
{
|
||
return db.Updateable(menu).ExecuteCommand() == 0 ? false : true;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据病人编号和时间节点编号更改记录时间
|
||
/// 用于快速扫码记录
|
||
/// </summary>
|
||
/// <param name="patientGuid">病人编号</param>
|
||
/// <param name="timeAxisID">时间节点编号</param>
|
||
/// <param name="recordingTime">操作时间</param>
|
||
/// <returns></returns>
|
||
public bool UpdateRecordingTimeByPatientIDAndTimeAxisID(string patientGuid, long timeAxisID, string recordingTime)
|
||
{
|
||
int InfluenceNumber = 0;
|
||
try
|
||
{
|
||
InfluenceNumber = db.Updateable<T_Service_ChestPain_PatientsTimeAxis>().SetColumns(it => new T_Service_ChestPain_PatientsTimeAxis() { RecordingTime = recordingTime }).Where(it => it.PatientGuid == patientGuid && it.TimeAxisID == timeAxisID).ExecuteCommand();
|
||
}
|
||
catch (Exception)
|
||
{
|
||
}
|
||
return InfluenceNumber > 0 ? true : false;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据病人编号和时间节点编号更改参考正常时间
|
||
/// </summary>
|
||
/// <param name="patientGuid">病人编号</param>
|
||
/// <param name="timeAxisID"></param>
|
||
/// <param name="normalTime"></param>
|
||
/// <returns></returns>
|
||
public bool UpdateNormalTime(string patientGuid, long timeAxisID, string normalTime)
|
||
{
|
||
int InfluenceNumber = db.Updateable<T_Service_ChestPain_PatientsTimeAxis>().SetColumns(it => new T_Service_ChestPain_PatientsTimeAxis() { NormalTime = normalTime }).Where(it => it.PatientGuid == patientGuid && it.TimeAxisID == timeAxisID).ExecuteCommand();
|
||
return InfluenceNumber > 0 ? true : false;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据病人编号和时间节点编号更改记录时间
|
||
/// 用于移动端
|
||
/// </summary>
|
||
/// <param name="patientGuid">患者编号</param>
|
||
/// <param name="timeAxisID">时间节点编号</param>
|
||
/// <param name="recordingTime">记录时间,为空时表示删除以前的记录值</param>
|
||
/// <returns></returns>
|
||
public bool UpdateRecordingTimeForApp(string patientGuid, long timeAxisID, string recordingTime)
|
||
{
|
||
string sql = string.Format("EXEC Update_TimeAxis_RecordingTime '{0}',{1},'{2}'", patientGuid, timeAxisID, recordingTime);
|
||
return db.Ado.ExecuteCommand(sql) > 0 ? true : false;
|
||
}
|
||
#endregion
|
||
|
||
#region 查
|
||
public T_Service_ChestPain_PatientsTimeAxis Get(string ID)
|
||
{
|
||
return db.Queryable<T_Service_ChestPain_PatientsTimeAxis>().First(it => it.GUID == ID);
|
||
}
|
||
|
||
public TableModel<T_Service_ChestPain_PatientsTimeAxis> GetPageList(int pageIndex, int pageSize)
|
||
{
|
||
int total = 0;
|
||
List<T_Service_ChestPain_PatientsTimeAxis> data = db.Queryable<T_Service_ChestPain_PatientsTimeAxis>().ToPageList(pageIndex, pageSize, ref total);
|
||
TableModel<T_Service_ChestPain_PatientsTimeAxis> t = new TableModel<T_Service_ChestPain_PatientsTimeAxis>();
|
||
t.Code = 0;
|
||
t.PageCount = data.Count;
|
||
t.TotalNumber = total;
|
||
t.Data = data;
|
||
t.Msg = "成功";
|
||
return t;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取患者列表--分页
|
||
/// </summary>
|
||
/// <param name="pageIndex">起始页</param>
|
||
/// <param name="pageSize">每页大小</param>
|
||
/// <param name="hospitalGuid">所属院区GUID</param>
|
||
/// <param name="systemModuleID">所属模块ID</param>
|
||
/// <param name="startTime">开始时间(创建)</param>
|
||
/// <param name="endTime">结束时间(创建)</param>
|
||
/// <param name="state">急救状态:-1全部 0未结束(对应急救中0+住院中1) 1已结束(对应已转归2)</param>
|
||
/// <param name="hospitalMode">来院方式代码 0:未选择;参考字典表T_Base_HospitalMode</param>
|
||
/// <param name="vehicleout_Unit">出车单位代码0:未选择;1:120救护车;2:本院救护车;3:外院救护车</param>
|
||
/// <param name="preliminaryDiagnosis">初步诊断0:未选择,参考字典表T_Base_PreliminaryDiagnosis</param>
|
||
/// <param name="keyWord">关键词</param>
|
||
/// <returns></returns>
|
||
/// <returns></returns>
|
||
public TableModel<ViewModel_PatientsList> GetPatientsTime(int pageIndex, int pageSize, string hospitalGuid, long systemModuleID, string startTime, string endTime, int state, int hospitalMode, int vehicleoutUnit, int preliminaryDiagnosis, string keyWord)
|
||
{
|
||
int TotalNumber = 0;
|
||
TableModel<ViewModel_PatientsList> t = new TableModel<ViewModel_PatientsList>();
|
||
try
|
||
{
|
||
var listMode = db.Queryable<T_Service_Patient, T_Service_ChestPain_Prehospital, T_Service_ChestPain_FirstMedicalReception, T_Base_Gender, T_Base_PreliminaryDiagnosis, T_Base_Hospital, T_Base_WristStrap, T_Base_HospitalMode>((Patient, Prehospital, FirstMedicalReception, Gender, PreliminaryDiagnosis, Hospital, WristStrap, HospitalMode) => new object[] {
|
||
JoinType.Left,Patient.GUID == Prehospital.PatientGuid,
|
||
JoinType.Left,Patient.GUID == FirstMedicalReception.PatientGuid,
|
||
JoinType.Left,Patient.Gender == Gender.GenderCode,
|
||
JoinType.Left,Prehospital.PreliminaryDiagnosis == PreliminaryDiagnosis.ID,
|
||
JoinType.Left,Patient.HospitalGuid == Hospital.GUID,
|
||
JoinType.Left,Patient.WristStrapID == WristStrap.ID,
|
||
JoinType.Left,Prehospital.HospitalMode.ToString() == HospitalMode.Value & HospitalMode.SystemModuleID == systemModuleID,
|
||
})
|
||
.Where((Patient, Prehospital, FirstMedicalReception, Gender, PreliminaryDiagnosis, Hospital, WristStrap, HospitalMode) => SqlFunc.Between(Patient.RegisterTime, startTime, endTime) && Patient.SystemModuleID == systemModuleID && Patient.DeleteFlag == 0)
|
||
.WhereIF(!string.IsNullOrEmpty(hospitalGuid), (Patient, Prehospital, FirstMedicalReception, Gender, PreliminaryDiagnosis, Hospital, WristStrap, HospitalMode) => Patient.HospitalGuid == hospitalGuid)
|
||
.WhereIF(state == 0, (Patient, Prehospital, FirstMedicalReception, Gender, PreliminaryDiagnosis, Hospital, WristStrap, HospitalMode) => Patient.EmergencyState == 0 || Patient.EmergencyState == 1)
|
||
.WhereIF(state == 1, (Patient, Prehospital, FirstMedicalReception, Gender, PreliminaryDiagnosis, Hospital, WristStrap, HospitalMode) => Patient.EmergencyState == 2)
|
||
.WhereIF(hospitalMode > 0, (Patient, Prehospital, FirstMedicalReception, Gender, PreliminaryDiagnosis, Hospital, WristStrap, HospitalMode) => Prehospital.HospitalMode == hospitalMode)
|
||
.WhereIF(vehicleoutUnit > 0, (Patient, Prehospital, FirstMedicalReception, Gender, PreliminaryDiagnosis, Hospital, WristStrap, HospitalMode) => Prehospital.Vehicleout_Unit == vehicleoutUnit)
|
||
.WhereIF(preliminaryDiagnosis > 0, (Patient, Prehospital, FirstMedicalReception, Gender, PreliminaryDiagnosis, Hospital, WristStrap, HospitalMode) => Prehospital.PreliminaryDiagnosis == preliminaryDiagnosis)
|
||
.WhereIF(!string.IsNullOrEmpty(keyWord), (Patient, Prehospital, FirstMedicalReception, Gender, PreliminaryDiagnosis, Hospital, WristStrap, HospitalMode) => Patient.Name.Contains(keyWord) || Patient.PymCode.Contains(keyWord) || Patient.WbmCode.Contains(keyWord) || Patient.CustomCode.Contains(keyWord) || Patient.MobilePhone.Contains(keyWord) || Patient.IdentityCard.Contains(keyWord) || Patient.Address.Contains(keyWord) || Patient.OutpatientNumber.Contains(keyWord) || Patient.AdmissionNumber.Contains(keyWord))
|
||
.Select((Patient, Prehospital, FirstMedicalReception, Gender, PreliminaryDiagnosis, Hospital, WristStrap, HospitalMode) => new ViewModel_PatientsList
|
||
{
|
||
ID = Patient.ID,
|
||
GUID = Patient.GUID,
|
||
Name = Patient.Name,
|
||
Gender = Patient.Gender,
|
||
GenderName = Gender.GenderName,
|
||
Age = Patient.Age,
|
||
EmergencyState = Patient.EmergencyState,
|
||
EmergencyStateCase = Patient.EmergencyState.ToString(),
|
||
Nation = Patient.Nation,
|
||
MobilePhone = Patient.MobilePhone,
|
||
IdentityCard = Patient.IdentityCard,
|
||
Address = Patient.Address,
|
||
Attack_Address = Patient.Attack_Address,
|
||
OutpatientNumber = Patient.OutpatientNumber,
|
||
AdmissionNumber = Patient.AdmissionNumber,
|
||
HospitalModeName = HospitalMode.Content,
|
||
RegisterTime = Patient.RegisterTime,
|
||
CallHelpTime = Convert.ToDateTime(Prehospital.CallHelpTime),
|
||
Attack_Time = Prehospital.Attack_Time,
|
||
First_MC_Time = Convert.ToDateTime(FirstMedicalReception.First_Organization_Time) + "",
|
||
PreliminaryDiagnosis = PreliminaryDiagnosis.Content,
|
||
HospitalGuid = Patient.HospitalGuid,
|
||
HospitalName = Hospital.Name,
|
||
EqmtNo = Patient.EqmtNo,
|
||
WardshipId = Patient.WardshipId,
|
||
WristStrapID = Patient.WristStrapID,
|
||
WristStrapCode = WristStrap.Code,
|
||
WristStrapCodeAlias = WristStrap.Alias,
|
||
Vehicleout_Unit = Prehospital.Vehicleout_Unit.ToString(),
|
||
Vehicleout_Unit_Name = Prehospital.Vehicleout_Unit_Name,
|
||
AmbulanceGuid = Patient.AmbulanceGuid,
|
||
CCPC_State = Patient.CCPC_State,
|
||
CCPC_StateCase = Patient.CCPC_State.ToString(),
|
||
CCPC_Register_ID = Patient.CCPC_Register_ID,
|
||
IsGreenChannel = Patient.IsGreenChannel,
|
||
PymCode = Patient.PymCode,
|
||
WbmCode = Patient.WbmCode,
|
||
CustomCode = Patient.CustomCode,
|
||
Status = Patient.Status,
|
||
Give_UP_Treatment = Patient.Give_UP_Treatment,
|
||
Thrombolysis = Patient.Thrombolysis,
|
||
Interventional_Therapy = Patient.Interventional_Therapy,
|
||
Specified_Archiving_Time = Patient.Specified_Archiving_Time,
|
||
Print_CPTRS_Num = Patient.Print_CPTRS_Num,
|
||
Print_CPTRS_Person_ID = Patient.Print_CPTRS_Person_ID,
|
||
Print_CPTRS_Person = Patient.Print_CPTRS_Person,
|
||
Print_CPTRS_Time = Patient.Print_CPTRS_Time,
|
||
|
||
}).OrderBy((Patient) => Patient.RegisterTime, OrderByType.Desc).ToPageList(pageIndex, pageSize, ref TotalNumber);
|
||
|
||
t.Code = 0;
|
||
t.PageCount = listMode.Count;
|
||
t.TotalNumber = TotalNumber;
|
||
t.Data = listMode;
|
||
t.Msg = "成功";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Help.Info(ex.Message);
|
||
}
|
||
return t;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取患者列表--分页 V2.1
|
||
/// </summary>
|
||
/// <param name="pageIndex">起始页</param>
|
||
/// <param name="pageSize">每页大小</param>
|
||
/// <param name="hospitalGuid">所属院区GUID集合,包含分园区、网络医院等</param>
|
||
/// <param name="systemModuleID">所属模块ID</param>
|
||
/// <param name="startTime">开始时间(创建)</param>
|
||
/// <param name="endTime">结束时间(创建)</param>
|
||
/// <param name="state">急救状态:-1全部 0未结束(对应急救中0+住院中1) 1已结束(对应已转归2)</param>
|
||
/// <param name="coming_Way_Code">来院方式代码 "":未选择;参考字典表T_Base_HospitalMode</param>
|
||
/// <param name="ambulance_Department">出车单位代码 "":未选择;1:120救护车;2:本院救护车;3:外院救护车</param>
|
||
/// <param name="diagnosis_Code">初步诊断 "":未选择,参考字典表T_Base_PreliminaryDiagnosis</param>
|
||
/// <param name="keyWord">关键词</param>
|
||
/// <returns></returns>
|
||
/// <returns></returns>
|
||
public TableModel<ViewModel_PatientsList> GetPatientsTime2(int pageIndex, int pageSize, string hospitalGuid, long systemModuleID, string startTime, string endTime, int state, string coming_Way_Code, string ambulance_Department, string diagnosis_Code, string keyWord, string GreenWay, string IllnessLevel, int status, int ccpcState)
|
||
{
|
||
int TotalNumber = 0;
|
||
TableModel<ViewModel_PatientsList> t = new TableModel<ViewModel_PatientsList>();
|
||
try
|
||
{
|
||
var listMode = db.Queryable<T_Service_Patient, T_Service_ChestPain_FirstAIDInfo, T_Service_ChestPain_TreatmentInfo, T_Base_Gender, T_Base_Hospital, T_Base_WristStrap, T_Base_HospitalMode>((Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => new object[] {
|
||
JoinType.Left,Patient.GUID == FirstAIDInfo.PatientGuid,
|
||
JoinType.Left,Patient.GUID == TreatmentInfo.PatientGuid,
|
||
JoinType.Left,Patient.Gender == Gender.GenderCode,
|
||
JoinType.Left,Patient.HospitalGuid == Hospital.GUID,
|
||
JoinType.Left,Patient.WristStrapID == WristStrap.ID,
|
||
JoinType.Left,HospitalMode.Value ==FirstAIDInfo.CW_Coming_Way_Code && HospitalMode.SystemModuleID == systemModuleID
|
||
})
|
||
.Where((Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => SqlFunc.Between(Patient.RegisterTime, startTime, endTime) && Patient.HospitalGuid == hospitalGuid && Patient.SystemModuleID == systemModuleID && Patient.DeleteFlag == 0)
|
||
.WhereIF(state == 0, (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.EmergencyState == 0 || Patient.EmergencyState == 1)
|
||
.WhereIF(state == 1, (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.EmergencyState == 2)
|
||
.WhereIF(!string.IsNullOrEmpty(coming_Way_Code), (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => FirstAIDInfo.CW_Coming_Way_Code == coming_Way_Code)
|
||
.WhereIF(!string.IsNullOrEmpty(ambulance_Department), (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => FirstAIDInfo.CW_120_Ambulance_Department == ambulance_Department)
|
||
.WhereIF(!string.IsNullOrEmpty(diagnosis_Code), (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => TreatmentInfo.CP_Diagnosis_Code == diagnosis_Code)
|
||
.WhereIF(status > 0, (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.Status == status)
|
||
.WhereIF(ccpcState > -1, (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.CCPC_State == ccpcState)
|
||
.WhereIF(!string.IsNullOrEmpty(GreenWay), (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.IsGreenWay == GreenWay)
|
||
.WhereIF(!string.IsNullOrEmpty(IllnessLevel), (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.IllnessLevel == IllnessLevel)
|
||
.WhereIF(!string.IsNullOrEmpty(keyWord), (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.Name.Contains(keyWord) || Patient.PymCode.Contains(keyWord) || Patient.WbmCode.Contains(keyWord) || Patient.CustomCode.Contains(keyWord) || Patient.MobilePhone.Contains(keyWord) || Patient.IdentityCard.Contains(keyWord) || Patient.Address.Contains(keyWord) || Patient.OutpatientNumber.Contains(keyWord) || Patient.AdmissionNumber.Contains(keyWord))
|
||
.OrderBy((Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.RegisterTime, OrderByType.Desc)
|
||
.Select((Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => new ViewModel_PatientsList
|
||
{
|
||
ID = Patient.ID,
|
||
GUID = Patient.GUID,
|
||
IsForward = Patient.IsForward,
|
||
Name = Patient.Name,
|
||
Gender = Patient.Gender,
|
||
GenderName = Gender.GenderName,
|
||
Age = Patient.Age,
|
||
CP_Diagnosis_Code = TreatmentInfo.CP_Diagnosis_Code,
|
||
EmergencyState = Patient.EmergencyState,
|
||
EmergencyStateCase = Patient.EmergencyState.ToString(),
|
||
Nation = Patient.Nation,
|
||
MobilePhone = Patient.MobilePhone,
|
||
IdentityCard = Patient.IdentityCard,
|
||
Address = Patient.Address,
|
||
Province = Patient.Province,
|
||
City = Patient.City,
|
||
Area = Patient.Area,
|
||
Attack_Address = Patient.Attack_Address,
|
||
OutpatientNumber = Patient.OutpatientNumber,
|
||
AdmissionNumber = Patient.AdmissionNumber,
|
||
HospitalModeName = HospitalMode.Content,
|
||
RegisterTime = Patient.RegisterTime,
|
||
CallHelpTime = FirstAIDInfo.CW_120_Help_Time,
|
||
Is_Null_Attack_Detail_Time = FirstAIDInfo.Is_Null_Attack_Detail_Time,
|
||
Attack_Time = FirstAIDInfo.Is_Null_Attack_Detail_Time == "1" ? Convert.ToDateTime(FirstAIDInfo.Attack_Time).ToString("yyyy-MM-dd") : Convert.ToDateTime(FirstAIDInfo.Attack_Time).ToString("yyyy-MM-dd HH:mm"),
|
||
First_MC_Time = SqlFunc.Subqueryable<T_Service_ChestPain_PatientsTimeAxis>().Where(s => s.PatientGuid == Patient.GUID && (s.TimeAxisID.ToString() == SqlFunc.Subqueryable<T_Base_Config>().Where(c => c.ID == 1003).Select(c => c.Config)) && s.DeleteFlag == 0).Select(s => s.RecordingTime),
|
||
PreliminaryDiagnosis = TreatmentInfo.CP_Diagnosis_Code,
|
||
HospitalGuid = Patient.HospitalGuid,
|
||
HospitalName = Hospital.Name,
|
||
EqmtNo = Patient.EqmtNo,
|
||
WardshipId = Patient.WardshipId,
|
||
WristStrapID = Patient.WristStrapID,
|
||
WristStrapCode = WristStrap.Code,
|
||
WristStrapCodeAlias = WristStrap.Alias,
|
||
Vehicleout_Unit = FirstAIDInfo.CW_120_Ambulance_Department,
|
||
AmbulanceGuid = Patient.AmbulanceGuid,
|
||
CCPC_State = Patient.CCPC_State,
|
||
CCPC_StateCase = Patient.CCPC_State.ToString(),
|
||
CCPC_Register_ID = Patient.CCPC_Register_ID,
|
||
IsGreenChannel = Patient.IsGreenChannel,
|
||
PymCode = Patient.PymCode,
|
||
WbmCode = Patient.WbmCode,
|
||
CustomCode = Patient.CustomCode,
|
||
Status = Patient.Status,
|
||
Give_UP_Treatment = Patient.Give_UP_Treatment,
|
||
Thrombolysis = Patient.Thrombolysis,
|
||
Interventional_Therapy = Patient.Interventional_Therapy,
|
||
Specified_Archiving_Time = Patient.Specified_Archiving_Time,
|
||
Print_CPTRS_Num = Patient.Print_CPTRS_Num,
|
||
Print_CPTRS_Person_ID = Patient.Print_CPTRS_Person_ID,
|
||
Print_CPTRS_Person = Patient.Print_CPTRS_Person,
|
||
Print_CPTRS_Time = Patient.Print_CPTRS_Time,
|
||
Creator = Patient.Creator,
|
||
Audit_Refuse_Note = Patient.Audit_Refuse_Note,
|
||
IsGreenWay = Patient.IsGreenWay,
|
||
IllnessLevel = Patient.IllnessLevel
|
||
}).ToPageList(pageIndex, pageSize, ref TotalNumber);
|
||
|
||
//if (listMode.Count > 0)
|
||
//{
|
||
// for (int i = 0; i < listMode.Count; i++)
|
||
// {
|
||
// if (listMode[i].Is_Null_Attack_Detail_Time == "1" && listMode[i].AttackTime.ToString() != "")
|
||
// listMode[i].Attack_Time = Convert.ToDateTime(listMode[i].AttackTime).ToString("yyyy-MM-dd");
|
||
|
||
// if (listMode[i].Is_Null_Attack_Detail_Time == "0" && listMode[i].AttackTime.ToString() != "")
|
||
// listMode[i].Attack_Time = Convert.ToDateTime(listMode[i].AttackTime).ToString("yyyy-MM-dd HH:mm");
|
||
// }
|
||
//}
|
||
t.Code = 0;
|
||
t.PageCount = listMode.Count;
|
||
t.TotalNumber = TotalNumber;
|
||
t.Data = listMode;
|
||
t.Msg = "成功";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Help.Info(ex.Message);
|
||
}
|
||
return t;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取患者列表--分页 V2.1
|
||
/// 用于移动端
|
||
/// </summary>
|
||
/// <param name="pageIndex">起始页</param>
|
||
/// <param name="pageSize">每页大小</param>
|
||
/// <param name="hospitalGuid">所属院区GUID</param>
|
||
/// <param name="systemModuleID">所属模块ID</param>
|
||
/// <param name="startTime">开始时间(创建)</param>
|
||
/// <param name="endTime">结束时间(创建)</param>
|
||
/// <param name="state">急救状态:-1全部 0未结束(对应急救中0+住院中1) 1已结束(对应已转归2)</param>
|
||
/// <param name="coming_Way_Code">来院方式代码 "":未选择;参考字典表T_Base_HospitalMode</param>
|
||
/// <param name="ambulance_Department">出车单位代码 "":未选择;1:120救护车;2:本院救护车;3:外院救护车</param>
|
||
/// <param name="diagnosis_Code">初步诊断 "":未选择,参考字典表T_Base_PreliminaryDiagnosis</param>
|
||
/// <param name="keyWord">关键词</param>
|
||
/// <returns></returns>
|
||
/// <returns></returns>
|
||
public TableModel<ViewModel_PatientsList> GetPatientsTimeForApp(int pageIndex, int pageSize, string hospitalGuid, long systemModuleID, string startTime, string endTime, int state, string coming_Way_Code, string ambulance_Department, string diagnosis_Code, string keyWord, string GreenWay, string IllnessLevel, int status, int ccpcState)
|
||
{
|
||
int TotalNumber = 0;
|
||
TableModel<ViewModel_PatientsList> t = new TableModel<ViewModel_PatientsList>();
|
||
try
|
||
{
|
||
var listMode = db.Queryable<T_Service_Patient, T_Service_ChestPain_FirstAIDInfo, T_Service_ChestPain_TreatmentInfo, T_Base_Gender, T_Base_Hospital, T_Base_WristStrap, T_Base_HospitalMode>((Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => new object[] {
|
||
JoinType.Left,Patient.GUID == FirstAIDInfo.PatientGuid,
|
||
JoinType.Left,Patient.GUID == TreatmentInfo.PatientGuid,
|
||
JoinType.Left,Patient.Gender == Gender.GenderCode,
|
||
JoinType.Left,Patient.HospitalGuid == Hospital.GUID,
|
||
JoinType.Left,Patient.WristStrapID == WristStrap.ID,
|
||
JoinType.Left,FirstAIDInfo.CW_Coming_Way_Code == HospitalMode.Value & HospitalMode.SystemModuleID == systemModuleID,
|
||
})
|
||
.Where((Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => SqlFunc.Between(Patient.RegisterTime, startTime, endTime) && Patient.SystemModuleID == systemModuleID && Patient.DeleteFlag == 0)
|
||
.WhereIF(!string.IsNullOrEmpty(hospitalGuid), (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.HospitalGuid == hospitalGuid)
|
||
.WhereIF(state == 0, (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.EmergencyState == 0 || Patient.EmergencyState == 1)
|
||
.WhereIF(state == 1, (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.EmergencyState == 2)
|
||
.WhereIF(!string.IsNullOrEmpty(coming_Way_Code), (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => FirstAIDInfo.CW_Coming_Way_Code == coming_Way_Code)
|
||
.WhereIF(!string.IsNullOrEmpty(ambulance_Department), (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => FirstAIDInfo.CW_120_Ambulance_Department == ambulance_Department)
|
||
.WhereIF(!string.IsNullOrEmpty(diagnosis_Code), (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => TreatmentInfo.CP_Diagnosis_Code == diagnosis_Code)
|
||
.WhereIF(status > 0, (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.Status == status)
|
||
.WhereIF(ccpcState > -1, (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.CCPC_State == ccpcState)
|
||
.WhereIF(!string.IsNullOrEmpty(GreenWay), (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.IsGreenWay == GreenWay)
|
||
.WhereIF(!string.IsNullOrEmpty(IllnessLevel), (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.IllnessLevel == IllnessLevel)
|
||
.WhereIF(!string.IsNullOrEmpty(keyWord), (Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => Patient.Name.Contains(keyWord) || Patient.PymCode.Contains(keyWord) || Patient.WbmCode.Contains(keyWord) || Patient.CustomCode.Contains(keyWord) || Patient.MobilePhone.Contains(keyWord) || Patient.IdentityCard.Contains(keyWord) || Patient.Address.Contains(keyWord) || Patient.OutpatientNumber.Contains(keyWord) || Patient.AdmissionNumber.Contains(keyWord))
|
||
.Select((Patient, FirstAIDInfo, TreatmentInfo, Gender, Hospital, WristStrap, HospitalMode) => new ViewModel_PatientsList
|
||
{
|
||
ID = Patient.ID,
|
||
GUID = Patient.GUID,
|
||
Name = Patient.Name,
|
||
Gender = Patient.Gender,
|
||
GenderName = Gender.GenderName,
|
||
Age = Patient.Age,
|
||
Province = Patient.Province,
|
||
City = Patient.City,
|
||
Area = Patient.Area,
|
||
EmergencyState = Patient.EmergencyState,
|
||
EmergencyStateCase = Patient.EmergencyState.ToString(),
|
||
Nation = Patient.Nation,
|
||
MobilePhone = Patient.MobilePhone,
|
||
IdentityCard = Patient.IdentityCard,
|
||
Address = Patient.Address,
|
||
Attack_Address = Patient.Attack_Address,
|
||
OutpatientNumber = Patient.OutpatientNumber,
|
||
AdmissionNumber = Patient.AdmissionNumber,
|
||
HospitalModeName = HospitalMode.Content,
|
||
RegisterTime = Patient.RegisterTime,
|
||
CallHelpTime = FirstAIDInfo.CW_120_Help_Time,
|
||
Is_Null_Attack_Detail_Time = FirstAIDInfo.Is_Null_Attack_Detail_Time,
|
||
AttackTime = FirstAIDInfo.Attack_Time,
|
||
First_MC_Time = FirstAIDInfo.CW_120_First_MC_Time,
|
||
PreliminaryDiagnosis = TreatmentInfo.CP_Diagnosis_Code,
|
||
HospitalGuid = Patient.HospitalGuid,
|
||
HospitalName = Hospital.Name,
|
||
EqmtNo = Patient.EqmtNo,
|
||
WardshipId = Patient.WardshipId,
|
||
WristStrapID = Patient.WristStrapID,
|
||
WristStrapCode = WristStrap.Code,
|
||
WristStrapCodeAlias = WristStrap.Alias,
|
||
Vehicleout_Unit = FirstAIDInfo.CW_120_Ambulance_Department,
|
||
AmbulanceGuid = Patient.AmbulanceGuid,
|
||
CCPC_State = Patient.CCPC_State,
|
||
CCPC_StateCase = Patient.CCPC_State.ToString(),
|
||
CCPC_Register_ID = Patient.CCPC_Register_ID,
|
||
IsGreenChannel = Patient.IsGreenChannel,
|
||
PymCode = Patient.PymCode,
|
||
WbmCode = Patient.WbmCode,
|
||
CustomCode = Patient.CustomCode,
|
||
Status = Patient.Status,
|
||
Give_UP_Treatment = Patient.Give_UP_Treatment,
|
||
Thrombolysis = Patient.Thrombolysis,
|
||
Interventional_Therapy = Patient.Interventional_Therapy,
|
||
Specified_Archiving_Time = Patient.Specified_Archiving_Time,
|
||
Print_CPTRS_Num = Patient.Print_CPTRS_Num,
|
||
Print_CPTRS_Person_ID = Patient.Print_CPTRS_Person_ID,
|
||
Print_CPTRS_Person = Patient.Print_CPTRS_Person,
|
||
Print_CPTRS_Time = Patient.Print_CPTRS_Time,
|
||
IsGreenWay = Patient.IsGreenWay,
|
||
IllnessLevel = Patient.IllnessLevel
|
||
}).OrderBy((Patient) => Patient.RegisterTime, OrderByType.Desc).ToPageList(pageIndex, pageSize, ref TotalNumber);
|
||
if (listMode.Count > 0)
|
||
{
|
||
for (int i = 0; i < listMode.Count; i++)
|
||
{
|
||
if (listMode[i].Is_Null_Attack_Detail_Time == "1")
|
||
{
|
||
if (!string.IsNullOrEmpty(listMode[i].AttackTime + ""))
|
||
{
|
||
listMode[i].Attack_Time = Convert.ToDateTime(listMode[i].AttackTime).ToString("yyyy-MM-dd");
|
||
}
|
||
}
|
||
|
||
if (listMode[i].Is_Null_Attack_Detail_Time == "0")
|
||
{
|
||
if (!string.IsNullOrEmpty(listMode[i].AttackTime + ""))
|
||
{
|
||
listMode[i].Attack_Time = Convert.ToDateTime(listMode[i].AttackTime).ToString("yyyy-MM-dd HH:mm");
|
||
}
|
||
}
|
||
}
|
||
}
|
||
t.Code = 0;
|
||
t.PageCount = listMode.Count;
|
||
t.TotalNumber = TotalNumber;
|
||
t.Data = listMode;
|
||
t.Msg = "成功";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Help.Info(ex.Message);
|
||
}
|
||
return t;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据病人编号获取所有记录节点时间
|
||
/// </summary>
|
||
/// <param name="patientGuid">病人编号</param>
|
||
/// <param name="isDisplayTimeAxis">是否显示到时间轴0是1否</param>
|
||
/// <returns></returns>
|
||
public string GetPatientDetailTime(string patientGuid, int isDisplayTimeAxis)
|
||
{
|
||
string items = "";
|
||
string whereStr = "";
|
||
if (isDisplayTimeAxis != -1)
|
||
{
|
||
whereStr = " AND c.IsDisplayTimeAxis = " + isDisplayTimeAxis;
|
||
}
|
||
|
||
string SqlStr = @"
|
||
SELECT temp.*,e.IncrementalInterval_X,e.IncrementalInterval_Y,e.TotalPerRow,e.LocationX_Start,e.LocationY_Start,f.OrderBy,e.Thrombolysis,e.Interventional_Therapy FROM (
|
||
SELECT c.ID,a.[GUID],a.IsGreenChannel,c.GUID AS TimeAxisGUID,a.Name,a.Age,a.Gender,c.TimeName,b.RecordingTime,c.Interval,c.ParentID,b.NormalTime,c.LocationX,c.LocationY,c.ContrastTimeAxisID,c.Describe,c.Form_Flag,d.CW_Coming_Way_Code as HospitalMode,a.SystemModuleID,a.Thrombolysis,a.Interventional_Therapy
|
||
FROM T_Service_Patient a
|
||
LEFT JOIN T_Service_ChestPain_PatientsTimeAxis b on a.GUID = b.PatientGuid
|
||
LEFT JOIN T_Base_TimeAxis c on b.TimeAxisID = c.ID
|
||
LEFT JOIN T_Service_ChestPain_FirstAIDInfo d ON d.PatientGuid=a.GUID
|
||
WHERE a.GUID = '{0}' {1} AND a.DeleteFlag=0 AND b.DeleteFlag=0 AND c.DeleteFlag=0)
|
||
AS temp
|
||
LEFT JOIN T_Base_TimeAxis_Templet e ON e.SystemModuleID=temp.SystemModuleID AND e.HospitalModeValue=temp.HospitalMode AND e.IsGreenChannel=temp.IsGreenChannel AND e.Thrombolysis=temp.Thrombolysis AND e.Interventional_Therapy=temp.Interventional_Therapy
|
||
JOIN T_Base_TimeAxis_TempletDetail f ON f.TempletGUID=e.GUID AND temp.TimeAxisGUID=f.TimeAxisGUID AND f.DeleteFlag=0
|
||
ORDER BY f.OrderBy";
|
||
SqlStr = string.Format(SqlStr, patientGuid, whereStr);
|
||
DataTable dt = db.Ado.GetDataTable(SqlStr);
|
||
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow item in dt.Rows)
|
||
{
|
||
string row = "";
|
||
for (int i = 0; i < dt.Columns.Count; i++)
|
||
{
|
||
row += JsonConvert.SerializeObject(dt.Columns[i].ColumnName) + ":";
|
||
row += JsonConvert.SerializeObject(item[i]) + ",";
|
||
}
|
||
row = row.Remove(row.Length - 1);
|
||
items += "{" + row + "}" + ",";
|
||
|
||
}
|
||
items = items.Remove(items.Length - 1);
|
||
}
|
||
items = "[" + items + "]";
|
||
return items;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据病人编号获取所有记录节点时间
|
||
/// </summary>
|
||
/// <param name="patientGuid">病人编号</param>
|
||
/// <param name="isDisplayTimeAxis">是否显示到时间轴0是1否</param>
|
||
/// <returns></returns>
|
||
public string GetPatientTime(string patientGuid)
|
||
{
|
||
string items = "";
|
||
string SqlStr = @"
|
||
SELECT c.ID,a.[GUID],a.IsGreenChannel,c.GUID AS TimeAxisGUID,a.Name,a.Age,a.Gender,c.TimeName,b.RecordingTime,c.Interval,c.ParentID,b.NormalTime,c.LocationX,c.LocationY,c.ContrastTimeAxisID,c.Describe,c.Form_Flag,d.HospitalMode,a.SystemModuleID
|
||
FROM T_Service_Patient a
|
||
LEFT JOIN T_Service_ChestPain_PatientsTimeAxis b on a.GUID = b.PatientGuid
|
||
LEFT JOIN T_Base_TimeAxis c on b.TimeAxisID = c.ID
|
||
LEFT JOIN T_Service_ChestPain_Prehospital d ON d.PatientGuid=a.GUID
|
||
WHERE a.GUID = '{0}' AND a.DeleteFlag=0 AND b.DeleteFlag=0 AND c.DeleteFlag=0";
|
||
SqlStr = string.Format(SqlStr, patientGuid);
|
||
DataTable dt = db.Ado.GetDataTable(SqlStr);
|
||
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow item in dt.Rows)
|
||
{
|
||
string row = "";
|
||
for (int i = 0; i < dt.Columns.Count; i++)
|
||
{
|
||
row += JsonConvert.SerializeObject(dt.Columns[i].ColumnName) + ":";
|
||
row += JsonConvert.SerializeObject(item[i]) + ",";
|
||
}
|
||
row = row.Remove(row.Length - 1);
|
||
items += "{" + row + "}" + ",";
|
||
|
||
}
|
||
items = items.Remove(items.Length - 1);
|
||
}
|
||
items = "[" + items + "]";
|
||
return items;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据病人编号+时间节点标识 获取记录时间
|
||
/// </summary>
|
||
/// <param name="patientGuid">病人编号</param>
|
||
/// <param name="timeAxisID">时间节点编号:-1查询该病人的全部节点</param>
|
||
/// <returns></returns>
|
||
public TableModel<T_Service_ChestPain_PatientsTimeAxis> GetRecordingTime(string patientGuid, long timeAxisID)
|
||
{
|
||
TableModel<T_Service_ChestPain_PatientsTimeAxis> t = new TableModel<T_Service_ChestPain_PatientsTimeAxis>();
|
||
|
||
var listMode = db.Queryable<T_Service_ChestPain_PatientsTimeAxis>().Where(it => it.PatientGuid == patientGuid && it.DeleteFlag == 0).WhereIF(timeAxisID > 0, it => it.TimeAxisID == timeAxisID)
|
||
.Select(it => new T_Service_ChestPain_PatientsTimeAxis
|
||
{
|
||
//ID = it.ID,
|
||
GUID = it.GUID.ToString(),
|
||
PatientGuid = it.PatientGuid,
|
||
TimeAxisID = it.TimeAxisID,
|
||
DeleteFlag = it.DeleteFlag,
|
||
RecordingTime = it.RecordingTime,
|
||
NormalTime = it.NormalTime,
|
||
SystemModuleID = it.SystemModuleID
|
||
}).OrderBy((it) => it.RecordingTime).ToList();
|
||
|
||
t.Code = 0;
|
||
t.PageCount = listMode.Count;
|
||
t.TotalNumber = listMode.Count;
|
||
t.Data = listMode;
|
||
t.Msg = "成功";
|
||
return t;
|
||
}
|
||
|
||
public TableModel<T_Service_ChestPain_PatientsTimeAxis> GetModelByReport(string where)
|
||
{
|
||
string sql = "select * from T_Service_ChestPain_PatientsTimeAxis where DeleteFlag=0 and " + where + "";
|
||
List<T_Service_ChestPain_PatientsTimeAxis> data = db.Ado.SqlQuery<T_Service_ChestPain_PatientsTimeAxis>(sql);
|
||
TableModel<T_Service_ChestPain_PatientsTimeAxis> t = new TableModel<T_Service_ChestPain_PatientsTimeAxis>();
|
||
t.Code = 0;
|
||
t.PageCount = data.Count;
|
||
t.TotalNumber = data.Count;
|
||
t.Data = data;
|
||
t.Msg = "成功";
|
||
return t;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据相关条件获取符合条件的时间节点
|
||
/// 用于移动端
|
||
/// </summary>
|
||
/// <param name="patientGuid">病人编号</param>
|
||
/// <param name="groupId">节点组编号</param>
|
||
/// <returns></returns>
|
||
public string GetTimeAxisByGroupIDForApp(string patientGuid, int groupId)
|
||
{
|
||
string ReturnStr = "";
|
||
string SqlStr = "";
|
||
//按组查询
|
||
if (groupId > 0)
|
||
{
|
||
SqlStr = @"
|
||
SELECT a.ID,a.TimeAxisID,b.TimeName,a.RecordingTime,c.GroupName FROM T_Service_ChestPain_PatientsTimeAxis a
|
||
JOIN T_Base_TimeAxis b ON a.TimeAxisID =b.ID
|
||
LEFT JOIN T_Base_TimeAxisGroup c ON b.GroupID=c.ID
|
||
WHERE a.PatientGuid='{0}' AND b.GroupID={1} AND b.IsDisplayTimeAxis =0 AND a.DeleteFlag=0 AND b.DeleteFlag=0";
|
||
SqlStr = string.Format(SqlStr, patientGuid, groupId);
|
||
}
|
||
else
|
||
{
|
||
SqlStr = @"
|
||
SELECT temp.*,e.IncrementalInterval_X,e.IncrementalInterval_Y,e.TotalPerRow,e.LocationX_Start,e.LocationY_Start,f.OrderBy FROM (
|
||
SELECT c.ID,a.[GUID],a.IsGreenChannel,c.GUID AS TimeAxisGUID,a.Name,a.Age,a.Gender,c.TimeName,b.RecordingTime,c.Interval,c.ParentID,b.NormalTime,c.LocationX,c.LocationY,c.ContrastTimeAxisID,c.Describe,c.Form_Flag,d.CW_Coming_Way_Code as HospitalMode,a.SystemModuleID
|
||
FROM T_Service_Patient a
|
||
LEFT JOIN T_Service_ChestPain_PatientsTimeAxis b on a.GUID = b.PatientGuid
|
||
LEFT JOIN T_Base_TimeAxis c on b.TimeAxisID = c.ID
|
||
LEFT JOIN T_Service_ChestPain_FirstAIDInfo d ON d.PatientGuid=a.GUID
|
||
WHERE a.GUID = '{0}' AND c.IsDisplayTimeAxis =0 AND a.DeleteFlag=0 AND b.DeleteFlag=0 AND c.DeleteFlag=0) AS temp
|
||
LEFT JOIN T_Base_TimeAxis_Templet e ON e.SystemModuleID=temp.SystemModuleID AND e.HospitalModeValue=temp.HospitalMode AND e.IsGreenChannel=temp.IsGreenChannel
|
||
JOIN T_Base_TimeAxis_TempletDetail f ON f.TempletGUID=e.GUID AND temp.TimeAxisGUID=f.TimeAxisGUID AND f.DeleteFlag=0
|
||
ORDER BY f.OrderBy";
|
||
SqlStr = string.Format(SqlStr, patientGuid);
|
||
}
|
||
|
||
DataTable dt = db.Ado.GetDataTable(SqlStr);
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow item in dt.Rows)
|
||
{
|
||
string row = "";
|
||
for (int i = 0; i < dt.Columns.Count; i++)
|
||
{
|
||
row += JsonConvert.SerializeObject(dt.Columns[i].ColumnName) + ":";
|
||
row += JsonConvert.SerializeObject(item[i]) + ",";
|
||
}
|
||
row = row.Remove(row.Length - 1);
|
||
ReturnStr += "{" + row + "}" + ",";
|
||
|
||
}
|
||
ReturnStr = ReturnStr.Remove(ReturnStr.Length - 1);
|
||
}
|
||
ReturnStr = "[" + ReturnStr + "]";
|
||
return ReturnStr;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取胸痛患者质量控制列表
|
||
/// </summary>
|
||
/// <param name="pageIndex">起始页</param>
|
||
/// <param name="pageSize">每页大小</param>
|
||
/// <param name="hospitalGuid">所属院区GUID</param>
|
||
/// <param name="startTime">开始时间(创建)</param>
|
||
/// <param name="endTime">结束时间(创建)</param>
|
||
/// <param name="isPCI">是否PCI:1是,0否,-1查询全部</param>
|
||
/// <param name="diagnosisCode">诊断,用','分割,为空查全部</param>
|
||
/// <param name="keyWord">关键词</param>
|
||
/// <param name="patientGuid">患者编号</param>
|
||
/// <returns></returns>
|
||
public string GetChestPainQualityControl(int pageIndex, int pageSize, string hospitalGuid, string startTime, string endTime, int isPCI, string diagnosisCode, string keyWord, string patientGuid)
|
||
{
|
||
try
|
||
{
|
||
DataTable dataTable = db.Ado.GetDataTable("EXEC Pro_ChestPain_QualityControl @PageIndex,@PageSize,@HospitalGuid,@StartDate,@EndDate,@IsPCI,@DiagnosisCode,@KeyWord,@PatientGuid",
|
||
new
|
||
{
|
||
PageIndex = pageIndex,
|
||
PageSize = pageSize,
|
||
HospitalGuid = hospitalGuid,
|
||
StartDate = startTime,
|
||
EndDate = endTime,
|
||
IsPCI = isPCI,
|
||
DiagnosisCode = diagnosisCode,
|
||
KeyWord = keyWord,
|
||
PatientGuid = patientGuid
|
||
});
|
||
|
||
string JsonStr = Help.DataTableToJsonStr(dataTable);
|
||
return JsonStr;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Help.Info(ex.Message);
|
||
return ex.Message;
|
||
}
|
||
}
|
||
|
||
public T_Service_ChestPain_PatientsTimeAxis GetPatientDetailTime(string patientGuid, long timeAxisID)
|
||
{
|
||
return db.Queryable<T_Service_ChestPain_PatientsTimeAxis>().First(it => it.PatientGuid == patientGuid && it.TimeAxisID == timeAxisID);
|
||
}
|
||
#endregion
|
||
}
|
||
} |