Add hash function to BaseDiagnosis.