Energy Management In Wireless Healthcare Systems Using Dynamic Task Assignment