Through analyzing behavior of malignant tumors in terminal stage, characteristics and problems of hospitalization behavior were summarized. Evidence was used to adjust and optimize the allocation of medical resources. Terminal stage means the last two years before death. All insured residents died from malignant tumor in 2016 were included. Data came from Shanghai Health Information Network Database.In 2016, 13.8 million malignant tumors died in medical institutions in Shanghai. The proportion of age 56-85 were 78.36%. The demand for hospitalization increased sharply near death. The average hospital admissions were 5.39 times. Per capita admissions increased from 1.21 in penultimate month to 1.56 in the last month of death. The admissions happened in the last quarter accounted for 44.60%. Patients could choose medical institutions. The hospitalization institutions composition was consistent with the distribution of oncology department beds, which was 56.58% in tertiary hospitals and 35.76% in secondary hospitals. The proportion of patients staying in one hospital accounted for 44.87%. About 90% of patients were referred to less than three institutions. The patients with over 10 referral hospitals accounted for 0.52%. As for referring status, 40.34% patients were referred from tertiary hospitals to lower level institutions. The proportion of referred patients to higher institutions was 21.36%. The referral of patients had obvious regional clustering. Referral happened frequently in institutions within medical groups, or located closely. We conclude that regional medical centers and grass-roots medical institutions should be strengthened to alleviate the pressure of tertiary hospitals and facilitate elderly patients' treatment.