public frmOutOldMen() { InitializeComponent(); this.dgvData.AutoGenerateColumns = false; this.EveryThingIsOk = false; this.HaveToSave = false; requiredt = RequireBLL.GetList(" TabName = '老年人随访' ").Tables[0]; }
public frmOutBaseInfo() { InitializeComponent(); this.dgvData.AutoGenerateColumns = false; this.dgvData.ShowCellToolTips = false; this.toolTip1.AutomaticDelay = 0; this.toolTip1.OwnerDraw = true; this.toolTip1.ShowAlways = true; this.toolTip1.ToolTipTitle = ""; this.toolTip1.UseAnimation = true; this.toolTip1.UseFading = true; this.dgvData.CellMouseLeave += new DataGridViewCellEventHandler(dgvData_CellMouseLeave); this.dgvData.CellMouseEnter += new DataGridViewCellEventHandler(dgvData_CellMouseEnter); this.EveryThingIsOk = false; this.HaveToSave = false; #region 取得必填项设置的内容 requiredBaseDt = RequireBLL.GetList(" TabName='个人档案' AND Comment='封面信息' AND IsRequired='1' ").Tables[0]; requiredDetailedDt = RequireBLL.GetList(" TabName='个人档案' AND Comment='详细信息' AND IsRequired='1' ").Tables[0]; requiredHealthDt = RequireBLL.GetList(" TabName='个人档案' AND Comment='健康信息' AND IsRequired='1' ").Tables[0]; DataView dvBase = requiredBaseDt.DefaultView; dvBase.RowFilter = "ISNULL(OptionName,'') <>'' "; DataTable dtBase = dvBase.ToTable(); DataView dvDetailed = requiredDetailedDt.DefaultView; dvDetailed.RowFilter = "ISNULL(OptionName,'') <>'' "; DataTable dtDetailed = dvDetailed.ToTable(); DataView dvHealth = requiredHealthDt.DefaultView; dvHealth.RowFilter = "ISNULL(OptionName,'') <>'' "; DataTable dtHealth = dvHealth.ToTable(); // 封面信息 if (dtBase.Rows.Count > 0) { reqBaseWhere = "AND (1=1"; reqBaseCol = " \r\n,CONCAT(0+"; reqBaseTipCol = " \r\n,CONCAT(' 封面信息未填写项:\\r\\n',"; for (int i = 0; i < dtBase.Rows.Count; i++) { string col = dtBase.Rows[i]["OptionName"].ToString(); string colName = dtBase.Rows[i]["ChinName"].ToString(); string tableName = dtBase.Rows[i]["TableName"].ToString(); if (tableName.ToUpper().Equals("ARCHIVE_BASEINFO_OUT")) { col = "HealthRecords." + col; } else { col = "Base." + col; } // 拼接必输栏位非空白条件 reqBaseWhere += " OR IFNULL(" + col + ", '')='' "; // sum必输栏位空白的笔数 reqBaseCol += " (CASE WHEN IFNULL(" + col + ", '')='' THEN 1 ELSE 0 END) +"; reqBaseTipCol += " CASE WHEN IFNULL(" + col + ", '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } reqBaseCol = reqBaseCol.TrimEnd('+') + ") AS BaseInfoCount"; reqBaseTipCol = reqBaseTipCol.TrimEnd(',') + ") AS BaseInfo"; } // 详细信息 if (dtDetailed.Rows.Count > 0) { reqBaseWhere += reqBaseWhere.Length > 0 ? "" : " AND (1=1"; reqDetailedCol = " \r\n,CONCAT(0+"; reqDetailedTipCol = " \r\n,CONCAT(' 详细信息未填写项:\\r\\n',"; for (int i = 0; i < dtDetailed.Rows.Count; i++) { string col = "Base." + dtDetailed.Rows[i]["OptionName"].ToString(); string colName = dtDetailed.Rows[i]["ChinName"].ToString(); // 拼接必输栏位非空白条件 reqBaseWhere += " OR IFNULL(" + col + ", '')='' "; // sum必输栏位空白的笔数 reqDetailedCol += " (CASE WHEN IFNULL(" + col + ", '')='' THEN 1 ELSE 0 END) +"; reqDetailedTipCol += " CASE WHEN IFNULL(" + col + ", '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } reqDetailedCol = reqDetailedCol.TrimEnd('+') + ") AS RecordInfoCount"; reqDetailedTipCol = reqDetailedTipCol.TrimEnd(',') + ") AS RecordInfo"; } // 健康信息 if (dtHealth.Rows.Count > 0) { reqBaseWhere += reqBaseWhere.Length > 0 ? "" : " AND (1=1"; reqHealthCol = "\r\n,CONCAT(0+"; reqHealthTipCol = "\r\n ,CONCAT(' 健康信息未填写项:\\r\\n',"; for (int i = 0; i < dtHealth.Rows.Count; i++) { string col = dtHealth.Rows[i]["OptionName"].ToString(); string colName = dtHealth.Rows[i]["ChinName"].ToString(); string tableName = dtHealth.Rows[i]["TableName"].ToString(); if (tableName.ToUpper().Equals("ARCHIVE_ILLNESSHISTORYINFO")) { col = "Ill." + col; } else if (tableName.ToUpper().Equals("ARCHIVE_FAMILYHISTORYINFO")) { col = "Family." + col; } else { col = "Environment." + col; } if (col.ToLower().Equals("illnesstype")) { // sum必输栏位空白的笔数 reqHealthCol += " SUM(CASE WHEN IFNULL(Ill.IDCardNo, '')='' THEN 1 ELSE 0 END) +"; reqHealthCol += " (CASE WHEN IFNULL(Family.IDCardNo, '')='' THEN 1 ELSE 0 END) +"; reqHealthTipCol += " CASE WHEN IFNULL(Ill.IDCardNo, '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; reqHealthTipCol += " CASE WHEN IFNULL(Family.IDCardNo, '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } else { // 拼接必输栏位非空白条件 reqBaseWhere += " OR IFNULL(" + col + ", '')='' "; // sum必输栏位空白的笔数 reqHealthCol += " (CASE WHEN IFNULL(" + col + ", '')='' THEN 1 ELSE 0 END) +"; reqHealthTipCol += " CASE WHEN IFNULL(" + col + ", '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } } reqHealthCol = reqHealthCol.TrimEnd('+') + ") AS HealthInfoCount"; reqHealthTipCol = reqHealthTipCol.TrimEnd(',') + ") AS HealthInfo"; } reqBaseWhere += ")"; #endregion }
public frmOutHyper() { InitializeComponent(); this.dgvData.AutoGenerateColumns = false; this.dgvData.ShowCellToolTips = false; this.toolTip1.AutomaticDelay = 0; this.toolTip1.OwnerDraw = true; this.toolTip1.ShowAlways = true; this.toolTip1.ToolTipTitle = ""; this.toolTip1.UseAnimation = true; this.toolTip1.UseFading = true; this.dgvData.CellMouseLeave += new DataGridViewCellEventHandler(dgvData_CellMouseLeave); this.dgvData.CellMouseEnter += new DataGridViewCellEventHandler(dgvData_CellMouseEnter); this.EveryThingIsOk = false; this.HaveToSave = false; #region 取得必填项设置的内容 requireBaseDt = RequireBLL.GetList(" TabName = '高血压随访' AND Comment = '高血压基本信息' AND IsRequired='1' ").Tables[0]; requireVisitDt = RequireBLL.GetList(" TabName = '高血压随访' AND Comment = '高血压随访信息' AND IsRequired='1' ").Tables[0]; DataView dvBase = requireBaseDt.DefaultView; dvBase.RowFilter = "ISNULL(OptionName,'') <>'' "; DataTable dtBase = dvBase.ToTable(); DataView dvVisit = requireVisitDt.DefaultView; dvVisit.RowFilter = "ISNULL(OptionName,'') <>'' "; DataTable dtVisit = dvVisit.ToTable(); #region 基本信息 // 一般情况 if (dtBase.Rows.Count > 0) { reqWhere = "AND (1=1"; reqBaseCol = " \r\n,CONCAT(0+"; reqBaseTipCol = " \r\n,CONCAT(' 基本信息未填写项:\\r\\n',"; for (int i = 0; i < dtBase.Rows.Count; i++) { string col = dtBase.Rows[i]["OptionName"].ToString(); string colName = dtBase.Rows[i]["ChinName"].ToString(); string tableName = "HyperBase."; // 拼接必输栏位非空白条件 reqWhere += " OR IFNULL(" + tableName + col + ", '')='' "; // sum必输栏位空白的笔数 reqBaseCol += " (CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN 1 ELSE 0 END) +"; reqBaseTipCol += " CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } reqBaseCol = reqBaseCol.TrimEnd('+') + ") AS BaseCount"; reqBaseTipCol = reqBaseTipCol.TrimEnd(',') + ") AS BaseInfo"; } #endregion #region 随访信息 // 生活方式 if (dtVisit.Rows.Count > 0) { reqWhere += reqWhere.Length > 0 ? "" : " AND (1=1"; reqVisitCol = " \r\n,CONCAT(0+"; reqVisitTipCol = " \r\n,CONCAT(' 随访信息未填写项:\\r\\n',"; for (int i = 0; i < dtVisit.Rows.Count; i++) { string col = dtVisit.Rows[i]["OptionName"].ToString(); string colName = dtVisit.Rows[i]["ChinName"].ToString(); string tableName = "Visit."; if (colName.Contains("签名") || colName.Contains("签字")) { continue; } // 用药 if (colName.Equals("用药情况")) { // sum必输栏位空白的笔数 reqVisitCol += " SUM(CASE WHEN IFNULL(Conditions.IDCardNo, '')='' THEN 1 ELSE 0 END) +"; reqVisitTipCol += " CASE WHEN IFNULL(Conditions.IDCardNo, '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } else if (colName.Equals("用药调整意见")) { // sum必输栏位空白的笔数 reqVisitCol += " SUM(CASE WHEN IFNULL(ConditionChange.IDCardNo, '')='' THEN 1 ELSE 0 END) +"; reqVisitTipCol += " CASE WHEN IFNULL(ConditionChange.IDCardNo, '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } else { // 拼接必输栏位非空白条件 reqWhere += " OR IFNULL(" + tableName + col + ", '')='' "; // sum必输栏位空白的笔数 reqVisitCol += " (CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN 1 ELSE 0 END) +"; reqVisitTipCol += " CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } } reqVisitCol = reqVisitCol.TrimEnd('+') + ") AS VisitCount"; reqVisitTipCol = reqVisitTipCol.TrimEnd(',') + ") AS VisitInfo"; } #endregion reqWhere += ")"; #endregion }
public frmOutInfoQuery() { InitializeComponent(); this.dgvData.AutoGenerateColumns = false; this.dgvData.ShowCellToolTips = false; this.toolTip1.AutomaticDelay = 0; this.toolTip1.OwnerDraw = true; this.toolTip1.ShowAlways = true; this.toolTip1.ToolTipTitle = ""; this.toolTip1.UseAnimation = true; this.toolTip1.UseFading = true; this.dgvData.CellMouseLeave += new DataGridViewCellEventHandler(dgvData_CellMouseLeave); this.dgvData.CellMouseEnter += new DataGridViewCellEventHandler(dgvData_CellMouseEnter); this.EveryThingIsOk = false; this.HaveToSave = false; #region 取得必填项设置的内容 requireGerneralDt = RequireBLL.GetList(" TabName = '健康体检' AND Comment = '一般状况' AND IsRequired='1' ").Tables[0]; requireLifeDt = RequireBLL.GetList(" TabName = '健康体检' AND Comment = '生活方式' AND IsRequired='1' ").Tables[0]; requirePhysicalDt = RequireBLL.GetList(" TabName = '健康体检' AND Comment = '查体信息' AND IsRequired='1' ").Tables[0]; requireCheckDt = RequireBLL.GetList(" TabName = '健康体检' AND Comment = '辅助检查' AND IsRequired='1' ").Tables[0]; requireFunctionDt = RequireBLL.GetList(" TabName = '健康体检' AND Comment = '脏器功能' AND IsRequired='1' ").Tables[0]; requireHealthDt = RequireBLL.GetList(" TabName = '健康体检' AND Comment = '健康问题' AND IsRequired='1' ").Tables[0]; requireAssessmentDt = RequireBLL.GetList(" TabName = '健康体检' AND Comment = '健康评价' AND IsRequired='1' ").Tables[0]; DataView dvGerneral = requireGerneralDt.DefaultView; dvGerneral.RowFilter = "ISNULL(OptionName,'') <>'' "; DataTable dtGerneral = dvGerneral.ToTable(); DataView dvLife = requireLifeDt.DefaultView; dvLife.RowFilter = "ISNULL(OptionName,'') <>'' "; DataTable dtLife = dvLife.ToTable(); DataView dvPhysical = requirePhysicalDt.DefaultView; dvPhysical.RowFilter = "ISNULL(OptionName,'') <>'' "; DataTable dtPhysical = dvPhysical.ToTable(); DataView dvCheck = requireCheckDt.DefaultView; dvCheck.RowFilter = "ISNULL(OptionName,'') <>'' "; DataTable dtCheck = dvCheck.ToTable(); DataView dvFunction = requireFunctionDt.DefaultView; dvFunction.RowFilter = "ISNULL(OptionName,'') <>'' "; DataTable dtFunction = dvFunction.ToTable(); DataView dvHealth = requireHealthDt.DefaultView; dvHealth.RowFilter = "ISNULL(OptionName,'') <>'' "; DataTable dtHealth = dvHealth.ToTable(); DataView dvAssessment = requireAssessmentDt.DefaultView; dvAssessment.RowFilter = "ISNULL(OptionName,'') <>'' "; DataTable dtAssessment = dvAssessment.ToTable(); #region 一般情况 // 一般情况 if (dtGerneral.Rows.Count > 0) { reqWhere = "AND (1=1"; reqGerneralCol = " \r\n,CONCAT(0+"; reqGerneralTipCol = " \r\n,CONCAT(' 一般情况未填写项:\\r\\n',"; for (int i = 0; i < dtGerneral.Rows.Count; i++) { string col = dtGerneral.Rows[i]["OptionName"].ToString(); string colName = dtGerneral.Rows[i]["ChinName"].ToString(); string tableName = "General."; if (col.Equals("Symptom")) { tableName = "Customer."; } // 拼接必输栏位非空白条件 reqWhere += " OR IFNULL(" + tableName + col + ", '')='' "; // sum必输栏位空白的笔数 reqGerneralCol += " (CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN 1 ELSE 0 END) +"; reqGerneralTipCol += " CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } reqGerneralCol = reqGerneralCol.TrimEnd('+') + ") AS NormalCount"; reqGerneralTipCol = reqGerneralTipCol.TrimEnd(',') + ") AS NormalInfo"; } #endregion #region 生活方式 // 生活方式 if (dtLife.Rows.Count > 0) { reqWhere += reqWhere.Length > 0 ? "" : " AND (1=1"; reqLifeCol = " \r\n,CONCAT(0+"; reqLifeTipCol = " \r\n,CONCAT(' 生活方式未填写项:\\r\\n',"; for (int i = 0; i < dtLife.Rows.Count; i++) { string col = dtLife.Rows[i]["OptionName"].ToString(); string colName = dtLife.Rows[i]["ChinName"].ToString(); string tableName = "Life."; // 拼接必输栏位非空白条件 reqWhere += " OR IFNULL(" + tableName + col + ", '')='' "; // sum必输栏位空白的笔数 reqLifeCol += " (CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN 1 ELSE 0 END) +"; reqLifeTipCol += " CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } reqLifeCol = reqLifeCol.TrimEnd('+') + ") AS LifeCount"; reqLifeTipCol = reqLifeTipCol.TrimEnd(',') + ") AS LifeInfo"; } #endregion #region 查体信息 // 查体信息 if (dtPhysical.Rows.Count > 0) { reqWhere += reqWhere.Length > 0 ? "" : " AND (1=1"; reqPhysicalCol = " \r\n,CONCAT(0+"; reqPhysicalTipCol = " \r\n,CONCAT(' 一般情况未填写项:\\r\\n',"; for (int i = 0; i < dtPhysical.Rows.Count; i++) { string col = dtPhysical.Rows[i]["OptionName"].ToString(); string colName = dtPhysical.Rows[i]["ChinName"].ToString(); string tableName = "Physical."; // 拼接必输栏位非空白条件 reqWhere += " OR IFNULL(" + tableName + col + ", '')='' "; // sum必输栏位空白的笔数 reqPhysicalCol += " (CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN 1 ELSE 0 END) +"; reqPhysicalTipCol += " CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } reqPhysicalCol = reqPhysicalCol.TrimEnd('+') + ") AS PhysicalCount"; reqPhysicalTipCol = reqPhysicalTipCol.TrimEnd(',') + ") AS PhysicalInfo"; } #endregion #region 辅助检查 // 辅助检查 if (dtCheck.Rows.Count > 0) { reqWhere += reqWhere.Length > 0 ? "" : " AND (1=1"; reqCheckCol = " \r\n,CONCAT(0+"; reqCheckTipCol = " \r\n,CONCAT(' 辅助检查未填写项:\\r\\n',"; for (int i = 0; i < dtCheck.Rows.Count; i++) { string col = dtCheck.Rows[i]["OptionName"].ToString(); string colName = dtCheck.Rows[i]["ChinName"].ToString(); string tableName = "Checks."; // 拼接必输栏位非空白条件 reqWhere += " OR IFNULL(" + tableName + col + ", '')='' "; // sum必输栏位空白的笔数 reqCheckCol += " (CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN 1 ELSE 0 END) +"; reqCheckTipCol += " CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } reqCheckCol = reqCheckCol.TrimEnd('+') + ") AS CheckCount"; reqCheckTipCol = reqCheckTipCol.TrimEnd(',') + ") AS CheckInfo"; } #endregion #region 脏器功能 // 脏器功能 if (dtFunction.Rows.Count > 0) { reqWhere += reqWhere.Length > 0 ? "" : " AND (1=1"; reqFunctionCol = " \r\n,CONCAT(0+"; reqFunctionTipCol = " \r\n,CONCAT(' 脏器功能未填写项:\\r\\n',"; for (int i = 0; i < dtFunction.Rows.Count; i++) { string col = dtFunction.Rows[i]["OptionName"].ToString(); string colName = dtFunction.Rows[i]["ChinName"].ToString(); string tableName = "Function."; // 拼接必输栏位非空白条件 reqWhere += " OR IFNULL(" + tableName + col + ", '')='' "; // sum必输栏位空白的笔数 reqFunctionCol += " (CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN 1 ELSE 0 END) +"; reqFunctionTipCol += " CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } reqFunctionCol = reqFunctionCol.TrimEnd('+') + ") AS FunctionCount"; reqFunctionTipCol = reqFunctionTipCol.TrimEnd(',') + ") AS FunctionInfo"; } #endregion #region 健康问题 // 健康问题 if (dtHealth.Rows.Count > 0) { reqWhere += reqWhere.Length > 0 ? "" : " AND (1=1"; reqHealthCol = " \r\n,CONCAT(0+"; reqHealthTipCol = " \r\n,CONCAT(' 健康问题未填写项:\\r\\n',"; for (int i = 0; i < dtHealth.Rows.Count; i++) { string col = dtHealth.Rows[i]["OptionName"].ToString(); string colName = dtHealth.Rows[i]["ChinName"].ToString(); string tableName = "Health."; // 拼接必输栏位非空白条件 reqWhere += " OR IFNULL(" + tableName + col + ", '')='' "; // sum必输栏位空白的笔数 reqHealthCol += " (CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN 1 ELSE 0 END) +"; reqHealthTipCol += " CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } reqHealthCol = reqHealthCol.TrimEnd('+') + ") AS HealthCount"; reqHealthTipCol = reqHealthTipCol.TrimEnd(',') + ") AS HealthInfo"; } #endregion #region 健康评价 // 健康评价 if (dtAssessment.Rows.Count > 0) { reqWhere += reqWhere.Length > 0 ? "" : " AND (1=1"; reqAssessCol = "\r\n,CONCAT(0+"; reqAssessTipCol = " \r\n,CONCAT(' 健康评价未填写项:\\r\\n',"; for (int i = 0; i < dtAssessment.Rows.Count; i++) { string col = dtAssessment.Rows[i]["OptionName"].ToString(); string colName = dtAssessment.Rows[i]["ChinName"].ToString(); string tableName = "Assess."; // 非免疫预防接种史 if (col.ToLower().Equals("inoculationhistory")) { // sum必输栏位空白的笔数 reqAssessCol += " SUM(CASE WHEN IFNULL(Inocula.IDCardNo, '')='' THEN 1 ELSE 0 END) +"; reqAssessTipCol += " CASE WHEN IFNULL(Inocula.IDCardNo, '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } else { // 拼接必输栏位非空白条件 reqWhere += " OR IFNULL(" + tableName + col + ", '')='' "; // sum必输栏位空白的笔数 reqAssessCol += " (CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN 1 ELSE 0 END) +"; reqAssessTipCol += " CASE WHEN IFNULL(" + tableName + col + ", '')='' THEN '" + colName + "\\r\\n' ELSE '' END,"; } } reqAssessCol = reqAssessCol.TrimEnd('+') + ") AS AssessCount"; reqAssessTipCol = reqAssessTipCol.TrimEnd(',') + ") AS AssessInfo"; } #endregion reqWhere += ")"; #endregion }