If a child no longer meets the standards under which the child was hospitalized or admitted to a treatment resource under §37-1-176(4), the child shall be discharged under title 33, chapter 6, part 7, and the child shall remain in the custody of the department until the department's custody is terminated under §§37-1-179 and37-1-180.