One who enters to measure his granary says: "May it be Your will, Hashem my G-d, that You send blessing upon this pile," for this is a prayer for the future. Once he has begun to measure, he says: "Blessed is He who sends blessing upon this pile," because he is assured that there will be a blessing. If he measured and afterwards recited a blessing—this is a vain prayer, for blessing is only found in something hidden from the eye, so that it should not appear explicitly as being truly against nature, for most miracles are hidden.
And one who enters a bathhouse—and in their bathhouses, which were heated from underneath and were always in a state of danger—says: "May it be Your will, Hashem my G-d, that You bring me in in peace and bring me out in peace, and save me from this fire and the like in the world to come." And when he exits in peace, he says: "I give thanks before You, Hashem my G-d, that You saved me from this fire." And nowadays, the custom is not to do this, as the furnace stands to the side and there is no danger (Bach, and Taz, and Magen Avraham), and so it is explicitly in the Yerushalmi of the tenth chapter of Berakhot.
And one who enters to let blood says: "May it be Your will... that this matter be for me a healing, for You are a free healer." And after he has let blood, he should say: "Blessed is the Healer of the sick." And there is one who says it with the Name and Sovereignty (Taz, subsection 3), and also in the Rambam it is with the Name, see there (and so wrote the Beit Yosef in the name of the Smag). And it is proper that for every medicine one takes, he should say: "May it be Your will, Hashem my G-d, that this be for me a healing," and so the meticulous are accustomed to do.
And a person should always be accustomed to say: "All that the Merciful One does, He does for the good." The general principle of the matter: a person should always pray for the future and request mercy before Him, may He be blessed, and give thanks for the past, and thank and praise according to his strength; and whoever increases in thanking Hashem, this is praiseworthy, as the verse says: "It is good to give thanks to Hashem and to sing to Your Name, O Most High."
הנכנס למוד את גורנו אומר: "יהי רצון מלפניך ה' אלקי שתשלח ברכה בכרי הזה", שהיא תפלה על להבא. התחיל למוד אומר: "ברוך השולח ברכה בכרי הזה", לפי שהוא מובטח שתהיה ברכה. מדד ואחר כך בירך - הרי זה תפלה שוא, שאין הברכה מצויה אלא בדבר הנעלם מן העין כדי שלא יהא נראה להדיא כנגד הטבע ממש, דרוב נסים הם נסתרים. והנכנס למרחץ ובמרחצים שלהם שהיתה נסוקת מתחתיו והיו בסכנה תמיד, אומר: "יהי רצון מלפניך ד' אלקי שתכניסני לשלום ותוציאני לשלום, ותצילני מהאור הזה וכיוצא בו לעתיד לבוא", וכשיצא בשלום אומר: "מודה אני לפניך ד' אלקי שהצלתני מהאור הזה". ועכשיו לא נהגו בזה, דהתנור עומד מן הצד וליכא סכנה (ב"ח וט"ז ומג"א), וכן הוא להדיא בירושלמי דפרק י' דברכות. והנכנס להקיז דם אומר: "יהי רצון… שיהא עסק זה לי לרפואה, כי רופא חנם אתה", ולאחר שהקיז יאמר: "ברוך רופא חולים", ויש מי שאומר בשם ומלכות (ט"ז סק"ג), וגם ברמב"ם הוא בשם ע"ש (וכן כתב הבית יוסף בשם הסמ"ג). ונכון שכל רפואה שנוטל יאמר: "יהי רצון מלפניך ד' אלקי שתהא זה לי לרפואה", וכן נוהגין המדקדקים. ולעולם יהא אדם רגיל לומר: "כל מה דעביד רחמנא - לטב עביד". כללו של דבר: לעולם יתפלל אדם על העתיד ויבקש רחמים מלפניו יתברך ויתן הודאה על העבר, ויודה וישבח כפי כחו, וכל המרבה להודות לד' הרי זה משובח, וכמאמר הכתוב: "טוב להודות לד' ולזמר לשמך עליון”.