120 lines
6.1 KiB
C#
120 lines
6.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data;
|
|
using System.Xml;
|
|
using AIMSModel;
|
|
using HelperDB;
|
|
|
|
namespace AIMSBLL
|
|
{
|
|
public class BOperationReview
|
|
{
|
|
public static DataTable GetOperationReviewDataTable(string MdrecNo, string PatientName, string OperationBeginTime, string OperationEndTime)
|
|
{
|
|
string strSql = " SELECT of1.PatientId, of1.ApplyId, of1.MdrecNo, of1.ArchivesNo, of1.PatientName,of1.ApplyDepName, of1.PatientKind," +
|
|
" of1.Sex, of1.BirthDay, of1.Height, of1.[Weight], of1.BloodType," +
|
|
" of1.RHBloodType, of1.Illdistrict, of1.SickBed, of1.OperationType," +
|
|
" of1.[State],od.DiagnoseInfoName, od.OperationInfoName," +
|
|
" od.OperationBeginTime,od.OperationEndTime," +
|
|
" od.AnaesthesiaMethodName, od.OperationCutTypeName," +
|
|
" od.OperationBodyPositionName, od.OperationPositionName," +
|
|
" od.OperationDoctor, od.Assistant, od.AnesthesiaDoctor," +
|
|
" od.Nurse, od.Remarks,of1.MedicalRecord,of1.MedicalRecordTime FROM V_OperationDoing od" +
|
|
" LEFT JOIN V_OperationFront of1 ON of1.PatientId = od.PatientId WHERE (of1.MdrecNo ='" + MdrecNo + "' OR of1.PatientName LIKE '" + PatientName + "%')" +
|
|
" AND od.OperationBeginTime >='" + OperationBeginTime + "' AND od.OperationBeginTime <'" + OperationEndTime + "' AND " +
|
|
" od.[State] IN ('手术结束','麻醉恢复结束')";
|
|
return HelperDB.DbHelperSQL.GetDataTable(strSql.ToString());
|
|
}
|
|
|
|
public static DataTable GetOperationPlanDataTable(DateTime BeginDate, DateTime EndDate, string DepName)
|
|
{
|
|
string strSql = "SELECT of1.ApplyId,OperationRoom,PlanOrder ,OrderOperationTime , of1.ApplyDepName,of1.SickBed, of1.MdrecNo, of1.PatientName, of1.Sex, of1.Age,of1.ApplyDiagnoseInfoName, of1.ApplyOperationInfoName,of1.OperationDoctor, of1.Assistant1 Assistant, " +
|
|
" of1.AnaesthesiaMethodName , of1.AnesthesiaDoctor , of1.InstrumentNurse , of1.TourNurse , of1.Remark,of1.OperationType" +
|
|
" FROM V_OperationFront of1 WHERE of1.PlanOperationTime>='" + BeginDate + "' AND of1.PlanOperationTime<'" + EndDate + "' Order By OperationRoomID,PlanOrder";
|
|
return HelperDB.DbHelperSQL.GetDataTable(strSql);
|
|
}
|
|
public static DataTable GetOperationPlanDataTable(string ApplyId)
|
|
{
|
|
string strSql = "SELECT of1.ApplyId,OperationRoom,PlanOrder ,OrderOperationTime , of1.ApplyDepName,of1.SickBed, of1.MdrecNo, of1.PatientName, of1.Sex, of1.Age,of1.ApplyDiagnoseInfoName, of1.ApplyOperationInfoName,of1.OperationDoctor, of1.Assistant1 Assistant, " +
|
|
" of1.AnaesthesiaMethodName , of1.AnesthesiaDoctor , of1.InstrumentNurse , of1.TourNurse , of1.Remark ,of1.OperationType " +
|
|
" FROM V_OperationFront of1 WHERE " + ApplyId + " ";
|
|
return HelperDB.DbHelperSQL.GetDataTable(strSql);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 根据模板名称查询文档
|
|
/// </summary>
|
|
/// <param name="tempName">模板名称</param>
|
|
/// <param name="patientId">患者Id</param>
|
|
/// <returns></returns>
|
|
public static PrintDocument GetDocumentbyName(string tempName, int patientId)
|
|
{
|
|
PrintDocument model = new PrintDocument();
|
|
string result = string.Empty;
|
|
try
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.Append("select ");
|
|
sb.Append(" pd.Id,");
|
|
sb.Append(" pd.PatientId,");
|
|
sb.Append(" pd.TemplateId,");
|
|
sb.Append(" pd.XmlFileName,");
|
|
sb.Append(" pd.XmlFile,");
|
|
sb.Append(" pd.XmlStatic,");
|
|
sb.Append(" pd.IsValid,");
|
|
sb.Append(" pd.OperatorNo,");
|
|
sb.Append(" pd.OperatorDate");
|
|
sb.Append(" from PrintDocument pd");
|
|
sb.Append(" where ");
|
|
sb.Append(" pd.PatientId = " + patientId);
|
|
sb.Append(" and pd.XmlFileName = '" + tempName + "'");
|
|
sb.Append(" and pd.IsValid = 1");
|
|
DataTable dt = DbHelperSQL.GetDataTable(sb.ToString());
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
model.Id = int.Parse(dt.Rows[0]["Id"].ToString());
|
|
model.PatientId = int.Parse(dt.Rows[0]["PatientId"].ToString());
|
|
model.TemplateId = int.Parse(dt.Rows[0]["TemplateId"].ToString());
|
|
model.XmlFileName = dt.Rows[0]["XmlFileName"].ToString();
|
|
model.XmlFile = dt.Rows[0]["XmlFile"].ToString();
|
|
model.XmlStatic = dt.Rows[0]["XmlStatic"].ToString();
|
|
model.OperatorNo = dt.Rows[0]["OperatorNo"].ToString();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
return model;
|
|
}
|
|
public static XmlDocument GetPrintDocumentXml(string tempName, int patientId)
|
|
{
|
|
PrintDocument model = GetDocumentbyName(tempName, patientId);
|
|
XmlDocument doc = new XmlDocument();
|
|
if (model.XmlStatic != null && model.XmlStatic.Length > 0)
|
|
{
|
|
doc.LoadXml(model.XmlStatic);
|
|
}
|
|
return doc;
|
|
}
|
|
public static string GetDocumentXmlStatic(string tempName, int patientId, string dictName)
|
|
{
|
|
string Value = "";
|
|
XmlDocument doc = GetPrintDocumentXml(tempName, patientId);
|
|
XmlElement root = doc.DocumentElement;
|
|
if (root != null)
|
|
{
|
|
foreach (XmlNode row in root.ChildNodes)
|
|
{
|
|
if (row.Attributes["Name"].InnerText == dictName)
|
|
Value = row.InnerText.Trim();//测试方法
|
|
}
|
|
}
|
|
return Value;
|
|
}
|
|
}
|
|
}
|