This is a bit complex, but here goes....
The Super Bowl winner drafts last and the loser drafts next to last, no matter what their regular season record. Other than that, all teams pick in reverse order of their regular season record, whether or not they got to the playoffs. So, as stated, Detroit would pick first.
Strength of schedule during the season (opponents W-L record) is the first tie breaker. Divisional and conference comparative records are next on the tiebreaker list, followed by a coin toss, if necessary. If a playoff team and a non-playoff team have the same record, the non-playoff team drafts first, no matter what the result of the other tiebreakers would be.
As for the Patriots, 8 of the other 31 teams have the same or better records than the Patriots. The other two with the same record both made the playoffs. Thus, if the draft were held today, only those 8 teams would pick behind the Patriots, meaning that they would pick 24th. If one or two of the playoff teams with worse records than the Patriots gets to the Super Bowl, that would move the Patriots up to 23rd or 22nd in the draft order.