El Paso, Texas (CNN) By the time Dr. Roberto "Bert" Johansson saw the toddler in the emergency room, she was vomiting, feverish, dehydrated and desperately ill with acute gastroenteritis.

The girl had been in Border Patrol custody for two days before agents rushed her to El Paso Children's Hospital. Johansson told CNN he admitted her and put her on an IV line, fluids and other treatment.

"She lived, but her illness had been missed," he said of that day three months ago. "We need to get to these kids earlier."

Since September, at least six migrant children have died in federal custody, including at least three children taken into Border Patrol custody around El Paso.

In recent days, public attention has focused on how some 250 children recently held for as long as three weeks at the Border Patrol's station in Clint, Texas, southeast of El Paso. During that time, the children had little or no access to soap, showers, toothpaste and adequate bedding, and were sleeping in holding rooms that are lit 24 hours a day, according to attorneys and doctors who interviewed children there

But Johansson, a pediatrician who specializes in emergency medicine and intensive care, says there's another pressing problem: The medical screening the Border Patrol gives to undocumented children is "absolutely, unequivocally inadequate."

Johansson said that in his decade at El Paso Children's Hospital, he's treated more than 100 children brought in from Border Patrol custody (nearly a third of them in the past year). As a volunteer doctor at Annunciation House , which takes in migrant families released by Customs and Border Protection or Immigrations and Customs Enforcement, he said he has seen more than 1,000 migrant children over that time.

Some children arrive at the border ill. But Johansson said the Border Patrol does a poor job of initially assessing a child's illness and too often misses early signs of health problems of youngsters in custody. By the time children are sent to local hospitals, conditions that could have been treated earlier have grown more serious and more difficult to treat.

Once at the hospital, border agents or other officers stand guard outside the children's rooms. CNN visited El Paso Children's Hospital on Friday and found a Border Patrol agent sitting outside a 16-year-old girl's room. A floor above on the pediatric intensive care unit, a Homeland Security officer from New York made small talk with one of the doctors as he stood outside a 6-year-old girl's room.

A border agent sits outside the hospital room of an 16-year-old migrant girl.

Under a CBP directive announced in January, a medical professional under CBP contract or a "credentialed healthcare provider" is supposed to conduct an interview and medical assessment of every child taken into custody.

"We have increased the medical contract capability across the Southwest Border," a CBP spokesman told reporters in a conference call last week. "We have about 85% coverage now by our current contract, nurses and RNs who are in our intake center, 24 hours a day, seven days a week. In those areas that we don't have that, we have Border Patrol EMTs."

The spokesman said that CBP doesn't want to hold children in its facilities for more than 72 hours, but that it is constrained in turning them over to the Office of Refugee Resettlement by limited bed space at ORR facilities.

"We do not want them in our custody. Our facilities were not designed for that. We have short-term holding facilities," the spokesman said.

The spokesman contested reports that the children didn't have access to showers, soap, toothpaste or proper medical care.

When reporters visited the Clint station last week, they saw at least four monitors, newly hired by CBP, helping some of the 117 children at the facility that day. One teenage girl, quarantined with a sign saying she might have the flu, sat isolated in a holding cell.

Johansson is not alone in his observations about the health care of migrant children. On Friday, a federal judge in California ordered CBP to allow independent medical professionals into its facilities in the Border Patrol's Rio Grande Valley and El Paso sectors to make sure the facilities are safe and sanitary and to assess the medical needs of the children being held in them. The agency has until July 12 to comply.

A coalition of advocacy groups asked the court to intervene by filing a motion that included 80 declarations from doctors, attorneys, detained children and their parents, describing conditions as endangering children's lives.

"The children, including infants and expectant mothers, are dirty, cold, hungry and sleep-deprived. Because the facilities deny basic hygiene to the children, the flu is spreading among detained class members, who also are not receiving essential medical assessments or prompt medical treatment," the motion stated. "With each passing day, more hospitalizations are occurring and more lives are at risk. Immediate judicial intervention is necessary to... end this health and welfare crisis, and prevent more illness and child deaths at the border."

Pediatrician Dolly Lucio Sevier said in a declaration accompanying the motion that her recent visit to a CBP detention center in McAllen, Texas, led to five infants being admitted to the neonatal intensive care unit at a local hospital. Other doctors noted that the crowding and lack of hygiene make it easy for infectious diseases to spread.

For his part, Johansson doesn't blame the agents for the lack of adequate screening. "They're not pediatricians; sometimes the symptoms can be subtle." That's why the agency needs to make sure that the medical providers it contracts with are well trained, he said.

Johansson said he's seen the number of migrant children brought in by Border Patrol or ICE agents climb from rare and occasional a decade ago, to five or six a month since last September.

Border Patrol agents also take children to Providence Children's Hospital in El Paso, which declined to comment on how many they receive. Last December, 7-year-old Jakelin Caal Maquin of Guatemala died at Providence from streptococcal sepsis, a fast-progressing bacterial infection, two days after she and her father were detained by Border Patrol agents. By the time she arrived at the hospital, agents had revived her twice and her internal temperature had climbed to 105.7 degrees.

Johansson, who attended her autopsy, said that because streptococcal sepsis progresses so rapidly, even a few hours delay in treatment can potentially make a life-or-death difference.

Last Sunday, at an El Paso shelter run by Annunciation House in the historic South El Paso neighborhood known as Segundo Barrio, Johansson treated a young Central American girl who had just been released after a couple of days in Border Patrol custody.

"She had all the signs and symptoms of early sepsis," he said. He had her admitted to hospital, where with antibiotics, fluids and proper treatment she quickly recovered, he said.

Johansson says he has treated migrant children with parasitic infections such as leishmaniasis and Chagas' disease, leukemia, pulmonary embolisms, congenital cardiac disease, pneumonia and many other ailments. At the very least, Johansson said, those doing medical screening need better training to "recognize what to look for" when migrant children are first taken into custody.

Five months ago, Johansson treated a 14-year-old migrant girl for complications from diabetes. She told him Border Patrol agents took away her insulin when she was taken into custody and never returned it, he said.

Although CBP didn't respond to that specific allegation, the agency has said its policy is to not to allow detainees to keep medications they arrive with, but that migrants can be issued medication once they have been diagnosed and CBP medical personnel have issued a prescription.

Similar accounts have come from elsewhere along the border. Eric Russell, a pediatric emergency medicine physician who volunteers at a shelter in McAllen, Texas, in the Rio Grande Valley, told a Yahoo News reporter of treating a boy of eight or nine who said Border Patrol agents had taken away and never returned his prescription seizure medication.

Last week, Kyle Yasuda, president of the American Academy of Pediatrics, sent a message to AAP members saying that he and president-elect Sally Goza were visiting the border to call for "immediate, permanent changes to the way we treat immigrant children when they come here."

The academy's position is that children shouldn't be detained at all. The academy said that CBP facilities holding children "must provide medical care, adequate nutrition, including clean drinking water, shelter, infant formula and baby food, access to hygiene, including showers and handwashing, and essential items like diapers."

Johansson, who volunteers to treat children in various clinics and shelters when he isn't working at the hospital, said he'd like to see CBP boost its ranks of medical personnel.

"Let's get some pediatricians out there," he said, immediately volunteering himself. "I would work there."