BUSHORO, Uganda — Lying on a church pew with his arm over his head, 6-year-old Gordon Andindagaye whimpered a bit — in fear, not pain — as Dr. William A. Cherniak slowly swept a small ultrasound scanner up and down his chest.

Dr. Cherniak and Rodgers Ssekawoko Muhumuza, the Ugandan clinical officer he was training, stared at the iPhone into which the scanner was plugged, watching Gordon’s lung expand and contract.

“O.K.,” Dr. Cherniak finally said. “What do you recommend?”

Gordon had a persistent cough and swollen lymph nodes, and looked tired and unwell. As other boys ran around outside, kicking a soccer ball made of rags and twine, he clung weakly to his mother. The scan on the iPhone’s screen suggested his lungs had fluid in them.

As Dr. Cherniak nodded approval, Mr. Muhumuza prescribed an antibiotic, and ordered blood tests to rule out tuberculosis, malaria and H.I.V. He arranged for Gordon and his mother to get a ride to a local clinic for an X-ray and a night of observation.