The Welsh Government has announced a £145m investment into the NHS across Wales to reduce patient waiting times.