The present invention relates to preparation of a blattodea polypeptide, and uses of the blattodea polypeptide in anti-gram-positive bacteria and anti-gram-negative bacteria. Specifically the present invention relates to a blattodea extract effective fraction having a function of prevention and treatment of bacterial infection diseases, a preparation method and a medical use thereof. The Periplaneta Americana extract effective fraction of the present invention is a polypeptide substance with a molecular weight less than 5000 dalton, and is prepared by the following steps: carrying out solvent extraction and membrane separation on fresh polypide or dried polypide of Periplaneta Americana to obtain the product of the present invention, wherein the polypeptide active substance of the effective fraction has significant anti-gram-positive bacteria activity and anti-gram-negative bacteria activity, can be prepared into forms of a hydrogel, a cataplasm, lyophilized powder, a water agent, an aerosol, a suppository, a film agent, an external application liniment, and an ointment, and can be used for preparations of drugs for prevention and treatment of diseases related to gram-positive bacteria and gram-negative bacteria and infections, daily chemical products or medical devices.