new monitoring system using accelerometer ,, gyroscope(gy86 sensor)

we have a project on which we are working but we are facing problems..
we have gy86 sensor and we need it to see 3d mapping of patients to which it is attached .
what we need is that when sensor is connected to patient then we can get reading of accelerometer, gyroscope . and using that we can evaluate that wheather patient sleeping facing celeing(on his back), sleeping on right hand side(on right),on left hand side(left side).
so we need coding for gy86 for that we are not able to get it from anywhere ..
please help !!!

A quick Google search leads me to believe the gy86 uses a MPU6050 and a HMC5883L. I think it also has a air pressure sensor.

The MPU6050 should be enough to get the information you're after.

I2Cdevlib has some amazing code to use with the MPU6050.