/// <summary> /// 重新加载数据 /// </summary> /// <param name="catalog"></param> public void Reload(BaseDataCatalog catalog) { DataTable dtData = LoadBaseData(catalog); if (_dataSet != null) { if (_dataSet.Tables.Contains(catalog.ToString())) { _dataSet.Tables.Remove(catalog.ToString()); dtData.TableName = catalog.ToString(); _dataSet.Tables.Add(dtData); } } }
/// <summary> /// 读取指定的基础数据并为数据表指定名称 /// </summary> /// <param name="catalog"></param> /// <returns></returns> private DataTable LoadBaseData(BaseDataCatalog catalog) { switch (catalog) { case BaseDataCatalog.人员列表: return(_dal.GetEmployeeList()); case BaseDataCatalog.科室列表: return(_dal.GetDepartmentList()); case BaseDataCatalog.基本分类与各分类对应表: return(_dal.GetBaseStatClassAndAllStatClassRelation()); case BaseDataCatalog.基本分类科目: return(_dal.GetBaseStatItemList()); case BaseDataCatalog.门诊发票科目: return(_dal.GetMzfpItemList()); case BaseDataCatalog.经管核算科目: return(_dal.GetHsItemList()); case BaseDataCatalog.病人类型列表: return(_dal.GetPatientType()); case BaseDataCatalog.疾病诊断列表: return(_dal.GetDiseaseList()); case BaseDataCatalog.医生列表: return(_dal.GetDoctorDetailList()); case BaseDataCatalog.族列表: return(_dal.GetFolkList()); case BaseDataCatalog.医生类别列表: return(_dal.GetDoctorTypeList()); case BaseDataCatalog.挂号类型定义列表: return(_dal.GetRegisterTypeList()); case BaseDataCatalog.挂号类型与收费项目对应表: return(_dal.GetRegisterTypeAndServiceItemRelation()); case BaseDataCatalog.划价模板列表: return(_dal.GetTemplateList()); case BaseDataCatalog.划价模板明细列表: return(_dal.GetTemplateDetailList()); case BaseDataCatalog.工作单位列表: return(_dal.GetWorkUnitList()); case BaseDataCatalog.基本医疗服务项目列表: return(_dal.GetBaseServiceItems()); default: throw new NotImplementedException(catalog.ToString() + "还未实现数据访问"); } }
public DataTable this[BaseDataCatalog catalog] { get { if (_dataSet == null) { _dataSet = new DataSet(); } if (!_dataSet.Tables.Contains(catalog.ToString())) { DataTable dtData = LoadBaseData(catalog); dtData.TableName = catalog.ToString(); _dataSet.Tables.Add(dtData); } //返回副本,防止因引用而被修改 return(_dataSet.Tables[catalog.ToString()].Copy()); } }
/// <summary> /// 在指定的数据集中根据标识符查找名称 /// </summary> /// <param name="catalog">数据集目录</param> /// <param name="identifier">标识符</param> /// <returns></returns> public static string GetName(BaseDataCatalog catalog, object identifier) { string idColumn = ""; string nameColumn = ""; switch (catalog) { case BaseDataCatalog.人员列表: idColumn = "Employee_Id"; nameColumn = "Name"; break; case BaseDataCatalog.科室列表: idColumn = "Dept_Id"; nameColumn = "Name"; break; case BaseDataCatalog.基本分类科目: case BaseDataCatalog.门诊发票科目: case BaseDataCatalog.经管核算科目: idColumn = "CODE"; nameColumn = "ITEM_NAME"; break; case BaseDataCatalog.病人类型列表: idColumn = "PATTYPECODE"; nameColumn = "NAME"; break; case BaseDataCatalog.疾病诊断列表: idColumn = "CODING"; nameColumn = "NAME"; break; case BaseDataCatalog.医生列表: idColumn = "Employee_Id"; nameColumn = "Emp_Name"; break; case BaseDataCatalog.医生类别列表: idColumn = "type_id"; nameColumn = "type_name"; break; default: throw new NotImplementedException(catalog.ToString() + "获取名称的方法还未实现"); } string selectString = ""; string quotChar = ""; if (identifier is string) { quotChar = "'"; } selectString = idColumn + " = " + quotChar + identifier.ToString() + quotChar; DataRow[] drs = BaseDataSet[catalog].Select(selectString); if (drs.Length == 0) { return(""); } else { return(drs[0][nameColumn].ToString().Trim()); } }