105 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			105 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Data;
 | |
| using System.Data.SqlClient;
 | |
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using AIMSModel;
 | |
| using AIMSObjectQuery;
 | |
| using System.Text;
 | |
| 
 | |
| namespace AIMSDAL
 | |
| {
 | |
|     internal partial class DFactDiagnoseInfo
 | |
|     {
 | |
| 		public static void Add(FactDiagnoseInfo FactDiagnoseInfoObj)
 | |
| 		{
 | |
| 			StringBuilder strSql=new StringBuilder();
 | |
| 			strSql.Append("insert into [FactDiagnoseInfo](");
 | |
| 			strSql.Append("PatientId,ApplyId,DiagnoseId,OperatorNo,OperatorName,OperateDate");
 | |
| 			strSql.Append(")");
 | |
| 			strSql.Append(" values (");
 | |
| 			strSql.Append(""+FactDiagnoseInfoObj.PatientId+",");
 | |
| 			strSql.Append(""+FactDiagnoseInfoObj.ApplyId+",");
 | |
| 			strSql.Append(""+FactDiagnoseInfoObj.DiagnoseId+",");
 | |
| 			strSql.Append("'"+FactDiagnoseInfoObj.OperatorNo+"',");
 | |
| 			strSql.Append("'"+FactDiagnoseInfoObj.OperatorName+"',");
 | |
| 			strSql.Append("'"+FactDiagnoseInfoObj.OperateDate+"'");
 | |
| 			strSql.Append(")");
 | |
| 		    HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
 | |
| 		}
 | |
| 
 | |
| 		public static void Delete(int PatientId)
 | |
| 		{
 | |
| 			StringBuilder strSql=new StringBuilder();
 | |
| 			strSql.Append("delete FactDiagnoseInfo ");
 | |
| 			strSql.Append(" where PatientId="+PatientId+"" );
 | |
| 				  HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
 | |
| 		}
 | |
| 
 | |
| 		public static FactDiagnoseInfo GetModel(int Id)
 | |
| 		{
 | |
|             FactDiagnoseInfo FactDiagnoseInfoObj = new FactDiagnoseInfo();
 | |
| 			StringBuilder strSql=new StringBuilder();
 | |
| 			strSql.Append("select  ");
 | |
| 			strSql.Append("Id,PatientId,ApplyId,DiagnoseId,OperatorNo,OperatorName,OperateDate ");
 | |
| 			strSql.Append(" from FactDiagnoseInfo ");
 | |
| 			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()!="")
 | |
| 				{
 | |
|                     FactDiagnoseInfoObj.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
 | |
| 				}
 | |
| 				if(ds.Tables[0].Rows[0]["PatientId"].ToString()!="")
 | |
| 				{
 | |
|                     FactDiagnoseInfoObj.PatientId = int.Parse(ds.Tables[0].Rows[0]["PatientId"].ToString());
 | |
| 				}
 | |
| 				if(ds.Tables[0].Rows[0]["ApplyId"].ToString()!="")
 | |
| 				{
 | |
|                     FactDiagnoseInfoObj.ApplyId = int.Parse(ds.Tables[0].Rows[0]["ApplyId"].ToString());
 | |
| 				}
 | |
| 				if(ds.Tables[0].Rows[0]["DiagnoseId"].ToString()!="")
 | |
| 				{
 | |
|                     FactDiagnoseInfoObj.DiagnoseId = int.Parse(ds.Tables[0].Rows[0]["DiagnoseId"].ToString());
 | |
| 				}
 | |
|                 FactDiagnoseInfoObj.OperatorNo = ds.Tables[0].Rows[0]["OperatorNo"].ToString();
 | |
|                 FactDiagnoseInfoObj.OperatorName = ds.Tables[0].Rows[0]["OperatorName"].ToString();
 | |
| 				if(ds.Tables[0].Rows[0]["OperateDate"].ToString()!="")
 | |
| 				{
 | |
|                     FactDiagnoseInfoObj.OperateDate = DateTime.Parse(ds.Tables[0].Rows[0]["OperateDate"].ToString());
 | |
| 				}
 | |
| 			}
 | |
|             return FactDiagnoseInfoObj;
 | |
| 		}
 | |
| 
 | |
|         public static DataTable GetDataTable(string strWhere)
 | |
| 		{
 | |
| 			StringBuilder strSql=new StringBuilder();
 | |
| 			strSql.Append("select [Id],[PatientId],[ApplyId],[DiagnoseId],[OperatorNo],[OperatorName],[OperateDate] ");
 | |
| 			strSql.Append(" FROM FactDiagnoseInfo ");
 | |
| 			if(strWhere.Trim()!="")
 | |
| 			{
 | |
| 
 | |
| 				strSql.Append(" where "+strWhere);
 | |
| 			}
 | |
|             return HelperDB.DbHelperSQL.GetDataTable(strSql.ToString());
 | |
| 		}
 | |
| 
 | |
|         public static List<int> GetFactDiagnoseInfoIdList(int PatientId)
 | |
|         {
 | |
|             List<int> DiagnoseIdList = new List<int>();
 | |
|             string strSql = "SELECT  DiagnoseId FROM FactDiagnoseInfo WHERE PatientId='" + PatientId + "'";
 | |
| 
 | |
|             DataTable dt = HelperDB.DbHelperSQL.GetDataTable(strSql.ToString());
 | |
|             for (int i = 0; i < dt.Rows.Count; i++)
 | |
|             {
 | |
|                 DiagnoseIdList.Add(int.Parse(dt.Rows[i]["DiagnoseId"].ToString()));
 | |
| 
 | |
|             }
 | |
|             return DiagnoseIdList;
 | |
|         }
 | |
| 
 | |
|     }
 | |
| }
 |