IF EXISTS (SELECT * FROM HOSP_Elements WHERE KeyCode = 'ProvinceNumber' and KeyValue = '5')
BEGIN
	update LU_Institutions set 
	ValidateDescription = 'FOSTERBROOKE',
	ValidTo = '2099-03-31'
	where ValidateCode = '51624'

	delete [LU_Institutions] where RecordID in (395560, 398312, 398344, 398350, 398351, 398352, 398353, 398354, 398355, 398356, 398357, 398358, 398359)

	insert into [LU_Institutions] ([RecordID],[RegionID],[HospitalID],[FilterLink],[UserCode],[ValidateCode],[UserDescription],[ValidateDescription],[LookUpNote],[ValidFrom],[ValidTo],[InterfaceOut],[InstitutionType],[Province],[MED2020])  
	values (395560, 0, 0, '', '50020', '50020', 'COMMUNITY SUPPORT SERV - GENERIC #', 'COMMUNITY SUPPORT SERV - GENERIC #', '', '2025/04/01', '2099/03/31', '50020', 'J', 'ON', 1) 
	insert into [LU_Institutions] ([RecordID],[RegionID],[HospitalID],[FilterLink],[UserCode],[ValidateCode],[UserDescription],[ValidateDescription],[LookUpNote],[ValidFrom],[ValidTo],[InterfaceOut],[InstitutionType],[Province],[MED2020])  
	values (398312, 0, 0, '', '57606', '57606', 'NORTHERN HEIGHTS COMMUNITY', 'NORTHERN HEIGHTS COMMUNITY', '', '2025/04/01', '2099/03/31', '57606', '4', 'ON', 1) 
	insert into [LU_Institutions] ([RecordID],[RegionID],[HospitalID],[FilterLink],[UserCode],[ValidateCode],[UserDescription],[ValidateDescription],[LookUpNote],[ValidFrom],[ValidTo],[InterfaceOut],[InstitutionType],[Province],[MED2020])  
	values (398344, 0, 0, '', '57666', '57666', 'STATION PLACE LONG-TERM CARE HOME', 'STATION PLACE LONG-TERM CARE HOME', '', '2025/04/01', '2099/03/31', '57666', '4', 'ON', 1) 
	insert into [LU_Institutions] ([RecordID],[RegionID],[HospitalID],[FilterLink],[UserCode],[ValidateCode],[UserDescription],[ValidateDescription],[LookUpNote],[ValidFrom],[ValidTo],[InterfaceOut],[InstitutionType],[Province],[MED2020])  
	values (398350, 0, 0, '', '57685', '57685', 'BOBCAYGEON PHYSIO & REHAB', 'BOBCAYGEON PHYSIO & REHAB', '', '2025/04/01', '2099/03/31', '57685', 'F', 'ON', 1) 
	insert into [LU_Institutions] ([RecordID],[RegionID],[HospitalID],[FilterLink],[UserCode],[ValidateCode],[UserDescription],[ValidateDescription],[LookUpNote],[ValidFrom],[ValidTo],[InterfaceOut],[InstitutionType],[Province],[MED2020])  
	values (398351, 0, 0, '', '57688', '57688', 'ALLEVIATE PHYSIOTHERAPY ETOBICOKE', 'ALLEVIATE PHYSIOTHERAPY ETOBICOKE', '', '2025/04/01', '2099/03/31', '57688', 'F', 'ON', 1) 
	insert into [LU_Institutions] ([RecordID],[RegionID],[HospitalID],[FilterLink],[UserCode],[ValidateCode],[UserDescription],[ValidateDescription],[LookUpNote],[ValidFrom],[ValidTo],[InterfaceOut],[InstitutionType],[Province],[MED2020])  
	values (398352, 0, 0, '', '57689', '57689', 'ALLEVIATE PHYSIOTHERAPY MISSISSAUGA', 'ALLEVIATE PHYSIOTHERAPY MISSISSAUGA', '', '2025/04/01', '2099/03/31', '57689', 'F', 'ON', 1) 
	insert into [LU_Institutions] ([RecordID],[RegionID],[HospitalID],[FilterLink],[UserCode],[ValidateCode],[UserDescription],[ValidateDescription],[LookUpNote],[ValidFrom],[ValidTo],[InterfaceOut],[InstitutionType],[Province],[MED2020])  
	values (398353, 0, 0, '', '57690', '57690', 'ALLEVIATE PHYSIOTHERAPY CLARKSON', 'ALLEVIATE PHYSIOTHERAPY CLARKSON', '', '2025/04/01', '2099/03/31', '57690', 'F', 'ON', 1) 
	insert into [LU_Institutions] ([RecordID],[RegionID],[HospitalID],[FilterLink],[UserCode],[ValidateCode],[UserDescription],[ValidateDescription],[LookUpNote],[ValidFrom],[ValidTo],[InterfaceOut],[InstitutionType],[Province],[MED2020])  
	values (398354, 0, 0, '', '57696', '57696', 'MM PHYSIO', 'MM PHYSIO', '', '2025/04/01', '2099/03/31', '57696', 'F', 'ON', 1) 
	insert into [LU_Institutions] ([RecordID],[RegionID],[HospitalID],[FilterLink],[UserCode],[ValidateCode],[UserDescription],[ValidateDescription],[LookUpNote],[ValidFrom],[ValidTo],[InterfaceOut],[InstitutionType],[Province],[MED2020])  
	values (398355, 0, 0, '', '57697', '57697', 'PLAINSVIEW PHYSIOTHERAPY', 'PLAINSVIEW PHYSIOTHERAPY', '', '2025/04/01', '2099/03/31', '57697', 'F', 'ON', 1) 
	insert into [LU_Institutions] ([RecordID],[RegionID],[HospitalID],[FilterLink],[UserCode],[ValidateCode],[UserDescription],[ValidateDescription],[LookUpNote],[ValidFrom],[ValidTo],[InterfaceOut],[InstitutionType],[Province],[MED2020])  
	values (398356, 0, 0, '', '57698', '57698', 'TANDEM PHYSIOTHERAPY', 'TANDEM PHYSIOTHERAPY', '', '2025/04/01', '2099/03/31', '57698', 'F', 'ON', 1) 
	insert into [LU_Institutions] ([RecordID],[RegionID],[HospitalID],[FilterLink],[UserCode],[ValidateCode],[UserDescription],[ValidateDescription],[LookUpNote],[ValidFrom],[ValidTo],[InterfaceOut],[InstitutionType],[Province],[MED2020])  
	values (398357, 0, 0, '', '57699', '57699', 'STEVENSON MEM HOSP-AHF-RIVERWOOD RH', 'STEVENSON MEM HOSP-AHF-RIVERWOOD RH', '', '2025/04/01', '2099/03/31', '57699', '1', 'ON', 1) 
	insert into [LU_Institutions] ([RecordID],[RegionID],[HospitalID],[FilterLink],[UserCode],[ValidateCode],[UserDescription],[ValidateDescription],[LookUpNote],[ValidFrom],[ValidTo],[InterfaceOut],[InstitutionType],[Province],[MED2020])  
	values (398358, 0, 0, '', '57701', '57701', 'CUMBERLAND PHYSIO AND ACUPUNCTURE', 'CUMBERLAND PHYSIO AND ACUPUNCTURE', '', '2025/04/01', '2099/03/31', '57701', 'F', 'ON', 1) 
	insert into [LU_Institutions] ([RecordID],[RegionID],[HospitalID],[FilterLink],[UserCode],[ValidateCode],[UserDescription],[ValidateDescription],[LookUpNote],[ValidFrom],[ValidTo],[InterfaceOut],[InstitutionType],[Province],[MED2020])  
	values (398359, 0, 0, '', '57712', '57712', 'STAYNER CARE CENTRE', 'STAYNER CARE CENTRE', '', '2025/04/01', '2099/03/31', '57712', '4', 'ON', 1) 

	DELETE FROM LU_Institution_Interchange WHERE 
	(RecordID = 395560 and InterchangeCode = '50020') OR
	(RecordID = 398344 and InterchangeCode = '57666') OR
	(RecordID = 398350 and InterchangeCode = '57685') OR
	(RecordID = 398351 and InterchangeCode = '57688') OR
	(RecordID = 398352 and InterchangeCode = '57689') OR
	(RecordID = 398353 and InterchangeCode = '57690') OR
	(RecordID = 398354 and InterchangeCode = '57696') OR
	(RecordID = 398355 and InterchangeCode = '57697') OR
	(RecordID = 398356 and InterchangeCode = '57698') OR
	(RecordID = 398357 and InterchangeCode = '57699') OR
	(RecordID = 398358 and InterchangeCode = '57701') OR
	(RecordID = 398359 and InterchangeCode = '57712') 

	INSERT INTO LU_Institution_Interchange (RecordID, InterchangeCode) VALUES 
	(398312, '57606')
	, (398344, '57666')
	, (398350, '57685')
	, (398351, '57688')
	, (398352, '57689')
	, (398353, '57690')
	, (398354, '57696')
	, (398355, '57697')
	, (398356, '57698')
	, (398357, '57699')
	, (398358, '57701')
	, (398359, '57712')

	update LU_Institutions set ValidateDescription = 'SOUTHLAKE HEALTH' where ValidateCode = '52038' 
	update LU_Institutions set ValidateDescription = 'SOUTHLAKE HEALTH' where ValidateCode = '52217' 
	update LU_Institutions set ValidateDescription = 'SOUTHLAKE HEALTH' where ValidateCode = '52771' 
	update LU_Institutions set ValidateDescription = 'ST JOSEPH''S HLTH CTR - LODGE SITE' where ValidateCode = '52924'
	update LU_Institutions set ValidateDescription = 'SOUTHLAKE HEALTH' where ValidateCode = '54001'
	update LU_Institutions set ValidateDescription = 'SOUTHLAKE HEALTH' where ValidateCode = '54538'
	update LU_Institutions set ValidateDescription = 'SOUTHLAKE HEALTH-RCC FINCH' where ValidateCode = '54853'
	update LU_Institutions set ValidateDescription = 'SOUTHLAKE HEALTH-RCC FINCH' where ValidateCode = '57453'
	update LU_Institutions set ValidateDescription = 'SOUTHLAKE HEALTH-RCC FINCH' where ValidateCode = '57577'
	update LU_Institutions set ValidateDescription = 'SOUTHLAKE HEALTH-AHF-ELDEN-TCU' where ValidateCode = '57605'
	update LU_Institutions set ValidateDescription = 'SOUTHLAKE HEALTH-AHF-SUNRISE TCU' where ValidateCode = '57612'
END
GO

IF EXISTS (SELECT * FROM HOSP_Elements WHERE KeyCode = 'ProvinceNumber' and KeyValue = '6')
BEGIN
	update LU_Institutions set ValidateDescription = 'GENERIC ISOLATION/AIA' where ValidateCode = '69698'
END
GO