/// <summary> /// 检查HIS系统中出院卡片是否已审核通过 /// 注:功能未启用、未配置、配置信息错误也视为未通过 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-03-04</date> /// <param name="noofinpat"></param> /// <returns></returns> public static bool CheckOutHosCardCheckPassed(int noofinpat) { try { string config = DS_SqlService.GetConfigValueByKey("AuditOutHosCardInHIS"); if (string.IsNullOrEmpty(config)) { return(false); } XmlDocument doc = new XmlDocument(); doc.LoadXml(config); #region 1、出科检查按钮是否显示 XmlNodeList isOutHosCheckBtnOpenList = doc.GetElementsByTagName("IsOutHosCheckBtnOpen"); if (null == isOutHosCheckBtnOpenList || isOutHosCheckBtnOpenList.Count == 0) { return(false); } if (null != isOutHosCheckBtnOpenList[0].InnerText && isOutHosCheckBtnOpenList[0].InnerText.Trim() != "1") { return(false); } #endregion #region 2、此功能是否启用 XmlNodeList isOpenList = doc.GetElementsByTagName("IsOpen"); if (null == isOpenList || isOpenList.Count == 0) { return(false); } if (null != isOpenList[0].InnerText && isOpenList[0].InnerText.Trim() != "1") { return(false); } #endregion #region 3、出科检查是否已通过 ///3.1、EMR中病人基本信息表 XmlNodeList emrBasicInfoTableNameList = doc.GetElementsByTagName("EmrBasicInfoTableName"); if (null == emrBasicInfoTableNameList || emrBasicInfoTableNameList.Count == 0) { return(false); } string emrBasicInfoTableName = null == emrBasicInfoTableNameList[0].InnerText ? string.Empty : emrBasicInfoTableNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(emrBasicInfoTableName)) { return(false); } ///3.2、EMR病人基本信息表中对应的出院检查标识字段 XmlNodeList emrOutHosCheckFlagFieldNameList = doc.GetElementsByTagName("EmrOutHosCheckFlagFieldName"); if (null == emrOutHosCheckFlagFieldNameList || emrOutHosCheckFlagFieldNameList.Count == 0) { return(false); } string emrOutHosCheckFlagFieldName = null == emrOutHosCheckFlagFieldNameList[0].InnerText ? string.Empty : emrOutHosCheckFlagFieldNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(emrOutHosCheckFlagFieldName)) { return(false); } ///3.3、EMR病人基本信息表中与病人表关联的字段 XmlNodeList relatedNoofinpatFieldNameList = doc.GetElementsByTagName("RelatedNoofinpatFieldName"); if (null == relatedNoofinpatFieldNameList || relatedNoofinpatFieldNameList.Count == 0) { return(false); } string relatedNoofinpatFieldName = null == relatedNoofinpatFieldNameList[0].InnerText ? string.Empty : relatedNoofinpatFieldNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(relatedNoofinpatFieldName)) { return(false); } ///3.4、EMR病人基本信息表中出院检查标识字段对应的检查通过的值 XmlNodeList emrOutHosCheckPassedValueList = doc.GetElementsByTagName("EmrOutHosCheckPassedValue"); if (null == emrOutHosCheckPassedValueList || emrOutHosCheckPassedValueList.Count == 0) { return(false); } string emrOutHosCheckPassedValue = null == emrOutHosCheckPassedValueList[0].InnerText ? string.Empty : emrOutHosCheckPassedValueList[0].InnerText.Trim(); if (string.IsNullOrEmpty(emrOutHosCheckPassedValue)) { return(false); } string checkFlagValue = DS_SqlService.GetFieldContent(DS_Common.DeleteSpecialCharacter(emrBasicInfoTableName), DS_Common.DeleteSpecialCharacter(emrOutHosCheckFlagFieldName), DS_Common.DeleteSpecialCharacter(relatedNoofinpatFieldName), DS_Common.DeleteSpecialCharacter(noofinpat.ToString()).Trim()); ///3.5、判断出科检查是否已通过 if (checkFlagValue != emrOutHosCheckPassedValue) { return(false); } #endregion #region 4、EMR中病人表与HIS关联的字段 ///4.1、EMR中病人表与HIS关联的字段 XmlNodeList emrRelatedFieldNameList = doc.GetElementsByTagName("EmrRelatedFieldName"); if (null == emrRelatedFieldNameList || emrRelatedFieldNameList.Count == 0) { return(false); } string emrRelatedFieldName = null == emrRelatedFieldNameList[0].InnerText ? string.Empty : emrRelatedFieldNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(emrRelatedFieldName)) { return(false); } ///4.2、EMR中病人表与HIS关联的字段的值 DataTable dt = DS_SqlService.GetInpatientByID(noofinpat, 1); emrRelatedFieldName = DS_Common.DeleteSpecialCharacter(emrRelatedFieldName); if (null == dt || dt.Rows.Count == 0 || !dt.Columns.Contains(emrRelatedFieldName.ToUpper())) { return(false); } string emrRelatedFieldValue = dt.Rows[0][emrRelatedFieldName].ToString(); if (string.IsNullOrEmpty(emrRelatedFieldValue)) { return(false); } #endregion #region 5、该病人的出院卡片在HIS系统中是否已经审核通过 ///5.1、获取HIS审核状态表 XmlNodeList auditTableNameList = doc.GetElementsByTagName("AuditTableName"); if (null == auditTableNameList || auditTableNameList.Count == 0) { return(false); } string auditTableName = null == auditTableNameList[0].InnerText ? string.Empty : auditTableNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(auditTableName)) { return(false); } ///5.2、获取HIS审核状态字段 XmlNodeList auditFieldNameList = doc.GetElementsByTagName("AuditFieldName"); if (null == auditFieldNameList || auditFieldNameList.Count == 0) { return(false); } string auditFieldName = null == auditFieldNameList[0].InnerText ? string.Empty : auditFieldNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(auditFieldName)) { return(false); } ///5.3、获取HIS审核状态字段对应的审核通过的值(配置项) XmlNodeList auditPassedValueList = doc.GetElementsByTagName("AuditPassedValue"); if (null == auditPassedValueList || auditPassedValueList.Count == 0) { return(false); } string auditPassedValue = null == auditPassedValueList[0].InnerText ? string.Empty : auditPassedValueList[0].InnerText.Trim(); if (string.IsNullOrEmpty(auditPassedValue)) { return(false); } ///5.4、获取HIS中与EMR病人表关联的字段 XmlNodeList hisRelatedFieldNameList = doc.GetElementsByTagName("HisRelatedFieldName"); if (null == hisRelatedFieldNameList || hisRelatedFieldNameList.Count == 0) { return(false); } string hisRelatedFieldName = null == hisRelatedFieldNameList[0].InnerText ? string.Empty : hisRelatedFieldNameList[0].InnerText.Trim(); if (string.IsNullOrEmpty(hisRelatedFieldName)) { return(false); } using (OracleConnection conn = new OracleConnection(DataAccessFactory.GetSqlDataAccess("HISDB").GetDbConnection().ConnectionString)) { if (conn.State != ConnectionState.Open) { conn.Open(); } OracleCommand cmd = conn.CreateCommand(); cmd.CommandType = CommandType.Text; ///5.5、该病人的出院卡片在HIS系统中是否已经审核通过 auditTableName = DS_Common.DeleteSpecialCharacter(auditTableName); auditFieldName = DS_Common.DeleteSpecialCharacter(auditFieldName); auditPassedValue = DS_Common.DeleteSpecialCharacter(auditPassedValue); hisRelatedFieldName = DS_Common.DeleteSpecialCharacter(hisRelatedFieldName); cmd.CommandText = " select " + auditFieldName + " from " + auditTableName + " where " + hisRelatedFieldName + " = :emrRelatedFieldValue "; cmd.Parameters.Clear(); OracleParameter para = new OracleParameter("emrRelatedFieldValue", OracleType.Char); para.Value = emrRelatedFieldValue; cmd.Parameters.Add(para); object obj = cmd.ExecuteOracleScalar(); if (null != obj && obj.ToString().Trim() == auditPassedValue.Trim()) { return(true); } } #endregion return(false); } catch (Exception ex) { throw new Exception(ex.Message); } }