Urbanization is intensifying in cities, accompanied by burgeoning inequalities, notably in the healthcare sector. Limited research offers a granular examination of healthcare resource accessibility across diverse population groups. In this study, we employ census data from all 6164 communities in Shanghai to investigate the relationship between multi-scalar spatial dimensions and the socio-economic (dis)advantage of populations concerning healthcare resource accessibility. Distinct from previous studies, this research quantifies social inequality by considering the demographics of community residents and their interactions with healthcare facilities. We elucidate the stratified spatial distribution of healthcare accessibility across various spatial scales in Shanghai, leveraging Web Application Programming Interface (API) technology and examine the pervasive social inequalities across sub-district, district, and the central urban-suburban divide, focusing on specific population subgroups including gender, age, education level, wealth, household registration, ethnicity, occupation, and housing living facilities. Findings reveal that disparities in healthcare accessibility correlate with the quality of healthcare facilities, the socio-spatial attributes of localities, and the socio-economic and demographic profiles of the populations. The insights from this research will aid policymakers in enhancing the distribution and provision of healthcare resources, thereby promoting spatial and social equity in public healthcare system planning and implementation.