The doctor’s office is moving into the kitchen.

After years of telling patients to skip junk food and prepare homemade meals, a growing number of doctors and medical groups are now going a step further and teaching them how to cook. Some are building teaching kitchens or creating food pantries right next to their practices. Others are prescribing culinary education programs in hopes of improving their patients’ nutrition and overall health. Some medical schools have even introduced culinary curriculums to train more doctors to talk to patients about food.

Dr. Nimali Fernando, a pediatrician in Spotsylvania, Va., noticed that many of her patients’ concerns could be traced to poor diet — even problems that may not seem connected, like bed-wetting. She started a food blog, and soon began offering cooking classes out of a church basement kitchen. In 2014 she opened Yum Pediatrics, a nutrition-based pediatrics practice that included a 600-square-foot teaching kitchen. She also created the Dr. Yum Project, a nonprofit with a preschool nutrition curriculum now taught in several Virginia schools.

“I needed to do more than just give patients a pamphlet. I had to have a kitchen in my office,” Dr. Fernando said. “I try to give a lot of prescriptions that are just recipes to see if we can fix an issue with food.”

Dr. Fernando said she has learned that poor food choices can be the root of many seemingly unrelated issues.