#if ARDUINO >= 100
SoftwareSerial mySerial(2, 3);
#else
NewSoftSerial mySerial(2, 3);
#endif
So, you have a mySerial attached to the two pins? What does a mySerial look like?
Servo myservo; // create servo object to control a servo
Good thing you are not using someone else's servo. They might want it back, and then your project wouldn't work.
Is there some good reason for not using names that reflect the physical objects that are connected? scanner and doorLockServo for instance?
As you can see, my program is very long and messy
It's messy because you use names that make no sense.
It's messy because you switch between switch statements with cases and if/else if/else statements for no good reason.
It's messy because you change styles for no good reason. Either the { goes after the statement it goes with on the same line (yuck!) or it goes on the next line (my preference). It does NOT go one place sometimes and the other other times.
A function has ONE return statement, not 47.
The variable p means one thing, not 14 things.
myservo.write(90); // tell servo to go to position in variable 'pos'
delay(1000); // waits 15ms for the servo to reach the position
If you are going to have useless comments, you MUST keep them correct useless comments. Otherwise, you look like an idiot.
getFingerprintIDez();
A function should do ONE thing. There is no reason for this function to be diddling with the servo. It should do EXACTLY what the name says - get the fingerprint ID. The return value should NOT be discarded. The loop() function should evaluate the return code and decide whether to move the servo, or not.
delay(1000);
There is absolutely no excuse for this in loop().