fixed sending of patient ids
updated sending of patient ids
updated pulling of next task
added methods for pulling encounters from multiple problem