120 lines
6.5 KiB
C#
120 lines
6.5 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using AIMSModel;
|
|
using AIMSObjectQuery;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
|
|
namespace AIMSDAL
|
|
{
|
|
internal partial class DOrisPatient
|
|
{
|
|
public static void Add(OrisPatient Oris_PatientObj)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("insert into [Oris_Patient](");
|
|
strSql.Append("MdrecNo,ArchivesNo,Name,Sex,BirthDay,Age,Height,Weight,DepId,Illdistrict,SickBed,BloodType,RHBloodType,PatientKind,InHosDate,IdentityCard,Contacts,ContactsPhone,OperatorNo,OperatorName,OperateDate,PatientType");
|
|
strSql.Append(")");
|
|
strSql.Append(" values (");
|
|
strSql.Append("'" + Oris_PatientObj.MdrecNo + "',");
|
|
strSql.Append("'" + Oris_PatientObj.ArchivesNo + "',");
|
|
strSql.Append("'" + Oris_PatientObj.Name + "',");
|
|
strSql.Append("'" + Oris_PatientObj.Sex + "',");
|
|
strSql.Append("'" + Oris_PatientObj.BirthDay + "',");
|
|
strSql.Append("'" + Oris_PatientObj.Age + "',");
|
|
strSql.Append("'" + Oris_PatientObj.Height + "',");
|
|
strSql.Append("'" + Oris_PatientObj.Weight + "',");
|
|
strSql.Append("" + Oris_PatientObj.DepId + ",");
|
|
strSql.Append("'" + Oris_PatientObj.Illdistrict + "',");
|
|
strSql.Append("'" + Oris_PatientObj.SickBed + "',");
|
|
strSql.Append("'" + Oris_PatientObj.BloodType + "',");
|
|
strSql.Append("'" + Oris_PatientObj.RHBloodType + "',");
|
|
strSql.Append("'" + Oris_PatientObj.PatientKind + "',");
|
|
strSql.Append("'" + Oris_PatientObj.InHosDate + "',");
|
|
strSql.Append("'" + Oris_PatientObj.IdentityCard + "',");
|
|
strSql.Append("'" + Oris_PatientObj.Contacts + "',");
|
|
strSql.Append("'" + Oris_PatientObj.ContactsPhone + "',");
|
|
strSql.Append("'" + Oris_PatientObj.OperatorNo + "',");
|
|
strSql.Append("'" + Oris_PatientObj.OperatorName + "',");
|
|
strSql.Append("'" + Oris_PatientObj.OperateDate + "',");
|
|
strSql.Append("'" + Oris_PatientObj.PatientType + "'");
|
|
strSql.Append(")");
|
|
HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
|
|
}
|
|
|
|
public static OrisPatient GetModel(int Id)
|
|
{
|
|
OrisPatient Oris_PatientObj = new OrisPatient();
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select ");
|
|
strSql.Append("Id,MdrecNo,ArchivesNo,Name,Sex,BirthDay,Age,Height,Weight,DepId,Illdistrict,SickBed,BloodType,RHBloodType,PatientKind,InHosDate,IdentityCard,Contacts,ContactsPhone,OperatorNo,OperatorName,OperateDate,PatientType ");
|
|
strSql.Append(" from Oris_Patient ");
|
|
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() != "")
|
|
{
|
|
Oris_PatientObj.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
|
|
}
|
|
Oris_PatientObj.PatientType = ds.Tables[0].Rows[0]["PatientType"].ToString();
|
|
Oris_PatientObj.MdrecNo = ds.Tables[0].Rows[0]["MdrecNo"].ToString();
|
|
Oris_PatientObj.ArchivesNo = ds.Tables[0].Rows[0]["ArchivesNo"].ToString();
|
|
Oris_PatientObj.Name = ds.Tables[0].Rows[0]["Name"].ToString();
|
|
Oris_PatientObj.Sex = ds.Tables[0].Rows[0]["Sex"].ToString();
|
|
if (ds.Tables[0].Rows[0]["BirthDay"].ToString() != "")
|
|
{
|
|
Oris_PatientObj.BirthDay = DateTime.Parse(ds.Tables[0].Rows[0]["BirthDay"].ToString());
|
|
}
|
|
Oris_PatientObj.Age = ds.Tables[0].Rows[0]["Age"].ToString();
|
|
Oris_PatientObj.Height = ds.Tables[0].Rows[0]["Height"].ToString();
|
|
Oris_PatientObj.Weight = ds.Tables[0].Rows[0]["Weight"].ToString();
|
|
if (ds.Tables[0].Rows[0]["DepId"].ToString() != "")
|
|
{
|
|
Oris_PatientObj.DepId = int.Parse(ds.Tables[0].Rows[0]["DepId"].ToString());
|
|
}
|
|
Oris_PatientObj.Illdistrict = ds.Tables[0].Rows[0]["Illdistrict"].ToString();
|
|
Oris_PatientObj.SickBed = ds.Tables[0].Rows[0]["SickBed"].ToString();
|
|
Oris_PatientObj.BloodType = ds.Tables[0].Rows[0]["BloodType"].ToString();
|
|
Oris_PatientObj.RHBloodType = ds.Tables[0].Rows[0]["RHBloodType"].ToString();
|
|
Oris_PatientObj.PatientKind = ds.Tables[0].Rows[0]["PatientKind"].ToString();
|
|
if (ds.Tables[0].Rows[0]["InHosDate"].ToString() != "")
|
|
{
|
|
Oris_PatientObj.InHosDate = DateTime.Parse(ds.Tables[0].Rows[0]["InHosDate"].ToString());
|
|
}
|
|
Oris_PatientObj.IdentityCard = ds.Tables[0].Rows[0]["IdentityCard"].ToString();
|
|
Oris_PatientObj.Contacts = ds.Tables[0].Rows[0]["Contacts"].ToString();
|
|
Oris_PatientObj.ContactsPhone = ds.Tables[0].Rows[0]["ContactsPhone"].ToString();
|
|
Oris_PatientObj.OperatorNo = ds.Tables[0].Rows[0]["OperatorNo"].ToString();
|
|
Oris_PatientObj.OperatorName = ds.Tables[0].Rows[0]["OperatorName"].ToString();
|
|
if (ds.Tables[0].Rows[0]["OperateDate"].ToString() != "")
|
|
{
|
|
Oris_PatientObj.OperateDate = DateTime.Parse(ds.Tables[0].Rows[0]["OperateDate"].ToString());
|
|
}
|
|
}
|
|
return Oris_PatientObj;
|
|
}
|
|
|
|
public static DataTable GetDataTable(string strWhere)
|
|
{
|
|
StringBuilder strSql = new StringBuilder();
|
|
strSql.Append("select [Id],[MdrecNo],[ArchivesNo],[Name],[Sex],[BirthDay],[Height],[Weight],[DepId],[Illdistrict],[SickBed],[BloodType],[RHBloodType],[PatientKind],[InHosDate],[IdentityCard],[Contacts],[ContactsPhone],PatientType ");
|
|
strSql.Append(" FROM Oris_Patient ");
|
|
if (strWhere.Trim() != "")
|
|
{
|
|
strSql.Append(" where " + strWhere);
|
|
}
|
|
return HelperDB.DbHelperSQL.GetDataTable(strSql.ToString());
|
|
}
|
|
public static int GetOris_PatientMaxId()
|
|
{
|
|
string strSql = "SELECT (ISNULL(MAX(Id),0)) AS Id FROM Oris_Patient";
|
|
DataTable dt = HelperDB.DbHelperSQL.GetDataTable(strSql);
|
|
return int.Parse(dt.Rows[0]["Id"].ToString());
|
|
}
|
|
}
|
|
}
|