Basically, maybe you have a right to this kind of privacy, but (and it's kind of a rational basis analysis, although that phrase isn't used) the state's interest in regulating these drugs prevails. The court recognizes that some laws might violate the constitutional interest, but that this one does not.
What do we think of it?
5%-10% is the current rate of non-paternity. There's a .1%-.01% rate of non-maternity also (baby swaps, intentional or unintentional).