update IDCardDefinition set curIdCardInstanceBarcode=(select max(b.barcode) from IDCardInstance i inner join barcodeDevice b on i.id=b.id where i.idCardDefinitionID=IDCardDefinition.id and i.status='使用中' and b.barcode is not null);
if not exists (select * from syscolumns where id=object_id('QualityMonitoringConfig') and name='showSterNameAndFre')
alter table [QualityMonitoringConfig] add showSterNameAndFre varchar(255);

if not exists (select * from syscolumns where id=object_id('QualityMonitoring') and name='responsibilityPart')
alter table [QualityMonitoring] add responsibilityPart varchar(255);

if not exists (select * from syscolumns where id=object_id('QualityMonitoring') and name='sterilizerName')
alter table [QualityMonitoring] add sterilizerName varchar(255);

if not exists (select * from syscolumns where id=object_id('QualityMonitoring') and name='sterilizerFrequency')
alter table [QualityMonitoring] add sterilizerFrequency varchar(255);

if not exists (select * from syscolumns where id=object_id('QualityMonitoring') and name='positionMsg')
alter table [QualityMonitoring] add positionMsg varchar(255);

if not exists (select * from syscolumns where id=object_id('QualityMonitoring') and name='washAndDisinfectRecordId')
alter table [QualityMonitoring] add washAndDisinfectRecordId varchar(255);