Problem is a software issue and not hardware
You can check it by switching off your phone and press and hold volume up and power key simultaneously.
Under recovery key you can see a key and press it.
It will change your language to english.
After that on top you can see "PCBA Test" click on it and press "Down" and select 17th option,
That is "CAMERA BACK" (can also choose 18th option "CAMERA FRONT")
Tap on it and check whether the camera working or not. If the camera works ! The problem is with your software
else the problem is in hardware.
If the camera works properly on testing, flash your phone's software.
if its not working take it to a xiaomi service center.
I had this problem on my redmi 2 prime and in my case the camera passed the test
and i flashed my phone. After flashing camera is working perfectly