Legal analysis: How to deal with social security and medical insurance depends on the specific circumstances of sentencing. If a person is sentenced to public surveillance or criminal detention, the working years will not be counted during the period when the unit stops paying wages, and the payment of pension insurance and medical insurance will be suspended. Insured units can go through the formalities of sealing up the insurance relationship with the endowment insurance agencies of local organs and institutions on the basis of relevant information; If a person is sentenced to more than fixed-term imprisonment for criminal punishment, the unit to which he belongs shall be responsible for handling the procedures for returning the individual contributions, and return the Handbook of Endowment Insurance to the social insurance agency to terminate the relationship between endowment insurance and medical insurance.
legal basis: social insurance law of the people's Republic of China
article 2 the state establishes social insurance systems such as basic old-age insurance, basic medical insurance, industrial injury insurance, unemployment insurance and maternity insurance to protect citizens' right to get material help from the state and society in case of old age, illness, industrial injury, unemployment and maternity.
article 26 the treatment standards of basic medical insurance for employees, new rural cooperative medical care and basic medical insurance for urban residents shall be implemented in accordance with state regulations.
article 28 medical expenses that meet the basic medical insurance drug list, diagnosis and treatment items, medical service facilities standards, and emergency and rescue shall be paid from the basic medical insurance fund in accordance with state regulations.