The true answer is “it depends”. Each community may be slightly different.
The main thing is that there is no state that holds a monopoly on power. This reenforces the idea that anarchism probably won’t come about from a quick revolution. It needs to be built over time and with trust and the understanding that we must work together.
An answer would be that the community uses some combination of restorative justice, therapy, arbitration, or in the worst cases exile or violence towards the offender.
It would be worth reading more about criminal justice on theanarchistlibrary.org.
The same people would operate a hospital. There are already anarchists from every walk of life, so in a hypothetical post capitalist society they could continue to work together in a hospital.
As I have put forward in other comments, anarchism does not spring up overnight. It would take years of work to get to (if it ever does). They main thing is that we take responsibility for ourselves and work together in a system of mutual aid.
This all will look different in each community. In communities that are able to grow larger with many people, there will be larger hospitals with more specialized departments. In smaller communities, there may not be a hospital or it may have limited services. But that is already the case in our current system. The major difference is that people will not have to second guess going in for care for fear that they cannot afford it.
There are many obstacles to a truely anarchist society. But that doesn’t mean that we can’t work towards one. People do not lose the desire to care for others, to research, or to organize because they don’t have a government.
If you are interested in learning more, I suggest looking at the Zapatista movement in Mexico. They have built multiple hospitals and clinics since they took the region. Again, this will look different in each area as anarchism is not a one size fits all approach.