

----add the first monitoring period for all activated users in db with no periods
--insert into TelehealthMeasurementMonitoringPeriods (PatientId, StartDateLocal, EndDateLocal,  MeasurementCounter)
--select userid,DATEADD(day,1,DATEADD(dd, DATEDIFF(dd, 0, ActivatedLocal), 0)),dateadd(day,31,DATEADD(dd, DATEDIFF(dd, 0, ActivatedLocal), 0)),0
--from TelehealthUserDetails 
--where ActivatedLocal is not null
--	and 0 = (select count(1) from TelehealthMeasurementMonitoringPeriods where PatientId=userid)



	