Update Quality Measure Engine to work with Mongoid 4

This contains fixes that should correct all of the things causing failures in the test suite when moving the quality measure engine from mongoid 3 to mongoid 4. It has also been tested and works with popHealth running rails 4.