148 lines
		
	
	
		
			7.4 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			148 lines
		
	
	
		
			7.4 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;
 | |
| using DrawGraph;
 | |
| 
 | |
| namespace AIMSDAL
 | |
| {
 | |
|     internal partial class DFactOutputLiquids
 | |
|     { 
 | |
|         public static void Add(FactOutputLiquids FactOutputLiquidsObj)
 | |
|         {
 | |
|             StringBuilder strSql = new StringBuilder();
 | |
|             strSql.Append("insert into [FactOutputLiquids](");
 | |
|             strSql.Append("PatientId,OutputLiquidsTypeId,OutputLiquidsId,BeginTime,EndTime,Dosage,DosageUnit,IsContinue,Remark,OperatorNo,OperatorName,OperateDate");
 | |
|             strSql.Append(")");
 | |
|             strSql.Append(" values (");
 | |
|             strSql.Append("" + FactOutputLiquidsObj.PatientId + ",");
 | |
|             strSql.Append("" + FactOutputLiquidsObj.OutputLiquidsTypeId + ",");
 | |
|             strSql.Append("" + FactOutputLiquidsObj.OutputLiquidsId + ",");
 | |
|             strSql.Append("'" + FactOutputLiquidsObj.BeginTime + "',");
 | |
|             strSql.Append("'" + FactOutputLiquidsObj.EndTime + "',");
 | |
|             strSql.Append("" + FactOutputLiquidsObj.Dosage + ",");
 | |
|             strSql.Append("'" + FactOutputLiquidsObj.DosageUnit + "',");
 | |
|             strSql.Append("" + FactOutputLiquidsObj.IsContinue + ",");
 | |
|             strSql.Append("'" + FactOutputLiquidsObj.Remark + "',");
 | |
|             strSql.Append("'" + FactOutputLiquidsObj.OperatorNo + "',");
 | |
|             strSql.Append("'" + FactOutputLiquidsObj.OperatorName + "',");
 | |
|             strSql.Append("'" + FactOutputLiquidsObj.OperateDate + "'");
 | |
|             strSql.Append(")");
 | |
|             HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
 | |
|         }
 | |
|         public static bool IsValid(int OutputLiquidsId)
 | |
|         {
 | |
|             bool Temp = false;
 | |
|             string strSql = "  SELECT * FROM OutputLiquids WHERE Id =" + OutputLiquidsId + " and IsValid=1";
 | |
|             DataTable dt = HelperDB.DbHelperSQL.GetDataTable(strSql.ToString());
 | |
|             if (dt.Rows.Count > 0)
 | |
|             {
 | |
|                 Temp = true;
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 Temp = false;
 | |
|             }
 | |
|             return Temp;
 | |
|         }
 | |
| 
 | |
|         //public static void Update(FactOutputLiquids FactOutputLiquidsObj)
 | |
|         //{
 | |
|         //    StringBuilder strSql = new StringBuilder();
 | |
|         //    strSql.Append("update FactOutputLiquids set ");
 | |
|         //    strSql.Append("PatientId=" + FactOutputLiquidsObj.PatientId + ",");
 | |
|         //    strSql.Append("OutputLiquidsTypeId=" + FactOutputLiquidsObj.OutputLiquidsTypeId + ",");
 | |
|         //    strSql.Append("OutputLiquidsId=" + FactOutputLiquidsObj.OutputLiquidsId + ",");
 | |
|         //    strSql.Append("BeginTime='" + FactOutputLiquidsObj.BeginTime + "',");
 | |
|         //    strSql.Append("EndTime='" + FactOutputLiquidsObj.EndTime + "',");
 | |
|         //    strSql.Append("Dosage=" + FactOutputLiquidsObj.Dosage + ",");
 | |
|         //    strSql.Append("DosageUnit='" + FactOutputLiquidsObj.DosageUnit + "',");
 | |
|         //    strSql.Append("IsContinue=" + FactOutputLiquidsObj.IsContinue + ",");
 | |
|         //    strSql.Append("Remark='" + FactOutputLiquidsObj.Remark + "',");
 | |
|         //    strSql.Append("OperatorNo='" + FactOutputLiquidsObj.OperatorNo + "',");
 | |
|         //    strSql.Append("OperatorName='" + FactOutputLiquidsObj.OperatorName + "',");
 | |
|         //    strSql.Append("OperateDate='" + FactOutputLiquidsObj.OperateDate + "'");
 | |
|         //    strSql.Append(" where Id=" + FactOutputLiquidsObj.Id + " ");
 | |
| 
 | |
|         //    HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
 | |
|         //}
 | |
| 
 | |
|         public static void Delete(int Id)
 | |
|         {
 | |
|             string strSql = "delete from FactOutputLiquids where id= " + Id + "";
 | |
|             HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
 | |
|         }
 | |
| 
 | |
|         public static FactOutputLiquids GetModel(int Id)
 | |
|         {
 | |
|             FactOutputLiquids FactOutputLiquidsObj = new FactOutputLiquids();
 | |
|             StringBuilder strSql = new StringBuilder();
 | |
|             strSql.Append("select  ");
 | |
|             strSql.Append("Id,PatientId,OutputLiquidsTypeId,OutputLiquidsId,BeginTime,EndTime,Dosage,DosageUnit,IsContinue,Remark,OperatorNo,OperatorName,OperateDate ");
 | |
|             strSql.Append(" from FactOutputLiquids ");
 | |
|             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() != "")
 | |
|                 {
 | |
|                     FactOutputLiquidsObj.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
 | |
|                 }
 | |
|                 if (ds.Tables[0].Rows[0]["PatientId"].ToString() != "")
 | |
|                 {
 | |
|                     FactOutputLiquidsObj.PatientId = int.Parse(ds.Tables[0].Rows[0]["PatientId"].ToString());
 | |
|                 }
 | |
|                 if (ds.Tables[0].Rows[0]["OutputLiquidsTypeId"].ToString() != "")
 | |
|                 {
 | |
|                     FactOutputLiquidsObj.OutputLiquidsTypeId = int.Parse(ds.Tables[0].Rows[0]["OutputLiquidsTypeId"].ToString());
 | |
|                 }
 | |
|                 if (ds.Tables[0].Rows[0]["OutputLiquidsId"].ToString() != "")
 | |
|                 {
 | |
|                     FactOutputLiquidsObj.OutputLiquidsId = int.Parse(ds.Tables[0].Rows[0]["OutputLiquidsId"].ToString());
 | |
|                 }
 | |
|                 if (ds.Tables[0].Rows[0]["BeginTime"].ToString() != "")
 | |
|                 {
 | |
|                     FactOutputLiquidsObj.BeginTime = DateTime.Parse(ds.Tables[0].Rows[0]["BeginTime"].ToString());
 | |
|                 }
 | |
|                 if (ds.Tables[0].Rows[0]["EndTime"].ToString() != "")
 | |
|                 {
 | |
|                     FactOutputLiquidsObj.EndTime = DateTime.Parse(ds.Tables[0].Rows[0]["EndTime"].ToString());
 | |
|                 }
 | |
|                 if (ds.Tables[0].Rows[0]["Dosage"].ToString() != "")
 | |
|                 {
 | |
|                     FactOutputLiquidsObj.Dosage = decimal.Parse(ds.Tables[0].Rows[0]["Dosage"].ToString());
 | |
|                 }
 | |
|                 FactOutputLiquidsObj.DosageUnit = ds.Tables[0].Rows[0]["DosageUnit"].ToString();
 | |
|                 if (ds.Tables[0].Rows[0]["IsContinue"].ToString() != "")
 | |
|                 {
 | |
|                     FactOutputLiquidsObj.IsContinue = int.Parse(ds.Tables[0].Rows[0]["IsContinue"].ToString());
 | |
|                 }
 | |
|                 FactOutputLiquidsObj.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
 | |
|                 FactOutputLiquidsObj.OperatorNo = ds.Tables[0].Rows[0]["OperatorNo"].ToString();
 | |
|                 FactOutputLiquidsObj.OperatorName = ds.Tables[0].Rows[0]["OperatorName"].ToString();
 | |
|                 if (ds.Tables[0].Rows[0]["OperateDate"].ToString() != "")
 | |
|                 {
 | |
|                     FactOutputLiquidsObj.OperateDate = DateTime.Parse(ds.Tables[0].Rows[0]["OperateDate"].ToString());
 | |
|                 }
 | |
|             }
 | |
| 
 | |
|             return FactOutputLiquidsObj;
 | |
|         }
 | |
| 
 | |
|         public static DataTable GetDataTable(int PatientId, int OutputLiquidsTypeId)
 | |
|         {
 | |
|             StringBuilder strSql = new StringBuilder();
 | |
|             strSql.Append("SELECT fol.Id, ol.Id as OutputLiquidsId, ol.Name, fol.BeginTime, fol.EndTime, fol.Dosage, fol.DosageUnit, fol.Remark ");
 | |
|             strSql.Append(" FROM FactOutputLiquids fol ");
 | |
|             strSql.Append(" LEFT JOIN OutputLiquids ol ON ol.Id = fol.OutputLiquidsId ");
 | |
|             strSql.Append(" WHERE fol.PatientId=" + PatientId + " AND fol.OutputLiquidsTypeId=" + OutputLiquidsTypeId + " ");
 | |
|             return HelperDB.DbHelperSQL.GetDataTable(strSql.ToString());
 | |
|         }
 | |
| 
 | |
|     }
 | |
| }
 |