Current and former health officers told lawmakers about the threats they faced over public health decisions.