Global.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /******************************************************************************
  2. * 文件名称: Global.cs
  3. * 文件说明: 全局变量及静态方法等
  4. * 当前版本: V1.0
  5. * 创建日期: 2022-06-20
  6. *
  7. * * 2020-06-20: 增加 Global 类
  8. * ***** 2020-06-20: 增加 CardReader 方法,获取URL地址,USER信息,地方版SSCard.dll使用
  9. ******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading.Tasks;
  15. using PTMedicalInsurance.Common;
  16. using System.Reflection;
  17. using System.IO;
  18. namespace PTMedicalInsurance.Variables
  19. {
  20. public static class Global
  21. {
  22. //当前路径
  23. public static String currentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
  24. public static IrisConfigue hisConfig;
  25. public static IrisConfigue insuConfig;
  26. public static InterfaceInfo inf;
  27. public static Patients pat;
  28. public static Settlements Set;
  29. public static currentEnvironment curEvt;
  30. public static User user;
  31. public static SelfServiceMachineParam ssmp;
  32. public static string businessType;
  33. public static string operationType;
  34. //写日志 二次封装
  35. public static void writeLog(string content)
  36. {
  37. string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_YB.Log";
  38. Log log = new Log(logDir, logName);
  39. string timeLine = "**********" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + "***********" + "\r\n";
  40. log.Write(timeLine + content);
  41. }
  42. public static void writeLog_debug(string content)
  43. {
  44. string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_debug.Log";
  45. Log log = new Log(logDir, logName);
  46. string timeLine = "**********" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + "***********" + "\r\n";
  47. log.Write(timeLine + content);
  48. }
  49. public static Boolean IsNeedEncrypt(string funNO)
  50. {
  51. List<string> infList = new List<string> { "10000", "9001", "9002", "1101", "1201", "2001", "2101", "2101A", "2102", "2102A", "2103", "2201", "2202", "2203", "2203A", "2204", "2205", "2206", "2207", "2208", "2301", "2302", "2303", "2304", "2305", "2401", "2402", "2403", "2404", "2405", "2501", "2501A", "2502", "2503", "2504", "2505", "2506", "2601", "3101", "3102", "5101", "5102", "5201", "5202", "5203", "5204", "5205", "5206", "5301", "5302", "5303", "5304", "5401", "5402", "1160", "5260", "3261" };
  52. return infList.Contains(funNO);
  53. }
  54. public static void writeLog(string tradeName, string inParam, string outParam)
  55. {
  56. string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_YB.Log";
  57. Log log = new Log(logDir, logName);
  58. string content = "****************************交易开始(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
  59. content = content + "交易名称:" + tradeName + "\r\n";
  60. content = content + "交易入参:" + inParam + "\r\n";
  61. content = content + "交易出参:" + outParam + "\r\n";
  62. //content = content + "****************************交易结束(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
  63. log.Write(content);
  64. }
  65. public static void writeLog_debug(string tradeName, string inParam, string outParam)
  66. {
  67. string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_debug.Log";
  68. Log log = new Log(logDir, logName);
  69. string content = "****************************交易开始(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
  70. content = content + "交易名称:" + tradeName + "\r\n";
  71. content = content + "交易入参:" + inParam + "\r\n";
  72. content = content + "交易出参:" + outParam + "\r\n";
  73. //content = content + "****************************交易结束(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
  74. log.Write(content);
  75. }
  76. public static void writeLog_Iris(string content)
  77. {
  78. string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_iris.Log";
  79. Log log = new Log(logDir, logName);
  80. string timeLine = "**********" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + "***********" + "\r\n";
  81. log.Write(timeLine + content);
  82. }
  83. public static void writeLog_Iris(string tradeName, string inParam, string outParam)
  84. {
  85. if (inParam.Contains("09010021"))
  86. {
  87. return;
  88. }
  89. string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_iris.Log";
  90. Log log = new Log(logDir, logName);
  91. string content = "****************************交易开始(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
  92. content = content + "交易名称:" + tradeName + "\r\n";
  93. content = content + "交易入参:" + inParam + "\r\n";
  94. //if ((outParam.Length > 10000) && (!inParam.Contains("09010122")))
  95. //{
  96. // content = content + "交易出参:" + outParam.Substring(0, 9999) + "................" + "\r\n";
  97. //}
  98. //else
  99. {
  100. content = content + "交易出参:" + outParam + "\r\n";
  101. }
  102. //content = content + "****************************交易结束(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
  103. log.Write(content);
  104. }
  105. }
  106. }