private InventarioMedicamentoEstoque verificarExistenciaContagem() {
    InventarioMedicamentoEstoque estoqueAferido = new InventarioMedicamentoEstoque();

    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append(
        "select o from InventarioMedicamentoEstoque o where o.estoque.idEstoque = ");
    stringBuilder.append(getEstoqueAferido().getIdEstoque());
    stringBuilder.append(" and o.inventarioMedicamento.idInventarioMedicamento = ");
    stringBuilder.append(getInventarioMedicamento().getIdInventarioMedicamento());

    InventarioMedicamentoEstoque registro =
        new ConsultaGeral<InventarioMedicamentoEstoque>(stringBuilder).consultaUnica();

    if (registro == null) {
      estoqueAferido.setInventarioMedicamento(getInventarioMedicamento());
      estoqueAferido.setEstoque(getEstoqueAferido());
      return estoqueAferido;
    } else {
      return registro;
    }
  }