BackgroundUnder the background that the concept of a community with shared future for mankind has been advocated, the doctor-patient relationship has rapidly sublimated into a community with shared future for doctor-patient. The purpose of this study was to analyze the changes and relationships of anxiety, perceived a community with shared future for doctor-patient (PCSF), health self-consciousness (HSC) and benefit finding (BF) in the outbreak stage of COVID-19 and in the stable stage of COVID-19.MethodsThe questionnaire consisted of a self-designed health self-consciousness scale, perceived a community with shared future for doctor-patient scale, revised 7-item generalized anxiety disorder scale and benefit finding scale. Questionnaires were administered in the outbreak stage of COVID-19 and in the stable stage of COVID-19 to address public anxiety, BF, and trust between medical staff and patients.ResultsRisk perception will increase anxiety in public, and the public who trust medical staff and the ability of the government to prevent and control the epidemic will have a higher PCSF. Compared with those in the outbreak stage of COVID-19, PCSF, HSC and BF all decreased in the stable stage of COVID-19. HSC partly plays a mediating role in the process of the influence of PCSF and BF (95% CI = [0.3785, 0.5007], [0.2357, 0.3695],P< .001). The R-value of the model in the outbreak stage of COVID-19 and in the stable stage of COVID-19 were 0.555 and 0.429, and the value of R2was 0.308 and 0.184 respectively (P< .001). In the stable stage of COVID-19, the coefficient of anxiety ✕ PCSF is negative. The B values of anxiety and PCSF are positive, and the moderating effect is negative (P= .038). Anxiety has a negative moderating effect between PCSF and HSC, indicating that anxiety will weaken the positive impact of PCSF on HSC. It means that there exists a substitution relationship between anxiety and PCSF.ConclusionsThe common goal of medical staff and patients is health, and health is the premise of the meaning of life. Vigorously advocating for PCSF can not only promote a harmonious doctor-patient relationship, but also establish a good HSC and improve the understanding of the meaning of life in the public. Furthermore, if the common concept of a community with a shared future for doctor-patient is integrated into the values of life, it may be more stable and long-term to maintain a good doctor-patient relationship. In addition, we should guard against the influence of high-level anxiety on the path of meaning perception.Supplementary InformationThe online version contains supplementary material available at 10.1186/s40359-023-01175-6.