331 lines
12 KiB
C#
331 lines
12 KiB
C#
using HL_FristAidPlatform_DataBase;
|
||
using HL_FristAidPlatform_Help;
|
||
using HL_FristAidPlatform_IDataBase;
|
||
using HL_FristAidPlatform_Models;
|
||
using System;
|
||
|
||
namespace HL_FristAidPlatform_Bussiness
|
||
{
|
||
/// <summary>
|
||
///急救信息 V2.1版
|
||
/// </summary>
|
||
public class T_Service_ChestPain_FirstAIDInfoBLL
|
||
{
|
||
private IT_Service_ChestPain_FirstAIDInfo IService = new T_Service_ChestPain_FirstAIDInfoDB();
|
||
private IT_Service_Patient IServicePatient = new T_Service_PatientDB();
|
||
|
||
#region 增
|
||
/// <summary>
|
||
/// 增加一条数据
|
||
/// </summary>
|
||
/// <param name="model">实体</param>
|
||
/// <returns></returns>
|
||
public MessageModel<T_Service_ChestPain_FirstAIDInfo> Add(T_Service_ChestPain_FirstAIDInfo model)
|
||
{
|
||
if (IService.Add(model))
|
||
{
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = true, Msg = "操作成功" };
|
||
}
|
||
else
|
||
{
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = false, Msg = "操作失败" };
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 新增 仅更新赋值的字段
|
||
/// </summary>
|
||
/// <param name="model"></param>
|
||
/// <returns></returns>
|
||
public MessageModel<T_Service_ChestPain_FirstAIDInfo> AddNotNullColumns(T_Service_ChestPain_FirstAIDInfo model)
|
||
{
|
||
if (IService.AddNotNullColumns(model) > 0)
|
||
{
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = true, Msg = "操作成功" };
|
||
}
|
||
else
|
||
{
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = false, Msg = "操作失败" };
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 新增 仅更新赋值的字段
|
||
/// 用于移动端
|
||
/// </summary>
|
||
/// <param name="model">实体类</param>
|
||
/// <returns></returns>
|
||
public MessageModel<T_Service_ChestPain_FirstAIDInfo> AddForApp(T_Service_ChestPain_FirstAIDInfo model)
|
||
{
|
||
if (IService.AddForApp(model) > 0)
|
||
{
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = true, Msg = "操作成功" };
|
||
}
|
||
else
|
||
{
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = false, Msg = "操作失败" };
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 删
|
||
/// <summary>
|
||
/// 删除一条数据
|
||
/// </summary>
|
||
/// <param name="ID">主键</param>
|
||
/// <returns></returns>
|
||
public MessageModel<T_Service_ChestPain_FirstAIDInfo> Delete(long ID)
|
||
{
|
||
if (IService.Delete(ID))
|
||
{
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = true, Msg = "操作成功" };
|
||
}
|
||
else
|
||
{
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = false, Msg = "操作失败" };
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 改
|
||
/// <summary>
|
||
/// 更新一条数据
|
||
/// </summary>
|
||
/// <param name="model">实体</param>
|
||
/// <returns></returns>
|
||
public MessageModel<T_Service_ChestPain_FirstAIDInfo> Update(T_Service_ChestPain_FirstAIDInfo model)
|
||
{
|
||
if (IService.Update(model))
|
||
{
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = true, Msg = "操作成功" };
|
||
}
|
||
else
|
||
{
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = false, Msg = "操作失败" };
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 仅更新赋值的字段
|
||
/// </summary>
|
||
/// <param name="model">实体类</param>
|
||
/// <returns></returns>
|
||
public MessageModel<T_Service_ChestPain_FirstAIDInfo> UpdateNotNullColumns(T_Service_ChestPain_FirstAIDInfo model)
|
||
{
|
||
if (IService.UpdateNotNullColumns(model) > 0)
|
||
{
|
||
updateTime(model);
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = true, Msg = "操作成功" };
|
||
}
|
||
else
|
||
{
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = false, Msg = "操作失败" };
|
||
}
|
||
}
|
||
private void updateTime(T_Service_ChestPain_FirstAIDInfo model)
|
||
{
|
||
T_Service_ChestPain_FirstAIDInfo service_ChestPain_FirstAIDInfo = new T_Service_ChestPain_FirstAIDInfo();
|
||
service_ChestPain_FirstAIDInfo = IService.GetModelOfPatient(model.PatientGuid);
|
||
if (model.Attack_Time == "")
|
||
{
|
||
service_ChestPain_FirstAIDInfo.Attack_Time = null;
|
||
}
|
||
if (model.CW_120_Arrived_Hospital_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_120_Arrived_Hospital_Time = null;
|
||
}
|
||
if (model.CW_120_First_Doctor_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_120_First_Doctor_Time = null;
|
||
}
|
||
if (model.CW_120_First_MC_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_120_First_MC_Time = null;
|
||
}
|
||
if (model.CW_120_Help_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_120_Help_Time = null;
|
||
}
|
||
if (model.CW_YNFB_Consultation_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_YNFB_Consultation_Time = null;
|
||
}
|
||
if (model.Start_Agree_time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.Start_Agree_time = null;
|
||
}
|
||
if (model.CW_ZY_First_MC_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_ZY_First_MC_Time = null;
|
||
}
|
||
if (model.CW_ZY_Outhospital_Visit_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_ZY_Outhospital_Visit_Time = null;
|
||
}
|
||
if (model.CW_ZY_Transfer_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_ZY_Transfer_Time = null;
|
||
}
|
||
if (model.CW_ZY_Leave_Outhospital_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_ZY_Leave_Outhospital_Time = null;
|
||
}
|
||
if (model.CW_ZY_Arrived_Hospital_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_ZY_Arrived_Hospital_Time = null;
|
||
}
|
||
if (model.CW_ZY_Admission_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_ZY_Admission_Time = null;
|
||
}
|
||
if (model.CW_ZXLY_First_MC_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_ZXLY_First_MC_Time = null;
|
||
}
|
||
if (model.CW_ZXLY_First_Doctor_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_ZXLY_First_Doctor_Time = null;
|
||
}
|
||
if (model.CW_YNFB_First_MC_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_YNFB_First_MC_Time = null;
|
||
}
|
||
if (model.CW_YNFB_Leave_Department_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.CW_YNFB_Leave_Department_Time = null;
|
||
}
|
||
if (model.Throm_Start_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.Throm_Start_Time = null;
|
||
}
|
||
if (model.Sign_Agree_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.Sign_Agree_Time = null;
|
||
}
|
||
if (model.Throm_End_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.Throm_End_Time = null;
|
||
}
|
||
if (model.Start_Radiography_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.Start_Radiography_Time = null;
|
||
}
|
||
if (model.Operation_Time == null)
|
||
{
|
||
service_ChestPain_FirstAIDInfo.Operation_Time = null;
|
||
}
|
||
IService.UpdateTime(service_ChestPain_FirstAIDInfo);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 修改--仅更新赋值的字段
|
||
/// 用于移动端
|
||
/// </summary>
|
||
/// <param name="model">实体类</param>
|
||
/// <returns></returns>
|
||
public MessageModel<T_Service_ChestPain_FirstAIDInfo> UpdateForApp(T_Service_ChestPain_FirstAIDInfo model)
|
||
{
|
||
if (IService.UpdateForApp(model) > 0)
|
||
{
|
||
T_Service_Patient patient = new T_Service_Patient();
|
||
patient.GUID = model.PatientGuid;
|
||
string MCTime = "";
|
||
/// <summary>
|
||
/// 来院方式
|
||
/// 1:呼叫(120或其他)出车
|
||
/// 2:转院(包含任何机构)
|
||
/// 3:自行来院
|
||
/// 4:院内发病
|
||
/// </summary>
|
||
if (model.CW_Coming_Way_Code == "1")
|
||
{
|
||
if (!string.IsNullOrEmpty(model.CW_120_First_MC_Time + ""))
|
||
{
|
||
MCTime = Convert.ToDateTime(model.CW_120_First_MC_Time + "").AddDays(14).ToString("yyyy-MM-dd HH:mm:ss");
|
||
}
|
||
}
|
||
if (model.CW_Coming_Way_Code == "2")
|
||
{
|
||
if (!string.IsNullOrEmpty(model.CW_ZY_First_MC_Time + ""))
|
||
{
|
||
MCTime = Convert.ToDateTime(model.CW_ZY_First_MC_Time + "").AddDays(14).ToString("yyyy-MM-dd HH:mm:ss");
|
||
}
|
||
}
|
||
if (model.CW_Coming_Way_Code == "3")
|
||
{
|
||
if (!string.IsNullOrEmpty(model.CW_ZXLY_First_MC_Time + ""))
|
||
{
|
||
MCTime = Convert.ToDateTime(model.CW_ZXLY_First_MC_Time).AddDays(14).ToString("yyyy-MM-dd HH:mm:ss");
|
||
}
|
||
}
|
||
if (model.CW_Coming_Way_Code == "4")
|
||
{
|
||
if (!string.IsNullOrEmpty(model.CW_YNFB_First_MC_Time + ""))
|
||
{
|
||
MCTime = Convert.ToDateTime(model.CW_YNFB_First_MC_Time + "").AddDays(14).ToString("yyyy-MM-dd HH:mm:ss");
|
||
}
|
||
}
|
||
if (string.IsNullOrEmpty(MCTime))
|
||
{
|
||
patient.Specified_Archiving_Time = null;
|
||
}
|
||
else
|
||
{
|
||
patient.Specified_Archiving_Time = MCTime;
|
||
}
|
||
IServicePatient.UpdateSpecifiedArchivingTime(patient);
|
||
updateTime(model);
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = true, Msg = "操作成功" };
|
||
}
|
||
else
|
||
{
|
||
return new MessageModel<T_Service_ChestPain_FirstAIDInfo> { Success = false, Msg = "操作失败" };
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 查
|
||
/// <summary>
|
||
/// 得到一个对象实体
|
||
/// </summary>
|
||
/// <param name="ID">主键</param>
|
||
/// <returns></returns>
|
||
public T_Service_ChestPain_FirstAIDInfo GetModel(long ID)
|
||
{
|
||
return IService.GetModel(ID);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据分页获得数据列表
|
||
/// </summary>
|
||
/// <param name="pageIndex">起始页</param>
|
||
/// <param name="pageSize">每页条数</param>
|
||
/// <returns></returns>
|
||
public TableModel<T_Service_ChestPain_FirstAIDInfo> GetPageList(int pageIndex, int pageSize)
|
||
{
|
||
return IService.GetPageList(pageIndex, pageSize);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据患者编号(GUID) 获取数据信息
|
||
/// </summary>
|
||
/// <param name="patientGuid">病人编号(GUID)</param>
|
||
/// <returns></returns>
|
||
public TableModel<T_Service_ChestPain_FirstAIDInfo> GetByPatientGuid(string patientGuid)
|
||
{
|
||
return IService.GetByPatientGuid(patientGuid);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查--根据患者编号(GUID) 获取数据信息
|
||
/// 用于移动端
|
||
/// </summary>
|
||
/// <param name="patientGuid">病人编号(GUID)</param>
|
||
/// <returns></returns>
|
||
public TableModel<T_Service_ChestPain_FirstAIDInfo> GetByPatientGuidForApp(string patientGuid)
|
||
{
|
||
return IService.GetByPatientGuidForApp(patientGuid);
|
||
}
|
||
#endregion
|
||
}
|
||
} |