An intelligent OCR-LLM prescription review system for inpatient narcotic and psychotropic drugs: Development and retrospective validation.
Ma Rong R, Xu Kai K, Zhang Mingming M, Li Xiangpeng X et al.
This study aimed to construct an intelligent prescription review system for inpatient narcotic and psychotropic drugs based on deep learning-based optical character recognition (OCR) and a local large language model (LLM) and evaluate its review performance and closed-loop management value. This study adopted a combined system development and retrospective validation design. Prescription images were first processed using OCR for text recognition and layout reconstruction. A local LLM was then applied to convert unstructured prescription text into standardized JavaScript Object Notation-formatted data. Subsequently, a locally developed rule base for narcotic and psychotropic drugs was used to evaluate prescription completeness, diagnosis-based dosage limits, medication instructions, physician signatures, and residual drug handling for injectable formulations. Using pharmacists' manual review results as the reference standard, 500 inpatient prescriptions for narcotic and psychotropic drugs were retrospectively included. System performance was evaluated in terms of accuracy, sensitivity, specificity, positive predictive value, negative predictive value, F1 score, and Cohen's kappa coefficient. The system successfully implemented prescription image recognition, text structuring, rule-based validation, signature verification, residual drug calculation, and triggers for manual pharmacist review. In the retrospective validation, compared with pharmacists' manual review, the system identified 144 true positives, 16 false positives, 334 true negatives, and 6 false negatives. The overall accuracy was 95.6%, sensitivity was 96.0%, specificity was 95.4%, positive predictive value was 90.0%, negative predictive value was 98.2%, F1 score was 0.929, and Cohen's kappa coefficient was 0.897. The proposed OCR-LLM-based intelligent prescription review system for inpatient narcotic and psychotropic drugs demonstrates high accuracy and strong consistency. It can serve as a front-end screening and decision-support tool for pharmacists and provides technical support for standardized, traceable, and closed-loop management of specially controlled medications.