BackgroundMultistage, stepwise HIV testing and treatment procedures can result in lost opportunities to provide timely antiretroviral therapy (ART). Incomplete engagement of patients along the care cascade translates into high preventable mortality. We aimed to identify whether a structural intervention to streamline testing and linkage to HIV health care would improve testing completeness, ART initiation, and viral suppression and reduce mortality.MethodsWe did a cluster-randomised, controlled trial in 12 hospitals in Guangxi, China. All hospitals were required to be level 2A county general hospitals and ART delivery sites. We selected the 12 most similar hospitals in terms of structural characteristics, past patient caseloads, and testing procedures. Hospitals were randomly assigned (1:1) to either the One4All intervention or standard of care. Hospitals were randomised in a block design and stratified by the historical rate of testing completeness of the individual hospital during the first 6 months of 2013. We enrolled patients aged 18 years or older who were identified as HIV-reactive during screening in study hospitals, who sought inpatient or outpatient care in a study hospital, and who resided in the study catchment area. The One4All strategy incorporated rapid, point-of-care HIV screening and CD4 counts, and in-parallel viral load testing, to promote fast and complete diagnosis and staging and provide immediate ART to eligible patients. Participants in control hospitals received standard care services. All enrolled patients were assessed for the primary outcome, which was testing completeness within 30 days, defined as completion of three required tests and their post-test counselling. Safety assessments were hospital admissions for the first 90 days and deaths up to 12 months after enrolment. This trial is registered with ClinicalTrials.gov, number NCT02084316.FindingsBetween Feb 24 and Nov 25, 2014, we enrolled 478 patients (232 in One4All, 246 in standard of care). In the One4All group, 177 (76%) of 232 achieved testing completeness within 30 days versus 63 (26%) of 246 in the standard-of-care group (odds ratio 19·94, 95% CI 3·86-103·04, p=0·0004). Although no difference was observed between study groups in the number of hospital admissions at 90 days, by 12 months there were 65 deaths (28%) in the in the One4All group compared with 115 (47%) in the standard-of-care group (Cox proportional hazard ratio 0·44, 0·19-1·01, p=0·0531).InterpretationOur study provides strong evidence for the benefits of a patient-centred approach to streamlined HIV testing and treatment that could help China change the trajectory of its HIV epidemic, and help to achieve the goal of an end to AIDS.FundingUS National Institute on Drug Abuse Clinical Trials Network and China's National Health and Family Planning Commission