92 lines
4.0 KiB
C#
92 lines
4.0 KiB
C#
using HL_FristAidPlatform_Help;
|
|
using HL_FristAidPlatform_IDataBase;
|
|
using HL_FristAidPlatform_Models;
|
|
using SqlSugar;
|
|
using System;
|
|
|
|
namespace HL_FristAidPlatform_DataBase
|
|
{
|
|
/// <summary>
|
|
/// 院前患者信息修改事务
|
|
/// </summary>
|
|
public class FirstAidPatientService : BaseDB, IFirstAidPatientService
|
|
{
|
|
public SqlSugarClient db = GetClient();
|
|
|
|
|
|
/// <summary>
|
|
/// 更新患者院前信息
|
|
/// </summary>
|
|
/// <param name="patient"></param>
|
|
/// <param name="info"></param>
|
|
/// <param name="aid"></param>
|
|
/// <param name="prehospital"></param>
|
|
/// <returns></returns>
|
|
public bool UpdateFirstAidPatientsInfo(T_Service_Patient patient, T_Service_FirstAid_PatientInfo info)
|
|
{
|
|
try
|
|
{
|
|
db.Ado.BeginTran();
|
|
if (!string.IsNullOrEmpty(patient.GUID))
|
|
{
|
|
db.Updateable(patient).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|
|
|
}
|
|
if (!string.IsNullOrEmpty(info.GUID))
|
|
{
|
|
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|
}
|
|
|
|
if (patient.SystemModuleID > 0)
|
|
{
|
|
if (patient.SystemModuleID == 2)
|
|
{
|
|
var patients2 = db.Queryable<T_Service_ChestPain_FirstAIDInfo>().Where(i => i.PatientGuid == patient.GUID).First();
|
|
if (string.IsNullOrEmpty(patients2.GUID))
|
|
{
|
|
T_Service_ChestPain_FirstAIDInfo aid = new T_Service_ChestPain_FirstAIDInfo();
|
|
aid.GUID = Guid.NewGuid().ToString();
|
|
aid.PatientGuid = patient.GUID;
|
|
aid.CW_Coming_Way_Code = "1";
|
|
aid.CW_120_Ambulance_Department = "1";
|
|
aid.CreationDate = DateTime.Now;
|
|
aid.CreatorID = 1;
|
|
db.Insertable(aid).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand();
|
|
}
|
|
}
|
|
else if (patient.SystemModuleID == 3) {
|
|
var patients3 = db.Queryable<T_Service_Apoplexy_Prehospital>().Where(i=>i.PatientGuid==patient.GUID).First();
|
|
if (string.IsNullOrEmpty(patients3.GUID))
|
|
{
|
|
T_Service_Apoplexy_Prehospital prehospital = new T_Service_Apoplexy_Prehospital();
|
|
prehospital.GUID = Guid.NewGuid().ToString();
|
|
prehospital.PatientGuid = patient.GUID;
|
|
// prehospital.OnsetTimeInterval = model.Attack_Zone;
|
|
//prehospital.IsCallHelp = 1;
|
|
//prehospital.CallHelpWay = 1;
|
|
// prehospital.HospitalMode = 0;
|
|
//prehospital.Breathing = Convert.ToInt32(model.Breathing);
|
|
//prehospital.HeartRate = Convert.ToInt32(model.HeartRate);
|
|
//prehospital.SystolicPressure = model.SystolicPressure;
|
|
//prehospital.DiastolicPressure = model.DiastolicPressure;
|
|
//prehospital.Temperature = model.Temperature;
|
|
//prehospital.Aneurysm = info.MedicalHistory;
|
|
//prehospital.CallHelpWay = 1;
|
|
db.Insertable(prehospital).IgnoreColumns(ignoreNullColumn: true).ExecuteCommand();
|
|
}
|
|
}
|
|
}
|
|
|
|
db.Ado.CommitTran();
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Ado.RollbackTran();
|
|
Help.WriteErrorLog("院前:更新患者院前信息(UpdateFirstAidPatientsInfo)", ex.ToString());
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|