While diagnosing and treating patients was once their domain, doctors are increasingly being replaced by nurse practitioners and physician assistants, collectively known as “midlevel practitioners,” who can perform many of the same duties and generate much of the same revenue for less than half of the pay.