Detection of errors in health care and evaluation of preventive measures for patient safety