Endoscopic nasobiliary drainage (ENBD) and endoscopic retrograde biliary drainage (ERBD) can rapidly alleviate obstruction, facilitate bile drainage, and reduce pressure in the bile duct. In this study, to evaluate the effect of plastic biliary stent on the recurrence rate of choledocholithiasis in patients with actual cholangitis after endoscopic retrograde cholangioangiography (ERCP), we a comparative analysis of the efficacy and safety between ENBD and ERBD in inflammatory remission rate, complication rate, and success rate of secondary or multiple endoscopic lithotomy. A total of 347 patients undergoing ENBD and ERBD were enrolled in this retrospective study. Preoperative assessments including blood tests, electrocardiography, abdominal ultrasonography, CT scans, MRI, or MRCP were conducted on all participants. Additionally, serum CRP and amylase levels were measured using a magnetic nanobead-based immunoassay. We found that The success rate of stone removal in the ENBD group was higher than that in the ERBD group (90.8% vs. 72.7%) (P <0.0001). The remission rate of inflammation in the ERBD group (100.0%) was higher than that in the ENBD group (98.7%) (P >0.05). No significant difference was observed between the ERBD group and the ENBD group in preoperative and postoperative inflammatory indexes (total bilirubin, direct bilirubin, white blood cells, neutrophils, CRP, and serum amylase). Moreover, there were significant differences in post-ERCP pancreatitis between the ERBD group and ENBD group. These results suggest that both ENBD and ERBD can effectively improve clinical efficacy. Moreover, magnetic nanobeads have good application in serum index detection to increase detection efficiency.