An integrated system based on wireless sensor networks for patient monitoring