Global.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 Patients pat_hh;
  29. public static Settlements Set;
  30. public static currentEnvironment curEvt;
  31. public static User user;
  32. public static SelfServiceMachineParam ssmp;
  33. public static string businessType;
  34. public static string operationType;
  35. //写日志 二次封装
  36. public static void writeLog(string content)
  37. {
  38. string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_YB.Log";
  39. Log log = new Log(logDir, logName);
  40. string timeLine = "**********" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + "***********" + "\r\n";
  41. log.Write(timeLine + content);
  42. }
  43. public static void writeLog_debug(string content)
  44. {
  45. string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_debug.Log";
  46. Log log = new Log(logDir, logName);
  47. string timeLine = "**********" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + "***********" + "\r\n";
  48. log.Write(timeLine + content);
  49. }
  50. public static Boolean IsNeedEncrypt(string funNO)
  51. {
  52. 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" };
  53. return infList.Contains(funNO);
  54. }
  55. public static void writeLog(string tradeName, string inParam, string outParam)
  56. {
  57. string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_YB.Log";
  58. Log log = new Log(logDir, logName);
  59. string content = "****************************交易开始(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
  60. content = content + "交易名称:" + tradeName + "\r\n";
  61. content = content + "交易入参:" + inParam + "\r\n";
  62. content = content + "交易出参:" + outParam + "\r\n";
  63. //content = content + "****************************交易结束(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
  64. log.Write(content);
  65. }
  66. public static void writeLog_debug(string tradeName, string inParam, string outParam)
  67. {
  68. string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_debug.Log";
  69. Log log = new Log(logDir, logName);
  70. string content = "****************************交易开始(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
  71. content = content + "交易名称:" + tradeName + "\r\n";
  72. content = content + "交易入参:" + inParam + "\r\n";
  73. content = content + "交易出参:" + outParam + "\r\n";
  74. //content = content + "****************************交易结束(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
  75. log.Write(content);
  76. }
  77. public static void writeLog_Iris(string content)
  78. {
  79. string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_iris.Log";
  80. Log log = new Log(logDir, logName);
  81. string timeLine = "**********" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + "***********" + "\r\n";
  82. log.Write(timeLine + content);
  83. }
  84. public static void writeLog_Iris(string tradeName, string inParam, string outParam)
  85. {
  86. if (inParam.Contains("09010021"))
  87. {
  88. return;
  89. }
  90. string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_iris.Log";
  91. Log log = new Log(logDir, logName);
  92. string content = "****************************交易开始(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
  93. content = content + "交易名称:" + tradeName + "\r\n";
  94. content = content + "交易入参:" + inParam + "\r\n";
  95. //if ((outParam.Length > 10000) && (!inParam.Contains("09010122")))
  96. //{
  97. // content = content + "交易出参:" + outParam.Substring(0, 9999) + "................" + "\r\n";
  98. //}
  99. //else
  100. {
  101. content = content + "交易出参:" + outParam + "\r\n";
  102. }
  103. //content = content + "****************************交易结束(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
  104. log.Write(content);
  105. }
  106. }
  107. }