The invention relates to a defecation mechanism on the bed, and belongs to the technical field of medical apparatuses and instruments. The defecation mechanism comprises a bed board supported on a bed frame, a bedpan hole is formed in the middle of the bed board, a movable covering board which is in fit with the bedpan hole in shape is installed at the bedpan hole, and the bed frame is provided with a sliding lifting mechanism supporting the covering board. The sliding lifting mechanism comprises a horizontal fixed guide rail, a movable guide rail and a lifting mechanism, wherein the horizontal fixed guide rail is fixed to the middle of the bed frame, the horizontal fixed guide rail and the movable guide rail form a movable pair, and the lifting mechanism is installed on the movable guide rail. The lifting mechanism comprises an X-type lifting rod of which the middle point is hinged; the lower end, far away from the fixed guide rail, of the X-type lifting rod and the movable guide rail form an articulated pair; the lower end, adjacent to the fixed guide rail, of the X-type lifting rod and a horizontal sliding groove in the movable guide rail form a movable pair; the upper end, far away from the fixed guide rail, of the X-type lifting rod and a horizontal sliding groove below the covering board form a movable pair; the upper end, adjacent to the fixed guide rail, of the X-type lifting rod and the covering board form an articulated pair. The defecation mechanism is simple and reliable in structure, avoids motion interference, and accordingly lays the foundation for designing feasible intelligent automatic nursing beds.