In the process of wireless sensor networks query, an adversary may violate the privacy of sensitive data and manipulate compromised storage sensors to reply incomplete or incorrect query results to sink. Based on the two-tiered wireless sensor network model, a secure range query protocol, named ZOSR, is proposed in this paper. ZOSR enables storage sensor to process queries correctly while preserving the privacy of sensed data and the integrity of query result. Firstly, it transfers the range judgment into the comparison between data distance with query range median and query range radius. Which enables the predication only once. To preserve privacy, it converts above comparison into the judgment on whether there is an intersection between two Z-O encoding data sets. Moreover it combines hashed message authentication code mechanism with proposed approach, so that it can prevent other sensitive sensed data from being disclosed and under conspiracy attack. To preserve the query result integrity, it generates Hash value of the shared key as the verification code of sensed data which is not satisfied with the query range. At last, it analyzes the security and conducts performance simulations of ZOSR protocol which shows greater security and less power consumption.