AIMS/AIMSEntity/Extensions/BOperationReview.cs
leomon 4b92b1d919 取消手术排程提示
医疗文书未排程列表
点击主复制药品 剂量也复制 在空白行之上
添加多个子药往后新增行
刷新手术间台次逻辑
药品判断相同新增通路 考虑模板
 通路 版本号 是否限制用药 自备药品 是否皮试
2022-11-14 23:13:04 +08:00

126 lines
6.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Xml;
using AIMSModel;
using HelperDB;
using DrawGraph;
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);
}
public static void GetASALevel(int PatientId, OperationRecord _record)
{
string ASALevel = GetDocumentXmlStatic("麻醉术前访视记录单", PatientId, "ASA分级");
if (ASALevel != "")
{
BasicDictionary dict = BBasicDictionary.SelectSingle(" ParentId=30 and Name='" + ASALevel + "'", null);
if (dict != null)
{
_record.ASALevel = dict.Id.Value;
BOperationRecord.Update(" ASALevel=@ASALevel where Id=@Id", new ParameterList("@ASALevel", _record.ASALevel, "@Id", _record.Id.Value));
}
}
}
/// <summary>
/// 根据模板名称查询文档
/// </summary>
/// <param name="tempName">模板名称</param>
/// <param name="patientId">患者Id</param>
/// <returns></returns>
public static string GetDocumentbyName2(string tempName, int patientId)
{
string XmlStatic = "";
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)
{
XmlStatic = dt.Rows[0]["XmlStatic"].ToString();
}
}
catch (Exception ex)
{
throw ex;
}
return XmlStatic;
}
public static XmlDocument GetPrintDocumentXml(string tempName, int patientId)
{
string XmlStatic = GetDocumentbyName2(tempName, patientId);
XmlDocument doc = new XmlDocument();
if (XmlStatic != null && XmlStatic.Length > 0)
{
doc.LoadXml(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;
}
}
}