Background People in prison are generally in poorer health than their peers in the community, often living with chronic illness and multimorbidity. Healthcare research in prisons has largely focused on specific problems, such as substance use; less attention has been paid to conditions routinely managed in primary care, such as diabetes or hypertension. It is important to understand how primary care in prisons is currently delivered in the United Kingdom and how it can be improved, in order to reduce health inequalities. Objective To understand the quality of primary care in prison, including gaps and variations in care, in order to recommend how quality of prison health care can be improved. Design A mixed-methods study with six interlinked work packages. Setting Predominantly the North of England. Methods Between August 2019 and June 2022, we undertook the following work packages: (1) International scoping review of prison healthcare quality indicators. (2) Stakeholder consensus process to identify United Kingdom focused prison healthcare quality indicators. (3) Qualitative interview study with 21 people who had been in prison and 22 prison healthcare staff. (4) Quantitative analysis of anonymised, routinely collected data derived from prison healthcare records (~ 25,000 records across 13 prisons). (5) Stakeholder deliberation process to identify interventions to improve prison health care. (6a) Secondary analysis of the qualitative data set, focusing on mental health and (6b) analysis of the quantitative data set, focusing on health care of three mental health subgroups Findings Our scoping review found predominantly only papers from the United States of America and of variable rigour with the main finding being that performance measurement is very challenging in the prison healthcare setting. In collaboration with stakeholders, we prioritised, refined and applied a suite of 30 quality indicators across several healthcare domains. We found considerable scope for improvement in several indicators and wide variations in indicator achievement that could not be attributed to differences in prison population characteristics. Examples of indicators with scope for improvement included: diabetes care, medicines reconciliation and epilepsy review and control. Longer length of stay in prison was generally associated with higher achievement than shorter stays. Indicator achievement was generally low compared to that of community general practice. We found some encouraging trends and relatively good performance for a minority of indicators. Our qualitative interviews found that quality of health care is related to factors that exist at several levels but is heavily influenced by organisational factors, such as understaffing, leading to a reactive and sometimes crisis-led service. Our stakeholder deliberations suggested opportunities for improvement, ideally drawing on data to assess and drive improvement. Our mental health work package found that coded mental illness had mixed associations with indicator achievement, while the interviews revealed that mental distress is viewed by many as an inevitable facet of imprisonment. Limitations Our analyses of indicator achievement were limited by the quality and coverage of available data. Most study findings are localised to England so international applicability may differ. Conclusions Marked variations in the quality of primary care in prisons are likely to be attributable to the local organisation and conditions of care delivery. Routinely collected data may offer a credible driver for change. Study registration This study is registered at researchregistry.com (Ref: 5098). Funding This award was funded by the National Institute for Health and Care Research (NIHR) Health and Social Care Delivery Research programme (NIHR award ref: 17/05/26) and is published in full in Health and Social Care Delivery Research; Vol. 12, No. 46. See the NIHR Funding and Awards website for further award information. Plain language summary People in prison often have health that is worse than people who live in the community. We do not know much about the quality of prison health care (how good it is). We also do not know much about what happens when people in prison go to see their doctor or nurse for common conditions, like asthma or diabetes. We need to understand how the quality of prison health care can be made better. This is the purpose of this study. Between 2019 and 2022, we worked with people who had knowledge about prison health care, and they helped us focus on what was most important about clinical aspects of the quality of prison health care. We looked at 25,000 prison medical records to see if there were patterns in the data (the medical records were anonymous, so we did not know who was who). There were big differences between prisons. People who were in prison with a long sentence had better-quality health care than those with a short sentence. We talked with 21 people who had been in prison and 22 prison healthcare staff who told us that quality could be influenced by many different things. They told us that one of the biggest issues was not enough healthcare staff in each prison. We took a closer look at mental health and found that health care was sometimes better for people with mental illness and sometimes worse. Mental distress was considered part of prison life by many people. Overall, we found that there is a large amount of difference in the quality of prison health care. This is probably related to how health care is organised in local areas and prisons. Scientific summary Background Compared to community populations, people in prison have significantly poorer health, with higher levels of long-term conditions, disability, and premature death. They need and are entitled to appropriate health care. Most research on prison health care has previously focused on specific priorities, such as mental illness, blood-borne virus infections and substance misuse. However, less attention has been paid to the quality of ‘routine’ primary care. This is important given shifting demographics, including an ageing population with more long-term conditions, and the opportunities to improve outcomes through primary and secondary prevention. We examined the quality of primary care in prison and identified strategies for improvement. Objectives To identify quality indicators based on current national guidance which can be assessed using routinely collected data through a stakeholder panel. To explore perceptions of quality of care, including barriers to and enablers of recommended care and quality indicators, through qualitative interviews involving people who had been in prison and prison healthcare staff. To assess the quality of primary care provided to people in prison through analysis of anonymised and routinely held prison healthcare records. To integrate the above findings and identify quality-improvement interventions which can be monitored by our set of quality indicators. To understand quality of prison health care in relation to mental health needs. Methods and findings Our mixed-methods programme had interlinked work packages (WPs) closely aligned to our objectives. It ran from August 2019 to July 2022 with research fieldwork and analyses over November 2019 to May 2022. Identification of quality indicators (WP1) Scoping review Methods We first conducted an international scoping review to describe existing literature on the development and selection of quality indicators for primary health care in the prison setting. We searched for articles published in English between 2004 and 2021. Our broad inclusion criteria included any research method, any health condition, and any country. We excluded papers relating to community criminal justice settings and on transitions from prison to community. We searched six electronic databases (MEDLINE, CINAHL, Scopus, EMBASE, PsycInfo and Criminal Justice Abstracts) supplemented by hand searching of four key journals, key author searches and forwards and backwards citation tracking. We performed a qualitative synthesis of eligible papers. Findings Of 1271 records screened, 24 were eligible for full text review and 15 were included. The literature was predominantly from the USA. Our synthesis found that rigour and stakeholder involvement in the selection of quality indicators varied, with no paper including patient representation. Performance measurement is challenging in prison settings because of limited or poor recording and coding of data and the lack of comparability between prison and community populations. Stakeholder consensus process Methods and findings A four-stage, iterative process involved (1) identification and screening of candidate indicators from guidance and wider literature, (2) shortlisting and selection with a stakeholder consensus panel, (3) reviewing and refining and (4) specifying eligible populations and criteria for achieving each indicator while piloting data extraction. This work took place from December 2019 to July 2020. We initially developed a ‘long-list’ of 361 candidate indicators derived from a range of sources including the National Institute for Health and Care Excellence, the Quality Outcomes Framework and local commissioning groups. Clinical research team members screened the list and agreed a reduction to 76 candidate indicators based on relevance to primary care, measurability and potential for patient benefit. Eight stakeholders with backgrounds in criminal justice, health care and mental health participated in the consensus process (face-to-face and online). They initially and independently rated each candidate indicator as having low, medium or high potential for significant patient benefit before a panel discussion and re-rating. We discarded all of the lowest-rated indicators and most of the medium-rated indicators. We then reviewed and specified the remaining 36 indicators, removing those that could not be reliably measured using routinely collected data and disaggregating selected composite (combined) indicators. We finally further defined and piloted indicators, producing a list of 30 indicators that spanned communicable disease, drug misuse, mental health, long-term conditions, prevention and screening. Perceptions of prison health care (WP2) Methods We interviewed 21 people who had been in prison and 22 healthcare staff. Participants were recruited through a variety of means but most often through patient and public involvement (PPI) partners (for people in prison) and through healthcare providers (for staff). We spoke to both men and women who had been in a range of different prisons; six were from an ethnic minority. Staff spanned a variety of healthcare roles and worked in both the male and female estate. All but two of the interviews were conducted over phone or video due to the COVID-19 pandemic. Interviews were on average about 40 minutes long and were conducted between November 2019 and March 2021. Analysis was undertaken by mapping the data onto a four-level quality-improvement matrix covering individual, team, organisation and wider system levels. Findings We elicited a wide range of barriers to and facilitators of high-quality care which operated across all levels of healthcare organisation and delivery. Both people who had been in prison and staff highlighted how the organisational-level factors of understaffing and poor skill mix undermine healthcare delivery, which then becomes reactive and crisis-led. The unreliability of communication processes and pathways regarding health care in prison was an issue which crossed over several different levels. Individual-level facilitators included, for some healthcare staff, having a sense of reward at being able to help a population with high levels of need. Continuity of care was a contested factor; it was a facilitator for some participants and a barrier for others, especially related to continuity of medicine prescribing and use. Overall, we found that people’s perceptions about the quality of prison health care were complex and multifactorial, with issues at the level of the organisation and wider system then influencing how teams and individuals related to each other and their experience of delivering or receiving health care. Analysis of quality indicator achievement using routinely collected data (WP3) Methods We conducted repeated cross-sectional analyses of anonymised routinely collected electronic primary care data from 13 prisons in the North of England. We remotely extracted all data between April and November 2020. We measured achievement against 30 quality indicators over a 3-year period (April 2017–March 2020). We explored associations between achievement and individual and prison characteristics. Explanatory variables included prison category, age, gender, ethnicity and length of stay. Date-range searches for most indicators coincided with the Quality Outcomes Framework years (1 April–31 March) to allow indirect comparisons with the community for similar indicators. Descriptive statistics for each indicator were produced by year for each of the explanatory variables. We developed multilevel logistic regression models for each indicator to explore associations with achievement. Findings The study population increased from 21,677 people to 25,811 over 2017–20. We found substantial scope for improvement and marked variations in the quality of primary care, as measured using routinely collected data. Gaps and variations in care spanned different domains, both for indicators that reflected particular needs of the prison population (e.g. medicine reconciliation) and those reflecting more general primary care needs (e.g. diabetes care). The extent of variations between prisons was poorly explained by differences in available prison population characteristics. We found encouraging trends suggesting improvement over time for several indicators, such as improving hepatitis B vaccination and falling gabapentinoid prescribing, and strengths in performance, such as secondary prevention of stroke. However, we identified areas of concern, where overall achievement had declined over a 3-year period, notably declining antipsychotic monitoring and rising opioid prescribing. Relatively short lengths of stay were frequently associated with lower achievement across prison-specific, long-term conditions and screening domains. We observed no consistent patterns in achievement by gender, age or prison category. Indirect comparisons with community achievement were unfavourable for 20 out of 22 indicators. Integration of findings and identification of quality-improvement interventions (WP4) Methods and findings We held three sequential online stakeholder workshops (October and November 2021, January 2022). Stakeholders were predominantly commissioners or deliverers of prison health care. In the first workshop, 28 stakeholders were presented with an integration of the findings of all prior WPs, which generated a broad discussion about the challenges of prison health care. Delegates were particularly interested in issues pertaining to opioid prescribing and women’s health. This first workshop also dovetailed as a dissemination event. In the second workshop, 10 stakeholders rated the importance of indicators after hearing about the evidence base for the likely success of differing implementation interventions. Delegates queried specifics regarding certain indicators and brought up interesting points about the prison healthcare tendering process and the potential for using routine data. In the third workshop, three stakeholders participated in a deliberation process using the APEASE criteria, and gave their opinions on the applicability of six candidate implementation strategies put forward by the research team, for example, audit and feedback. Following the deliberation process, we devised two illustrative improvement strategies for two indicators: opioid and gabapentinoid prescribing; and management of hypertension. Quality of care in relation to mental health needs (WP5) Methods Qualitative: We undertook a secondary analysis of the interview data set generated in WP2, comprising 43 interviews with prison leavers and prison healthcare staff. Seven of these interviews did not contain content about mental health and therefore this focused mental health analysis is based on 36 interviews. Reflexive thematic analysis was conducted. Quantitative: We re-analysed data from WP3, focusing on achievement and associations for three groups: people with no coded mental illness; people with a coded mental illness prescribed an antipsychotic drug in the previous 12 months; and people with a coded mental health diagnosis not prescribed an antipsychotic drug in the previous 12 months. We explored associations between indicator achievement and mental health groupings using multilevel logistic regression models. Findings Qualitative: Mental distress was perceived as a major problem within prison but also an inevitable feature of imprisonment. Many people entered the prison with existing mental illness, but the prison environment could also cause mental distress or exacerbate it. Mental health care in prison was described as a low priority alongside an overburdened workforce. Prison leavers said that seeking help for their mental distress was often risky as they may receive inadequate care that would make them feel worse. Quantitative: Of 69,587 prison stays over 3 years, almost 14% had a coded mental illness and a further 1.5% had a coded mental illness and antipsychotic drug prescription. Coded mental illness was higher amongst women than men and higher amongst white people compared with other ethnic groups. Across most indicators, achievement was generally higher for stays of prisoners with coded mental illness than for those without. Achievement also tended to be higher for stays of prisoners with coded mental illness and prescribed antipsychotics. Nevertheless, we still identified examples where prisoners with coded mental illness were less likely to experience recommended care than those without, namely breast screening for women aged 50–70 years and drug treatment following myocardial infarction. Furthermore, we found increased likelihoods of opioid prescribing, gabapentinoid prescribing and psychotropic polypharmacy for stays of prisoners with coded mental illness compared to those without. Conclusions We looked across all WPs to derive five headline ideas of interest regarding what we have learnt about the quality of prison health care from this mixed-methods programme of research. First, measurement and monitoring is the foundation of high-quality healthcare provision. While the Quality Outcomes Framework provides incentives for this in community primary care, the absence of any comparable lever in the prison setting leads to inconsistent quality of clinical coding. Second, there are marked variations in the quality of health care delivered between different prisons that are poorly explained by differences in prison population characteristics. People in prison highlighted variations when trying to access prison health care; these were often largely dependent on factors extraneous to the healthcare department itself. Third, we found no consistent signals from both the qualitative and quantitative work that any specific group related to age, gender or ethnicity were receiving better or worse care than others. Rather, for some female-specific and older age-specific indicators, the notable variation in quality was between the community and prison setting, with achievement being higher in the community. Fourth, factors at the level of the prison as an organisation and the prison system as an institution are likely to exhibit a large influence on quality of health care. Our qualitative findings pointed to understaffing as an umbrella issue which then has consequences for many aspects of day-to-day care delivery. Fifth, the prison–community interface is important when considering the high rate of recidivism in the UK prison population. This particularly relates to the limited interoperability between community and prison clinical systems and resulting losses in informational continuity which then contribute to deficits in health care. Implications for health care and recommendations for future research We highlight three implications for health care. First, the loss of informational continuity between community and prison primary care undermines individual patient care as well as the ability to measure and improve whole-system care. Improved linkage of individual electronic health records at this interface may deliver benefits for patient care and system-level improvement. Second, our work has demonstrated marked gaps and variations in achievement of quality indicators across 13 prisons served by one primary care provider which are incompletely explained by population characteristics. Such gaps and variations are likely to be a more widespread phenomenon affecting other prisons and warrant attention. Third, our suite of indicators, based on routinely collected data, may serve as a foundation for an efficient and evidence-based audit and feedback intervention, which could be scaled up and applied across the prison sector. We highlight two areas for future research: understanding ethnic variations in receipt of recommended health care; and evaluating the effectiveness and cost-effectiveness of strategies to improve primary care in prisons. Study registration This study is registered at researchregistry.com (Ref: 5098). Funding This award was funded by the National Institute for Health and Care Research (NIHR) Health and Social Care Delivery Research programme (NIHR award ref: 17/05/26) and is published in full in Health and Social Care Delivery Research; Vol. 12, No. 46. See the NIHR Funding and Awards website for further award information.