using System; using Dapper; using HNWD.Pregrant.Model; using System.Collections.Generic; using System.Text; namespace HNWD.Pregrant.DataAccess { public class WD_PartInfoDataAccess : GenericDataAccess { private WD_PartInfo wd_DeviceInfo = null; public WD_PartInfoExt ext = new WD_PartInfoExt(); private readonly static WD_PartInfoDataAccess wd_PartInfoDataAccess = new WD_PartInfoDataAccess(); private readonly static object lockobj = new object(); private WD_PartInfoDataAccess() { } public static WD_PartInfoDataAccess GetInstance() { lock (lockobj) { return wd_PartInfoDataAccess; } } public List Query() { string strSql = " select {0} from [WD_PartInfo] " ; ext.messageDataList = this.Query(strSql, new WD_PartInfo()); ext.messageDataList.ForEach(f => f.bSuccess = this.bSuccess); ext.messageDataList.ForEach(f => f.Code = this.Code); ext.messageDataList.ForEach(f => f.Message = this.Message); ext.messageDataList.ForEach(f => f.Rows = this.Rows); ext.bSuccess = this.bSuccess; ext.Code = this.Code; ext.Message = this.Message; ext.Rows = this.Rows; return ext.messageDataList; } public bool Update(string sql) { this.Execute(sql, new WD_PartInfo()); return this.bSuccess; } public void Business(List il, List ul, List dl) { StringBuilder strSql_utemp = new StringBuilder(); strSql_utemp.Append( " Update WD_PartInfo set "); strSql_utemp.Append( " PART_HOSPITALNAME = '{0}' , PART_NAME = '{1}' , PART_CODE = '{2}' , PART_CONTENT = '{3}' , PART_ROOMCOUNT = '{4}', "); strSql_utemp.Append( " PART_BEDCOUNT = '{5}' , PART_SLEEPTIME = '{6}' , PART_DAY_START = '{7}' , PART_DAY_BLIGHT = '{8}' , PART_DAY_SIPVOL = '{9}', "); strSql_utemp.Append( " PART_DAY_RINGVOL = '{10}' , PART_DAY_RINGTIMES = '{11}' , PART_DAY_NURSINGLED = '{12}' , PART_DAY_DOORSIPVOL = '{13}' , PART_DAY_BEDSIPVOL = '{14}', "); strSql_utemp.Append( " PART_NIGHT_START = '{11}' , PART_NIGHT_BLIGHT = '{12}' , PART_NIGHT_SIPVOL = '{13}' , PART_NIGHT_RINGVOL = '{14}' , PART_NIGHT_RINGTIMES = '{15}', "); strSql_utemp.Append( " PART_NIGHT_NURSINGLED = '{16}' , PART_NIGHT_DOORSIPVOL = '{17}' , PART_NIGHT_BEDSIPVOL = '{18}' , PART_SIP_OVERTIME = '{19}' , PART_ERRORPIC = '{20}', "); strSql_utemp.Append( " PART_NURSE_LEVEL0 = '{21}' , PART_NURSE_LEVEL1 = '{22}' , PART_NURSE_LEVEL2 = '{23}' , PART_NURSE_LEVEL3 = '{24}' , PART_NURSE_LEVEL4 = '{25}', "); strSql_utemp.Append( " PART_SPECIAL_CARE = '{26}' , PART_PRIMARY_CARE = '{27}' , PART_DISPLAY_ILLNESS = '{28}' , PART_CODESWITCH = '{29}' , SIPSEV_IP = '{30}', "); strSql_utemp.Append( " SIPSEV_MYSQLPASSWORD = '{31}' , SIPSEV_MYSQLUSERNAME = '{32}' , PART_DATETIME = '{33}' "); strSql_utemp.Append( " where ID = '{34}' "); StringBuilder sb_append = new StringBuilder(); StringBuilder sb_i = new StringBuilder(); foreach (WD_PartInfo wd in il) { } StringBuilder sb_u = new StringBuilder(); foreach (WD_PartInfo wd in ul) { sb_u.AppendFormat(strSql_utemp.ToString(), wd.PART_HOSPITALNAME , wd.PART_NAME , wd.PART_CODE , wd.PART_CONTENT , wd.PART_ROOMCOUNT , wd.PART_SLEEPTIME , wd.PART_DAY_START , wd.PART_DAY_BLIGHT , wd.PART_DAY_SIPVOL , wd.PART_DAY_RINGVOL , wd.PART_DAY_RINGTIMES , wd.PART_DAY_NURSINGLED , wd.PART_DAY_DOORSIPVOL , wd.PART_DAY_BEDSIPVOL , wd.PART_NIGHT_START , wd.PART_NIGHT_BLIGHT , wd.PART_NIGHT_RINGVOL , wd.PART_NIGHT_RINGTIMES , wd.PART_NIGHT_NURSINGLED , wd.PART_NIGHT_DOORSIPVOL , wd.PART_NIGHT_BEDSIPVOL , wd.PART_SIP_OVERTIME , wd.PART_ERRORPIC , wd.PART_NURSE_LEVEL0 , wd.PART_NURSE_LEVEL1 , wd.PART_NURSE_LEVEL2 , wd.PART_NURSE_LEVEL3 , wd.PART_NURSE_LEVEL4 , wd.PART_SPECIAL_CARE , wd.PART_PRIMARY_CARE , wd.PART_DISPLAY_ILLNESS , wd.PART_CODESWITCH , wd.SIPSEV_IP , wd.SIPSEV_MYSQLPASSWORD , wd.SIPSEV_MYSQLUSERNAME , wd.PART_DATETIME , wd.ID ); //修改特级护理配置(196-255) sb_append.AppendFormat( " update [WD_NurseCfgInfo] SET [NURSECFG_VALUE]=255 where [NURSECFG_ID]='0' and [ID]= '{0}' ",wd.PART_SPECIAL_CARE ); //修改一级护理配置(130-195) sb_append.AppendFormat( " update [WD_NurseCfgInfo] SET [NURSECFG_VALUE]=195 where [NURSECFG_ID]='0' and [ID]= '{0}' ",wd.PART_PRIMARY_CARE ); //二级护理 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 ); //通知服务器发送UDP,立即生效! sb_append.Append( " update [WD_RunProfile] SET [SysSettingsFlag]=1 "); } StringBuilder sb_d = new StringBuilder(); foreach (WD_PartInfo wd in dl) { } this.Execute(sb_i.ToString(), sb_u.ToString(), sb_d.ToString() , sb_append.ToString()); } } }