103 lines
4.2 KiB
C#
103 lines
4.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data;
|
|
namespace AIMS.OperationDoing.AnasRecordBill.DAL
|
|
{
|
|
public class FactOperationInfoDB
|
|
{
|
|
public void Add(Model.FactOperationInfo FactOperationInfoObj)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("insert into [FactOperationInfo](");
|
|
strSql.Append("PatientId,ApplyId,OperationId,OperatorNo,OperatorName,OperateDate,OperationName,LeftRemark,RightRemark");
|
|
strSql.Append(")");
|
|
strSql.Append(" values (");
|
|
strSql.Append("" + FactOperationInfoObj.PatientId + ",");
|
|
strSql.Append("" + FactOperationInfoObj.ApplyId + ",");
|
|
strSql.Append("" + FactOperationInfoObj.OperationId + ",");
|
|
strSql.Append("'" + FactOperationInfoObj.OperatorNo + "',");
|
|
strSql.Append("'" + FactOperationInfoObj.OperatorName + "',");
|
|
strSql.Append("'" + FactOperationInfoObj.OperateDate + "',");
|
|
strSql.Append("'" + FactOperationInfoObj.OperationName + "',");
|
|
strSql.Append("'" + FactOperationInfoObj.LeftRemark + "',");
|
|
strSql.Append("'" + FactOperationInfoObj.RightRemark + "'");
|
|
strSql.Append(")");
|
|
HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
|
|
}
|
|
|
|
public void Delete(int PatientId)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("delete FactOperationInfo ");
|
|
strSql.Append(" where PatientId="+PatientId+"" );
|
|
HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
|
|
}
|
|
|
|
public Model.FactOperationInfo GetModel(int Id)
|
|
{
|
|
Model.FactOperationInfo FactOperationInfoObj = new Model.FactOperationInfo();
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("select * from FactOperationInfo ");
|
|
strSql.Append(" where Id="+Id+"" );
|
|
DataSet ds = HelperDB.DbHelperSQL.GetDataSet(strSql.ToString());
|
|
if(ds.Tables[0].Rows.Count>0)
|
|
{
|
|
if(ds.Tables[0].Rows[0]["Id"].ToString()!="")
|
|
{
|
|
FactOperationInfoObj.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
|
|
}
|
|
if(ds.Tables[0].Rows[0]["PatientId"].ToString()!="")
|
|
{
|
|
FactOperationInfoObj.PatientId = int.Parse(ds.Tables[0].Rows[0]["PatientId"].ToString());
|
|
}
|
|
if(ds.Tables[0].Rows[0]["ApplyId"].ToString()!="")
|
|
{
|
|
FactOperationInfoObj.ApplyId = int.Parse(ds.Tables[0].Rows[0]["ApplyId"].ToString());
|
|
}
|
|
if(ds.Tables[0].Rows[0]["OperationId"].ToString()!="")
|
|
{
|
|
FactOperationInfoObj.OperationId = int.Parse(ds.Tables[0].Rows[0]["OperationId"].ToString());
|
|
}
|
|
FactOperationInfoObj.OperatorNo = ds.Tables[0].Rows[0]["OperatorNo"].ToString();
|
|
FactOperationInfoObj.OperatorName = ds.Tables[0].Rows[0]["OperatorName"].ToString();
|
|
FactOperationInfoObj.OperationName = ds.Tables[0].Rows[0]["OperationName"].ToString();
|
|
FactOperationInfoObj.LeftRemark = ds.Tables[0].Rows[0]["LeftRemark"].ToString();
|
|
FactOperationInfoObj.RightRemark = ds.Tables[0].Rows[0]["RightRemark"].ToString();
|
|
if(ds.Tables[0].Rows[0]["OperateDate"].ToString()!="")
|
|
{
|
|
FactOperationInfoObj.OperateDate = DateTime.Parse(ds.Tables[0].Rows[0]["OperateDate"].ToString());
|
|
}
|
|
}
|
|
return FactOperationInfoObj;
|
|
}
|
|
|
|
public DataTable GetDataTable(string strWhere)
|
|
{
|
|
StringBuilder strSql=new StringBuilder();
|
|
strSql.Append("select * ");
|
|
strSql.Append(" FROM FactOperationInfo ");
|
|
if(strWhere.Trim()!="")
|
|
{
|
|
strSql.Append(" where "+strWhere);
|
|
}
|
|
return HelperDB.DbHelperSQL.GetDataTable(strSql.ToString());
|
|
}
|
|
|
|
public List<int> GetFactOperationInfoIdList(int PatientId)
|
|
{
|
|
List<int> OperationIdList = new List<int>();
|
|
string strSql = "SELECT OperationId FROM FactOperationInfo WHERE PatientId='" + PatientId + "'";
|
|
|
|
DataTable dt = HelperDB.DbHelperSQL.GetDataTable(strSql.ToString());
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
OperationIdList.Add(int.Parse(dt.Rows[i]["OperationId"].ToString()));
|
|
|
|
}
|
|
return OperationIdList;
|
|
}
|
|
}
|
|
}
|