Justina Pelletier, a teenager caught in the middle of a high-profile medical dispute and child custody battle, is expected to be discharged from Boston Children’s Hospital to a residential facility in the next few weeks, after a juvenile court judge moved on Friday to end a stalemate that has kept the girl at the hospital for almost a year.