OCXOZ0W	;SLC/RJS,CLA - Order Check Scan ;NOV 8,2009 at 18:44
	;;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
	;
R56R1A	; Verify all Event/Elements of  Rule #56 'RECENT BARIUM STUDY'  Relation #1 'BARIUM'
	;  Called from EL67+5^OCXOZ0H.
	;
	Q:$G(OCXOERR)
	;
	;      Local Extrinsic Functions
	; MCE67( ----------->  Verify Event/Element: 'RECENT BARIUM STUDY ORDERED'
	;
	Q:$G(^OCXS(860.2,56,"INACT"))
	;
	I $$MCE67 D R56R1B
	Q
	;
R56R1B	; Send Order Check, Notication messages and/or Execute code for  Rule #56 'RECENT BARIUM STUDY'  Relation #1 'BARIUM'
	;  Called from R56R1A+10.
	;
	Q:$G(OCXOERR)
	;
	;      Local Extrinsic Functions
	; GETDATA( ---------> GET DATA FROM THE ACTIVE DATA FILE
	;
	Q:$D(OCXRULE("R56R1B"))
	;
	N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
	I ($G(OCXOSRC)="CPRS ORDER PRESCAN") S OCXCMSG=(+OCXPSD)_"^14^^Recent Barium study: "_$$GETDATA(DFN,"67^",70)_" ["_$$GETDATA(DFN,"67^",121)_"]" I 1
	E  S OCXCMSG="Recent Barium study: "_$$GETDATA(DFN,"67^",70)_" ["_$$GETDATA(DFN,"67^",121)_"]"
	S OCXNMSG=""
	;
	Q:$G(OCXOERR)
	;
	; Send Order Check Message
	;
	S OCXOCMSG($O(OCXOCMSG(999999),-1)+1)=OCXCMSG
	Q
	;
R57R1A	; Verify all Event/Elements of  Rule #57 'CLOZAPINE'  Relation #1 'CLOZAPINE AND (NO WBC W/IN 7 DAYS OR NO ANC W/IN 7...'
	;  Called from EL116+5^OCXOZ0H, and EL117+5^OCXOZ0H, and EL118+5^OCXOZ0H.
	;
	Q:$G(OCXOERR)
	;
	;      Local Extrinsic Functions
	; MCE116( ---------->  Verify Event/Element: 'CLOZAPINE DRUG SELECTED'
	; MCE117( ---------->  Verify Event/Element: 'CLOZAPINE NO ANC W/IN 7 DAYS'
	; MCE118( ---------->  Verify Event/Element: 'CLOZAPINE NO WBC W/IN 7 DAYS'
	;
	Q:$G(^OCXS(860.2,57,"INACT"))
	;
	I $$MCE116 D 
	.I $$MCE118 D R57R1B
	.I $$MCE117 D R57R1B
	Q
	;
R57R1B	; Send Order Check, Notication messages and/or Execute code for  Rule #57 'CLOZAPINE'  Relation #1 'CLOZAPINE AND (NO WBC W/IN 7 DAYS OR NO ANC W/IN 7...'
	;  Called from R57R1A+13.
	;
	Q:$G(OCXOERR)
	;
	;      Local Extrinsic Functions
	; GETDATA( ---------> GET DATA FROM THE ACTIVE DATA FILE
	;
	Q:$D(OCXRULE("R57R1B"))
	;
	N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
	I ($G(OCXOSRC)="CPRS ORDER PRESCAN") S OCXCMSG=(+OCXPSD)_"^19^^Clozapine orders require a CBC/Diff within past 7 days.  Please order CBC/Diff with WBC and ANC immediately.  Most recent results - "_$$GETDATA(DFN,"116^117^118",130) I 1
	E  S OCXCMSG="Clozapine orders require a CBC/Diff within past 7 days.  Please order CBC/Diff with WBC and ANC immediately.  Most recent results - "_$$GETDATA(DFN,"116^117^118",130)
	S OCXNMSG=""
	;
	Q:$G(OCXOERR)
	;
	; Send Order Check Message
	;
	S OCXOCMSG($O(OCXOCMSG(999999),-1)+1)=OCXCMSG
	Q
	;
R57R2A	; Verify all Event/Elements of  Rule #57 'CLOZAPINE'  Relation #2 'CLOZAPINE AND (WBC < 3.0 OR ANC < 1.5)'
	;  Called from EL116+6^OCXOZ0H, and EL114+5^OCXOZ0I, and EL119+5^OCXOZ0I.
	;
	Q:$G(OCXOERR)
	;
	;      Local Extrinsic Functions
	; MCE114( ---------->  Verify Event/Element: 'CLOZAPINE ANC < 1.5'
	; MCE116( ---------->  Verify Event/Element: 'CLOZAPINE DRUG SELECTED'
	; MCE119( ---------->  Verify Event/Element: 'CLOZAPINE WBC < 3.0'
	;
	Q:$G(^OCXS(860.2,57,"INACT"))
	;
	I $$MCE116 D 
	.I $$MCE119 D R57R2B
	.I $$MCE114 D R57R2B
	Q
	;
R57R2B	; Send Order Check, Notication messages and/or Execute code for  Rule #57 'CLOZAPINE'  Relation #2 'CLOZAPINE AND (WBC < 3.0 OR ANC < 1.5)'
	;  Called from R57R2A+13.
	;
	Q:$G(OCXOERR)
	;
	;      Local Extrinsic Functions
	; GETDATA( ---------> GET DATA FROM THE ACTIVE DATA FILE
	;
	Q:$D(OCXRULE("R57R2B"))
	;
	N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
	I ($G(OCXOSRC)="CPRS ORDER PRESCAN") S OCXCMSG=(+OCXPSD)_"^19^^WBC < 3.0 and/or ANC < 1.5 - pharmacy cannot fill clozapine order. Most recent results - "_$$GETDATA(DFN,"114^116^119",130) I 1
	E  S OCXCMSG="WBC < 3.0 and/or ANC < 1.5 - pharmacy cannot fill clozapine order. Most recent results - "_$$GETDATA(DFN,"114^116^119",130)
	S OCXNMSG=""
	;
	Q:$G(OCXOERR)
	;
	; Send Order Check Message
	;
	S OCXOCMSG($O(OCXOCMSG(999999),-1)+1)=OCXCMSG
	Q
	;
R57R3A	; Verify all Event/Elements of  Rule #57 'CLOZAPINE'  Relation #3 'CLOZAPINE AND 3.0 <= WBC < 3.5 AND ANC >= 1.5'
	;  Called from EL116+7^OCXOZ0H, and EL115+5^OCXOZ0I, and EL120+5^OCXOZ0I.
	;
	Q:$G(OCXOERR)
	;
	;      Local Extrinsic Functions
	; MCE115( ---------->  Verify Event/Element: 'CLOZAPINE ANC >= 1.5'
	; MCE116( ---------->  Verify Event/Element: 'CLOZAPINE DRUG SELECTED'
	; MCE120( ---------->  Verify Event/Element: 'CLOZAPINE WBC >= 3.0 & < 3.5'
	;
	Q:$G(^OCXS(860.2,57,"INACT"))
	;
	I $$MCE116 D 
	.I $$MCE120 D 
	..I $$MCE115 D R57R3B
	Q
	;
R57R3B	; Send Order Check, Notication messages and/or Execute code for  Rule #57 'CLOZAPINE'  Relation #3 'CLOZAPINE AND 3.0 <= WBC < 3.5 AND ANC >= 1.5'
	;  Called from R57R3A+14.
	;
	Q:$G(OCXOERR)
	;
	;      Local Extrinsic Functions
	; GETDATA( ---------> GET DATA FROM THE ACTIVE DATA FILE
	;
	Q:$D(OCXRULE("R57R3B"))
	;
	N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
	I ($G(OCXOSRC)="CPRS ORDER PRESCAN") S OCXCMSG=(+OCXPSD)_"^19^^WBC between 3.0 and 3.5 with ANC >= 1.5 - please repeat CBC/Diff including WBC and ANC immediately and twice weekly.  Most recent results - "_$$GETDATA(DFN,"115^116^120",130) I 1
	E  S OCXCMSG="WBC between 3.0 and 3.5 with ANC >= 1.5 - please repeat CBC/Diff including WBC and ANC immediately and twice weekly.  Most recent results - "_$$GETDATA(DFN,"115^116^120",130)
	S OCXNMSG=""
	;
	Q:$G(OCXOERR)
	;
	; Send Order Check Message
	;
	S OCXOCMSG($O(OCXOCMSG(999999),-1)+1)=OCXCMSG
	Q
	;
R57R4A	; Verify all Event/Elements of  Rule #57 'CLOZAPINE'  Relation #4 'CLOZAPINE AND 1.5 <= ANC < 2.0'
	;  Called from EL116+8^OCXOZ0H, and EL140+5^OCXOZ0I.
	;
	Q:$G(OCXOERR)
	;
	;      Local Extrinsic Functions
	; MCE116( ---------->  Verify Event/Element: 'CLOZAPINE DRUG SELECTED'
	; MCE140( ---------->  Verify Event/Element: 'CLOZAPINE ANC >= 1.5 & < 2.0'
	;
	Q:$G(^OCXS(860.2,57,"INACT"))
	;
	I $$MCE116 D 
	.I $$MCE140 D R57R4B^OCXOZ0X
	Q
	;
GETDATA(DFN,OCXL,OCXDFI)	;     This Local Extrinsic Function returns runtime data
	;
	N OCXE,VAL,PC S VAL=""
	F PC=1:1:$L(OCXL,U) S OCXE=$P(OCXL,U,PC) I OCXE S VAL=$G(^TMP("OCXCHK",$J,DFN,OCXE,OCXDFI)) Q:$L(VAL)
	Q VAL
	;
MCE114()	; Verify Event/Element: CLOZAPINE ANC < 1.5
	;
	;  OCXDF(37) -> PATIENT IEN data field
	;
	N OCXRES
	S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXRES(114,37)=OCXDF(37)
	Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),114)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),114))
	Q 0
	;
MCE115()	; Verify Event/Element: CLOZAPINE ANC >= 1.5
	;
	;  OCXDF(37) -> PATIENT IEN data field
	;
	N OCXRES
	S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXRES(115,37)=OCXDF(37)
	Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),115)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),115))
	Q 0
	;
MCE116()	; Verify Event/Element: CLOZAPINE DRUG SELECTED
	;
	;  OCXDF(37) -> PATIENT IEN data field
	;
	N OCXRES
	S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXRES(116,37)=OCXDF(37)
	Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),116)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),116))
	Q 0
	;
MCE117()	; Verify Event/Element: CLOZAPINE NO ANC W/IN 7 DAYS
	;
	;  OCXDF(37) -> PATIENT IEN data field
	;
	N OCXRES
	S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXRES(117,37)=OCXDF(37)
	Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),117)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),117))
	Q 0
	;
MCE118()	; Verify Event/Element: CLOZAPINE NO WBC W/IN 7 DAYS
	;
	;  OCXDF(37) -> PATIENT IEN data field
	;
	N OCXRES
	S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXRES(118,37)=OCXDF(37)
	Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),118)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),118))
	Q 0
	;
MCE119()	; Verify Event/Element: CLOZAPINE WBC < 3.0
	;
	;  OCXDF(37) -> PATIENT IEN data field
	;
	N OCXRES
	S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXRES(119,37)=OCXDF(37)
	Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),119)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),119))
	Q 0
	;
MCE120()	; Verify Event/Element: CLOZAPINE WBC >= 3.0 & < 3.5
	;
	;  OCXDF(37) -> PATIENT IEN data field
	;
	N OCXRES
	S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXRES(120,37)=OCXDF(37)
	Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),120)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),120))
	Q 0
	;
MCE140()	; Verify Event/Element: CLOZAPINE ANC >= 1.5 & < 2.0
	;
	;  OCXDF(37) -> PATIENT IEN data field
	;
	N OCXRES
	S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXRES(140,37)=OCXDF(37)
	Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),140)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),140))
	Q 0
	;
MCE67()	; Verify Event/Element: RECENT BARIUM STUDY ORDERED
	;
	;  OCXDF(37) -> PATIENT IEN data field
	;
	N OCXRES
	S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXRES(67,37)=OCXDF(37)
	Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),67)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),67))
	Q 0
	;
