If i leave my house for both business and personal stuff while i am out does the whole trip count as business miles? or just the to and from the business places?

lets say i have to run to the post office to mail a package, and while i am out i decide to go to the grocery store and the grocery store is further than the post office what is and isn't mileage deductible. 

also i went on vacation last summer and while i was at camp i had to do business related stuff including shopping for business stuff while their. the vacation was personal but i had business stuff to do while their along with driving for business. what is and isn't deductible?

is it the same with medical?