Presumably you have some way of identifying which medications are which types. Given that,
[man]usort[/man] will allow you to reorder arrays any way you like. The comparison function would be something like:
function compare_medications($a, $b)
{
// We array_flip here because we want to look up the category's _position_
// in the array given its _name_
$types = array_flip(array('antibiotic', 'hypertensive', 'antiglycemic', ...., 'unknown'));
$a_type = identify_category($a); // A function to decide what type a given medication is
$b_type = identify_category($b); // e.g., identify_category('erythromycin') would return 'antibiotic'
return $types[$b_type] - $types[$a_type];
}