As the incidence of postoperative pain in patients with biliary and pancreatic diseases has gradually increased, how to control postoperative pain has received increasing research attention. By reading pain management guidelines and multidisciplinary communication and cooperation, clinical pharmacists designed multi-mode analgesia regimens based on surgical types, in order to provide strong evidence for the effectiveness and safety of postoperative analgesia regimens and better serve patients. Data from biliary or pancreatic surgery performed at Nanjing Drum Tower Hospital from 2019 to 2021 were collected. Take October 2020 as the time point to compare the outcomes before and after the implementation of the path-based postoperative analgesic regimens. The primary outcomes were NRS pain scores, sleep quality, and incidence of adverse reactions. Length of stay was a secondary outcome. A total of 268 and 239 patients were enrolled in the study and control groups, respectively. Four path-based postoperative analgesic management regimens significantly reduced patients' static and dynamic NRS scores in the 24 h (p < 0.05). The patients' sleep quality were better than controls (p > 0.05). The incidence of adverse reactions and the length of stay in the study group were numerically lower than controls. Moderate analysis indicated that four analgesia regimens are more precise and better meet actual clinical needs. Effective and safe postoperative pain management is particularly important for clinical purposes. Path-based postoperative analgesia regimens based on different types of surgery overcome the disadvantages of overly broad and generalized traditional guidelines, which play an important role in providing personalized and precise clinical services. Further, study findings provide evidence that four path-based analgesic regimens can reduce postoperative pain and reduce the length of hospital stay, which may provide a better direction for clinical postoperative pain management.