958 lines
60 KiB
C#
958 lines
60 KiB
C#
using AIMSModel;
|
|
using AIMSObjectQuery;
|
|
using HelperDB;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace AIMSDAL
|
|
{
|
|
public partial class DOperatingRoomPutDoorRegister
|
|
{
|
|
#region 插入实体操作部份
|
|
/// <summary>
|
|
/// 插入
|
|
/// </summary>
|
|
/// <param name="cmd">Command对象</param>
|
|
/// <param name="operatingRoomPutDoorRegister">实体类对象</param>
|
|
/// <returns>标识列值或影响的记录行数</returns>
|
|
public static int Insert(SqlCommand cmd, OperatingRoomPutDoorRegister operatingRoomPutDoorRegister)
|
|
{
|
|
cmd.Parameters.Clear();
|
|
cmd.CommandText = "insert into OperatingRoomPutDoorRegister (PatientId,HISPatientId,InHospitalNo,VisitId,PatientModel,PatientDeptNo,PatientDeptName,PatientBedNo,Name,Sex,Age,BirthDay,Height,Weight,IdEntityNo,Tel,Address,Contacts,ContactsTel,OperationType,IsPlanAgainOperation,ExecDeptNo,ExecDeptName,AnaesthesiaMethod,IsPainClinic,PainTreatment,PainTreatmentRemark,Diagnose,DiagnoseRemark,Operation,OPerationRemark,Anaesthesia,AnaesthesiaRemark,ASALevel,OperationLevel,OperationPosition,AnaesthesiaDrugs,Complication,OperationSituation,OperationDate,AnaesthesiaBeginTime,AnaesthesiaEndTime,OperationBeginTime,OperationEndTime,OperationDoctorNo,OperationDoctorName,AnaesthesiaDoctorNo,AnaesthesiaDoctorName,InstrumentNurseNo,InstrumentNurseName,TourNurseNo,TourNurseName,IsValid,State,OpeatorNo,OperatorTime,Remark,HCode) values (@PatientId,@HISPatientId,@InHospitalNo,@VisitId,@PatientModel,@PatientDeptNo,@PatientDeptName,@PatientBedNo,@Name,@Sex,@Age,@BirthDay,@Height,@Weight,@IdEntityNo,@Tel,@Address,@Contacts,@ContactsTel,@OperationType,@IsPlanAgainOperation,@ExecDeptNo,@ExecDeptName,@AnaesthesiaMethod,@IsPainClinic,@PainTreatment,@PainTreatmentRemark,@Diagnose,@DiagnoseRemark,@Operation,@OPerationRemark,@Anaesthesia,@AnaesthesiaRemark,@ASALevel,@OperationLevel,@OperationPosition,@AnaesthesiaDrugs,@Complication,@OperationSituation,@OperationDate,@AnaesthesiaBeginTime,@AnaesthesiaEndTime,@OperationBeginTime,@OperationEndTime,@OperationDoctorNo,@OperationDoctorName,@AnaesthesiaDoctorNo,@AnaesthesiaDoctorName,@InstrumentNurseNo,@InstrumentNurseName,@TourNurseNo,@TourNurseName,@IsValid,@State,@OpeatorNo,@OperatorTime,@Remark,@HCode);select @@identity";
|
|
//从实体中取出值放入Command的参数列表
|
|
cmd.Parameters.Add(new SqlParameter("@PatientId", operatingRoomPutDoorRegister.PatientId == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PatientId));
|
|
cmd.Parameters.Add(new SqlParameter("@HISPatientId", operatingRoomPutDoorRegister.HISPatientId == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.HISPatientId));
|
|
cmd.Parameters.Add(new SqlParameter("@InHospitalNo", operatingRoomPutDoorRegister.InHospitalNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.InHospitalNo));
|
|
cmd.Parameters.Add(new SqlParameter("@VisitId", operatingRoomPutDoorRegister.VisitId == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.VisitId));
|
|
cmd.Parameters.Add(new SqlParameter("@PatientModel", operatingRoomPutDoorRegister.PatientModel == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PatientModel));
|
|
cmd.Parameters.Add(new SqlParameter("@PatientDeptNo", operatingRoomPutDoorRegister.PatientDeptNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PatientDeptNo));
|
|
cmd.Parameters.Add(new SqlParameter("@PatientDeptName", operatingRoomPutDoorRegister.PatientDeptName == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PatientDeptName));
|
|
cmd.Parameters.Add(new SqlParameter("@PatientBedNo", operatingRoomPutDoorRegister.PatientBedNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PatientBedNo));
|
|
cmd.Parameters.Add(new SqlParameter("@Name", operatingRoomPutDoorRegister.Name == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Name));
|
|
cmd.Parameters.Add(new SqlParameter("@Sex", operatingRoomPutDoorRegister.Sex == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Sex));
|
|
cmd.Parameters.Add(new SqlParameter("@Age", operatingRoomPutDoorRegister.Age == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Age));
|
|
cmd.Parameters.Add(new SqlParameter("@BirthDay", operatingRoomPutDoorRegister.BirthDay.HasValue ? (object)operatingRoomPutDoorRegister.BirthDay.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@Height", operatingRoomPutDoorRegister.Height.HasValue ? (object)operatingRoomPutDoorRegister.Height.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@Weight", operatingRoomPutDoorRegister.Weight.HasValue ? (object)operatingRoomPutDoorRegister.Weight.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@IdEntityNo", operatingRoomPutDoorRegister.IdEntityNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.IdEntityNo));
|
|
cmd.Parameters.Add(new SqlParameter("@Tel", operatingRoomPutDoorRegister.Tel == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Tel));
|
|
cmd.Parameters.Add(new SqlParameter("@Address", operatingRoomPutDoorRegister.Address == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Address));
|
|
cmd.Parameters.Add(new SqlParameter("@Contacts", operatingRoomPutDoorRegister.Contacts == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Contacts));
|
|
cmd.Parameters.Add(new SqlParameter("@ContactsTel", operatingRoomPutDoorRegister.ContactsTel == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.ContactsTel));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationType", operatingRoomPutDoorRegister.OperationType == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OperationType));
|
|
cmd.Parameters.Add(new SqlParameter("@IsPlanAgainOperation", operatingRoomPutDoorRegister.IsPlanAgainOperation.HasValue ? (object)operatingRoomPutDoorRegister.IsPlanAgainOperation.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@ExecDeptNo", operatingRoomPutDoorRegister.ExecDeptNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.ExecDeptNo));
|
|
cmd.Parameters.Add(new SqlParameter("@ExecDeptName", operatingRoomPutDoorRegister.ExecDeptName == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.ExecDeptName));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaMethod", operatingRoomPutDoorRegister.AnaesthesiaMethod == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.AnaesthesiaMethod));
|
|
cmd.Parameters.Add(new SqlParameter("@IsPainClinic", operatingRoomPutDoorRegister.IsPainClinic.HasValue ? (object)operatingRoomPutDoorRegister.IsPainClinic.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@PainTreatment", operatingRoomPutDoorRegister.PainTreatment == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PainTreatment));
|
|
cmd.Parameters.Add(new SqlParameter("@PainTreatmentRemark", operatingRoomPutDoorRegister.PainTreatmentRemark == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PainTreatmentRemark));
|
|
cmd.Parameters.Add(new SqlParameter("@Diagnose", operatingRoomPutDoorRegister.Diagnose == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Diagnose));
|
|
cmd.Parameters.Add(new SqlParameter("@DiagnoseRemark", operatingRoomPutDoorRegister.DiagnoseRemark == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.DiagnoseRemark));
|
|
cmd.Parameters.Add(new SqlParameter("@Operation", operatingRoomPutDoorRegister.Operation == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Operation));
|
|
cmd.Parameters.Add(new SqlParameter("@OPerationRemark", operatingRoomPutDoorRegister.OPerationRemark == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OPerationRemark));
|
|
cmd.Parameters.Add(new SqlParameter("@Anaesthesia", operatingRoomPutDoorRegister.Anaesthesia == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Anaesthesia));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaRemark", operatingRoomPutDoorRegister.AnaesthesiaRemark == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.AnaesthesiaRemark));
|
|
cmd.Parameters.Add(new SqlParameter("@ASALevel", operatingRoomPutDoorRegister.ASALevel == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.ASALevel));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationLevel", operatingRoomPutDoorRegister.OperationLevel == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OperationLevel));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationPosition", operatingRoomPutDoorRegister.OperationPosition == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OperationPosition));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaDrugs", operatingRoomPutDoorRegister.AnaesthesiaDrugs == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.AnaesthesiaDrugs));
|
|
cmd.Parameters.Add(new SqlParameter("@Complication", operatingRoomPutDoorRegister.Complication == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Complication));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationSituation", operatingRoomPutDoorRegister.OperationSituation == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OperationSituation));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationDate", operatingRoomPutDoorRegister.OperationDate.HasValue ? (object)operatingRoomPutDoorRegister.OperationDate.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaBeginTime", operatingRoomPutDoorRegister.AnaesthesiaBeginTime.HasValue ? (object)operatingRoomPutDoorRegister.AnaesthesiaBeginTime.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaEndTime", operatingRoomPutDoorRegister.AnaesthesiaEndTime.HasValue ? (object)operatingRoomPutDoorRegister.AnaesthesiaEndTime.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationBeginTime", operatingRoomPutDoorRegister.OperationBeginTime.HasValue ? (object)operatingRoomPutDoorRegister.OperationBeginTime.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationEndTime", operatingRoomPutDoorRegister.OperationEndTime.HasValue ? (object)operatingRoomPutDoorRegister.OperationEndTime.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationDoctorNo", operatingRoomPutDoorRegister.OperationDoctorNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OperationDoctorNo));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationDoctorName", operatingRoomPutDoorRegister.OperationDoctorName == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OperationDoctorName));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaDoctorNo", operatingRoomPutDoorRegister.AnaesthesiaDoctorNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.AnaesthesiaDoctorNo));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaDoctorName", operatingRoomPutDoorRegister.AnaesthesiaDoctorName == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.AnaesthesiaDoctorName));
|
|
cmd.Parameters.Add(new SqlParameter("@InstrumentNurseNo", operatingRoomPutDoorRegister.InstrumentNurseNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.InstrumentNurseNo));
|
|
cmd.Parameters.Add(new SqlParameter("@InstrumentNurseName", operatingRoomPutDoorRegister.InstrumentNurseName == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.InstrumentNurseName));
|
|
cmd.Parameters.Add(new SqlParameter("@TourNurseNo", operatingRoomPutDoorRegister.TourNurseNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.TourNurseNo));
|
|
cmd.Parameters.Add(new SqlParameter("@TourNurseName", operatingRoomPutDoorRegister.TourNurseName == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.TourNurseName));
|
|
cmd.Parameters.Add(new SqlParameter("@IsValid", operatingRoomPutDoorRegister.IsValid.HasValue ? (object)operatingRoomPutDoorRegister.IsValid.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@State", operatingRoomPutDoorRegister.State.HasValue ? (object)operatingRoomPutDoorRegister.State.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@OpeatorNo", operatingRoomPutDoorRegister.OpeatorNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OpeatorNo));
|
|
cmd.Parameters.Add(new SqlParameter("@OperatorTime", operatingRoomPutDoorRegister.OperatorTime.HasValue ? (object)operatingRoomPutDoorRegister.OperatorTime.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@Remark", operatingRoomPutDoorRegister.Remark == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Remark));
|
|
cmd.Parameters.Add(new SqlParameter("@HCode", operatingRoomPutDoorRegister.HCode == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.HCode));
|
|
return Convert.ToInt32(cmd.ExecuteScalar());
|
|
}
|
|
/// <summary>
|
|
/// 不使用事务的插入方法
|
|
/// </summary>
|
|
/// <param name="operatingRoomPutDoorRegister">实体类对象</param>
|
|
/// <returns>标识列值或影响的记录行数</returns>
|
|
public static int Insert(OperatingRoomPutDoorRegister operatingRoomPutDoorRegister)
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(Connection.ConnectionString))
|
|
{
|
|
conn.Open();
|
|
using (SqlCommand cmd = conn.CreateCommand())
|
|
{
|
|
return Insert(cmd, operatingRoomPutDoorRegister);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 使用事务的插入方法
|
|
/// </summary>
|
|
/// <param name="connection">实现共享Connection的对象</param>
|
|
/// <param name="operatingRoomPutDoorRegister">实体类对象</param>
|
|
/// <returns>标识列值或影响的记录行数</returns>
|
|
public static int Insert(Connection connection, OperatingRoomPutDoorRegister operatingRoomPutDoorRegister)
|
|
{
|
|
return Insert(connection.Command, operatingRoomPutDoorRegister);
|
|
}
|
|
#endregion
|
|
|
|
#region 删除实体操作
|
|
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
/// <param name="cmd">Command对象</param>
|
|
/// <param name="operatingRoomPutDoorRegister">实体类对象</param>
|
|
/// <returns>影响的记录行数</returns>
|
|
public static int ExcuteDeleteCommand(SqlCommand cmd, OperatingRoomPutDoorRegister operatingRoomPutDoorRegister)
|
|
{
|
|
cmd.Parameters.Clear();
|
|
cmd.CommandText = "delete from OperatingRoomPutDoorRegister where Id=@Id";
|
|
//从实体中取出值放入Command的参数列表
|
|
cmd.Parameters.Add(new SqlParameter("@Id", operatingRoomPutDoorRegister.Id));
|
|
return cmd.ExecuteNonQuery();
|
|
}
|
|
/// <summary>
|
|
/// 不使用事务的删除方法
|
|
/// </summary>
|
|
/// <param name="operatingRoomPutDoorRegister">实体类对象</param>
|
|
/// <returns>影响的记录行数</returns>
|
|
public static int Delete(OperatingRoomPutDoorRegister operatingRoomPutDoorRegister)
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(Connection.ConnectionString))
|
|
{
|
|
conn.Open();
|
|
using (SqlCommand cmd = conn.CreateCommand())
|
|
{
|
|
return ExcuteDeleteCommand(cmd, operatingRoomPutDoorRegister);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 使用事务的删除方法
|
|
/// </summary>
|
|
/// <param name="connection">实现共享Connection的对象</param>
|
|
/// <param name="operatingRoomPutDoorRegister">实体类对象</param>
|
|
/// <returns>影响的记录行数</returns>
|
|
public static int Delete(Connection connection, OperatingRoomPutDoorRegister operatingRoomPutDoorRegister)
|
|
{
|
|
return ExcuteDeleteCommand(connection.Command, operatingRoomPutDoorRegister);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 执行删除命令
|
|
/// </summary>
|
|
/// <param name="cmd">Command对象</param>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <returns>影响的记录行数</returns>
|
|
public static int ExcuteDeleteCommand(SqlCommand cmd, string oql, ParameterList parameters)
|
|
{
|
|
//解析过滤部份Sql语句
|
|
string filterString = SyntaxAnalyzer.ParseSql(oql, new OperatingRoomPutDoorRegisterMap());
|
|
if (filterString != string.Empty)
|
|
{
|
|
filterString = " where " + filterString;
|
|
}
|
|
cmd.Parameters.Clear();
|
|
cmd.CommandText = "delete from OperatingRoomPutDoorRegister " + filterString;
|
|
//添加参数
|
|
if (parameters != null)
|
|
{
|
|
foreach (string key in parameters.Keys)
|
|
{
|
|
cmd.Parameters.Add(new SqlParameter(key, parameters[key]));
|
|
}
|
|
}
|
|
return cmd.ExecuteNonQuery();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 不使用事务的删除方法
|
|
/// </summary>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <returns>影响的记录行数</returns>
|
|
public static int Delete(string oql, ParameterList parameters)
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(Connection.ConnectionString))
|
|
{
|
|
conn.Open();
|
|
using (SqlCommand cmd = conn.CreateCommand())
|
|
{
|
|
return ExcuteDeleteCommand(cmd, oql, parameters);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 使用事务的删除方法
|
|
/// </summary>
|
|
/// <param name="connection">实现共享Connection的对象</param>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <returns>影响的记录行数</returns>
|
|
public static int Delete(Connection connection, string oql, ParameterList parameters)
|
|
{
|
|
return ExcuteDeleteCommand(connection.Command, oql, parameters);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 更新实体操作
|
|
|
|
/// <summary>
|
|
/// 更新
|
|
/// </summary>
|
|
/// <param name="cmd">Command对象</param>
|
|
/// <param name="operatingRoomPutDoorRegister">实体类对象</param>
|
|
/// <returns>影响的记录行数</returns>
|
|
public static int ExcuteUpdateCommand(SqlCommand cmd, OperatingRoomPutDoorRegister operatingRoomPutDoorRegister)
|
|
{
|
|
cmd.CommandText = "update OperatingRoomPutDoorRegister set PatientId=@PatientId,HISPatientId=@HISPatientId,InHospitalNo=@InHospitalNo,VisitId=@VisitId,PatientModel=@PatientModel,PatientDeptNo=@PatientDeptNo,PatientDeptName=@PatientDeptName,PatientBedNo=@PatientBedNo,Name=@Name,Sex=@Sex,Age=@Age,BirthDay=@BirthDay,Height=@Height,Weight=@Weight,IdEntityNo=@IdEntityNo,Tel=@Tel,Address=@Address,Contacts=@Contacts,ContactsTel=@ContactsTel,OperationType=@OperationType,IsPlanAgainOperation=@IsPlanAgainOperation,ExecDeptNo=@ExecDeptNo,ExecDeptName=@ExecDeptName,AnaesthesiaMethod=@AnaesthesiaMethod,IsPainClinic=@IsPainClinic,PainTreatment=@PainTreatment,PainTreatmentRemark=@PainTreatmentRemark,Diagnose=@Diagnose,DiagnoseRemark=@DiagnoseRemark,Operation=@Operation,OPerationRemark=@OPerationRemark,Anaesthesia=@Anaesthesia,AnaesthesiaRemark=@AnaesthesiaRemark,ASALevel=@ASALevel,OperationLevel=@OperationLevel,OperationPosition=@OperationPosition,AnaesthesiaDrugs=@AnaesthesiaDrugs,Complication=@Complication,OperationSituation=@OperationSituation,OperationDate=@OperationDate,AnaesthesiaBeginTime=@AnaesthesiaBeginTime,AnaesthesiaEndTime=@AnaesthesiaEndTime,OperationBeginTime=@OperationBeginTime,OperationEndTime=@OperationEndTime,OperationDoctorNo=@OperationDoctorNo,OperationDoctorName=@OperationDoctorName,AnaesthesiaDoctorNo=@AnaesthesiaDoctorNo,AnaesthesiaDoctorName=@AnaesthesiaDoctorName,InstrumentNurseNo=@InstrumentNurseNo,InstrumentNurseName=@InstrumentNurseName,TourNurseNo=@TourNurseNo,TourNurseName=@TourNurseName,IsValid=@IsValid,State=@State,OpeatorNo=@OpeatorNo,OperatorTime=@OperatorTime,Remark=@Remark,HCode=@HCode where Id=@Id";
|
|
//从实体中取出值放入Command的参数列表
|
|
cmd.Parameters.Add(new SqlParameter("@PatientId", operatingRoomPutDoorRegister.PatientId == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PatientId));
|
|
cmd.Parameters.Add(new SqlParameter("@HISPatientId", operatingRoomPutDoorRegister.HISPatientId == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.HISPatientId));
|
|
cmd.Parameters.Add(new SqlParameter("@InHospitalNo", operatingRoomPutDoorRegister.InHospitalNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.InHospitalNo));
|
|
cmd.Parameters.Add(new SqlParameter("@VisitId", operatingRoomPutDoorRegister.VisitId == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.VisitId));
|
|
cmd.Parameters.Add(new SqlParameter("@PatientModel", operatingRoomPutDoorRegister.PatientModel == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PatientModel));
|
|
cmd.Parameters.Add(new SqlParameter("@PatientDeptNo", operatingRoomPutDoorRegister.PatientDeptNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PatientDeptNo));
|
|
cmd.Parameters.Add(new SqlParameter("@PatientDeptName", operatingRoomPutDoorRegister.PatientDeptName == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PatientDeptName));
|
|
cmd.Parameters.Add(new SqlParameter("@PatientBedNo", operatingRoomPutDoorRegister.PatientBedNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PatientBedNo));
|
|
cmd.Parameters.Add(new SqlParameter("@Name", operatingRoomPutDoorRegister.Name == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Name));
|
|
cmd.Parameters.Add(new SqlParameter("@Sex", operatingRoomPutDoorRegister.Sex == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Sex));
|
|
cmd.Parameters.Add(new SqlParameter("@Age", operatingRoomPutDoorRegister.Age == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Age));
|
|
cmd.Parameters.Add(new SqlParameter("@BirthDay", operatingRoomPutDoorRegister.BirthDay.HasValue ? (object)operatingRoomPutDoorRegister.BirthDay.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@Height", operatingRoomPutDoorRegister.Height.HasValue ? (object)operatingRoomPutDoorRegister.Height.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@Weight", operatingRoomPutDoorRegister.Weight.HasValue ? (object)operatingRoomPutDoorRegister.Weight.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@IdEntityNo", operatingRoomPutDoorRegister.IdEntityNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.IdEntityNo));
|
|
cmd.Parameters.Add(new SqlParameter("@Tel", operatingRoomPutDoorRegister.Tel == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Tel));
|
|
cmd.Parameters.Add(new SqlParameter("@Address", operatingRoomPutDoorRegister.Address == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Address));
|
|
cmd.Parameters.Add(new SqlParameter("@Contacts", operatingRoomPutDoorRegister.Contacts == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Contacts));
|
|
cmd.Parameters.Add(new SqlParameter("@ContactsTel", operatingRoomPutDoorRegister.ContactsTel == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.ContactsTel));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationType", operatingRoomPutDoorRegister.OperationType == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OperationType));
|
|
cmd.Parameters.Add(new SqlParameter("@IsPlanAgainOperation", operatingRoomPutDoorRegister.IsPlanAgainOperation.HasValue ? (object)operatingRoomPutDoorRegister.IsPlanAgainOperation.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@ExecDeptNo", operatingRoomPutDoorRegister.ExecDeptNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.ExecDeptNo));
|
|
cmd.Parameters.Add(new SqlParameter("@ExecDeptName", operatingRoomPutDoorRegister.ExecDeptName == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.ExecDeptName));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaMethod", operatingRoomPutDoorRegister.AnaesthesiaMethod == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.AnaesthesiaMethod));
|
|
cmd.Parameters.Add(new SqlParameter("@IsPainClinic", operatingRoomPutDoorRegister.IsPainClinic.HasValue ? (object)operatingRoomPutDoorRegister.IsPainClinic.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@PainTreatment", operatingRoomPutDoorRegister.PainTreatment == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PainTreatment));
|
|
cmd.Parameters.Add(new SqlParameter("@PainTreatmentRemark", operatingRoomPutDoorRegister.PainTreatmentRemark == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.PainTreatmentRemark));
|
|
cmd.Parameters.Add(new SqlParameter("@Diagnose", operatingRoomPutDoorRegister.Diagnose == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Diagnose));
|
|
cmd.Parameters.Add(new SqlParameter("@DiagnoseRemark", operatingRoomPutDoorRegister.DiagnoseRemark == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.DiagnoseRemark));
|
|
cmd.Parameters.Add(new SqlParameter("@Operation", operatingRoomPutDoorRegister.Operation == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Operation));
|
|
cmd.Parameters.Add(new SqlParameter("@OPerationRemark", operatingRoomPutDoorRegister.OPerationRemark == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OPerationRemark));
|
|
cmd.Parameters.Add(new SqlParameter("@Anaesthesia", operatingRoomPutDoorRegister.Anaesthesia == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Anaesthesia));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaRemark", operatingRoomPutDoorRegister.AnaesthesiaRemark == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.AnaesthesiaRemark));
|
|
cmd.Parameters.Add(new SqlParameter("@ASALevel", operatingRoomPutDoorRegister.ASALevel == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.ASALevel));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationLevel", operatingRoomPutDoorRegister.OperationLevel == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OperationLevel));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationPosition", operatingRoomPutDoorRegister.OperationPosition == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OperationPosition));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaDrugs", operatingRoomPutDoorRegister.AnaesthesiaDrugs == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.AnaesthesiaDrugs));
|
|
cmd.Parameters.Add(new SqlParameter("@Complication", operatingRoomPutDoorRegister.Complication == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Complication));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationSituation", operatingRoomPutDoorRegister.OperationSituation == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OperationSituation));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationDate", operatingRoomPutDoorRegister.OperationDate.HasValue ? (object)operatingRoomPutDoorRegister.OperationDate.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaBeginTime", operatingRoomPutDoorRegister.AnaesthesiaBeginTime.HasValue ? (object)operatingRoomPutDoorRegister.AnaesthesiaBeginTime.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaEndTime", operatingRoomPutDoorRegister.AnaesthesiaEndTime.HasValue ? (object)operatingRoomPutDoorRegister.AnaesthesiaEndTime.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationBeginTime", operatingRoomPutDoorRegister.OperationBeginTime.HasValue ? (object)operatingRoomPutDoorRegister.OperationBeginTime.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationEndTime", operatingRoomPutDoorRegister.OperationEndTime.HasValue ? (object)operatingRoomPutDoorRegister.OperationEndTime.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationDoctorNo", operatingRoomPutDoorRegister.OperationDoctorNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OperationDoctorNo));
|
|
cmd.Parameters.Add(new SqlParameter("@OperationDoctorName", operatingRoomPutDoorRegister.OperationDoctorName == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OperationDoctorName));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaDoctorNo", operatingRoomPutDoorRegister.AnaesthesiaDoctorNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.AnaesthesiaDoctorNo));
|
|
cmd.Parameters.Add(new SqlParameter("@AnaesthesiaDoctorName", operatingRoomPutDoorRegister.AnaesthesiaDoctorName == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.AnaesthesiaDoctorName));
|
|
cmd.Parameters.Add(new SqlParameter("@InstrumentNurseNo", operatingRoomPutDoorRegister.InstrumentNurseNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.InstrumentNurseNo));
|
|
cmd.Parameters.Add(new SqlParameter("@InstrumentNurseName", operatingRoomPutDoorRegister.InstrumentNurseName == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.InstrumentNurseName));
|
|
cmd.Parameters.Add(new SqlParameter("@TourNurseNo", operatingRoomPutDoorRegister.TourNurseNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.TourNurseNo));
|
|
cmd.Parameters.Add(new SqlParameter("@TourNurseName", operatingRoomPutDoorRegister.TourNurseName == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.TourNurseName));
|
|
cmd.Parameters.Add(new SqlParameter("@IsValid", operatingRoomPutDoorRegister.IsValid.HasValue ? (object)operatingRoomPutDoorRegister.IsValid.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@State", operatingRoomPutDoorRegister.State.HasValue ? (object)operatingRoomPutDoorRegister.State.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@OpeatorNo", operatingRoomPutDoorRegister.OpeatorNo == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.OpeatorNo));
|
|
cmd.Parameters.Add(new SqlParameter("@OperatorTime", operatingRoomPutDoorRegister.OperatorTime.HasValue ? (object)operatingRoomPutDoorRegister.OperatorTime.Value : (object)DBNull.Value));
|
|
cmd.Parameters.Add(new SqlParameter("@Remark", operatingRoomPutDoorRegister.Remark == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.Remark));
|
|
cmd.Parameters.Add(new SqlParameter("@HCode", operatingRoomPutDoorRegister.HCode == null ? (object)DBNull.Value : (object)operatingRoomPutDoorRegister.HCode));
|
|
cmd.Parameters.Add(new SqlParameter("@Id", operatingRoomPutDoorRegister.Id));
|
|
return cmd.ExecuteNonQuery();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 不使用事务的更新方法
|
|
/// </summary>
|
|
/// <param name="operatingRoomPutDoorRegister">实体类对象</param>
|
|
/// <returns>影响的记录行数</returns>
|
|
public static int Update(OperatingRoomPutDoorRegister operatingRoomPutDoorRegister)
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(Connection.ConnectionString))
|
|
{
|
|
conn.Open();
|
|
using (SqlCommand cmd = conn.CreateCommand())
|
|
{
|
|
return ExcuteUpdateCommand(cmd, operatingRoomPutDoorRegister);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 使用事务的更新方法
|
|
/// </summary>
|
|
/// <param name="connection">实现共享Connection的对象</param>
|
|
/// <param name="operatingRoomPutDoorRegister">实体类对象</param>
|
|
/// <returns>影响的记录行数</returns>
|
|
public static int Update(Connection connection, OperatingRoomPutDoorRegister operatingRoomPutDoorRegister)
|
|
{
|
|
return ExcuteUpdateCommand(connection.Command, operatingRoomPutDoorRegister);
|
|
}
|
|
/// <summary>
|
|
/// 执行更新命令
|
|
/// </summary>
|
|
/// <param name="cmd">Command对象</param>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <returns>影响的记录行数</returns>
|
|
public static int ExcuteUpdateCommand(SqlCommand cmd, string oql, ParameterList parameters)
|
|
{
|
|
//解析过滤部份Sql语句
|
|
string updateString = SyntaxAnalyzer.ParseSql(oql, new OperatingRoomPutDoorRegisterMap());
|
|
cmd.CommandText = "update OperatingRoomPutDoorRegister set " + updateString;
|
|
cmd.Parameters.Clear();
|
|
//添加参数
|
|
if (parameters != null)
|
|
{
|
|
foreach (string key in parameters.Keys)
|
|
{
|
|
cmd.Parameters.Add(new SqlParameter(key, parameters[key]));
|
|
}
|
|
}
|
|
return cmd.ExecuteNonQuery();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 不使用事务的更新方法
|
|
/// </summary>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <returns>影响的记录行数</returns>
|
|
public static int Update(string oql, ParameterList parameters)
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(Connection.ConnectionString))
|
|
{
|
|
conn.Open();
|
|
using (SqlCommand cmd = conn.CreateCommand())
|
|
{
|
|
return ExcuteUpdateCommand(cmd, oql, parameters);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 使用事务的更新方法
|
|
/// </summary>
|
|
/// <param name="connection">实现共享Connection的对象</param>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <returns>影响的记录行数</returns>
|
|
public static int Update(Connection connection, string oql, ParameterList parameters)
|
|
{
|
|
return ExcuteUpdateCommand(connection.Command, oql, parameters);
|
|
}
|
|
#endregion
|
|
|
|
#region 查询实体集合
|
|
/// <summary>
|
|
/// 执行Command获取对象列表
|
|
/// </summary>
|
|
/// <param name="cmd">Command对象</param>
|
|
/// <param name="recursiveType">递归类型</param>
|
|
/// <param name="recursiveDepth">递归深度</param>
|
|
/// <returns>实体类对象列表</returns>
|
|
public static List<OperatingRoomPutDoorRegister> ExcuteSelectCommand(SqlCommand cmd, RecursiveType recursiveType, int recursiveDepth)
|
|
{
|
|
List<OperatingRoomPutDoorRegister> operatingRoomPutDoorRegisterList = new List<OperatingRoomPutDoorRegister>();
|
|
using (SqlDataReader dr = cmd.ExecuteReader())
|
|
{
|
|
while (dr.Read())
|
|
{
|
|
OperatingRoomPutDoorRegister operatingRoomPutDoorRegister = DataReaderToEntity(dr);
|
|
operatingRoomPutDoorRegisterList.Add(operatingRoomPutDoorRegister);
|
|
}
|
|
}
|
|
return operatingRoomPutDoorRegisterList;
|
|
}
|
|
/// <summary>
|
|
/// 执行查询命令
|
|
/// </summary>
|
|
/// <param name="cmd">Command对象</param>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <param name="recursiveType">递归类型</param>
|
|
/// <param name="recursiveDepth">递归深度</param>
|
|
/// <returns>实体类对象集合</returns>
|
|
public static List<OperatingRoomPutDoorRegister> ExcuteSelectCommand(SqlCommand cmd, string oql, ParameterList parameters, RecursiveType recursiveType, int recursiveDepth)
|
|
{
|
|
//解析过滤部份Sql语句
|
|
string filterString = SyntaxAnalyzer.ParseSql(oql, new OperatingRoomPutDoorRegisterMap());
|
|
if (filterString != string.Empty)
|
|
{
|
|
if (filterString.Trim().ToLower().IndexOf("order ") != 0)
|
|
filterString = " where " + filterString;
|
|
}
|
|
cmd.Parameters.Clear();
|
|
cmd.CommandText = "select * from OperatingRoomPutDoorRegister " + filterString;
|
|
//添加参数
|
|
if (parameters != null)
|
|
{
|
|
foreach (string key in parameters.Keys)
|
|
{
|
|
cmd.Parameters.Add(new SqlParameter(key, parameters[key]));
|
|
}
|
|
}
|
|
return ExcuteSelectCommand(cmd, recursiveType, recursiveDepth);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据对象查询语句查询实体集合
|
|
/// </summary>
|
|
/// <returns>实体类对象集合</returns>
|
|
public static List<OperatingRoomPutDoorRegister> Select()
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(Connection.ConnectionString))
|
|
{
|
|
conn.Open();
|
|
using (SqlCommand cmd = conn.CreateCommand())
|
|
{
|
|
cmd.CommandText = "select * from OperatingRoomPutDoorRegister";
|
|
return ExcuteSelectCommand(cmd, RecursiveType.Parent, 1);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 根据对象查询语句查询实体集合
|
|
/// </summary>
|
|
/// <param name="recursiveType">递归类型</param>
|
|
/// <param name="recursiveDepth">递归深度</param>
|
|
/// <returns>实体类对象集合</returns>
|
|
public static List<OperatingRoomPutDoorRegister> Select(RecursiveType recursiveType, int recursiveDepth)
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(Connection.ConnectionString))
|
|
{
|
|
conn.Open();
|
|
using (SqlCommand cmd = conn.CreateCommand())
|
|
{
|
|
cmd.CommandText = "select * from OperatingRoomPutDoorRegister";
|
|
return ExcuteSelectCommand(cmd, recursiveType, recursiveDepth);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据对象查询语句查询实体集合
|
|
/// </summary>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <returns>实体类对象集合</returns>
|
|
public static List<OperatingRoomPutDoorRegister> Select(string oql, ParameterList parameters)
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(Connection.ConnectionString))
|
|
{
|
|
conn.Open();
|
|
using (SqlCommand cmd = conn.CreateCommand())
|
|
{
|
|
return ExcuteSelectCommand(cmd, oql, parameters, RecursiveType.Parent, 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据对象查询语句查询实体集合
|
|
/// </summary>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <param name="recursiveType">递归类型</param>
|
|
/// <param name="recursiveDepth">递归深度</param>
|
|
/// <returns>实体类对象集合</returns>
|
|
public static List<OperatingRoomPutDoorRegister> Select(string oql, ParameterList parameters, RecursiveType recursiveType, int recursiveDepth)
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(Connection.ConnectionString))
|
|
{
|
|
conn.Open();
|
|
using (SqlCommand cmd = conn.CreateCommand())
|
|
{
|
|
return ExcuteSelectCommand(cmd, oql, parameters, recursiveType, recursiveDepth);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据对象查询语句查询实体集合(启用事务)
|
|
/// </summary>
|
|
/// <param name="connection">连接对象</param>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <param name="recursiveType">递归类型</param>
|
|
/// <param name="recursiveDepth">递归深度</param>
|
|
/// <returns>实体类对象集合</returns>
|
|
public static List<OperatingRoomPutDoorRegister> Select(Connection connection, string oql, ParameterList parameters, RecursiveType recursiveType, int recursiveDepth)
|
|
{
|
|
return ExcuteSelectCommand(connection.Command, oql, parameters, recursiveType, recursiveDepth);
|
|
}
|
|
#endregion
|
|
|
|
#region 查询单个实体
|
|
|
|
/// <summary>
|
|
/// 递归查询单个实体
|
|
/// </summary>
|
|
/// <param name="cmd">Command对象</param>
|
|
/// <param name="recursiveType">递归类型</param>
|
|
/// <param name="recursiveDepth">递归深度</param>
|
|
/// <returns>实体对象</returns>
|
|
public static OperatingRoomPutDoorRegister ExcuteSelectSingleCommand(SqlCommand cmd, RecursiveType recursiveType, int recursiveDepth)
|
|
{
|
|
OperatingRoomPutDoorRegister operatingRoomPutDoorRegister = null;
|
|
using (SqlDataReader dr = cmd.ExecuteReader())
|
|
{
|
|
if (dr.Read())
|
|
operatingRoomPutDoorRegister = DataReaderToEntity(dr);
|
|
}
|
|
if (operatingRoomPutDoorRegister == null)
|
|
return operatingRoomPutDoorRegister;
|
|
return operatingRoomPutDoorRegister;
|
|
}
|
|
/// <summary>
|
|
/// 更据对象查询语句递归查询单个实体
|
|
/// </summary>
|
|
/// <param name="cmd">Command对象</param>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <param name="recursiveType">递归类型</param>
|
|
/// <param name="recursiveDepth">递归深度</param>
|
|
/// <returns>实体对象</returns>
|
|
public static OperatingRoomPutDoorRegister ExcuteSelectSingleCommand(SqlCommand cmd, string oql, ParameterList parameters, RecursiveType recursiveType, int recursiveDepth)
|
|
{
|
|
//解析过滤部份Sql语句
|
|
string filterString = SyntaxAnalyzer.ParseSql(oql, new OperatingRoomPutDoorRegisterMap());
|
|
if (filterString != string.Empty)
|
|
{
|
|
filterString = " where " + filterString;
|
|
}
|
|
cmd.CommandText = "select * from OperatingRoomPutDoorRegister " + filterString;
|
|
cmd.Parameters.Clear();
|
|
//添加参数
|
|
if (parameters != null)
|
|
{
|
|
foreach (string key in parameters.Keys)
|
|
{
|
|
cmd.Parameters.Add(new SqlParameter(key, parameters[key]));
|
|
}
|
|
}
|
|
return ExcuteSelectSingleCommand(cmd, recursiveType, recursiveDepth);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更据对象查询语句递归查询单个实体
|
|
/// </summary>
|
|
/// <param name="cmd">Command对象</param>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <param name="recursiveType">递归类型</param>
|
|
/// <param name="recursiveDepth">递归深度</param>
|
|
/// <returns>实体对象</returns>
|
|
public static OperatingRoomPutDoorRegister SelectSingle(string oql, ParameterList parameters, RecursiveType recursiveType, int recursiveDepth)
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(Connection.ConnectionString))
|
|
{
|
|
conn.Open();
|
|
using (SqlCommand cmd = conn.CreateCommand())
|
|
{
|
|
return ExcuteSelectSingleCommand(cmd, oql, parameters, recursiveType, recursiveDepth);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更据对象查询语句查询单个实体
|
|
/// </summary>
|
|
/// <param name="cmd">Command对象</param>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <returns>实体对象</returns>
|
|
public static OperatingRoomPutDoorRegister SelectSingle(string oql, ParameterList parameters)
|
|
{
|
|
return SelectSingle(oql, parameters, RecursiveType.Parent, 1);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更据对象查询语句并启用事务查询单个实体
|
|
/// </summary>
|
|
/// <param name="connection">连接对象</param>
|
|
/// <param name="oql">对象查询语句</param>
|
|
/// <param name="parameters">参数列表</param>
|
|
/// <returns>实体对象</returns>
|
|
public static OperatingRoomPutDoorRegister SelectSingle(Connection connection, string oql, ParameterList parameters, RecursiveType recursiveType, int recursiveDepth)
|
|
{
|
|
return ExcuteSelectSingleCommand(connection.Command, oql, parameters, recursiveType, recursiveDepth);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更据主键值递归查询单个实体
|
|
/// </summary>
|
|
/// <param name="cmd">Command对象</param>
|
|
/// <param name="id">主键值</param>
|
|
/// <param name="recursiveType">递归类型</param>
|
|
/// <param name="recursiveDepth">递归深度</param>
|
|
/// <returns>实体对象</returns>
|
|
public static OperatingRoomPutDoorRegister SelectSingle(SqlCommand cmd, int? id, RecursiveType recursiveType, int recursiveDepth)
|
|
{
|
|
cmd.Parameters.Clear();
|
|
if (id.HasValue)
|
|
{
|
|
cmd.CommandText = "select * from OperatingRoomPutDoorRegister where Id=@pk";
|
|
cmd.Parameters.Add(new SqlParameter("@pk", id.Value));
|
|
}
|
|
else
|
|
{
|
|
cmd.CommandText = "select * from OperatingRoomPutDoorRegister where Id is null";
|
|
}
|
|
return ExcuteSelectSingleCommand(cmd, recursiveType, recursiveDepth);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 按主键字段查询特定实体
|
|
/// </summary>
|
|
/// <param name="id">主键值</param>
|
|
/// <returns>实体类对象</returns>
|
|
public static OperatingRoomPutDoorRegister SelectSingle(int? id)
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(Connection.ConnectionString))
|
|
{
|
|
conn.Open();
|
|
using (SqlCommand cmd = conn.CreateCommand())
|
|
{
|
|
return SelectSingle(cmd, id, RecursiveType.Parent, 1);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 按主键字段查询特定实体
|
|
/// </summary>
|
|
/// <param name="id">主键值</param>
|
|
/// <param name="recursiveType">递归类型</param>
|
|
/// <param name="recursiveDepth">递归深度</param>
|
|
/// <returns>实体类对象</returns>
|
|
public static OperatingRoomPutDoorRegister SelectSingle(int? id, RecursiveType recursiveType, int recursiveDepth)
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(Connection.ConnectionString))
|
|
{
|
|
conn.Open();
|
|
using (SqlCommand cmd = conn.CreateCommand())
|
|
{
|
|
return SelectSingle(cmd, id, recursiveType, recursiveDepth);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 使用事务并按主键字段查询特定实体
|
|
/// </summary>
|
|
/// <param name="connection">连接对象</param>
|
|
/// <param name="id">主键值</param>
|
|
/// <returns>实体类对象</returns>
|
|
public static OperatingRoomPutDoorRegister SelectSingle(Connection connection, int? id, RecursiveType recursiveType, int recursiveDepth)
|
|
{
|
|
return SelectSingle(connection.Command, id, recursiveType, recursiveDepth);
|
|
}
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
/// 从DataReader中取出值生成实体对象
|
|
/// </summary>
|
|
/// <param name="searcher">查询对象</param>
|
|
/// <returns>过滤条件字符串</returns>
|
|
private static OperatingRoomPutDoorRegister DataReaderToEntity(SqlDataReader dr)
|
|
{
|
|
OperatingRoomPutDoorRegister entity = new OperatingRoomPutDoorRegister();
|
|
if (dr["Id"] != System.DBNull.Value)
|
|
{
|
|
entity.Id = Convert.ToInt32(dr["Id"]);
|
|
}
|
|
if (dr["PatientId"] != System.DBNull.Value)
|
|
{
|
|
entity.PatientId = dr["PatientId"].ToString();
|
|
}
|
|
if (dr["HISPatientId"] != System.DBNull.Value)
|
|
{
|
|
entity.HISPatientId = dr["HISPatientId"].ToString();
|
|
}
|
|
if (dr["InHospitalNo"] != System.DBNull.Value)
|
|
{
|
|
entity.InHospitalNo = dr["InHospitalNo"].ToString();
|
|
}
|
|
if (dr["VisitId"] != System.DBNull.Value)
|
|
{
|
|
entity.VisitId = dr["VisitId"].ToString();
|
|
}
|
|
if (dr["PatientModel"] != System.DBNull.Value)
|
|
{
|
|
entity.PatientModel = dr["PatientModel"].ToString();
|
|
}
|
|
if (dr["PatientDeptNo"] != System.DBNull.Value)
|
|
{
|
|
entity.PatientDeptNo = dr["PatientDeptNo"].ToString();
|
|
}
|
|
if (dr["PatientDeptName"] != System.DBNull.Value)
|
|
{
|
|
entity.PatientDeptName = dr["PatientDeptName"].ToString();
|
|
}
|
|
if (dr["PatientBedNo"] != System.DBNull.Value)
|
|
{
|
|
entity.PatientBedNo = dr["PatientBedNo"].ToString();
|
|
}
|
|
if (dr["Name"] != System.DBNull.Value)
|
|
{
|
|
entity.Name = dr["Name"].ToString();
|
|
}
|
|
if (dr["Sex"] != System.DBNull.Value)
|
|
{
|
|
entity.Sex = dr["Sex"].ToString();
|
|
}
|
|
if (dr["Age"] != System.DBNull.Value)
|
|
{
|
|
entity.Age = dr["Age"].ToString();
|
|
}
|
|
if (dr["BirthDay"] != System.DBNull.Value)
|
|
{
|
|
entity.BirthDay = Convert.ToDateTime(dr["BirthDay"]);
|
|
}
|
|
if (dr["Height"] != System.DBNull.Value)
|
|
{
|
|
entity.Height = Convert.ToDecimal(dr["Height"]);
|
|
}
|
|
if (dr["Weight"] != System.DBNull.Value)
|
|
{
|
|
entity.Weight = Convert.ToDecimal(dr["Weight"]);
|
|
}
|
|
if (dr["IdEntityNo"] != System.DBNull.Value)
|
|
{
|
|
entity.IdEntityNo = dr["IdEntityNo"].ToString();
|
|
}
|
|
if (dr["Tel"] != System.DBNull.Value)
|
|
{
|
|
entity.Tel = dr["Tel"].ToString();
|
|
}
|
|
if (dr["Address"] != System.DBNull.Value)
|
|
{
|
|
entity.Address = dr["Address"].ToString();
|
|
}
|
|
if (dr["Contacts"] != System.DBNull.Value)
|
|
{
|
|
entity.Contacts = dr["Contacts"].ToString();
|
|
}
|
|
if (dr["ContactsTel"] != System.DBNull.Value)
|
|
{
|
|
entity.ContactsTel = dr["ContactsTel"].ToString();
|
|
}
|
|
if (dr["OperationType"] != System.DBNull.Value)
|
|
{
|
|
entity.OperationType = dr["OperationType"].ToString();
|
|
}
|
|
if (dr["IsPlanAgainOperation"] != System.DBNull.Value)
|
|
{
|
|
entity.IsPlanAgainOperation = Convert.ToInt32(dr["IsPlanAgainOperation"]);
|
|
}
|
|
if (dr["ExecDeptNo"] != System.DBNull.Value)
|
|
{
|
|
entity.ExecDeptNo = dr["ExecDeptNo"].ToString();
|
|
}
|
|
if (dr["ExecDeptName"] != System.DBNull.Value)
|
|
{
|
|
entity.ExecDeptName = dr["ExecDeptName"].ToString();
|
|
}
|
|
if (dr["AnaesthesiaMethod"] != System.DBNull.Value)
|
|
{
|
|
entity.AnaesthesiaMethod = dr["AnaesthesiaMethod"].ToString();
|
|
}
|
|
if (dr["IsPainClinic"] != System.DBNull.Value)
|
|
{
|
|
entity.IsPainClinic = Convert.ToInt32(dr["IsPainClinic"]);
|
|
}
|
|
if (dr["PainTreatment"] != System.DBNull.Value)
|
|
{
|
|
entity.PainTreatment = dr["PainTreatment"].ToString();
|
|
}
|
|
if (dr["PainTreatmentRemark"] != System.DBNull.Value)
|
|
{
|
|
entity.PainTreatmentRemark = dr["PainTreatmentRemark"].ToString();
|
|
}
|
|
if (dr["Diagnose"] != System.DBNull.Value)
|
|
{
|
|
entity.Diagnose = dr["Diagnose"].ToString();
|
|
}
|
|
if (dr["DiagnoseRemark"] != System.DBNull.Value)
|
|
{
|
|
entity.DiagnoseRemark = dr["DiagnoseRemark"].ToString();
|
|
}
|
|
if (dr["Operation"] != System.DBNull.Value)
|
|
{
|
|
entity.Operation = dr["Operation"].ToString();
|
|
}
|
|
if (dr["OPerationRemark"] != System.DBNull.Value)
|
|
{
|
|
entity.OPerationRemark = dr["OPerationRemark"].ToString();
|
|
}
|
|
if (dr["Anaesthesia"] != System.DBNull.Value)
|
|
{
|
|
entity.Anaesthesia = dr["Anaesthesia"].ToString();
|
|
}
|
|
if (dr["AnaesthesiaRemark"] != System.DBNull.Value)
|
|
{
|
|
entity.AnaesthesiaRemark = dr["AnaesthesiaRemark"].ToString();
|
|
}
|
|
if (dr["ASALevel"] != System.DBNull.Value)
|
|
{
|
|
entity.ASALevel = dr["ASALevel"].ToString();
|
|
}
|
|
if (dr["OperationLevel"] != System.DBNull.Value)
|
|
{
|
|
entity.OperationLevel = dr["OperationLevel"].ToString();
|
|
}
|
|
if (dr["OperationPosition"] != System.DBNull.Value)
|
|
{
|
|
entity.OperationPosition = dr["OperationPosition"].ToString();
|
|
}
|
|
if (dr["AnaesthesiaDrugs"] != System.DBNull.Value)
|
|
{
|
|
entity.AnaesthesiaDrugs = dr["AnaesthesiaDrugs"].ToString();
|
|
}
|
|
if (dr["Complication"] != System.DBNull.Value)
|
|
{
|
|
entity.Complication = dr["Complication"].ToString();
|
|
}
|
|
if (dr["OperationSituation"] != System.DBNull.Value)
|
|
{
|
|
entity.OperationSituation = dr["OperationSituation"].ToString();
|
|
}
|
|
if (dr["OperationDate"] != System.DBNull.Value)
|
|
{
|
|
entity.OperationDate = Convert.ToDateTime(dr["OperationDate"]);
|
|
}
|
|
if (dr["AnaesthesiaBeginTime"] != System.DBNull.Value)
|
|
{
|
|
entity.AnaesthesiaBeginTime = Convert.ToDateTime(dr["AnaesthesiaBeginTime"]);
|
|
}
|
|
if (dr["AnaesthesiaEndTime"] != System.DBNull.Value)
|
|
{
|
|
entity.AnaesthesiaEndTime = Convert.ToDateTime(dr["AnaesthesiaEndTime"]);
|
|
}
|
|
if (dr["OperationBeginTime"] != System.DBNull.Value)
|
|
{
|
|
entity.OperationBeginTime = Convert.ToDateTime(dr["OperationBeginTime"]);
|
|
}
|
|
if (dr["OperationEndTime"] != System.DBNull.Value)
|
|
{
|
|
entity.OperationEndTime = Convert.ToDateTime(dr["OperationEndTime"]);
|
|
}
|
|
if (dr["OperationDoctorNo"] != System.DBNull.Value)
|
|
{
|
|
entity.OperationDoctorNo = dr["OperationDoctorNo"].ToString();
|
|
}
|
|
if (dr["OperationDoctorName"] != System.DBNull.Value)
|
|
{
|
|
entity.OperationDoctorName = dr["OperationDoctorName"].ToString();
|
|
}
|
|
if (dr["AnaesthesiaDoctorNo"] != System.DBNull.Value)
|
|
{
|
|
entity.AnaesthesiaDoctorNo = dr["AnaesthesiaDoctorNo"].ToString();
|
|
}
|
|
if (dr["AnaesthesiaDoctorName"] != System.DBNull.Value)
|
|
{
|
|
entity.AnaesthesiaDoctorName = dr["AnaesthesiaDoctorName"].ToString();
|
|
}
|
|
if (dr["InstrumentNurseNo"] != System.DBNull.Value)
|
|
{
|
|
entity.InstrumentNurseNo = dr["InstrumentNurseNo"].ToString();
|
|
}
|
|
if (dr["InstrumentNurseName"] != System.DBNull.Value)
|
|
{
|
|
entity.InstrumentNurseName = dr["InstrumentNurseName"].ToString();
|
|
}
|
|
if (dr["TourNurseNo"] != System.DBNull.Value)
|
|
{
|
|
entity.TourNurseNo = dr["TourNurseNo"].ToString();
|
|
}
|
|
if (dr["TourNurseName"] != System.DBNull.Value)
|
|
{
|
|
entity.TourNurseName = dr["TourNurseName"].ToString();
|
|
}
|
|
if (dr["IsValid"] != System.DBNull.Value)
|
|
{
|
|
entity.IsValid = Convert.ToInt32(dr["IsValid"]);
|
|
}
|
|
if (dr["State"] != System.DBNull.Value)
|
|
{
|
|
entity.State = Convert.ToInt32(dr["State"]);
|
|
}
|
|
if (dr["OpeatorNo"] != System.DBNull.Value)
|
|
{
|
|
entity.OpeatorNo = dr["OpeatorNo"].ToString();
|
|
}
|
|
if (dr["OperatorTime"] != System.DBNull.Value)
|
|
{
|
|
entity.OperatorTime = Convert.ToDateTime(dr["OperatorTime"]);
|
|
}
|
|
if (dr["Remark"] != System.DBNull.Value)
|
|
{
|
|
entity.Remark = dr["Remark"].ToString();
|
|
}
|
|
if (dr["HCode"] != System.DBNull.Value)
|
|
{
|
|
entity.HCode = dr["HCode"].ToString();
|
|
}
|
|
return entity;
|
|
|
|
}
|
|
|
|
public static DataTable GetOperatingRoomPutDoorRegisterByCondition(string begin, string end, string anaesthesiaMethod, string anaesthesiaDoctor, string execDepart, string pDept, string Asa)
|
|
{
|
|
DataTable dt = null;
|
|
string sql = "select *,dbo.split(AnaesthesiaDoctorName,',',0)AnaesthesiaDoctorName1,dbo.split(AnaesthesiaDoctorName,',',1)AnaesthesiaDoctorName2 from OperatingRoomPutDoorRegister where OperationDate>='" + begin + "' and OperationDate<='" + end + "' ";
|
|
if (anaesthesiaMethod != "")
|
|
{
|
|
sql += " and AnaesthesiaMethod like '%" + anaesthesiaMethod + "%'";
|
|
}
|
|
if (anaesthesiaDoctor != "")
|
|
{
|
|
sql += " and AnaesthesiaDoctorName='" + anaesthesiaDoctor + "'";
|
|
}
|
|
if (execDepart != "")
|
|
{
|
|
sql += " and ExecDeptName='" + execDepart + "'";
|
|
}
|
|
if (Asa != "")
|
|
{
|
|
sql += " and ASALevel='" + Asa + "'";
|
|
}
|
|
if (pDept != "")
|
|
{
|
|
sql += " and PatientDeptName='" + pDept + "'";
|
|
}
|
|
dt = DBHelper.GetDataTable(sql);
|
|
return dt;
|
|
}
|
|
|
|
}
|
|
}
|
|
|