[OE-3987] refactored conflict detection slightly; fixed bugs in the way conflicts are detected for medications