Hi and welcome to the forum! I am glad that I can help you.
You would like to know what the reason is for a lung collapse.
Lungs may collapse due to one of these conditions: pneumothorax or atelectasis. Pneumothorax appears if the lung tissue is injured (spontaneously or accompanied with injury of the chest cavity wall)and air is released in the chest cavity, or if the chest wall is injured and the negative pressure that is normal for the chest cavity gets positive causing the lungs to collapse. Atelectasis is a lack of gas exchange within alveoli, due to alveolar collapse or fluid consolidation. It may affect part or all of one lung.
Given the data that you provided, it is likely that you may have experienced one of these conditions. Patients who experience diabetes mellitus - both types - are critical and are at greater risk of developing any kind of complications during and after surgery. You may consider seeing your doctor or other qualified healthcare provider such as a surgeon for further advice.
Please keep in mind that I provide medical information only. I am not able to diagnose medical conditions online. Please contact your doctor or other qualified healthcare provider such as a surgeon for further advice and information.