Failure to have an erection automatically during sex may be erectile dysfunction, which needs to be treated by general measures, medication, physical therapy and surgery. 1. General measures: patients need to improve bad habits, regular sex life, ensure that there is enough rest time, avoid overwork. Secondly, psychological counseling may also be needed to enhance self-confidence and self-esteem, which will help the recovery of sexual function. 2. Medication: Patients need to use phosphodiesterase 5 inhibitors, such as sildenafil, tadalafil, vardenafil, etc., under the guidance of the doctor. If there is low androgen, you need to follow the doctor’s instructions to use testosterone undecanoate pills and other drugs to supplement androgens. 3. Physical therapy: The treatment can be carried out through vacuum erection device therapy, low energy extracorporeal shock wave therapy and other physical measures. 4. Surgery: For patients who are ineffective on medication or other treatments, it is necessary to consider surgical treatment, such as penile artery reconstruction surgery, penile venous fistula surgery. Usually erectile dysfunction patients after standardized treatment in time, the prognosis is good, patients need to strengthen the daily life management, on time follow-up.