Introduction: With the development of photothermal technology, the appearance of composite photothermal hydrogels has increased the selectivity of treating infectious skin defects. However, how to design composite photothermal hydrogel with better antibacterial performance, reduce the resistance rate of bacteria, and the damage rate of normal tissue still needs further study.Methods: The Prussian blue and tannic acid were loaded on polyacrylamide hydrogels. Characterization of DLS, Zeta potential, UV absorption spectrum, hydrogel swelling rate, scanning electronic microscopic, drug release profile, photothermal properties, in vitro cytocompatibility, and antibacterial properties. Experiments were measured by skin defect repair, antibacterial detection, and histological staining experiments.Results: The polyacrylamide hydrogel with photothermal effect and controllable release of tannic acid was successfully prepared. The hydrogel has strong light transmittance and adhesion, and the swelling rate can reach 600%, which improves the self-cleaning ability. SEM results showed the porous structure of hydrogels, promoting cell growth. Through photothermal switches, the composite hydrogel represented adjustable and controllable drug release ability. Combined with the synergistic antibacterial effect of tannic acid, this further enhanced the antibacterial ability and reduced the probability of antibiotic resistance. The in vitro and in vivo experiments showed the hydrogel had good biocompatibility and excellent antibacterial properties, which could promote the repair of infectious skin defects in SD rats.Conclusion: We fabricated a hydrogel with a triggering drug release rate, alleviating heat damage, transparent morphology, mechanical stability, strong adhesion, good biocompatibility, and synergistic antibacterial ability, which presents new treatment options for infectious skin defect repair.