191 lines
7.2 KiB
C#
191 lines
7.2 KiB
C#
using System;
|
|
using AIMSDAL;
|
|
using AIMSModel;
|
|
using AIMSObjectQuery;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using HelperDB;
|
|
using AIMSExtension;
|
|
using System.Data.SqlClient;
|
|
using System.Reflection;
|
|
using System.Windows.Forms;
|
|
|
|
namespace AIMSBLL
|
|
{
|
|
public partial class BOperationRecord
|
|
{
|
|
public static int AddTitleTime(int PatientId, int ApplyId, int RecoverId, string TableColumnName, DateTime Time, int RoomId)
|
|
{
|
|
return DOperationRecord.AddTitleTime(PatientId, ApplyId, RecoverId, TableColumnName, Time, RoomId);
|
|
}
|
|
|
|
public static TitleTime GetTitleTime(int PatientId, int RecoverId)
|
|
{
|
|
return DOperationRecord.GetTitleTime(PatientId, RecoverId);
|
|
}
|
|
public static void UpdateState(int PatientId, int TypeId, int State)
|
|
{
|
|
DOperationRecord.UpdateState(PatientId, TypeId, State);
|
|
}
|
|
public static void DeleteOperationRecordData(int RecorId, int PatientId, int TypeId)
|
|
{
|
|
DOperationRecord.DeleteOperationRecordData(RecorId, PatientId, TypeId);
|
|
}
|
|
public static void DeleteOperationRecorvreData(int PatientId, int TypeId)
|
|
{
|
|
DOperationRecord.DeleteOperationRecorvreData(PatientId, TypeId);
|
|
}
|
|
public static void DeleteEvent(int PatientId, int eventId)
|
|
{
|
|
DOperationRecord.DeleteEvent(PatientId, eventId);
|
|
}
|
|
public static DataTable GetOperationDoingDataTableByPatientId(int PatientId, int TypeId)
|
|
{
|
|
return DOperationRecord.GetOperationDoingMainInfo(PatientId, TypeId);
|
|
}
|
|
public static bool ValidInput(int PatientId, int TypeId)
|
|
{
|
|
|
|
bool result = false;
|
|
DataTable dt = DOperationRecord.GetOperationDoingMainInfo(PatientId, TypeId);
|
|
if (dt.Rows[0]["InRoomTime"].ToString().Length < 1)
|
|
{
|
|
MessageBox.Show("入室不能为空!");
|
|
}
|
|
else if (dt.Rows[0]["OutRoomTime"].ToString().Length < 1)
|
|
{
|
|
MessageBox.Show("出室不能为空!");
|
|
}
|
|
else if (dt.Rows[0]["OperationBeginTime"].ToString().Length < 1)
|
|
{
|
|
MessageBox.Show("手术开始时间不能为空!");
|
|
}
|
|
else if (dt.Rows[0]["OperationEndTime"].ToString().Length < 1)
|
|
{
|
|
MessageBox.Show("手术结束时间不能为空!");
|
|
}
|
|
else if (dt.Rows[0]["DiagnoseInfoName"].ToString().Length < 1)
|
|
{
|
|
MessageBox.Show("术后诊断不能为空!");
|
|
}
|
|
else if (dt.Rows[0]["OperationInfoName"].ToString().Length < 1)
|
|
{
|
|
MessageBox.Show("实施手术不能为空!");
|
|
}
|
|
else if (dt.Rows[0]["AnaesthesiaMethodName"].ToString().Length < 1)
|
|
{
|
|
MessageBox.Show("麻醉方式不能为空!");
|
|
}
|
|
else if (dt.Rows[0]["OperationDoctor"].ToString().Length < 1)
|
|
{
|
|
MessageBox.Show("手术医生不能为空!");
|
|
}
|
|
else if (dt.Rows[0]["AnesthesiaDoctor"].ToString().Length < 1)
|
|
{
|
|
MessageBox.Show("麻醉医生不能为空!");
|
|
}
|
|
else
|
|
{
|
|
result = true;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 得到手术的最大时间点
|
|
/// </summary>
|
|
/// <param name="doOpeInfo"></param>
|
|
/// <returns></returns>
|
|
public static DateTime lastMaxOperationDate(int PatientId)
|
|
{
|
|
string sqlStr = "select top 1 * from (SELECT s.PatientId , s.EventEndTime etime FROM FactEvents s WHERE s.PatientId = " + PatientId + " union all SELECT s.PatientId , s.DrugEndTime FROM[dbo].[FactDrug] s WHERE s.PatientId = " + PatientId + " ) a order by a.etime desc";
|
|
DataTable dt = DBHelper.GetDataTable(sqlStr);
|
|
return DateTime.Parse(dt.Rows[0][1].ToString());
|
|
}
|
|
|
|
public static DataTable getPhysioDataByTimeName(string IP, string name, DateTime starttime, DateTime endtime)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
string sqlStr = " exec [usp_GetPhysioDataByName] '" + IP + "','" + name + "','" + starttime + "','" + endtime + "'";//
|
|
dt = DATADBHelper.GetDataTable(sqlStr);
|
|
return dt;
|
|
}
|
|
|
|
public static DataTable getPhysioDataByIp(string IP, int operationId, DateTime starttime, DateTime endtime, int collectInterval)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
string sqlStr = " exec [usp_GetPhysioDataByIp] '" + IP + "','" + starttime + "','" + endtime + "'," + collectInterval;
|
|
dt = DATADBHelper.GetDataTable(sqlStr);
|
|
foreach (DataRow item in dt.Rows)
|
|
{
|
|
if (item[0].ToString() == "7")
|
|
{
|
|
foreach (DataRow item1 in dt.Rows)
|
|
{
|
|
if (item1[0].ToString() == "5" && item1[1].ToString() == item[1].ToString())
|
|
{
|
|
item1[2] = "0";
|
|
}
|
|
}
|
|
}
|
|
if (item[0].ToString() == "8")
|
|
{
|
|
foreach (DataRow item1 in dt.Rows)
|
|
{
|
|
if (item1[0].ToString() == "6" && item1[1].ToString() == item[1].ToString())
|
|
{
|
|
item1[2] = "0";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return dt;
|
|
}
|
|
|
|
public static int Update(string oql, ParameterList parameters)
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(Connection.ConnectionString))
|
|
{
|
|
conn.Open();
|
|
using (SqlCommand cmd = conn.CreateCommand())
|
|
{
|
|
//解析过滤部份Sql语句
|
|
string updateString = oql;// SyntaxAnalyzer.ParseSql(oql, new OperationRecordMap());
|
|
cmd.CommandText = "update OperationRecord 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();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public static DateTime GetMaxTime(int PatientId, int Type)
|
|
{
|
|
return DOperationRecord.GetMaxTime(PatientId, Type);
|
|
}
|
|
public static int GetDataCount(int RecorId, int PatientId, int Type)
|
|
{
|
|
return DOperationRecord.GetDataCount(RecorId, PatientId, Type);
|
|
}
|
|
|
|
public static DataTable FillDrugData(int PatientId, int DrugTypeId)
|
|
{
|
|
return DOperationRecord.FillDrugData(PatientId, DrugTypeId);
|
|
}
|
|
|
|
public static DataTable FillOutFluid(int PatientId, int DrugTypeId)
|
|
{
|
|
return DOperationRecord.FillOutFluid(PatientId, DrugTypeId);
|
|
}
|
|
}
|
|
}
|