Medical functional beds and mattresses