ORDOTP1 ; SLC/TCK - OTP API FILER FOR #101.22 ; Oct 1, 2024@09:58:00
;;3.0;ORDER ENTRY/RESULTS REPORTING;**618**;Sep 19, 2024;Build 14
;
; Reference to ^DIE in ICR #2053
Q
;
EN(DFN,DSTR) ;
;
; Called from ^TIUOTPF when opioid dispense data is received from a clinic
;
; Inputs
; DFN - Patient ID
; DSTR - Array containing fields to be entered into #101.22
;
N FDA,I,IEN,IENS,OFDA
K FDA,OFDA
I 'DFN Q ;Invalid patient
;Check if patient has dispense data in 101.22. If not, add this patient to the file.
I '$D(^ORD(101.22,"B",DFN)) S FDA(101.22,"?+1,",.01)=DFN D UPDATE^DIE("","FDA","","")
S IEN="",IEN=$O(^ORD(101.22,"B",DFN,IEN)),IENS="+1,"_IEN_","
Q:$G(DSTR)=""
S OFDA(101.221,IENS,.01)=$P(DSTR,"^",1)
F I=2:1:9 S OFDA(101.221,IENS,I)=$P(DSTR,"^",I)
D UPDATE^DIE("","OFDA","","")
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORDOTP1 841 printed Jan 29, 2026@15:28:48 Page 2
ORDOTP1 ; SLC/TCK - OTP API FILER FOR #101.22 ; Oct 1, 2024@09:58:00
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**618**;Sep 19, 2024;Build 14
+2 ;
+3 ; Reference to ^DIE in ICR #2053
+4 QUIT
+5 ;
EN(DFN,DSTR) ;
+1 ;
+2 ; Called from ^TIUOTPF when opioid dispense data is received from a clinic
+3 ;
+4 ; Inputs
+5 ; DFN - Patient ID
+6 ; DSTR - Array containing fields to be entered into #101.22
+7 ;
+8 NEW FDA,I,IEN,IENS,OFDA
+9 KILL FDA,OFDA
+10 ;Invalid patient
IF 'DFN
QUIT
+11 ;Check if patient has dispense data in 101.22. If not, add this patient to the file.
+12 IF '$DATA(^ORD(101.22,"B",DFN))
SET FDA(101.22,"?+1,",.01)=DFN
DO UPDATE^DIE("","FDA","","")
+13 SET IEN=""
SET IEN=$ORDER(^ORD(101.22,"B",DFN,IEN))
SET IENS="+1,"_IEN_","
+14 if $GET(DSTR)=""
QUIT
+15 SET OFDA(101.221,IENS,.01)=$PIECE(DSTR,"^",1)
+16 FOR I=2:1:9
SET OFDA(101.221,IENS,I)=$PIECE(DSTR,"^",I)
+17 DO UPDATE^DIE("","OFDA","","")
+18 QUIT
+19 ;