修改HIS数据库名

增加了HIS数据库名的可配置功能, 未配置时使用默认名称
dhzzyy
LiJiaWen 1 month ago
parent 43af2f9d10
commit 1d2f38fc84
  1. 28
      PEIS/Model/Register/EPatientModel.cs
  2. 6
      PEIS/Model/UserModel.cs
  3. 4
      PEIS/Program.cs
  4. 9
      PEIS/Utils/Global.cs
  5. 3
      PEIS/Utils/VersionHelper.cs

@ -121,7 +121,7 @@ namespace PEIS.Model.Register
public List<FeeItem> GetItemsByPack(Int64 id) // 从套餐获取收费项目
{
return DAOHelp.GetDataBySQL<FeeItem>(
@"
$@"
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<FeeItem> GetFeelItems() // 获取收费项目
{
return DAOHelp.GetDataBySQL<FeeItem>(
@"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

@ -30,7 +30,7 @@ namespace PEIS.Model
public User GetByCode4His(String code)
{
List<User> lstUser = DAOHelp.GetDataBySQL<User>($"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<User> lstUser = DAOHelp.GetDataBySQL<User>($"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<User> lstUser = DAOHelp.GetDataBySQL<User>(sql);
if (lstUser.Count == 0)
return false;
@ -61,7 +61,7 @@ namespace PEIS.Model
public User QueryUser(string code)
{
return DAOHelp.GetDataBySQL<User>($"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<User>($"select Code,RTRIM(Name) as Name,kscode as DeptCode,RTRIM(ksname) as DeptName from {Global.HisDBName}.yscode where code='{code}'").FirstOrDefault();
}
/// <summary>

@ -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());
}

@ -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";
}
}
/// <summary>
/// 配置信息
@ -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();

@ -17,8 +17,7 @@ namespace PEIS.Utils
/// </summary>
public static void CheckUpdate()
{
var version = DAOHelp.GetDataBySQL<Config>("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;

Loading…
Cancel
Save