DELETE FROM VCLib.T_BASE_FEATURE_SETTINGS 
WHERE EXISTS (
    SELECT 1 
    FROM VCLib.T_CLIENT_MODULE_FEATURE 
    WHERE T_CLIENT_MODULE_FEATURE.ClientModuleFeatureID = VCLib.T_BASE_FEATURE_SETTINGS.ClientModuleFeature
    AND T_CLIENT_MODULE_FEATURE.Name = 'ArmStatisticsWorkSpaceEnableWeb'
);

delete from vclib.T_CLIENT_MODULE_FEATURE 
where name = 'ArmStatisticsWorkSpaceEnableWeb' 
and ClientModules = (select top 1 ClientModuleId from vclib.T_CLIENT_MODULES cm where cm.ModuleType = 'HospitalARMSClientModule')
GO

DELETE FROM VCLib.T_BASE_FEATURE_SETTINGS 
WHERE EXISTS (
    SELECT 1 
    FROM VCLib.T_CLIENT_MODULE_FEATURE 
    WHERE T_CLIENT_MODULE_FEATURE.ClientModuleFeatureID = VCLib.T_BASE_FEATURE_SETTINGS.ClientModuleFeature
    AND T_CLIENT_MODULE_FEATURE.Name = 'ArmAccountRegisterWorkSpaceWeb'
);

delete from vclib.T_CLIENT_MODULE_FEATURE 
where name = 'ArmAccountRegisterWorkSpaceWeb' 
and ClientModules = (select top 1 ClientModuleId from vclib.T_CLIENT_MODULES cm where cm.ModuleType = 'HospitalARMSClientModule')
GO

DELETE FROM VCLib.T_BASE_FEATURE_SETTINGS 
WHERE EXISTS (
    SELECT 1 
    FROM VCLib.T_CLIENT_MODULE_FEATURE 
    WHERE T_CLIENT_MODULE_FEATURE.ClientModuleFeatureID = VCLib.T_BASE_FEATURE_SETTINGS.ClientModuleFeature
    AND T_CLIENT_MODULE_FEATURE.Name = 'ArmRegistryEnableWeb'
);


delete from vclib.T_CLIENT_MODULE_FEATURE 
where name = 'ArmRegistryEnableWeb' 
and ClientModules = (select top 1 ClientModuleId from vclib.T_CLIENT_MODULES cm where cm.ModuleType = 'HospitalARMSClientModule')
GO

DELETE FROM VCLib.T_BASE_FEATURE_SETTINGS 
WHERE EXISTS (
    SELECT 1 
    FROM VCLib.T_CLIENT_MODULE_FEATURE 
    WHERE T_CLIENT_MODULE_FEATURE.ClientModuleFeatureID = VCLib.T_BASE_FEATURE_SETTINGS.ClientModuleFeature
    AND T_CLIENT_MODULE_FEATURE.Name = 'RegistryPolyclinicWorkspaceEnableWeb'
);

delete from vclib.T_CLIENT_MODULE_FEATURE 
where name = 'RegistryPolyclinicWorkspaceEnableWeb' 
and ClientModules = (select top 1 ClientModuleId from vclib.T_CLIENT_MODULES cm where cm.ModuleType = 'PolyclinicARMsClientModule')
GO