Oral ulcer is a common inflammatory disease of oral mucosa, causing severe burning pain and great inconvenience to daily life. In this study, compound 3J with anti-inflammatory activity was synthesized beforehand. Following that, an intelligent composite hydrogel supported 3J was designed with sodium alginate, carboxymethyl chitosan, and chitosan quaternary ammonium salt as the skeleton, and its therapeutic effect on the rat oral ulcer model was investigated. The results show that the composite hydrogel has a dense honeycomb structure, which is conducive to drug loading and wound ventilation, and has biodegradability. It has certain antibacterial effects and good anti-inflammatory activity. When loaded with 3J, it reduced levels of TNF-α and IL-6 in inflammatory cells by up to 50.0%. It has excellent swelling and water retention properties, with a swelling rate of up to 765.0% in a pH 8.5 environment. The existence of a large number of quaternary ammonium groups, carboxyl groups, and hydroxyl groups makes it show obvious differences in swelling in different pH environments, which proves that it has double pH sensitivity. It is beneficial to adapt to the highly dynamic changes of the oral environment. Compared with single hydrogel or drug treatment, the drug-loaded hydrogel has a better effect on the treatment of oral ulcers.