StableVersion4.3/HL_FristAidPlatform_Bussiness/TranService/EmergencyTriageTranBLL.cs

753 lines
36 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using HL_FristAidPlatform_DataBase;
using HL_FristAidPlatform_Help;
using HL_FristAidPlatform_IDataBase;
using HL_FristAidPlatform_Models;
using SqlSugar;
using System;
using System.Collections.Generic;
namespace HL_FristAidPlatform_Bussiness
{
/// <summary>
/// 急诊分诊
/// </summary>
public class EmergencyTriageTranBLL
{
private IT_Service_FirstAid_Call firstAid_Call = new T_Service_FirstAid_CallDB();
private IT_Base_Hospital hospital = new T_Base_HospitalDB();
private IEmergencyTriageService service = new EmergencyTriageService();
private IT_Service_FirstAid_AlarmTaskInfo taskInfo = new T_Service_FirstAid_AlarmTaskInfoDB();
IT_Service_Patient patientService = new T_Service_PatientDB();
IT_Service_ChestPain_TreatmentInfo TreatmentInfo = new T_Service_ChestPain_TreatmentInfoDB();
IT_Service_ChestPain_TreatmentPCIInfo TreatmentPCIInfo = new T_Service_ChestPain_TreatmentPCIInfoDB();
IT_Service_ChestPain_OutComeInfo OutComeInfo = new T_Service_ChestPain_OutComeInfoDB();
IT_Service_ChestPain_FirstAIDInfo firstAIDInfoService = new T_Service_ChestPain_FirstAIDInfoDB();
IT_Service_ChestPain_Add IService = new T_Service_ChestPain_AddDB();
IT_Service_ChestPain_PatientsTimeAxis _PatientsTimeAxis = new T_Service_ChestPain_PatientsTimeAxisDB();
private IT_Service_Apoplexy_Prehospital prehospitalService = new T_Service_Apoplexy_PrehospitalDB();
IT_Service_Trauma_BaseInfo baseInfoService = new T_Service_Trauma_BaseInfoDB();
/// <summary>
/// 分诊保存
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public string EmergencyTriageTran(EmergencyTriageModel model)
{
var task = taskInfo.GetPatientInfoModel(model.TaskGUID);
#region
T_Service_Patient patient = new T_Service_Patient();
patient.GUID = Guid.NewGuid().ToString();
patient.SystemModuleID = model.SystemModelId;
patient.HospitalGuid = task.HospitalGuid;
patient.Name = model.Name;
patient.Age = model.Age;
patient.Gender = model.Gender;
patient.Nation = model.Nation;
patient.MobilePhone = model.Phone;
patient.IdentityCard = model.IdentityCard;
patient.Credentials_Type = model.Credentials_Type;
patient.Attack_Address = model.Attack_Address;
patient.Birthday = model.Birthday;
patient.RegisterTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
patient.Address = model.Address;
//patient.Profession = model.Profession;
patient.EmergencyContact = model.EmergencyContact;
patient.EmergencyContactPhone = model.EmergencyContactPhone;
patient.CreationDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
//胸痛系统时间轴显示必须给以下3个字段赋值
patient.Thrombolysis = "0";
patient.Interventional_Therapy = "0";
if (model.TriageDepartment == "导管室")
{
patient.IsGreenChannel = 3;
}
else
{
patient.IsGreenChannel = 1;
}
T_Service_FirstAid_PatientInfo fp = new T_Service_FirstAid_PatientInfo();
fp.GUID = Guid.NewGuid().ToString();
fp.TransportAddress = model.TransportAddress;
fp.PatientGUID = patient.GUID;
fp.TaskGUID = model.TaskGUID;
fp.FilledByID = model.CreatorID;
fp.Killip = model.Killip;
fp.SignArea = model.SignArea;
fp.TriageDepartment = model.TriageDepartment;
if (!string.IsNullOrEmpty(model.Attack_Time))
fp.Attack_Time = Convert.ToDateTime(model.Attack_Time)+"";
fp.TransportAddress = model.TransportAddress;
fp.ChiefComplaint = model.ChiefComplaint;
fp.MedicalHistory = model.MedicalHistory;
fp.AllergyHistory = model.AllergyHistory;
fp.DisposalRecord = model.DisposalRecord;
fp.WhereAbouts = 0;
fp.PathogenyGUID = model.PathogenyGUID;
fp.IdentityType = model.IdentityType;
T_Service_FirstAid_HealthCheckup checkup = new T_Service_FirstAid_HealthCheckup();
if (!string.IsNullOrEmpty(model.Pulse) || !string.IsNullOrEmpty(model.HeartRate) || !string.IsNullOrEmpty(model.Breathing) || !string.IsNullOrEmpty(model.Temperature) || !string.IsNullOrEmpty(model.DiastolicPressure) || !string.IsNullOrEmpty(model.SystolicPressure))
{
checkup.GUID = Guid.NewGuid().ToString();
checkup.PatientGUID = patient.GUID;
checkup.Pulse = model.Pulse;
checkup.Temperature = model.Temperature;
checkup.HeartRate = model.HeartRate;
checkup.SystolicPressure = model.SystolicPressure;
checkup.DiastolicPressure = model.DiastolicPressure;
checkup.Breathing = model.Breathing;
checkup.Conscious = model.Conscious;
checkup.DeleteFlag = 0;
checkup.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
checkup.CreateUser = model.CreatorID;
}
T_Service_FirstAid_AssistantExamination ass = new T_Service_FirstAid_AssistantExamination();
if (!string.IsNullOrEmpty(model.PrimaryDiagnosis) || !string.IsNullOrEmpty(model.Illness))
{
ass.GUID = Guid.NewGuid().ToString();
ass.PatientGUID = patient.GUID;
ass.Illness = model.Illness;
ass.PrimaryDiagnosis = model.PrimaryDiagnosis;
ass.CreateUser = model.CreatorID;
ass.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
ass.DeleteFlag = 1;
}
//======== 根据SystemmodelID 操作胸痛或者卒中 =======
T_Service_ChestPain_FirstAIDInfo info = new T_Service_ChestPain_FirstAIDInfo();
T_Service_Apoplexy_Prehospital prehospital = new T_Service_Apoplexy_Prehospital();
switch (model.SystemModelId)
{
case 2:
var hospitalInfo = hospital.GethospitalGUID(task.HospitalGuid);
if (hospitalInfo == null)
{
return "医院不存在";
}
info.GUID = Guid.NewGuid().ToString();
info.PatientGuid = patient.GUID;
info.Heart_Rate = model.HeartRate;
info.Pulse_Rate = model.Pulse;
info.Temperature = model.Temperature;
if (!string.IsNullOrEmpty(model.Attack_Time))
info.Attack_Time = Convert.ToDateTime(model.Attack_Time)+"";
// info.Attack_Zone = model.Attack_Zone;
info.Attack_Address = info.Attack_Address;
info.Respiration_Rate = model.Breathing;
info.Pulse_Rate = model.Pulse;
info.Blood_Pressure = model.SystolicPressure + "/" + model.DiastolicPressure;
info.CW_Coming_Way_Code = "1";
info.CW_120_Help_Time = Convert.ToDateTime(task.CallTime);
//info.CW_120_Ambulance_Department = "1";
//info.Patient_Remark = model.Note;
info.CreationDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
info.CreatorID = model.CreatorID;
info.Consciousness_Type = model.Conscious;
break;
case 3:
prehospital.GUID = Guid.NewGuid().ToString();
prehospital.PatientGuid = patient.GUID;
// prehospital.OnsetTimeInterval = model.Attack_Zone;
prehospital.IsCallHelp = 1;
prehospital.CallHelpWay = 1;
//prehospital.BCLyType = 0;
if (!string.IsNullOrEmpty(model.Breathing))
prehospital.Breathing = model.Breathing;
if (!string.IsNullOrEmpty(model.HeartRate))
prehospital.HeartRate =model.HeartRate;
prehospital.HESsy = model.SystolicPressure;
prehospital.HESzy = model.DiastolicPressure;
prehospital.Temperature = model.Temperature;
prehospital.CallHelpWay = 1;
break;
}
#endregion
return service.EmergencyTriageTran(fp, checkup, ass, patient, info, prehospital, model.CreatorID);
}
/// <summary>
/// 新增急诊分诊患者
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public string AddEmergencyTriage(EmergencyTriageModel model)
{
var task = taskInfo.GetPatientInfoModel(model.TaskGUID);
#region
T_Service_Patient patient = new T_Service_Patient();
patient.GUID = Guid.NewGuid().ToString();
patient.SystemModuleID = model.SystemModelId;
patient.HospitalGuid = model.HospitalGuid;
patient.Name = model.Name;
patient.Age = model.Age;
patient.Gender = model.Gender;
patient.Nation = model.Nation;
patient.MobilePhone = model.Phone;
patient.IdentityCard = model.IdentityCard;
patient.Credentials_Type = model.Credentials_Type;
patient.Attack_Address = model.Attack_Address;
patient.Birthday = model.Birthday;
patient.RegisterTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
patient.Address = model.Address;
patient.EmergencyContact = model.EmergencyContact;
patient.EmergencyContactPhone = model.EmergencyContactPhone;
patient.CreationDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
if (!string.IsNullOrEmpty(model.Category))
{
patient.Category = int.Parse(model.Category);
}
patient.IsGreenWay = model.IsGreenWay;
patient.CreatorID = model.CreatorID;
//patient.WristStrapID = model.WristStrapID;
//patient.EqmtNo = model.EqmtNo;
//patient.Creator = model.Creator;
//patient.Editor = model.Editor;
//patient.EditorID = model.EditorID;
T_Service_FirstAid_PatientInfo fp = new T_Service_FirstAid_PatientInfo();
fp.GUID = Guid.NewGuid().ToString();
fp.TransportAddress = model.TransportAddress;
fp.PatientGUID = patient.GUID;
fp.TaskGUID = model.TaskGUID;
fp.FilledByID = model.CreatorID;
fp.Killip = model.Killip;
fp.SignArea = model.SignArea;
fp.TriageDepartment = model.TriageDepartment;
if (!string.IsNullOrEmpty(model.Attack_Time))
fp.Attack_Time = Convert.ToDateTime(model.Attack_Time)+"";
fp.TransportAddress = model.TransportAddress;
fp.ChiefComplaint = model.ChiefComplaint;
fp.MedicalHistory = model.MedicalHistory;
fp.AllergyHistory = model.AllergyHistory;
fp.DisposalRecord = model.DisposalRecord;
fp.WhereAbouts = 0;
fp.PathogenyGUID = model.PathogenyGUID;
fp.IdentityType = model.IdentityType;
fp.DiagnosisImpression = model.DiagnosisImpression;
fp.ComeHospital = model.ComeHospital;
fp.FeverTime = model.FeverTime;
fp.FMCTime = model.FMCTime;
fp.CallTime = model.CallTime;
fp.ArrivalDoorTime = model.ArrivalDoorTime;
fp.EventID = model.EventID;
fp.EventName = model.EventName;
fp.TriageTime = model.TriageTime;
fp.SiteSymptoms = model.SiteSymptoms;
T_Service_FirstAid_HealthCheckup checkup = new T_Service_FirstAid_HealthCheckup();
if (!string.IsNullOrEmpty(model.Pulse) || !string.IsNullOrEmpty(model.HeartRate) || !string.IsNullOrEmpty(model.Breathing) || !string.IsNullOrEmpty(model.Temperature) || !string.IsNullOrEmpty(model.DiastolicPressure) || !string.IsNullOrEmpty(model.SystolicPressure))
{
checkup.GUID = Guid.NewGuid().ToString();
checkup.PatientGUID = patient.GUID;
checkup.Pulse = model.Pulse;
checkup.Temperature = model.Temperature;
checkup.HeartRate = model.HeartRate;
checkup.SystolicPressure = model.SystolicPressure;
checkup.DiastolicPressure = model.DiastolicPressure;
checkup.Breathing = model.Breathing;
checkup.Conscious = model.Conscious;
checkup.DeleteFlag = 0;
checkup.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
checkup.CreateUser = model.CreatorID;
}
T_Service_FirstAid_AssistantExamination ass = new T_Service_FirstAid_AssistantExamination();
if (!string.IsNullOrEmpty(model.PrimaryDiagnosis) || !string.IsNullOrEmpty(model.Illness))
{
ass.GUID = Guid.NewGuid().ToString();
ass.PatientGUID = patient.GUID;
ass.Illness = model.Illness;
ass.PrimaryDiagnosis = model.PrimaryDiagnosis;
ass.CreateUser = model.CreatorID;
ass.CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
ass.DeleteFlag = 1;
}
string resultPatientGuid = service.AddEmergencyTriage(fp, checkup, ass, patient);
//======== 根据SystemmodelID 操作胸痛或者卒中 =======
//T_Service_ChestPain_FirstAIDInfo info = new T_Service_ChestPain_FirstAIDInfo();
//T_Service_Apoplexy_Prehospital prehospital = new T_Service_Apoplexy_Prehospital();
switch (model.SystemModelId)
{
case 2:
//T_Service_ChestPain_Prehospital chestPainPrehospital = new T_Service_ChestPain_Prehospital();
T_Service_ChestPain_FirstAIDInfo firstAIDInfo = new T_Service_ChestPain_FirstAIDInfo();
T_Service_ChestPain_TreatmentInfo M_TreatmentInfo = new T_Service_ChestPain_TreatmentInfo();
T_Service_ChestPain_TreatmentPCIInfo M_TreatmentPCIInfo = new T_Service_ChestPain_TreatmentPCIInfo();
T_Service_ChestPain_OutComeInfo M_OutComeInfo = new T_Service_ChestPain_OutComeInfo();
T_Service_ChestPain_PatientsTimeAxis M_PatientsTimeAxis = new T_Service_ChestPain_PatientsTimeAxis();
if (!SqlFunc.IsNullOrEmpty(patient.GUID))
{
var oneClass = patientService.Get(patient.GUID);
if (oneClass == null)
{
return "";
}
var TreatmentInfoClass = TreatmentInfo.GetModel(patient.GUID);
if (TreatmentInfoClass != null)
{
M_TreatmentInfo.GUID = TreatmentInfoClass.GUID;
}
var TreatmentPCIInfoClass = TreatmentPCIInfo.GetModel(patient.GUID);
if (TreatmentPCIInfoClass != null)
{
M_TreatmentPCIInfo.GUID = TreatmentPCIInfoClass.GUID;
}
var OutComeInfoClass = OutComeInfo.GetModel(patient.GUID);
if (OutComeInfoClass != null)
{
M_OutComeInfo.GUID = OutComeInfoClass.GUID;
}
}
//胸痛系统时间轴显示必须给以下3个字段赋值
patient.Thrombolysis = "0";
patient.Interventional_Therapy = "0";
patient.IsGreenChannel = 1;
if (model.TriageDepartment == "导管室")
{
patient.IsGreenChannel = 3;
}
else
{
patient.IsGreenChannel = 1;
}
if (!string.IsNullOrEmpty(model.IdentityCard))
patient.Credentials_Type = "1";
var twoClass = firstAIDInfoService.GetModelOfPatient(patient.GUID);
if (twoClass != null)
{
firstAIDInfo.GUID = twoClass.GUID;
}
firstAIDInfo.PatientGuid = patient.GUID;
if (!string.IsNullOrEmpty(model.Attack_Time + ""))
{
firstAIDInfo.Attack_Time = Convert.ToDateTime(model.Attack_Time)+"";
firstAIDInfo.Is_Null_Attack_Detail_Time = "0";
}
switch (model.ComeHospital)
{
//自行来院
case "1":
firstAIDInfo.CW_Coming_Way_Code = "3";
firstAIDInfo.CW_ZXLY_First_MC_Time = Convert.ToDateTime(model.FMCTime);
break;
//120来院
case "2":
firstAIDInfo.CW_Coming_Way_Code = "1";
firstAIDInfo.CW_120_First_MC_Time = Convert.ToDateTime(model.FMCTime)+"";
break;
//院内发病
case "3":
firstAIDInfo.CW_Coming_Way_Code = "4";
firstAIDInfo.CW_YNFB_First_MC_Time = Convert.ToDateTime(model.FMCTime);
break;
//转院
case "4":
firstAIDInfo.CW_Coming_Way_Code = "2";
firstAIDInfo.CW_ZY_First_MC_Time = Convert.ToDateTime(model.FMCTime);
break;
//转院
case "5":
firstAIDInfo.CW_Coming_Way_Code = "2";
firstAIDInfo.CW_ZY_First_MC_Time = Convert.ToDateTime(model.FMCTime);
break;
//转院
case "6":
firstAIDInfo.CW_Coming_Way_Code = "2";
firstAIDInfo.CW_ZY_First_MC_Time = Convert.ToDateTime(model.FMCTime);
break;
default:
break;
}
//firstAIDInfo.Province = model.Province;
//firstAIDInfo.City = model.City;
//firstAIDInfo.Area = model.Area;
firstAIDInfo.Attack_Address = model.Attack_Address;
// 胸痛诊疗
M_TreatmentInfo.PatientGuid = patient.GUID;
// 导管室信息
M_TreatmentPCIInfo.PatientGuid = patient.GUID;
// 患者转归
M_OutComeInfo.PatientGuid = patient.GUID;
string temp = IService.InsertTriage(firstAIDInfo, M_TreatmentInfo, M_TreatmentPCIInfo, M_OutComeInfo);
if (temp != "")
{
//增加对应模块的时间节点记录业务 且排除已存在的记录
M_PatientsTimeAxis.PatientGuid = temp;
M_PatientsTimeAxis.SystemModuleID = model.SystemModelId;
bool isTime = _PatientsTimeAxis.Add(M_PatientsTimeAxis);
}
break;
case 3:
T_Service_Apoplexy_Prehospital prehospital = new T_Service_Apoplexy_Prehospital();
if (!SqlFunc.IsNullOrEmpty(patient.GUID))
{
var oneClass = patientService.Get(patient.GUID);
if (oneClass == null)
{
return "";
}
else
{
patient.GUID = oneClass.GUID;
}
var result = prehospitalService.GetOfPatient(patient.GUID);
if (result != null)
{
prehospital.GUID = result.GUID;
}
}
prehospital.PatientGuid = patient.GUID;
prehospital.DiseaseRecord = model.ChiefComplaint;
switch (model.ComeHospital)
{
//自行来院
case "1":
prehospital.BCLyType = "4";
break;
//120来院
case "2":
prehospital.BCLyType = "1";
break;
//院内发病
case "3":
prehospital.BCLyType = "5";
break;
//转院
case "4":
prehospital.BCLyType = "3";
break;
//转院
case "5":
prehospital.BCLyType = "3";
break;
//转院
case "6":
prehospital.BCLyType = "3";
break;
default:
break;
}
//prehospital.BCRyType = model.BCRyType;
prehospital.CreateUser = model.CreatorID;
if (!string.IsNullOrEmpty(model.IdentityCard))
patient.Credentials_Type = "1";
patientService.SaveApoplexyPaitentInfoForTriage(prehospital);
break;
case 4:
T_Service_Trauma_BaseInfo info = new T_Service_Trauma_BaseInfo();
switch (model.ComeHospital)
{
//自行来院
case "1":
info.ComeHosptialWay = "3";
break;
//120来院
case "2":
info.ComeHosptialWay = "1";
break;
//院内发病
case "3":
info.ComeHosptialWay = "4";
break;
//转院
case "4":
info.ComeHosptialWay = "2";
break;
//转院
case "5":
info.ComeHosptialWay = "2";
break;
//其他
case "6":
info.ComeHosptialWay = "5";
break;
default:
break;
}
info.CreationDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
info.CreatorID = model.CreatorID;
//info.FollowingDoctor = model.FollowingDoctor;
//info.FollowingNurse = model.FollowingNurse;
info.GUID = Guid.NewGuid().ToString();
info.PatientGuid = patient.GUID;
//info.HosptialName = model.HosptialName;
//info.IllnessLevel = model.IllnessLevel;
//info.MPDS = model.MPDS;
//info.MPDSType = model.MPDSType;
//info.AttackAddress = model.AttackAddress;
//info.ZXLYComeHosptialWay = model.ZXLYComeHosptialWay;
//info.AmbulanceType = model.AmbulanceType;
//info.OtherComeHosptialWay = model.OtherComeHosptialWay;
//info.MPDSContent = model.MPDSContent;
baseInfoService.SaveTraumaPatientInfoForTriage(info);
break;
}
#endregion
return resultPatientGuid;
}
/// <summary>
/// 新增急诊分诊患者
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public string AddBatchPatient(EmergencyTriageModel model)
{
string resultPatientGuid = "";
#region
for (int i = 1; i <= model.EventNumber; i++)
{
T_Service_Patient patient = new T_Service_Patient();
patient.GUID = Guid.NewGuid().ToString();
patient.SystemModuleID = model.SystemModelId;
patient.HospitalGuid = model.HospitalGuid;
patient.Name = model.EventName + "_" + i + "号患者";
patient.Age = model.Age;
patient.Gender = model.Gender;
patient.Nation = model.Nation;
patient.MobilePhone = model.Phone;
patient.IdentityCard = model.IdentityCard;
patient.Credentials_Type = model.Credentials_Type;
patient.Attack_Address = model.Attack_Address;
patient.Birthday = model.Birthday;
patient.RegisterTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
patient.Address = model.Address;
patient.EmergencyContact = model.EmergencyContact;
patient.EmergencyContactPhone = model.EmergencyContactPhone;
patient.CreationDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
if (!string.IsNullOrEmpty(model.Category))
{
patient.Category = int.Parse(model.Category);
}
patient.CreatorID = model.CreatorID;
patient.DeleteFlag = 0;
T_Service_FirstAid_PatientInfo fp = new T_Service_FirstAid_PatientInfo();
fp.GUID = Guid.NewGuid().ToString();
fp.TransportAddress = model.TransportAddress;
fp.PatientGUID = patient.GUID;
fp.TaskGUID = model.TaskGUID;
fp.FilledByID = model.CreatorID;
fp.Killip = model.Killip;
fp.SignArea = model.SignArea;
fp.TriageDepartment = model.TriageDepartment;
if (!string.IsNullOrEmpty(model.Attack_Time))
fp.Attack_Time = Convert.ToDateTime(model.Attack_Time)+"";
fp.TransportAddress = model.TransportAddress;
fp.ChiefComplaint = model.ChiefComplaint;
fp.MedicalHistory = model.MedicalHistory;
fp.AllergyHistory = model.AllergyHistory;
fp.DisposalRecord = model.DisposalRecord;
fp.WhereAbouts = 0;
fp.PathogenyGUID = model.PathogenyGUID;
fp.IdentityType = model.IdentityType;
fp.DiagnosisImpression = model.DiagnosisImpression;
fp.ComeHospital = model.ComeHospital;
fp.FeverTime = model.FeverTime;
fp.FMCTime = model.FMCTime;
fp.CallTime = model.CallTime;
fp.ArrivalDoorTime = model.ArrivalDoorTime;
fp.EventID = model.EventID;
fp.TriageTime = model.TriageTime;
fp.DeleteFlag = 0;
fp.EventName = model.EventName;
resultPatientGuid += service.AddBatchPatient(fp, patient);
}
#endregion
return resultPatientGuid;
}
/// <summary>
/// 出科召回
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public string RecallDepartment(EmergencyTriageModel model)
{
#region
T_Service_FirstAid_PatientInfo fp = new T_Service_FirstAid_PatientInfo();
fp.PatientGUID = model.PatientGuid;
fp.TriageDepartment = model.TriageDepartment;
string resultPatientGuid = service.RecallDepartment(fp);
//======== 根据SystemmodelID 操作胸痛或者卒中 =======
switch (model.SystemModelId)
{
case 2:
//T_Service_ChestPain_Prehospital chestPainPrehospital = new T_Service_ChestPain_Prehospital();
T_Service_ChestPain_FirstAIDInfo firstAIDInfo = new T_Service_ChestPain_FirstAIDInfo();
T_Service_ChestPain_TreatmentInfo M_TreatmentInfo = new T_Service_ChestPain_TreatmentInfo();
T_Service_ChestPain_TreatmentPCIInfo M_TreatmentPCIInfo = new T_Service_ChestPain_TreatmentPCIInfo();
T_Service_ChestPain_OutComeInfo M_OutComeInfo = new T_Service_ChestPain_OutComeInfo();
T_Service_ChestPain_PatientsTimeAxis M_PatientsTimeAxis = new T_Service_ChestPain_PatientsTimeAxis();
firstAIDInfo.DeleteFlag = 1;
firstAIDInfo.PatientGuid = model.PatientGuid;
firstAIDInfoService.UpdateNotNullColumns(firstAIDInfo);
M_TreatmentInfo.DeleteFlag = 1;
M_TreatmentInfo.PatientGuid = model.PatientGuid;
TreatmentInfo.UpdateNotNullColumns(M_TreatmentInfo);
_PatientsTimeAxis.DeleteForPatientGuid(model.PatientGuid);
M_TreatmentPCIInfo.DeleteFlag = 1;
M_TreatmentPCIInfo.PatientGuid = model.PatientGuid;
TreatmentPCIInfo.UpdateNotNullColumns(M_TreatmentPCIInfo);
M_OutComeInfo.DeleteFlag = 1;
M_OutComeInfo.PatientGuid = model.PatientGuid;
OutComeInfo.UpdateNotNullColumns(M_OutComeInfo);
break;
case 3:
T_Service_Apoplexy_Prehospital prehospital = new T_Service_Apoplexy_Prehospital();
prehospital.DeleteFlag = 1;
prehospital.PatientGuid = model.PatientGuid;
prehospitalService.UpdateNotNullColumns(prehospital);
break;
case 4:
T_Service_Trauma_BaseInfo info = new T_Service_Trauma_BaseInfo();
info.DeleteFlag = 1;
info.PatientGuid = model.PatientGuid;
baseInfoService.UpdateNotNullColumns(info);
break;
}
#endregion
return resultPatientGuid;
}
/// <summary>
/// 交接 非重大事故
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public MessageModel<bool> HandoverVehicleAndPer(HandoverModel model)
{
var res = firstAid_Call.GetOfGUID(model.GUID);
T_Service_Patient patient = new T_Service_Patient();
patient.GUID = Guid.NewGuid().ToString();
patient.HospitalGuid = model.HospitalGuid;
patient.Name = model.Name;
patient.Age = model.Age;
patient.Gender = model.Gender;
patient.MobilePhone = model.Phone;
patient.Attack_Address = model.CallAddress;
T_Service_FirstAid_HealthCheckup health = new T_Service_FirstAid_HealthCheckup();
health.GUID = Guid.NewGuid().ToString();
health.PatientGUID = patient.GUID;
health.Pulse = model.Pulse;
health.HeartRate = model.HeartRate;
health.SystolicPressure = model.SystolicPressure;
health.DiastolicPressure = model.DiastolicPressure;
health.Temperature = model.Temperature;
health.Breathing = model.Breathing;
health.DisposalRecord = model.DisposalRecord;
//修改人员状态
List<T_Service_FirstAid_Personnel> perList = new List<T_Service_FirstAid_Personnel>();
List<T_Base_Ambulance> ambList = new List<T_Base_Ambulance>();
if (res == null)
{
return new MessageModel<bool> { Success = false, Msg = "CallGUID不存在" };
}
string[] after = res.AccompanyinPersonnel.Split(new char[] { ',' });
for (int i = 0; i < after.Length; i++)
{
T_Service_FirstAid_Personnel personnel = new T_Service_FirstAid_Personnel();
personnel.GUID = after[i];
perList.Add(personnel);
}
string[] result = res.VehicleGUID.Split(new char[] { ',' });
for (int i = 0; i < result.Length; i++)
{
T_Base_Ambulance amb = new T_Base_Ambulance();
amb.GUID = result[i];
ambList.Add(amb);
}
T_Service_FirstAid_Call call = new T_Service_FirstAid_Call();
call.GUID = model.GUID;
call.TaskState = 5;
call.HandoverTime = DateTime.Now.ToString();
call.HandoverUser = model.HandoverUser;
if (service.HandoverVehicleAndPer(patient, health, perList, ambList, call, Convert.ToInt32(res.WristStrapID)))
{
return new MessageModel<bool> { Success = true, Msg = "操作成功" };
}
else
{
return new MessageModel<bool> { Success = false, Msg = "操作失败" };
}
}
/// <summary>
/// 交接 重大事故(未修改标签卡状态 后期加)
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public MessageModel<bool> HandoverVehicleAndPer(List<AccidentHandoverModel> list)
{
List<T_Service_FirstAid_Personnel> perlist = new List<T_Service_FirstAid_Personnel>();
List<T_Base_Ambulance> ambList = new List<T_Base_Ambulance>();
string guid = list[0].GUID;
for (int i = 0; i < list.Count; i++)
{
if (list[i].Personnels.Count > 0 && list[i].Personnels != null)
{
for (int j = 0; j < list[i].Personnels.Count; j++)
{
T_Service_FirstAid_Personnel per = new T_Service_FirstAid_Personnel();
per.GUID = list[i].Personnels[j].GUID;
perlist.Add(per);
}
}
if (list[i].Ambulances != null && list[i].Ambulances.Count > 0)
{
for (int k = 0; k < list[i].Ambulances.Count; k++)
{
T_Base_Ambulance amb = new T_Base_Ambulance();
amb.GUID = list[i].Ambulances[k].GUID;
ambList.Add(amb);
}
}
}
T_Service_FirstAid_Call call = new T_Service_FirstAid_Call();
call.GUID = guid;
if (service.HandoverVehicleAndPer(perlist, ambList, guid))
{
return new MessageModel<bool> { Success = true, Msg = "操作成功" };
}
else
{
return new MessageModel<bool> { Success = false, Msg = "操作失败" };
}
}
}
}