Sample exposure to air during optical detection leads to the widespread dispersal of microorganisms in the air, posing a health threat to patients and healthcare workers and potentially causing numerous nosocomial infections. In this study, a TiO2/CS-nanocapsules-Va visualization sensor was developed by alternatively spin-coating TiO2, CS and nanocapsules-Va. The uniformly distributed TiO2can endow the visualization sensor with good photocatalytic performance, and the nanocapsules-Va can bind specifically to the antigen and change its volume. The research results showed that the visualization sensor cannot only detect acute promyelocytic leukemia conveniently, quickly and accurately, but also kill bacteria, decompose organic residues in blood samples under the influence of sunlight, and have an extensive application prospect in substance detection and disease diagnosis.