WD_PartInfoDataAccess.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. using System;
  2. using Dapper;
  3. using HNWD.Pregrant.Model;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. namespace HNWD.Pregrant.DataAccess
  7. {
  8. public class WD_PartInfoDataAccess : GenericDataAccess<WD_PartInfo>
  9. {
  10. private WD_PartInfo wd_DeviceInfo = null;
  11. public WD_PartInfoExt ext = new WD_PartInfoExt();
  12. private readonly static WD_PartInfoDataAccess wd_PartInfoDataAccess = new WD_PartInfoDataAccess();
  13. private readonly static object lockobj = new object();
  14. private WD_PartInfoDataAccess()
  15. {
  16. }
  17. public static WD_PartInfoDataAccess GetInstance()
  18. {
  19. lock (lockobj)
  20. {
  21. return wd_PartInfoDataAccess;
  22. }
  23. }
  24. public List<WD_PartInfo> Query()
  25. {
  26. string strSql = " select {0} from [WD_PartInfo] " ;
  27. ext.messageDataList = this.Query(strSql, new WD_PartInfo());
  28. ext.messageDataList.ForEach(f => f.bSuccess = this.bSuccess);
  29. ext.messageDataList.ForEach(f => f.Code = this.Code);
  30. ext.messageDataList.ForEach(f => f.Message = this.Message);
  31. ext.messageDataList.ForEach(f => f.Rows = this.Rows);
  32. ext.bSuccess = this.bSuccess;
  33. ext.Code = this.Code;
  34. ext.Message = this.Message;
  35. ext.Rows = this.Rows;
  36. return ext.messageDataList;
  37. }
  38. public bool Update(string sql)
  39. {
  40. this.Execute(sql, new WD_PartInfo());
  41. return this.bSuccess;
  42. }
  43. public void Business(List<WD_PartInfo> il, List<WD_PartInfo> ul, List<WD_PartInfo> dl)
  44. {
  45. StringBuilder strSql_utemp = new StringBuilder();
  46. strSql_utemp.Append( " Update WD_PartInfo set ");
  47. strSql_utemp.Append( " PART_HOSPITALNAME = '{0}' , PART_NAME = '{1}' , PART_CODE = '{2}' , PART_CONTENT = '{3}' , PART_ROOMCOUNT = '{4}', ");
  48. strSql_utemp.Append( " PART_BEDCOUNT = '{5}' , PART_SLEEPTIME = '{6}' , PART_DAY_START = '{7}' , PART_DAY_BLIGHT = '{8}' , PART_DAY_SIPVOL = '{9}', ");
  49. strSql_utemp.Append( " PART_DAY_RINGVOL = '{10}' , PART_DAY_RINGTIMES = '{11}' , PART_DAY_NURSINGLED = '{12}' , PART_DAY_DOORSIPVOL = '{13}' , PART_DAY_BEDSIPVOL = '{14}', ");
  50. strSql_utemp.Append( " PART_NIGHT_START = '{11}' , PART_NIGHT_BLIGHT = '{12}' , PART_NIGHT_SIPVOL = '{13}' , PART_NIGHT_RINGVOL = '{14}' , PART_NIGHT_RINGTIMES = '{15}', ");
  51. strSql_utemp.Append( " PART_NIGHT_NURSINGLED = '{16}' , PART_NIGHT_DOORSIPVOL = '{17}' , PART_NIGHT_BEDSIPVOL = '{18}' , PART_SIP_OVERTIME = '{19}' , PART_ERRORPIC = '{20}', ");
  52. strSql_utemp.Append( " PART_NURSE_LEVEL0 = '{21}' , PART_NURSE_LEVEL1 = '{22}' , PART_NURSE_LEVEL2 = '{23}' , PART_NURSE_LEVEL3 = '{24}' , PART_NURSE_LEVEL4 = '{25}', ");
  53. strSql_utemp.Append( " PART_SPECIAL_CARE = '{26}' , PART_PRIMARY_CARE = '{27}' , PART_DISPLAY_ILLNESS = '{28}' , PART_CODESWITCH = '{29}' , SIPSEV_IP = '{30}', ");
  54. strSql_utemp.Append( " SIPSEV_MYSQLPASSWORD = '{31}' , SIPSEV_MYSQLUSERNAME = '{32}' , PART_DATETIME = '{33}' ");
  55. strSql_utemp.Append( " where ID = '{34}' ");
  56. StringBuilder sb_append = new StringBuilder();
  57. StringBuilder sb_i = new StringBuilder();
  58. foreach (WD_PartInfo wd in il)
  59. {
  60. }
  61. StringBuilder sb_u = new StringBuilder();
  62. foreach (WD_PartInfo wd in ul)
  63. {
  64. sb_u.AppendFormat(strSql_utemp.ToString(),
  65. wd.PART_HOSPITALNAME ,
  66. wd.PART_NAME ,
  67. wd.PART_CODE ,
  68. wd.PART_CONTENT ,
  69. wd.PART_ROOMCOUNT ,
  70. wd.PART_SLEEPTIME ,
  71. wd.PART_DAY_START ,
  72. wd.PART_DAY_BLIGHT ,
  73. wd.PART_DAY_SIPVOL ,
  74. wd.PART_DAY_RINGVOL ,
  75. wd.PART_DAY_RINGTIMES ,
  76. wd.PART_DAY_NURSINGLED ,
  77. wd.PART_DAY_DOORSIPVOL ,
  78. wd.PART_DAY_BEDSIPVOL ,
  79. wd.PART_NIGHT_START ,
  80. wd.PART_NIGHT_BLIGHT ,
  81. wd.PART_NIGHT_RINGVOL ,
  82. wd.PART_NIGHT_RINGTIMES ,
  83. wd.PART_NIGHT_NURSINGLED ,
  84. wd.PART_NIGHT_DOORSIPVOL ,
  85. wd.PART_NIGHT_BEDSIPVOL ,
  86. wd.PART_SIP_OVERTIME ,
  87. wd.PART_ERRORPIC ,
  88. wd.PART_NURSE_LEVEL0 ,
  89. wd.PART_NURSE_LEVEL1 ,
  90. wd.PART_NURSE_LEVEL2 ,
  91. wd.PART_NURSE_LEVEL3 ,
  92. wd.PART_NURSE_LEVEL4 ,
  93. wd.PART_SPECIAL_CARE ,
  94. wd.PART_PRIMARY_CARE ,
  95. wd.PART_DISPLAY_ILLNESS ,
  96. wd.PART_CODESWITCH ,
  97. wd.SIPSEV_IP ,
  98. wd.SIPSEV_MYSQLPASSWORD ,
  99. wd.SIPSEV_MYSQLUSERNAME ,
  100. wd.PART_DATETIME ,
  101. wd.ID );
  102. //修改特级护理配置(196-255)
  103. sb_append.AppendFormat( " update [WD_NurseCfgInfo] SET [NURSECFG_VALUE]=255 where [NURSECFG_ID]='0' and [ID]= '{0}' ",wd.PART_SPECIAL_CARE );
  104. //修改一级护理配置(130-195)
  105. sb_append.AppendFormat( " update [WD_NurseCfgInfo] SET [NURSECFG_VALUE]=195 where [NURSECFG_ID]='0' and [ID]= '{0}' ",wd.PART_PRIMARY_CARE );
  106. //二级护理
  107. sb_append.AppendFormat( " update [WD_NurseCfgInfo] SET [NURSECFG_VALUE]=129 where [NURSECFG_ID]='0' and [ID] <>'{0}' ",wd.PART_PRIMARY_CARE + " and [ID] <>'{1}' " + wd.PART_SPECIAL_CARE );
  108. //通知服务器发送UDP,立即生效!
  109. sb_append.Append( " update [WD_RunProfile] SET [SysSettingsFlag]=1 ");
  110. }
  111. StringBuilder sb_d = new StringBuilder();
  112. foreach (WD_PartInfo wd in dl)
  113. {
  114. }
  115. this.Execute(sb_i.ToString(), sb_u.ToString(), sb_d.ToString() , sb_append.ToString());
  116. }
  117. }
  118. }