Patients need to self certify for the first 7 days of sickness this can be done online, only after this can the Dr can extend the sick note, which can be backdated if necessary.
For more information please see the following links
https://www.gov.uk/taking-sick-leave
https://www.nhs.uk/when-do-i-need-a-fit-note/