A prisoner with a burst appendix was told it was a stomach bug, and waited six days to be admitted to hospital for surgery.