OCXOZ07 ;SLC/RJS,CLA - Order Check Scan ;OCT 30,2024 at 12:49
;;3.0;ORDER ENTRY/RESULTS REPORTING;**32,221,243**;Dec 17,1997;Build 242
;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
;
; ***************************************************************
; ** Warning: This routine is automatically generated by the **
; ** Rule Compiler (^OCXOCMP) and ANY changes to this routine **
; ** will be lost the next time the rule compiler executes. **
; ***************************************************************
;
Q
;
CHK121 ; Look through the current environment for valid Event/Elements for this patient.
; Called from CHK2+14^OCXOZ02.
;
Q:$G(OCXOERR)
;
; Local CHK121 Variables
; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
;
; Local Extrinsic Functions
; FILE(DFN,101, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 FINAL IMAGING RESULT)
; FILE(DFN,55, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: CONSULT FINAL RESULTS)
; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
;
I (OCXDF(2)="GMRC"),$L(OCXDF(34)) S OCXDF(96)=$$ORDITEM(OCXDF(34)),OCXOERR=$$FILE(DFN,55,"96") Q:OCXOERR
I (OCXDF(2)="RA"),$L(OCXDF(34)) S OCXDF(96)=$$ORDITEM(OCXDF(34)),OCXOERR=$$FILE(DFN,101,"96") Q:OCXOERR
Q
;
CHK131 ; Look through the current environment for valid Event/Elements for this patient.
; Called from CHK12+34^OCXOZ03.
;
Q:$G(OCXOERR)
;
; Local CHK131 Variables
; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
; OCXDF(54) ---> Data Field: SITE FLAGGED ORDER (BOOLEAN)
; OCXDF(146) --> Data Field: INPT/OUTPT (FREE TEXT)
; OCXDF(147) --> Data Field: PATIENT LOCATION (FREE TEXT)
;
; Local Extrinsic Functions
; FILE(DFN,58, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: NEW SITE FLAGGED ORDER)
; PATLOC( ----------> PATIENT LOCATION
;
S OCXDF(54)=$$SITEORD^ORB3F1(OCXDF(34),OCXDF(146)) I $L(OCXDF(54)),(OCXDF(54)) S OCXDF(147)=$P($$PATLOC(OCXDF(37)),"^",2),OCXOERR=$$FILE(DFN,58,"9,34,146,147") Q:OCXOERR
Q
;
CHK143 ; Look through the current environment for valid Event/Elements for this patient.
; Called from CHK47+20^OCXOZ05.
;
Q:$G(OCXOERR)
;
; Local CHK143 Variables
; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
; OCXDF(55) ---> Data Field: SITE FLAGGED RESULT (BOOLEAN)
; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
; OCXDF(146) --> Data Field: INPT/OUTPT (FREE TEXT)
; OCXDF(147) --> Data Field: PATIENT LOCATION (FREE TEXT)
;
; Local Extrinsic Functions
; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
; PATLOC( ----------> PATIENT LOCATION
;
S OCXDF(55)=$$SITERES^ORB3F1(OCXDF(34),OCXDF(146)) I $L(OCXDF(55)),(OCXDF(55)) S OCXDF(96)=$$ORDITEM(OCXDF(34)),OCXDF(147)=$P($$PATLOC(OCXDF(37)),"^",2) D CHK148
Q
;
CHK148 ; Look through the current environment for valid Event/Elements for this patient.
; Called from CHK143+17.
;
Q:$G(OCXOERR)
;
; Local Extrinsic Functions
; FILE(DFN,59, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: SITE FLAGGED FINAL LAB RESULT)
;
S OCXOERR=$$FILE(DFN,59,"9,96,147") Q:OCXOERR
Q
;
CHK150 ; Look through the current environment for valid Event/Elements for this patient.
; Called from CHK1+33^OCXOZ02.
;
Q:$G(OCXOERR)
;
; Local CHK150 Variables
; OCXDF(1) ----> Data Field: CONTROL CODE (FREE TEXT)
; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
; OCXDF(15) ---> Data Field: RESULT STATUS (OBX) (FREE TEXT)
; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
;
; Local Extrinsic Functions
; FILE(DFN,60, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: NEW OBR STAT ORDER)
; LIST( ------------> IN LIST OPERATOR
; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
;
I $L(OCXDF(1)),$$LIST(OCXDF(1),"NW,SN"),$L(OCXDF(34)) S OCXDF(96)=$$ORDITEM(OCXDF(34)),OCXOERR=$$FILE(DFN,60,"96") Q:OCXOERR
I $L(OCXDF(15)),(OCXDF(15)="F"),$L(OCXDF(1)),$$LIST(OCXDF(1),"RE"),$L(OCXDF(2)),($E(OCXDF(2),1,2)="LR"),$L(OCXDF(34)) S OCXDF(96)=$$ORDITEM(OCXDF(34)) D CHK263^OCXOZ0B
Q
;
CHK156 ; Look through the current environment for valid Event/Elements for this patient.
; Called from CHK1+34^OCXOZ02.
;
Q:$G(OCXOERR)
;
; Local CHK156 Variables
; OCXDF(1) ----> Data Field: CONTROL CODE (FREE TEXT)
; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
; OCXDF(23) ---> Data Field: REQUEST STATUS (OBR) (FREE TEXT)
; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
;
; Local Extrinsic Functions
; FILE(DFN,61, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: NEW ORC STAT ORDER)
; LIST( ------------> IN LIST OPERATOR
; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
;
I $L(OCXDF(1)),$$LIST(OCXDF(1),"NW,SN"),$L(OCXDF(34)) S OCXDF(96)=$$ORDITEM(OCXDF(34)),OCXOERR=$$FILE(DFN,61,"96") Q:OCXOERR
I $L(OCXDF(23)),(OCXDF(23)="F"),$L(OCXDF(1)),$$LIST(OCXDF(1),"RE"),$L(OCXDF(2)) D CHK252^OCXOZ0B
Q
;
CHK162 ; Look through the current environment for valid Event/Elements for this patient.
; Called from CHK58+18^OCXOZ05.
;
Q:$G(OCXOERR)
;
; Local CHK162 Variables
; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
; OCXDF(40) ---> Data Field: ORDER MODE (FREE TEXT)
; OCXDF(43) ---> Data Field: OI NATIONAL ID (FREE TEXT)
; OCXDF(156) --> Data Field: ALLERGY ASSESSMENT (BOOLEAN)
;
; Local Extrinsic Functions
; ALRGY( -----------> ALLERGY ASSESSMENT
; CLIST( -----------> STRING CONTAINS ONE OF A LIST OF VALUES
; FILE(DFN,136, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: NO ALLERGY ASSESSMENT)
;
I (OCXDF(40)="ACCEPT") D CHK163^OCXOZ08
I (OCXDF(40)="DISPLAY") S OCXDF(2)=$P($G(OCXPSD),"|",2) I $L(OCXDF(2)),($E(OCXDF(2),1,2)="PS") S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) D CHK181^OCXOZ08
I (OCXDF(40)="SELECT") D CHK195^OCXOZ09
I (OCXDF(40)="SESSION") S OCXDF(2)=$P($G(OCXPSD),"|",2) I $L(OCXDF(2)),($E(OCXDF(2),1,2)="PS") S OCXDF(43)=$P($P($G(OCXPSD),"|",3),"^",1) I $L(OCXDF(43)) D CHK226^OCXOZ0A
I $$CLIST(OCXDF(40),"SELECT,SESSION") S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXDF(156)=$$ALRGY(OCXDF(37)) I $L(OCXDF(156)),'(OCXDF(156)) S OCXOERR=$$FILE(DFN,136,"") Q:OCXOERR
Q
;
ALRGY(ORPT) ; determine if pt has an allergy assessment
; rtn 0 if no allergy assessment, 1 if allergy assessment or NKA
N ORALRGY
D EN1^GMRAOR1(ORPT,"ORALRGY")
Q:$G(ORALRGY)="" 0
Q 1
;
CLIST(DATA,LIST) ; DOES THE DATA FIELD CONTAIN AN ELEMENT IN THE LIST
;
N PC F PC=1:1:$L(LIST,","),0 I PC,$L($P(LIST,",",PC)),(DATA[$P(LIST,",",PC)) Q
Q ''PC
;
FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function logs a validated event/element.
;
N OCXTIMN,OCXTIML,OCXTIMT1,OCXTIMT2,OCXDATA,OCXPC,OCXPC,OCXVAL,OCXSUB,OCXDFI
S DFN=+$G(DFN),OCXELE=+$G(OCXELE)
;
Q:'DFN 1 Q:'OCXELE 1 K OCXDATA
;
S OCXDATA(DFN,OCXELE)=1
F OCXPC=1:1:$L(OCXDFL,",") S OCXDFI=$P(OCXDFL,",",OCXPC) I OCXDFI D
.S OCXVAL=$G(OCXDF(+OCXDFI)),OCXDATA(DFN,OCXELE,+OCXDFI)=OCXVAL
;
M ^TMP("OCXCHK",$J,DFN)=OCXDATA(DFN)
;
Q 0
;
LIST(DATA,LIST) ; IS THE DATA FIELD IN THE LIST
;
S:'($E(LIST,1)=",") LIST=","_LIST S:'($E(LIST,$L(LIST))=",") LIST=LIST_"," S DATA=","_DATA_","
Q (LIST[DATA)
;
ORDITEM(OIEN) ; Compiler Function: GET ORDERABLE ITEM FROM ORDER NUMBER
Q:'$G(OIEN) ""
;
N OITXT,X S OITXT=$$OI^ORQOR2(OIEN) Q:'OITXT "No orderable item found."
S X=$G(^ORD(101.43,+OITXT,0)) Q:'$L(X) "No orderable item found."
Q $P(X,U,1)
;
PATLOC(DFN) ; Compiler Function: PATIENT LOCATION
;
N OCXP1,OCXP2
S OCXP1=$G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",2))
S OCXP2=$P($G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",3)),"^",1)
I OCXP2 D
.S OCXP2=$P($G(^SC(+OCXP2,0)),"^",1,2)
.I $L($P(OCXP2,"^",2)) S OCXP2=$P(OCXP2,"^",2)
.E S OCXP2=$P(OCXP2,"^",1)
.S:'$L(OCXP2) OCXP2="NO LOC"
I $L(OCXP1),$L(OCXP2) Q OCXP1_"^"_OCXP2
;
S OCXP2=$G(^DPT(+$G(DFN),.1))
I $L(OCXP2) Q "I^"_OCXP2
Q "O^OUTPT"
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HOCXOZ07 8452 printed Dec 13, 2024@02:25:54 Page 2
OCXOZ07 ;SLC/RJS,CLA - Order Check Scan ;OCT 30,2024 at 12:49
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32,221,243**;Dec 17,1997;Build 242
+2 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
+3 ;
+4 ; ***************************************************************
+5 ; ** Warning: This routine is automatically generated by the **
+6 ; ** Rule Compiler (^OCXOCMP) and ANY changes to this routine **
+7 ; ** will be lost the next time the rule compiler executes. **
+8 ; ***************************************************************
+9 ;
+10 QUIT
+11 ;
CHK121 ; Look through the current environment for valid Event/Elements for this patient.
+1 ; Called from CHK2+14^OCXOZ02.
+2 ;
+3 if $GET(OCXOERR)
QUIT
+4 ;
+5 ; Local CHK121 Variables
+6 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
+7 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
+8 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
+9 ;
+10 ; Local Extrinsic Functions
+11 ; FILE(DFN,101, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 FINAL IMAGING RESULT)
+12 ; FILE(DFN,55, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: CONSULT FINAL RESULTS)
+13 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
+14 ;
+15 IF (OCXDF(2)="GMRC")
IF $LENGTH(OCXDF(34))
SET OCXDF(96)=$$ORDITEM(OCXDF(34))
SET OCXOERR=$$FILE(DFN,55,"96")
if OCXOERR
QUIT
+16 IF (OCXDF(2)="RA")
IF $LENGTH(OCXDF(34))
SET OCXDF(96)=$$ORDITEM(OCXDF(34))
SET OCXOERR=$$FILE(DFN,101,"96")
if OCXOERR
QUIT
+17 QUIT
+18 ;
CHK131 ; Look through the current environment for valid Event/Elements for this patient.
+1 ; Called from CHK12+34^OCXOZ03.
+2 ;
+3 if $GET(OCXOERR)
QUIT
+4 ;
+5 ; Local CHK131 Variables
+6 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
+7 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
+8 ; OCXDF(54) ---> Data Field: SITE FLAGGED ORDER (BOOLEAN)
+9 ; OCXDF(146) --> Data Field: INPT/OUTPT (FREE TEXT)
+10 ; OCXDF(147) --> Data Field: PATIENT LOCATION (FREE TEXT)
+11 ;
+12 ; Local Extrinsic Functions
+13 ; FILE(DFN,58, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: NEW SITE FLAGGED ORDER)
+14 ; PATLOC( ----------> PATIENT LOCATION
+15 ;
+16 SET OCXDF(54)=$$SITEORD^ORB3F1(OCXDF(34),OCXDF(146))
IF $LENGTH(OCXDF(54))
IF (OCXDF(54))
SET OCXDF(147)=$PIECE($$PATLOC(OCXDF(37)),"^",2)
SET OCXOERR=$$FILE(DFN,58,"9,34,146,147")
if OCXOERR
QUIT
+17 QUIT
+18 ;
CHK143 ; Look through the current environment for valid Event/Elements for this patient.
+1 ; Called from CHK47+20^OCXOZ05.
+2 ;
+3 if $GET(OCXOERR)
QUIT
+4 ;
+5 ; Local CHK143 Variables
+6 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
+7 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
+8 ; OCXDF(55) ---> Data Field: SITE FLAGGED RESULT (BOOLEAN)
+9 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
+10 ; OCXDF(146) --> Data Field: INPT/OUTPT (FREE TEXT)
+11 ; OCXDF(147) --> Data Field: PATIENT LOCATION (FREE TEXT)
+12 ;
+13 ; Local Extrinsic Functions
+14 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
+15 ; PATLOC( ----------> PATIENT LOCATION
+16 ;
+17 SET OCXDF(55)=$$SITERES^ORB3F1(OCXDF(34),OCXDF(146))
IF $LENGTH(OCXDF(55))
IF (OCXDF(55))
SET OCXDF(96)=$$ORDITEM(OCXDF(34))
SET OCXDF(147)=$PIECE($$PATLOC(OCXDF(37)),"^",2)
DO CHK148
+18 QUIT
+19 ;
CHK148 ; Look through the current environment for valid Event/Elements for this patient.
+1 ; Called from CHK143+17.
+2 ;
+3 if $GET(OCXOERR)
QUIT
+4 ;
+5 ; Local Extrinsic Functions
+6 ; FILE(DFN,59, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: SITE FLAGGED FINAL LAB RESULT)
+7 ;
+8 SET OCXOERR=$$FILE(DFN,59,"9,96,147")
if OCXOERR
QUIT
+9 QUIT
+10 ;
CHK150 ; Look through the current environment for valid Event/Elements for this patient.
+1 ; Called from CHK1+33^OCXOZ02.
+2 ;
+3 if $GET(OCXOERR)
QUIT
+4 ;
+5 ; Local CHK150 Variables
+6 ; OCXDF(1) ----> Data Field: CONTROL CODE (FREE TEXT)
+7 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
+8 ; OCXDF(15) ---> Data Field: RESULT STATUS (OBX) (FREE TEXT)
+9 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
+10 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
+11 ;
+12 ; Local Extrinsic Functions
+13 ; FILE(DFN,60, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: NEW OBR STAT ORDER)
+14 ; LIST( ------------> IN LIST OPERATOR
+15 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
+16 ;
+17 IF $LENGTH(OCXDF(1))
IF $$LIST(OCXDF(1),"NW,SN")
IF $LENGTH(OCXDF(34))
SET OCXDF(96)=$$ORDITEM(OCXDF(34))
SET OCXOERR=$$FILE(DFN,60,"96")
if OCXOERR
QUIT
+18 IF $LENGTH(OCXDF(15))
IF (OCXDF(15)="F")
IF $LENGTH(OCXDF(1))
IF $$LIST(OCXDF(1),"RE")
IF $LENGTH(OCXDF(2))
IF ($EXTRACT(OCXDF(2),1,2)="LR")
IF $LENGTH(OCXDF(34))
SET OCXDF(96)=$$ORDITEM(OCXDF(34))
DO CHK263^OCXOZ0B
+19 QUIT
+20 ;
CHK156 ; Look through the current environment for valid Event/Elements for this patient.
+1 ; Called from CHK1+34^OCXOZ02.
+2 ;
+3 if $GET(OCXOERR)
QUIT
+4 ;
+5 ; Local CHK156 Variables
+6 ; OCXDF(1) ----> Data Field: CONTROL CODE (FREE TEXT)
+7 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
+8 ; OCXDF(23) ---> Data Field: REQUEST STATUS (OBR) (FREE TEXT)
+9 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
+10 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
+11 ;
+12 ; Local Extrinsic Functions
+13 ; FILE(DFN,61, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: NEW ORC STAT ORDER)
+14 ; LIST( ------------> IN LIST OPERATOR
+15 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
+16 ;
+17 IF $LENGTH(OCXDF(1))
IF $$LIST(OCXDF(1),"NW,SN")
IF $LENGTH(OCXDF(34))
SET OCXDF(96)=$$ORDITEM(OCXDF(34))
SET OCXOERR=$$FILE(DFN,61,"96")
if OCXOERR
QUIT
+18 IF $LENGTH(OCXDF(23))
IF (OCXDF(23)="F")
IF $LENGTH(OCXDF(1))
IF $$LIST(OCXDF(1),"RE")
IF $LENGTH(OCXDF(2))
DO CHK252^OCXOZ0B
+19 QUIT
+20 ;
CHK162 ; Look through the current environment for valid Event/Elements for this patient.
+1 ; Called from CHK58+18^OCXOZ05.
+2 ;
+3 if $GET(OCXOERR)
QUIT
+4 ;
+5 ; Local CHK162 Variables
+6 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
+7 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
+8 ; OCXDF(40) ---> Data Field: ORDER MODE (FREE TEXT)
+9 ; OCXDF(43) ---> Data Field: OI NATIONAL ID (FREE TEXT)
+10 ; OCXDF(156) --> Data Field: ALLERGY ASSESSMENT (BOOLEAN)
+11 ;
+12 ; Local Extrinsic Functions
+13 ; ALRGY( -----------> ALLERGY ASSESSMENT
+14 ; CLIST( -----------> STRING CONTAINS ONE OF A LIST OF VALUES
+15 ; FILE(DFN,136, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: NO ALLERGY ASSESSMENT)
+16 ;
+17 IF (OCXDF(40)="ACCEPT")
DO CHK163^OCXOZ08
+18 IF (OCXDF(40)="DISPLAY")
SET OCXDF(2)=$PIECE($GET(OCXPSD),"|",2)
IF $LENGTH(OCXDF(2))
IF ($EXTRACT(OCXDF(2),1,2)="PS")
SET OCXDF(37)=$GET(DFN)
IF $LENGTH(OCXDF(37))
DO CHK181^OCXOZ08
+19 IF (OCXDF(40)="SELECT")
DO CHK195^OCXOZ09
+20 IF (OCXDF(40)="SESSION")
SET OCXDF(2)=$PIECE($GET(OCXPSD),"|",2)
IF $LENGTH(OCXDF(2))
IF ($EXTRACT(OCXDF(2),1,2)="PS")
SET OCXDF(43)=$PIECE($PIECE($GET(OCXPSD),"|",3),"^",1)
IF $LENGTH(OCXDF(43))
DO CHK226^OCXOZ0A
+21 IF $$CLIST(OCXDF(40),"SELECT,SESSION")
SET OCXDF(37)=$GET(DFN)
IF $LENGTH(OCXDF(37))
SET OCXDF(156)=$$ALRGY(OCXDF(37))
IF $LENGTH(OCXDF(156))
IF '(OCXDF(156))
SET OCXOERR=$$FILE(DFN,136,"")
if OCXOERR
QUIT
+22 QUIT
+23 ;
ALRGY(ORPT) ; determine if pt has an allergy assessment
+1 ; rtn 0 if no allergy assessment, 1 if allergy assessment or NKA
+2 NEW ORALRGY
+3 DO EN1^GMRAOR1(ORPT,"ORALRGY")
+4 if $GET(ORALRGY)=""
QUIT 0
+5 QUIT 1
+6 ;
CLIST(DATA,LIST) ; DOES THE DATA FIELD CONTAIN AN ELEMENT IN THE LIST
+1 ;
+2 NEW PC
FOR PC=1:1:$LENGTH(LIST,","),0
IF PC
IF $LENGTH($PIECE(LIST,",",PC))
IF (DATA[$PIECE(LIST,",",PC))
QUIT
+3 QUIT ''PC
+4 ;
FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function logs a validated event/element.
+1 ;
+2 NEW OCXTIMN,OCXTIML,OCXTIMT1,OCXTIMT2,OCXDATA,OCXPC,OCXPC,OCXVAL,OCXSUB,OCXDFI
+3 SET DFN=+$GET(DFN)
SET OCXELE=+$GET(OCXELE)
+4 ;
+5 if 'DFN
QUIT 1
if 'OCXELE
QUIT 1
KILL OCXDATA
+6 ;
+7 SET OCXDATA(DFN,OCXELE)=1
+8 FOR OCXPC=1:1:$LENGTH(OCXDFL,",")
SET OCXDFI=$PIECE(OCXDFL,",",OCXPC)
IF OCXDFI
Begin DoDot:1
+9 SET OCXVAL=$GET(OCXDF(+OCXDFI))
SET OCXDATA(DFN,OCXELE,+OCXDFI)=OCXVAL
End DoDot:1
+10 ;
+11 MERGE ^TMP("OCXCHK",$JOB,DFN)=OCXDATA(DFN)
+12 ;
+13 QUIT 0
+14 ;
LIST(DATA,LIST) ; IS THE DATA FIELD IN THE LIST
+1 ;
+2 if '($EXTRACT(LIST,1)=",")
SET LIST=","_LIST
if '($EXTRACT(LIST,$LENGTH(LIST))=",")
SET LIST=LIST_","
SET DATA=","_DATA_","
+3 QUIT (LIST[DATA)
+4 ;
ORDITEM(OIEN) ; Compiler Function: GET ORDERABLE ITEM FROM ORDER NUMBER
+1 if '$GET(OIEN)
QUIT ""
+2 ;
+3 NEW OITXT,X
SET OITXT=$$OI^ORQOR2(OIEN)
if 'OITXT
QUIT "No orderable item found."
+4 SET X=$GET(^ORD(101.43,+OITXT,0))
if '$LENGTH(X)
QUIT "No orderable item found."
+5 QUIT $PIECE(X,U,1)
+6 ;
PATLOC(DFN) ; Compiler Function: PATIENT LOCATION
+1 ;
+2 NEW OCXP1,OCXP2
+3 SET OCXP1=$GET(^TMP("OCXSWAP",$JOB,"OCXODATA","PV1",2))
+4 SET OCXP2=$PIECE($GET(^TMP("OCXSWAP",$JOB,"OCXODATA","PV1",3)),"^",1)
+5 IF OCXP2
Begin DoDot:1
+6 SET OCXP2=$PIECE($GET(^SC(+OCXP2,0)),"^",1,2)
+7 IF $LENGTH($PIECE(OCXP2,"^",2))
SET OCXP2=$PIECE(OCXP2,"^",2)
+8 IF '$TEST
SET OCXP2=$PIECE(OCXP2,"^",1)
+9 if '$LENGTH(OCXP2)
SET OCXP2="NO LOC"
End DoDot:1
+10 IF $LENGTH(OCXP1)
IF $LENGTH(OCXP2)
QUIT OCXP1_"^"_OCXP2
+11 ;
+12 SET OCXP2=$GET(^DPT(+$GET(DFN),.1))
+13 IF $LENGTH(OCXP2)
QUIT "I^"_OCXP2
+14 QUIT "O^OUTPT"
+15 ;