Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: OCXOZ07

OCXOZ07.m

Go to the documentation of this file.
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"
 ;