I am familiar with the formula: 連用形+に+動の動詞 (行く、来る、帰る、戻る、出かける、出る) which means "moving somewhere with a purpose", where "moving" is a template for going, coming, returning, etc.
E.g.
林さんは何をしに来たのですか。Why did Hayashi come?
本を借りに来たんです。He came to borrow a book.
Can a noun+に be used in the same manner to express purpose?
E.g. can 健診に be used as the purpose for the verb いく?
林さんは健診に病院に行った。Hayashi went to the hospital for medical examination.