With question answering system in medicine, users could use sentences in daily life to raise questions. The question answering system will analyze and comprehend these questions and return answers to users directly. Aiming at the problems in automatic diagnosis for medicine, such as low precision of question answering, imperfect expression of domain knowledge, low reuse rate, and lack of reasonable theory reference models, we put forward the information integration method of semantic Web based on pervasive agent ontology (SWPAO method) in medicine, which will integrate, analyze, and process enormous Web information and extract answers on the basis of semantics. A novel approach for automatic diagnosis in medicine based on ontology and fuzzy rough set is brought forward. The data mining algorithm for automatic diagnosis rules in medicine is brought forward: (1) computing the measurement matrix of effect; (2) extracting rules; (3) computing the importance of rules; (4) shearing the rules by genetic algorithm. In this paper, rough sets method is used to take potential diagnosis rule from the decision-making table in medicine. These rules can offer effective automatic diagnosis service. With the SWPAO method as the clue, we mainly study the method of concept extraction based on uniform semantic term mining, pervasive agent ontology construction method on account of multipoints and the answer extraction in view of semantic inference. Meanwhile, we present the structural model of the question answering system applying ontology, which adopts OWL language to describe domain knowledge base from where it infers and extracts answers by Jena inference engine, thus the precision of question answering in QA system could be improved. In the system testing, the precision has reached 86% and the recalling rate is 93%. The experiment indicates that this method is feasible, and it has the signiÞcance of reference and value of further study for the question answering systems in medicine. C