The invention relates to a medical data security consensus method based on credit rating, which comprises the following steps: dividing nodes into data nodes, consensus nodes and supervision nodes, and quickly verifying node identities by adopting a node identity verification mechanism; improving an inter-node distance calculation method, a fitness value of a judgment radius and a cutting method in different optimization stages, and realizing rapid division of miner credit rating based on a self-optimization credit rating division method of an improved ocean grazing feeder; meanwhile, according to the situation that the nodes participate in the block consensus, providing a credit rating mechanism, which comprises a reward and punishment mechanism, a credit value model and a credit rating division algorithm, improving the enthusiasm of the nodes participating in the block consensus, and realizing reasonable credit rating division; providing a representative node election mechanism, andpreventing malicious nodes from becoming representative nodes as much as possible; and finally, proposing a representative node consensus mechanism to improve the block consensus efficiency. Accordingto the method, malicious nodes can be eliminated, the node participation block consensus enthusiasm is improved, the transaction delay is reduced, and the consensus efficiency is improved.