557 lines
30 KiB
C#
557 lines
30 KiB
C#
using HL_FristAidPlatform_Help;
|
|
using HL_FristAidPlatform_Help.Model;
|
|
using HL_FristAidPlatform_IDataBase;
|
|
using HL_FristAidPlatform_Models;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace HL_FristAidPlatform_DataBase
|
|
{
|
|
public class T_Service_EmergencyTriageDB : BaseDB, IT_Service_EmergencyTriage
|
|
{
|
|
public SqlSugarClient db = GetClient();
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 患者列表-急诊分诊
|
|
/// </summary>
|
|
/// <param name="name"></param>
|
|
/// <param name="startTime"></param>
|
|
/// <param name="endTime"></param>
|
|
/// <param name="killip"></param>
|
|
/// <param name="aignArea"></param>
|
|
/// <param name="comeHospital"></param>
|
|
/// <param name="triageDepartment"></param>
|
|
/// <param name=""></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <returns></returns>
|
|
public TableModel<TriagePatientModel> GetPatientListOfTriage(string name, string startTime, string endTime, string killip, string signArea, string comeHospital, string triageDepartment, string isGreenWay, int category, string eventName, int eventId, int pageIndex, int pageSize)
|
|
{
|
|
int total = 0;
|
|
TableModel<TriagePatientModel> t = new TableModel<TriagePatientModel>();
|
|
List<TriagePatientModel> list = new List<TriagePatientModel>();
|
|
|
|
var oneClass = db.Queryable<T_Service_Patient, T_Service_FirstAid_PatientInfo, T_Base_AccidentInfo>
|
|
((a, b, c) => new JoinQueryInfos(
|
|
JoinType.Inner, a.GUID == b.PatientGUID, JoinType.Left, b.EventID == c.ID))
|
|
.Where((a, b) => a.DeleteFlag == 0 && b.DeleteFlag == 0)
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(name), (a, b) => a.Name.Contains(name))
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(startTime), (a, b) => a.RegisterTime >= Convert.ToDateTime(startTime))
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(endTime), (a, b) => a.RegisterTime <= Convert.ToDateTime(endTime).AddDays(1))
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(killip), (a, b) => b.Killip == killip)
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(signArea), (a, b) => b.SignArea == signArea)
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(comeHospital), (a, b) => b.ComeHospital == comeHospital)
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(triageDepartment), (a, b) => b.TriageDepartment == triageDepartment)
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(isGreenWay), (a, b) => a.IsGreenWay == isGreenWay)
|
|
.WhereIF(category != -1, (a, b) => a.Category == category)
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(eventName), (a, b) => b.EventName.Contains(eventName))
|
|
.WhereIF(eventId > 0, (a, b) => b.EventID == eventId)
|
|
.OrderBy((a, b) => a.RegisterTime, OrderByType.Desc)
|
|
.OrderBy((a, b) => a.ID)
|
|
.Select((a, b, c) => new TriagePatientModel()
|
|
{
|
|
ID = a.ID,
|
|
GUID = a.GUID,
|
|
Name = a.Name,
|
|
RegisterTime = a.RegisterTime,
|
|
Age = a.Age,
|
|
Gender = a.Gender,
|
|
Killip = b.Killip,
|
|
SignArea = b.SignArea,
|
|
ComeHospital = b.ComeHospital,
|
|
TriageTime = b.TriageTime,
|
|
ChiefComplaint = b.ChiefComplaint,
|
|
TriageDepartment = b.TriageDepartment == "" ? "" : SqlFunc.Subqueryable<T_Base_TriageGo>().Where(it => it.ID == int.Parse(b.TriageDepartment)).Select(it => it.Name),
|
|
IsGreenWay = a.IsGreenWay,
|
|
Category = a.Category,
|
|
EventName = b.EventName,
|
|
AccidentName = c.ParentName
|
|
}).ToPageList(pageIndex, pageSize, ref total);
|
|
list = oneClass;
|
|
t.Code = 0;
|
|
t.PageCount = list.Count;
|
|
t.TotalNumber = total;
|
|
t.Data = list;
|
|
t.Msg = "成功";
|
|
return t;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 急诊分诊台账
|
|
/// </summary>
|
|
/// <param name="name"></param>
|
|
/// <param name="startTime"></param>
|
|
/// <param name="endTime"></param>
|
|
/// <param name="killip"></param>
|
|
/// <param name="signArea"></param>
|
|
/// <param name="GreenChannel"></param>
|
|
/// <param name="triageDepartment"></param>
|
|
/// <param name="pageIndex"></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <returns></returns>
|
|
public TableModel<TriagePatientModel> GetEmergencyLedger(string name, string startTime, string endTime, string killip, string signArea, string GreenChannel, string triageDepartment, int pageIndex, int pageSize)
|
|
{
|
|
int total = 0;
|
|
TableModel<TriagePatientModel> t = new TableModel<TriagePatientModel>();
|
|
List<TriagePatientModel> list = new List<TriagePatientModel>();
|
|
|
|
var oneClass = db.Queryable<T_Service_Patient, T_Service_FirstAid_PatientInfo, T_Service_FirstAid_HealthCheckup>
|
|
((a, b, c) => new JoinQueryInfos(
|
|
JoinType.Inner, a.GUID == b.PatientGUID, JoinType.Left, a.GUID == c.PatientGUID))
|
|
.Where((a, b) => a.DeleteFlag == 0)
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(name), (a, b) => a.Name.Contains(name))
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(startTime), (a, b) => Convert.ToDateTime(b.TriageTime) >= Convert.ToDateTime(startTime))
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(endTime), (a, b) => Convert.ToDateTime(b.TriageTime) <= Convert.ToDateTime(endTime).AddDays(1))
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(killip), (a, b) => b.Killip == killip)
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(signArea), (a, b) => b.SignArea == signArea)
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(GreenChannel), (a, b) => a.IsGreenWay == GreenChannel)
|
|
.WhereIF(!SqlFunc.IsNullOrEmpty(triageDepartment), (a, b) => b.TriageDepartment == triageDepartment)
|
|
.OrderBy((a, b, c) => a.RegisterTime, OrderByType.Desc)
|
|
.Select((a, b, c) => new TriagePatientModel()
|
|
{
|
|
GUID = a.GUID,
|
|
Name = a.Name,
|
|
RegisterTime = a.RegisterTime,
|
|
Age = a.Age,
|
|
Gender = a.Gender,
|
|
Killip = b.Killip,
|
|
SignArea = b.SignArea,
|
|
ComeHospital = b.ComeHospital,
|
|
TriageTime = b.TriageTime,
|
|
Pulse = c.Pulse,
|
|
Temperature = c.Temperature,
|
|
ChiefComplaint = b.ChiefComplaint,
|
|
DiagnosisImpression = b.DiagnosisImpression,
|
|
BloodPressure = c.SystolicPressure + "/" + c.DiastolicPressure,
|
|
Breathing = c.Breathing,
|
|
TriageDepartment = b.TriageDepartment == "" ? "" : SqlFunc.Subqueryable<T_Base_TriageGo>().Where(it => it.ID == int.Parse(b.TriageDepartment)).Select(it => it.Name),
|
|
IsGreenWay=a.IsGreenWay
|
|
}).ToPageList(pageIndex, pageSize, ref total);
|
|
list = oneClass;
|
|
t.Code = 0;
|
|
t.PageCount = list.Count;
|
|
t.TotalNumber = total;
|
|
t.Data = list;
|
|
t.Msg = "成功";
|
|
return t;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 患者分诊信息保存
|
|
/// </summary>
|
|
/// <param name="patientInfo"></param>
|
|
/// <param name="score"></param>
|
|
/// <param name="mews"></param>
|
|
/// <returns></returns>
|
|
public bool SavePatientTriage(T_Service_FirstAid_PatientInfo patientInfo, string isGreenWay)
|
|
{
|
|
try
|
|
{
|
|
db.Ado.BeginTran();
|
|
T_Service_Patient patient = new T_Service_Patient();
|
|
switch (patientInfo.TriageDepartment)
|
|
{
|
|
case "3":
|
|
patient.SystemModuleID = 3;
|
|
break;
|
|
case "4":
|
|
patient.SystemModuleID = 2;
|
|
break;
|
|
case "5":
|
|
patient.SystemModuleID = 3;
|
|
break;
|
|
}
|
|
patient.GUID = patientInfo.PatientGUID;
|
|
patient.IsGreenWay = isGreenWay;
|
|
if (!SqlFunc.IsNullOrEmpty(patientInfo.TriageDepartment))
|
|
db.Updateable(patient).UpdateColumns(it => new { it.SystemModuleID, it.IsGreenWay }).ExecuteCommand();
|
|
|
|
var health = db.Queryable<T_Service_FirstAid_HealthCheckup>().Where(i => i.PatientGUID == patientInfo.PatientGUID).First();
|
|
db.Updateable(patientInfo).ExecuteCommand();
|
|
if (patientInfo.TriageDepartment == "4")
|
|
{
|
|
|
|
//胸痛诊疗
|
|
T_Service_ChestPain_TreatmentInfo treatmentInfo = new T_Service_ChestPain_TreatmentInfo();
|
|
treatmentInfo.PatientGuid = patientInfo.GUID;
|
|
treatmentInfo.CreatorID = patientInfo.CreationID;
|
|
treatmentInfo.CreationDate = DateTime.Now;
|
|
treatmentInfo.GUID = Guid.NewGuid().ToString();
|
|
db.Insertable(treatmentInfo).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand();
|
|
//冠状动脉造影
|
|
T_Service_ChestPain_CoronaryAngiographie coronary = new T_Service_ChestPain_CoronaryAngiographie();
|
|
coronary.PatientGuid = patientInfo.GUID;
|
|
coronary.CreatorID = patientInfo.CreationID;
|
|
coronary.CreationDate = DateTime.Now;
|
|
coronary.GUID = Guid.NewGuid().ToString();
|
|
db.Insertable(coronary).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand();
|
|
//转归表
|
|
T_Service_ChestPain_OutComeInfo outComeInfo = new T_Service_ChestPain_OutComeInfo();
|
|
outComeInfo.PatientGuid = patientInfo.GUID;
|
|
outComeInfo.CreatorID = patientInfo.CreationID;
|
|
outComeInfo.CreationDate = DateTime.Now;
|
|
outComeInfo.GUID = Guid.NewGuid().ToString();
|
|
db.Insertable(outComeInfo).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand();
|
|
|
|
//增加对应模块的时间节点记录业务 且排除已存在的记录
|
|
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", patient.SystemModuleID, patient.GUID);
|
|
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 = patient.GUID;
|
|
InsertModel.TimeAxisID = Convert.ToInt32(item["ID"] + "");
|
|
InsertModel.DeleteFlag = 0;
|
|
InsertModel.IsAutoForRFID = 0;
|
|
InsertModel.SystemModuleID = patient.SystemModuleID;
|
|
number = db.Insertable(InsertModel).InsertColumns(it => new { it.GUID, it.PatientGuid, it.TimeAxisID, it.DeleteFlag, it.IsAutoForRFID, it.SystemModuleID }).ExecuteReturnIdentity();
|
|
}
|
|
}
|
|
}
|
|
if (patientInfo.TriageDepartment == "3")
|
|
{
|
|
if (patientInfo.TriageDepartment != "1" && patientInfo.TriageDepartment != "6")
|
|
{
|
|
T_Service_Apoplexy_Prehospital prehospital = new T_Service_Apoplexy_Prehospital();
|
|
prehospital.GUID = Guid.NewGuid().ToString();
|
|
prehospital.PatientGuid = patientInfo.PathogenyGUID;
|
|
prehospital.IsCallHelp = 0;
|
|
if (patientInfo.TriageDepartment == "2")
|
|
prehospital.CallHelpWay = 1;
|
|
if (patientInfo.TriageDepartment == "3")
|
|
prehospital.CallHelpWay = 2;
|
|
if (patientInfo.TriageDepartment == "4")
|
|
prehospital.CallHelpWay = 3;
|
|
prehospital.BCRyType = "1";
|
|
prehospital.BCLyType = "2";
|
|
prehospital.DiseaseRecord = patientInfo.ChiefComplaint;
|
|
if (health != null)
|
|
{
|
|
prehospital.Breathing = health.Breathing;
|
|
prehospital.HeartRate = health.HeartRate;
|
|
prehospital.HESsy = health.SystolicPressure;
|
|
prehospital.HESzy = health.DiastolicPressure;
|
|
prehospital.Temperature = health.Temperature;
|
|
var nihhs = db.Queryable<T_Service_PatientNIHSS>().Where(i => i.PatientGUID == patientInfo.PatientGUID && i.Flag == 1).First();
|
|
if (nihhs != null) { prehospital.RYNIHSSYN = "1"; prehospital.RYNIHSS = nihhs.TotalScore.ToString(); } else { prehospital.RYNIHSSYN = "2"; }
|
|
prehospital.HEBPulse = health.Pulse;
|
|
}
|
|
db.Insertable(prehospital).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand();
|
|
}
|
|
}
|
|
if (patientInfo.TriageDepartment == "5")
|
|
{
|
|
var oneclass = db.Queryable<T_Service_Patient>().Where(i => i.GUID == patientInfo.PatientGUID && i.DeleteFlag == 0).First();
|
|
|
|
T_Service_Trauma_BaseInfo baseInfo = new T_Service_Trauma_BaseInfo();
|
|
baseInfo.GUID = Guid.NewGuid().ToString();
|
|
baseInfo.PatientGuid = patientInfo.PatientGUID;
|
|
baseInfo.AttackAddress = oneclass.Attack_Address;
|
|
baseInfo.IllnessLevel = patientInfo.Killip == "5" ? "" : patientInfo.Killip;
|
|
if (patientInfo.TriageDepartment == "1")
|
|
baseInfo.ComeHosptialWay = "3";
|
|
if (patientInfo.TriageDepartment == "2")
|
|
{ baseInfo.ComeHosptialWay = "1"; baseInfo.AmbulanceType = "1"; }
|
|
if (patientInfo.TriageDepartment == "3")
|
|
baseInfo.ComeHosptialWay = "4";
|
|
if (patientInfo.TriageDepartment == "4" || patientInfo.TriageDepartment == "5")
|
|
{ baseInfo.ComeHosptialWay = "2"; baseInfo.AmbulanceType = "3"; }
|
|
if (patientInfo.TriageDepartment == "6")
|
|
baseInfo.ComeHosptialWay = "5";
|
|
baseInfo.CreationDate = DateTime.Now;
|
|
baseInfo.CreatorID = patientInfo.CreationID;
|
|
if (patientInfo.ComeHospital == "2" || patientInfo.ComeHospital == "4" || patientInfo.ComeHospital == "5")
|
|
{
|
|
T_Service_Trauma_FirstAidInfo first = new T_Service_Trauma_FirstAidInfo();
|
|
first.GUID = Guid.NewGuid().ToString();
|
|
first.PatientGuid = patientInfo.PatientGUID;
|
|
if (patientInfo.Attack_Time != null)
|
|
first.OnsetTime = patientInfo.Attack_Time != null ? Convert.ToDateTime(patientInfo.Attack_Time).ToString("yyyy-MM-dd HH:mm") : "";
|
|
first.HistoryIllness = patientInfo.AllergyHistory;
|
|
first.SystolicPressure = health.SystolicPressure;
|
|
first.DiastolicPressure = health.DiastolicPressure;
|
|
first.HeartRate = health.HeartRate;
|
|
first.Pulse = health.Pulse;
|
|
first.RespiratoryRate = health.Breathing;
|
|
first.Temperature = health.Temperature;
|
|
if (patientInfo.ComeHospital == "2")
|
|
first.RescueMeasures = patientInfo.MedicationRecord;
|
|
first.AllergyHistory = patientInfo.AllergyHistory;
|
|
first.ChiefComplaint = patientInfo.ChiefComplaint;
|
|
first.Diagnosis = patientInfo.DiagnosisImpression;
|
|
db.Insertable(first).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand();
|
|
}
|
|
db.Insertable(baseInfo).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand();
|
|
}
|
|
db.Ado.CommitTran();
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
db.Ado.RollbackTran();
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取患者分诊信息
|
|
/// </summary>
|
|
/// <param name="patientGuid"></param>
|
|
/// <returns></returns>
|
|
public PatientTriageModel GetTriagePatientInfo(string patientGuid)
|
|
{
|
|
PatientTriageModel info = new PatientTriageModel();
|
|
info = db.Queryable<T_Service_Patient, T_Service_FirstAid_PatientInfo>((a, b) => a.GUID == b.PatientGUID).Where((a, b) => b.PatientGUID == patientGuid)
|
|
.Select((a, b) => new PatientTriageModel
|
|
{
|
|
PatientGUID = b.PatientGUID,
|
|
Killip = b.Killip,
|
|
SignArea = b.SignArea,
|
|
TriageDepartment = b.TriageDepartment,
|
|
TriageDepartmentName = b.TriageDepartment == "" ? "" : SqlFunc.Subqueryable<T_Base_TriageGo>().Where(it => it.ID == int.Parse(b.TriageDepartment)).Select(it => it.Name),
|
|
Attack_Time = b.Attack_Time,
|
|
PastHistory = b.PastHistory,
|
|
AllergyHistory = b.AllergyHistory,
|
|
ArrivalDoorTime = b.ArrivalDoorTime,
|
|
TriageTime = b.TriageTime,
|
|
ComeHospital = b.ComeHospital,
|
|
DiagnosisImpression = b.DiagnosisImpression,
|
|
SiteSymptoms = b.SiteSymptoms,
|
|
FMCTime = b.FMCTime,
|
|
ArriveHospitalTime = b.ArriveHospitalTime,
|
|
EventID = b.EventID,
|
|
MedicalHistory = b.MedicalHistory,
|
|
ChiefComplaint = b.ChiefComplaint,
|
|
IsGreenWay = a.IsGreenWay,
|
|
CallTime = b.CallTime,
|
|
EventName = b.EventName,
|
|
}).First();
|
|
var oneclass = db.Queryable<T_Service_Trauma_EmergencyScore>().Where(i => i.PatientGuid == patientGuid).First();
|
|
if (oneclass != null)
|
|
info.MEWSScore = oneclass.SumScore;
|
|
var twoclass = db.Queryable<T_Service_FirstAid_PatientMEWS>().Where(i => i.PatientGUID == patientGuid).First();
|
|
if (twoclass != null)
|
|
info.RMESScore = twoclass.TotalScore.ToString();
|
|
return info;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据患者GUID获取疼痛评分
|
|
/// </summary>
|
|
/// <param name="patientGuid"></param>
|
|
/// <returns></returns>
|
|
public DataSetModel GetPainAssessmentByPatientGuid(string patientGuid)
|
|
{
|
|
DataSetModel DataSetModel = new DataSetModel();
|
|
return DataSetModel = db.Queryable<T_Service_FirstAid_PatientInfo>().Where(i => i.PatientGUID == patientGuid).Select(i => new DataSetModel()
|
|
{
|
|
Number = i.PainAssessment == "" ? 0 : SqlFunc.ToInt32(i.PainAssessment),
|
|
TimeDate = i.PainAssessmentTime
|
|
}).First();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 患者评分列表
|
|
/// </summary>
|
|
/// <param name="patientGuid"></param>
|
|
/// <returns></returns>
|
|
public List<PatientTriageScoreModel> GetPatientTriageScoreList(string patientGuid)
|
|
{
|
|
List<PatientTriageScoreModel> list = new List<PatientTriageScoreModel>();
|
|
var patientInfo = db.Queryable<T_Service_FirstAid_PatientInfo, T_SYS_User>((a, b) => new JoinQueryInfos(JoinType.Left, a.CreationID == b.ID)).Where((a, b) => a.PatientGUID == patientGuid).Select((a, b) => new { a.ComeHospital, a.PainAssessment, a.PainAssessmentTime, b.FullName }).First();
|
|
|
|
PatientTriageScoreModel rems = new PatientTriageScoreModel();
|
|
rems.ScoreType = "RMES评分";
|
|
var remsClass = db.Queryable<T_Service_Trauma_EmergencyScore, T_SYS_User>((a, b) => new JoinQueryInfos(JoinType.Left, a.CreatorID == b.ID)).Where((a, b) => a.PatientGuid == patientGuid).Select((a, b) => new { a.SumScore, a.CreationDate, b.FullName }).First();
|
|
if (remsClass != null)
|
|
{
|
|
rems.Score = remsClass.SumScore;
|
|
rems.ScoreTime = Convert.ToDateTime(remsClass.CreationDate).ToString("yyyy-MM-dd HH:mm");
|
|
rems.ScoreName = remsClass.FullName;
|
|
}
|
|
list.Add(rems);
|
|
|
|
PatientTriageScoreModel pain = new PatientTriageScoreModel();
|
|
pain.ScoreType = "PAIN评分";
|
|
if (patientInfo != null)
|
|
{
|
|
pain.Score = patientInfo.PainAssessment;
|
|
pain.ScoreTime = patientInfo.PainAssessmentTime;
|
|
pain.ScoreName = patientInfo.FullName;
|
|
}
|
|
list.Add(pain);
|
|
|
|
PatientTriageScoreModel gcs = new PatientTriageScoreModel();
|
|
gcs.ScoreType = "GCS评分";
|
|
var gcsClass = db.Queryable<T_Service_PatientGCS, T_SYS_User>((a, b) => new JoinQueryInfos(JoinType.Left, a.CreateUser == b.ID)).Where((a, b) => a.PatientGUID == patientGuid).Where((a, b) => a.PatientGUID == patientGuid && a.Flag == 1).Select((a, b) => new { a.Flag, a.TotalScore, a.ScoreTime, b.FullName }).First();
|
|
if (gcsClass != null)
|
|
{
|
|
gcs.Score = gcsClass.TotalScore.ToString();
|
|
gcs.ScoreTime = Convert.ToDateTime(gcsClass.ScoreTime).ToString("yyyy-MM-dd HH:mm");
|
|
gcs.ScoreName = gcsClass.FullName;
|
|
}
|
|
list.Add(gcs);
|
|
|
|
PatientTriageScoreModel phi = new PatientTriageScoreModel();
|
|
phi.ScoreType = "PHI院内评分";
|
|
var phiClass = db.Queryable<T_Service_FirstAid_PatientPHI, T_SYS_User>((a, b) => new JoinQueryInfos(JoinType.Left, a.CreateUser == b.ID)).Where((a, b) => a.PatientGUID == patientGuid)
|
|
.Select((a, b) => new { a.Flag, a.TotalScore, a.ScoreTime, b.FullName }).ToList();
|
|
if (phiClass != null && phiClass.Count > 0)
|
|
{
|
|
for (int i = 0; i < phiClass.Count; i++)
|
|
{
|
|
if (phiClass[i].Flag == 1)
|
|
{
|
|
phi.Score = phiClass[i].TotalScore.ToString();
|
|
phi.ScoreTime = Convert.ToDateTime(phiClass[i].ScoreTime).ToString("yyyy-MM-dd HH:mm");
|
|
phi.ScoreName = phiClass[i].FullName;
|
|
}
|
|
}
|
|
|
|
}
|
|
list.Add(phi);
|
|
|
|
PatientTriageScoreModel rts = new PatientTriageScoreModel();
|
|
rts.ScoreType = "RTS院内评分";
|
|
var rtsClass = db.Queryable<T_Service_FirstAid_PatientRTS, T_SYS_User>((a, b) => new JoinQueryInfos(JoinType.Left, a.CreateUser == b.ID)).Where((a, b) => a.PatientGUID == patientGuid)
|
|
.Select((a, b) => new { a.Flag, a.TotalScore, a.ScoreTime, b.FullName }).ToList();
|
|
if (rtsClass != null && rtsClass.Count > 0)
|
|
{
|
|
for (int i = 0; i < rtsClass.Count; i++)
|
|
{
|
|
if (rtsClass[i].Flag == 1)
|
|
{
|
|
rts.Score = rtsClass[i].TotalScore.ToString();
|
|
rts.ScoreTime = Convert.ToDateTime(rtsClass[i].ScoreTime).ToString("yyyy-MM-dd HH:mm");
|
|
rts.ScoreName = rtsClass[i].FullName;
|
|
}
|
|
}
|
|
}
|
|
list.Add(rts);
|
|
|
|
PatientTriageScoreModel mems = new PatientTriageScoreModel();
|
|
mems.ScoreType = "MEWS院内评分";
|
|
var memsClass = db.Queryable<T_Service_FirstAid_PatientMEWS, T_SYS_User>((a, b) => new JoinQueryInfos(JoinType.Left, a.CreateUser == b.ID)).Where((a, b) => a.PatientGUID == patientGuid)
|
|
.Select((a, b) => new { a.Flag, a.TotalScore, a.ScoreTime, b.FullName }).ToList();
|
|
|
|
if (memsClass != null && memsClass.Count > 0)
|
|
{
|
|
for (int i = 0; i < memsClass.Count; i++)
|
|
{
|
|
if (memsClass[i].Flag == 1)
|
|
{
|
|
mems.Score = memsClass[i].TotalScore.ToString();
|
|
mems.ScoreTime = Convert.ToDateTime(memsClass[i].ScoreTime).ToString("yyyy-MM-dd HH:mm");
|
|
mems.ScoreName = memsClass[i].FullName;
|
|
}
|
|
}
|
|
}
|
|
list.Add(mems);
|
|
|
|
|
|
//====================== 120来院方式 ===============================//
|
|
if (patientInfo.ComeHospital == "2")
|
|
{
|
|
PatientTriageScoreModel phi2 = new PatientTriageScoreModel();
|
|
phi2.ScoreType = "PHI院前评分";
|
|
if (phiClass != null && phiClass.Count > 0)
|
|
{
|
|
for (int i = 0; i < phiClass.Count; i++)
|
|
{
|
|
if (phiClass[i].Flag == 0)
|
|
{
|
|
phi2.Score = phiClass[i].TotalScore.ToString();
|
|
phi2.ScoreTime = Convert.ToDateTime(phiClass[i].ScoreTime).ToString("yyyy-MM-dd HH:mm");
|
|
phi2.ScoreName = phiClass[i].FullName;
|
|
}
|
|
}
|
|
}
|
|
list.Add(phi2);
|
|
|
|
|
|
PatientTriageScoreModel rts2 = new PatientTriageScoreModel();
|
|
rts2.ScoreType = "RTS院前评分";
|
|
|
|
if (rtsClass != null && rtsClass.Count > 0)
|
|
{
|
|
for (int i = 0; i < rtsClass.Count; i++)
|
|
{
|
|
if (rtsClass[i].Flag == 0)
|
|
{
|
|
rts2.Score = rtsClass[i].TotalScore.ToString();
|
|
rts2.ScoreTime = Convert.ToDateTime(rtsClass[i].ScoreTime).ToString("yyyy-MM-dd HH:mm");
|
|
rts2.ScoreName = rtsClass[i].FullName;
|
|
}
|
|
}
|
|
|
|
}
|
|
list.Add(rts2);
|
|
|
|
|
|
PatientTriageScoreModel mems2 = new PatientTriageScoreModel();
|
|
mems2.ScoreType = "MEWS院前评分";
|
|
if (memsClass != null && memsClass.Count > 0)
|
|
{
|
|
for (int i = 0; i < memsClass.Count; i++)
|
|
{
|
|
if (memsClass[i].Flag == 0)
|
|
{
|
|
mems2.Score = memsClass[i].TotalScore.ToString();
|
|
mems2.ScoreTime = Convert.ToDateTime(memsClass[i].ScoreTime).ToString("yyyy-MM-dd HH:mm");
|
|
mems2.ScoreName = memsClass[i].FullName;
|
|
}
|
|
}
|
|
}
|
|
list.Add(mems2);
|
|
|
|
|
|
PatientTriageScoreModel nihss = new PatientTriageScoreModel();
|
|
nihss.ScoreType = "NIHSS院前评分";
|
|
var nihssClass = db.Queryable<T_Service_PatientNIHSS, T_SYS_User>((a, b) => new JoinQueryInfos(JoinType.Left, a.CreateUser == b.ID)).Where((a, b) => a.PatientGUID == patientGuid && a.Flag == 1).Select((a, b) => new { a.TotalScore, a.ScoreTime, b.FullName }).First();
|
|
if (nihssClass != null)
|
|
{
|
|
|
|
nihss.Score = nihssClass.TotalScore.ToString();
|
|
nihss.ScoreTime = Convert.ToDateTime(nihssClass.ScoreTime).ToString("yyyy-MM-dd HH:mm");
|
|
nihss.ScoreName = nihssClass.FullName;
|
|
}
|
|
list.Add(nihss);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据患者唯一标识删除患者
|
|
/// </summary>
|
|
/// <param name="info"></param>
|
|
/// <returns></returns>
|
|
public bool UpdateDeletFlagByPatientGuid(T_Service_FirstAid_PatientInfo info)
|
|
{
|
|
return db.Updateable(info).ExecuteCommand() == 1 ? true : false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据患者唯一标识获取信息
|
|
/// </summary>
|
|
/// <param name="patientGuid"></param>
|
|
/// <returns></returns>
|
|
public T_Service_FirstAid_PatientInfo GetInfoByPatientGuid(string patientGuid)
|
|
{
|
|
return db.Queryable<T_Service_FirstAid_PatientInfo>().Where(i => i.PatientGUID == patientGuid && i.DeleteFlag == 0).First();
|
|
}
|
|
}
|
|
}
|