diff --git a/PEIS/Model/Register/EPatientModel.cs b/PEIS/Model/Register/EPatientModel.cs index 920885b..5621935 100644 --- a/PEIS/Model/Register/EPatientModel.cs +++ b/PEIS/Model/Register/EPatientModel.cs @@ -121,7 +121,7 @@ namespace PEIS.Model.Register public List GetItemsByPack(Int64 id) // 从套餐获取收费项目 { return DAOHelp.GetDataBySQL( - @" + $@" SELECT c.ID , c.FeeItemCode , c.SettlePrice , @@ -154,9 +154,9 @@ namespace PEIS.Model.Register ) AND A.ApplicationType = 1 THEN '普通' END ItemClass - FROM his.hisdata.dbo.ApplicationCheckCode a ( NOLOCK ) - JOIN his.hisdata.dbo.ApplicationSheet b ( NOLOCK ) ON ( a.ApplicationCode = b.ApplicationCode ) - JOIN his.hisdata.dbo.KSCODE c ( NOLOCK ) ON ( a.KSCode = c.CODE ) + FROM {Global.HisDBName}.ApplicationCheckCode a ( NOLOCK ) + JOIN {Global.HisDBName}.ApplicationSheet b ( NOLOCK ) ON ( a.ApplicationCode = b.ApplicationCode ) + JOIN {Global.HisDBName}.KSCODE c ( NOLOCK ) ON ( a.KSCode = c.CODE ) WHERE a.DelDate IS NULL AND a.GroupCode IS NULL AND b.DelDate IS NULL @@ -179,9 +179,9 @@ namespace PEIS.Model.Register ) AND A.ApplicationType = 1 THEN '普通' END ItemClass - FROM his.hisdata.dbo.ApplicationCheckCode a ( NOLOCK ) - JOIN his.hisdata.dbo.ApplicationSheet b ( NOLOCK ) ON ( a.ApplicationCode = b.ApplicationCode ) - JOIN his.hisdata.dbo.KSCODE c ( NOLOCK ) ON ( a.KSCode = c.CODE ) + FROM {Global.HisDBName}.ApplicationCheckCode a ( NOLOCK ) + JOIN {Global.HisDBName}.ApplicationSheet b ( NOLOCK ) ON ( a.ApplicationCode = b.ApplicationCode ) + JOIN {Global.HisDBName}.KSCODE c ( NOLOCK ) ON ( a.KSCode = c.CODE ) WHERE a.DelDate IS NULL AND a.GroupCode IS NOT NULL AND b.DelDate IS NULL @@ -214,7 +214,7 @@ namespace PEIS.Model.Register public List GetFeelItems() // 获取收费项目 { return DAOHelp.GetDataBySQL( - @"SELECT + $@"SELECT a.ID , a.FeeItemCode , a.SettlePrice , @@ -262,9 +262,9 @@ namespace PEIS.Model.Register '普通' END ItemClass FROM - his.hisdata.dbo.ApplicationCheckCode a ( NOLOCK ) - JOIN his.hisdata.dbo.ApplicationSheet b ( NOLOCK ) ON ( a.ApplicationCode = b.ApplicationCode ) - JOIN his.hisdata.dbo.KSCODE c ( NOLOCK ) ON ( a.KSCode = c.CODE ) + {Global.HisDBName}.ApplicationCheckCode a ( NOLOCK ) + JOIN {Global.HisDBName}.ApplicationSheet b ( NOLOCK ) ON ( a.ApplicationCode = b.ApplicationCode ) + JOIN {Global.HisDBName}.KSCODE c ( NOLOCK ) ON ( a.KSCode = c.CODE ) WHERE a.DelDate IS NULL AND a.GroupCode IS NULL @@ -291,9 +291,9 @@ namespace PEIS.Model.Register '普通' END ItemClass FROM - his.hisdata.dbo.ApplicationCheckCode a ( NOLOCK ) - JOIN his.hisdata.dbo.ApplicationSheet b ( NOLOCK ) ON ( a.ApplicationCode = b.ApplicationCode ) - JOIN his.hisdata.dbo.KSCODE c ( NOLOCK ) ON ( a.KSCode = c.CODE ) + {Global.HisDBName}.ApplicationCheckCode a ( NOLOCK ) + JOIN {Global.HisDBName}.ApplicationSheet b ( NOLOCK ) ON ( a.ApplicationCode = b.ApplicationCode ) + JOIN {Global.HisDBName}.KSCODE c ( NOLOCK ) ON ( a.KSCode = c.CODE ) WHERE a.DelDate IS NULL AND a.GroupCode IS NOT NULL diff --git a/PEIS/Model/UserModel.cs b/PEIS/Model/UserModel.cs index cad02da..fb9c446 100644 --- a/PEIS/Model/UserModel.cs +++ b/PEIS/Model/UserModel.cs @@ -30,7 +30,7 @@ namespace PEIS.Model public User GetByCode4His(String code) { - List lstUser = DAOHelp.GetDataBySQL($"SELECT a.code AS Code, RTRIM(a.name) AS Name, a.ystype, b.code AS DeptCode, RTRIM(b.name) AS DeptName, b.ksattrib FROM his.hisdata.dbo.YSCODE a(NOLOCK) JOIN his.hisdata.dbo.KSCode b(NOLOCK) ON a.kscode = b.code WHERE a.CODE = '{code}'"); + List lstUser = DAOHelp.GetDataBySQL($"SELECT a.code AS Code, RTRIM(a.name) AS Name, a.ystype, b.code AS DeptCode, RTRIM(b.name) AS DeptName, b.ksattrib FROM {Global.HisDBName}.YSCODE a(NOLOCK) JOIN {Global.HisDBName}.KSCode b(NOLOCK) ON a.kscode = b.code WHERE a.CODE = '{code}'"); if (lstUser?.Count() > 0) { return lstUser.ToArray()[0]; @@ -41,7 +41,7 @@ namespace PEIS.Model public Boolean HisLogin(User user) { - String sql = String.Format($"SELECT a.code AS Code, RTRIM(a.name) AS Name, a.ystype, b.code AS DeptCode, RTRIM(b.name) AS DeptName, b.ksattrib FROM his.hisdata.dbo.YSCODE a(NOLOCK) JOIN his.hisdata.dbo.KSCode b(NOLOCK) ON a.kscode = b.code WHERE a.CODE = '{user.Code}' AND a.PASSWORD = '{user.PassWord}'"); + String sql = String.Format($"SELECT a.code AS Code, RTRIM(a.name) AS Name, a.ystype, b.code AS DeptCode, RTRIM(b.name) AS DeptName, b.ksattrib FROM {Global.HisDBName}.YSCODE a(NOLOCK) JOIN {Global.HisDBName}.KSCode b(NOLOCK) ON a.kscode = b.code WHERE a.CODE = '{user.Code}' AND a.PASSWORD = '{user.PassWord}'"); List lstUser = DAOHelp.GetDataBySQL(sql); if (lstUser.Count == 0) return false; @@ -61,7 +61,7 @@ namespace PEIS.Model public User QueryUser(string code) { - return DAOHelp.GetDataBySQL($"select Code,RTRIM(Name) as Name,kscode as DeptCode,RTRIM(ksname) as DeptName from his.hisdata.dbo.yscode where code='{code}'").FirstOrDefault(); + return DAOHelp.GetDataBySQL($"select Code,RTRIM(Name) as Name,kscode as DeptCode,RTRIM(ksname) as DeptName from {Global.HisDBName}.yscode where code='{code}'").FirstOrDefault(); } /// diff --git a/PEIS/Program.cs b/PEIS/Program.cs index 051288b..745d609 100644 --- a/PEIS/Program.cs +++ b/PEIS/Program.cs @@ -36,14 +36,14 @@ namespace PEIS Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - + CacheDataModel.GetConfig(); VersionHelper.CheckUpdate(); var login = new LoginForm(); login.ShowDialog(); if (login.DialogResult == DialogResult.OK) { - ThreadPool.QueueUserWorkItem(state => CacheDataModel.GetConfig()); + //ThreadPool.QueueUserWorkItem(state => CacheDataModel.GetConfig()); login.Dispose(); Application.Run(new MainForm()); } diff --git a/PEIS/Utils/Global.cs b/PEIS/Utils/Global.cs index 71c8f6a..f6c59b4 100644 --- a/PEIS/Utils/Global.cs +++ b/PEIS/Utils/Global.cs @@ -29,6 +29,13 @@ namespace PEIS.Utils internal class Global { public static String HisConnection { get; set; } + public static string HisDBName + { + get + { + return Global._lstConfig.FirstOrDefault(x => x.Key == "HisDBName")?.Value ?? "his.hisdata.dbo"; + } + } /// /// 配置信息 @@ -214,7 +221,7 @@ namespace PEIS.Utils control.Invoke(new Action(action.Invoke)); } - public static User GetRequestUser () + public static User GetRequestUser() { User user = new User(); diff --git a/PEIS/Utils/VersionHelper.cs b/PEIS/Utils/VersionHelper.cs index 034305a..80ec809 100644 --- a/PEIS/Utils/VersionHelper.cs +++ b/PEIS/Utils/VersionHelper.cs @@ -17,8 +17,7 @@ namespace PEIS.Utils /// public static void CheckUpdate() { - var version = DAOHelp.GetDataBySQL("SELECT * FROM Dict_Config WHERE [KEY]='Version'") - ?.FirstOrDefault()?.Value; + var version = Global._lstConfig.FirstOrDefault(x => x.Key == "Version")?.Value ?? ""; var currentVersion = ConfigurationManager.AppSettings["Version"]; if (string.IsNullOrEmpty(currentVersion) || string.IsNullOrEmpty(version) || currentVersion == version) return;