We analyze the nature of optimal contracts in a dynamic model of repeated (and persistent) adverse selection and moral hazard. In particular we consider the case of surgeons who diagnose patients and then decide whether to perform an operation, and if so, whether to exert a costly but unobservable effort. The probability of a successful operation is a function of the surgeonâ€™s effort, his quality, and the severity of the patientâ€™s problem, all of which are the surgeonâ€™s private information. The principal observes only the history of successes and failures and is allowed to promise financial rewards as a function of the observed history. His goal is to provide incentives at minimum cost so that if the patient needs minor surgery he will be treated by any type of surgeon (low- or high-quality) but if he needs major surgery, only a high-quality surgeon will perform the operation. The optimal contract-pair is characterized and is shown to reflect the practice often observed in the medical industry. Performing an operation is a gamble whose probability of success is higher, the higher the quality of the surgeon. A sequence of operations is exponentially less likely to be successful if the surgeon is not high-quality. An optimal contract for a high-quality surgeon exploits this fact by stipulating a high reward conditional on a long history of successes, while such a stipulation makes the contract much less attractive to a low-quality surgeon.