WASHINGTON — President Trump was fed up with the grind of health care legislation, and at a dinner with Republican senators on Monday at the White House, he let them know it. He told the lawmakers how annoyed he was with one Republican who was not there, Senator Rand Paul of Kentucky, who had gone on television over the weekend to oppose a Senate health care bill that once held the promise of victory for Mr. Trump.

It is one thing to vote no, Mr. Trump told the group, according to one of the guests. It is another, the president said, to go on all of the Sunday shows and complain about it.

The scene on Monday night was an exasperating end for Mr. Trump to a month of negotiations between the White House and Senate Republicans in an effort to repeal the Affordable Care Act, President Barack Obama’s signature domestic legacy.

The Senate bill, which faced a near-impossible path forward after the House passed its version of the legislation in May, was ultimately defeated by deep divisions within the party, a lack of a viable health care alternative and a president who, one staff member said, was growing bored in selling the bill and often undermined the best-laid plans of his aides with a quip or a tweet.