OCXOZ03 ;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
;
CHK12 ; Look through the current environment for valid Event/Elements for this patient.
; Called from CHK1+28^OCXOZ02.
;
Q:$G(OCXOERR)
;
; Local CHK12 Variables
; OCXDF(1) ----> Data Field: CONTROL CODE (FREE TEXT)
; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
; OCXDF(105) --> Data Field: ORDER TEXT (51 CHARS) (FREE TEXT)
; OCXDF(146) --> Data Field: INPT/OUTPT (FREE TEXT)
; OCXDF(147) --> Data Field: PATIENT LOCATION (FREE TEXT)
; OCXDF(148) --> Data Field: FOOD-DRUG INTERACTION MED (BOOLEAN)
;
; Local Extrinsic Functions
; FILE(DFN,126, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 DCED OERR ORDER)
; FILE(DFN,142, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 PHARMACY DCED ORDER)
; FILE(DFN,20, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 LAB ORDER CANCELLED)
; FILE(DFN,30, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: RADIOLOGY ORDER PUT ON-HOLD)
; FILE(DFN,31, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: RADIOLOGY ORDER CANCELLED)
; FILE(DFN,32, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: RADIOLOGY ORDER DISCONTINUED)
; FILE(DFN,40, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 LAB REQUEST CANCELLED)
; FILE(DFN,6, ------> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 NEW OERR ORDER)
; FOODDRG( ---------> FOOD-DRUG INTERACTION MED
; LIST( ------------> IN LIST OPERATOR
; PATLOC( ----------> PATIENT LOCATION
;
I $$LIST(OCXDF(1),"NW,SN,XR"),$L(OCXDF(37)) S OCXDF(147)=$P($$PATLOC(OCXDF(37)),"^",2),OCXOERR=$$FILE(DFN,6,"147") Q:OCXOERR
I (OCXDF(1)="OC"),$L(OCXDF(2)),($E(OCXDF(2),1,2)="LR"),$L(OCXDF(34)) S OCXDF(105)=$P($$TEXT^ORKOR(OCXDF(34),51),"^",2),OCXOERR=$$FILE(DFN,20,"105") Q:OCXOERR
I (OCXDF(1)="OH"),$L(OCXDF(2)),(OCXDF(2)="RA"),$L(OCXDF(34)) S OCXDF(105)=$P($$TEXT^ORKOR(OCXDF(34),51),"^",2),OCXOERR=$$FILE(DFN,30,"105") Q:OCXOERR
I (OCXDF(1)="OD"),$L(OCXDF(2)),(OCXDF(2)="RA"),$L(OCXDF(34)) S OCXDF(105)=$P($$TEXT^ORKOR(OCXDF(34),51),"^",2),OCXOERR=$$FILE(DFN,31,"105") Q:OCXOERR
I (OCXDF(1)="DC"),$L(OCXDF(2)),(OCXDF(2)="RA"),$L(OCXDF(34)) S OCXDF(105)=$P($$TEXT^ORKOR(OCXDF(34),51),"^",2),OCXOERR=$$FILE(DFN,32,"105") Q:OCXOERR
I (OCXDF(1)="CA"),$L(OCXDF(2)),($E(OCXDF(2),1,2)="LR"),$L(OCXDF(34)) S OCXDF(105)=$P($$TEXT^ORKOR(OCXDF(34),51),"^",2),OCXOERR=$$FILE(DFN,40,"105") Q:OCXOERR
I $$LIST(OCXDF(1),"NW,SN,XO"),$L(OCXDF(37)) S OCXDF(146)=$P($$PATLOC(OCXDF(37)),"^",1) I $L(OCXDF(146)),$L(OCXDF(34)) D CHK131^OCXOZ07
I $$LIST(OCXDF(1),"NW,SN"),$L(OCXDF(34)) S OCXDF(148)=$P($$FOODDRG(OCXDF(34)),"^",1) I $L(OCXDF(148)),(OCXDF(148)),$L(OCXDF(37)) D CHK269^OCXOZ0B
I $$LIST(OCXDF(1),"DC,CA,OD,OC"),$L(OCXDF(37)) S OCXDF(147)=$P($$PATLOC(OCXDF(37)),"^",2),OCXOERR=$$FILE(DFN,126,"147") Q:OCXOERR
I $$LIST(OCXDF(1),"OC,OD"),$L(OCXDF(2)),(OCXDF(2)="PS") S OCXOERR=$$FILE(DFN,142,"") Q:OCXOERR
Q
;
CHK23 ; Look through the current environment for valid Event/Elements for this patient.
; Called from UPDATE+11^OCXOZ01.
;
Q:$G(OCXOERR)
;
; Local CHK23 Variables
; OCXDF(25) ---> Data Field: PATIENT MOVEMENT TYPE CURRENT (FREE TEXT)
; OCXDF(92) ---> Data Field: PATIENT MOVEMENT WARD IEN CURRENT (NUMERIC)
; OCXDF(93) ---> Data Field: PATIENT MOVEMENT WARD IEN PREVIOUS (NUMERIC)
; OCXDF(94) ---> Data Field: PATIENT MOVEMENT SERVICE PREVIOUS (FREE TEXT)
;
; Local Extrinsic Functions
; POINTER( ---------> RETURN POINTED TO VALUE
; WARDSERV( --------> GET WARD SERVICE
;
S OCXDF(25)=$$POINTER(405.3,$P($G(DGPMA),"^",2)) I $L(OCXDF(25)) D CHK25^OCXOZ04
S OCXDF(93)=$P($G(DGPM0),"^",6) I $L(OCXDF(93)) S OCXDF(94)=$$WARDSERV(OCXDF(93)) I $L(OCXDF(94)),(OCXDF(94)="PSYCHIATRY") S OCXDF(92)=$P($G(DGPMA),"^",6) D CHK87^OCXOZ05
Q
;
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
;
FOODDRG(OCXOR) ;func rtns 1^<med name> if OCXOR is food-drug med
N OCXTL,OCXT,OCXFD,OCXOI
S OCXOI=$$OI(OCXOR)
Q:'$L(OCXOI) "0^"
Q:'$$TERMLKUP("FOOD-DRUG INTERACTION MED",.OCXTL) "0^"
S OCXFD="",OCXT=0 F S OCXT=$O(OCXTL(OCXT)) Q:'OCXT D Q:$L(OCXFD)
.I OCXT=OCXOI S OCXFD="1^"_OCXTL(OCXT)
Q:'$L(OCXFD) "0^"
Q OCXFD
;
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)
;
OI(OCXOR) ;func rtns orderable item for an order number (OCXOR)
Q:+$G(OCXOR)<1 ""
N OCXOI S OCXOI=""
S OCXOI=+$G(^OR(100,+$G(OCXOR),.1,1,0))
Q OCXOI
;
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"
;
POINTER(OCXFILE,D0) ; This Local Extrinsic Function gets the value of the name field
; of record D0 in file OCXFILE
Q:'$G(D0) "" Q:'$L($G(OCXFILE)) ""
N GLREF
I '(OCXFILE=(+OCXFILE)) S GLREF=U_OCXFILE
E S GLREF=$$FILE^OCXBDTD(+OCXFILE,"GLOBAL NAME") Q:'$L(GLREF) ""
Q $P($G(@(GLREF_(+D0)_",0)")),U,1)
;
TERMLKUP(OCXTERM,OCXLIST) ;
Q $$TERM^OCXOZ01(OCXTERM,.OCXLIST)
;
WARDSERV(WARD) ; Compiler Function: GET WARD SERVICE
;
N CODESET,PC,SERV,DIC,X,Y,DA
S CODESET="M:MEDICINE;S:SURGERY;P:PSYCHIATRY;NH:NHCU;NE:NEUROLOGY;I:INTERMEDIATE MED;R:REHAB MEDICINE;SCI:SPINAL CORD INJURY;D:DOMICILIARY;B:BLIND REHAB;NC:NON-COUNT"
S DIC=42,DIC(0)="NZ",X="`"_(+WARD) D ^DIC Q:(Y<1) ""
S SERV=$P($G(Y(0)),U,3)
Q:'$L(SERV) "" Q:'$L(CODESET) ""
F PC=1:1:$L(CODESET,";"),0 I PC,($P($P(CODESET,";",PC),":",1)=SERV) Q
Q:'PC "" Q $P($P(CODESET,";",PC),":",2)
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HOCXOZ03 7010 printed Dec 13, 2024@02:25:50 Page 2
OCXOZ03 ;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 ;
CHK12 ; Look through the current environment for valid Event/Elements for this patient.
+1 ; Called from CHK1+28^OCXOZ02.
+2 ;
+3 if $GET(OCXOERR)
QUIT
+4 ;
+5 ; Local CHK12 Variables
+6 ; OCXDF(1) ----> Data Field: CONTROL CODE (FREE TEXT)
+7 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
+8 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
+9 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
+10 ; OCXDF(105) --> Data Field: ORDER TEXT (51 CHARS) (FREE TEXT)
+11 ; OCXDF(146) --> Data Field: INPT/OUTPT (FREE TEXT)
+12 ; OCXDF(147) --> Data Field: PATIENT LOCATION (FREE TEXT)
+13 ; OCXDF(148) --> Data Field: FOOD-DRUG INTERACTION MED (BOOLEAN)
+14 ;
+15 ; Local Extrinsic Functions
+16 ; FILE(DFN,126, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 DCED OERR ORDER)
+17 ; FILE(DFN,142, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 PHARMACY DCED ORDER)
+18 ; FILE(DFN,20, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 LAB ORDER CANCELLED)
+19 ; FILE(DFN,30, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: RADIOLOGY ORDER PUT ON-HOLD)
+20 ; FILE(DFN,31, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: RADIOLOGY ORDER CANCELLED)
+21 ; FILE(DFN,32, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: RADIOLOGY ORDER DISCONTINUED)
+22 ; FILE(DFN,40, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 LAB REQUEST CANCELLED)
+23 ; FILE(DFN,6, ------> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 NEW OERR ORDER)
+24 ; FOODDRG( ---------> FOOD-DRUG INTERACTION MED
+25 ; LIST( ------------> IN LIST OPERATOR
+26 ; PATLOC( ----------> PATIENT LOCATION
+27 ;
+28 IF $$LIST(OCXDF(1),"NW,SN,XR")
IF $LENGTH(OCXDF(37))
SET OCXDF(147)=$PIECE($$PATLOC(OCXDF(37)),"^",2)
SET OCXOERR=$$FILE(DFN,6,"147")
if OCXOERR
QUIT
+29 IF (OCXDF(1)="OC")
IF $LENGTH(OCXDF(2))
IF ($EXTRACT(OCXDF(2),1,2)="LR")
IF $LENGTH(OCXDF(34))
SET OCXDF(105)=$PIECE($$TEXT^ORKOR(OCXDF(34),51),"^",2)
SET OCXOERR=$$FILE(DFN,20,"105")
if OCXOERR
QUIT
+30 IF (OCXDF(1)="OH")
IF $LENGTH(OCXDF(2))
IF (OCXDF(2)="RA")
IF $LENGTH(OCXDF(34))
SET OCXDF(105)=$PIECE($$TEXT^ORKOR(OCXDF(34),51),"^",2)
SET OCXOERR=$$FILE(DFN,30,"105")
if OCXOERR
QUIT
+31 IF (OCXDF(1)="OD")
IF $LENGTH(OCXDF(2))
IF (OCXDF(2)="RA")
IF $LENGTH(OCXDF(34))
SET OCXDF(105)=$PIECE($$TEXT^ORKOR(OCXDF(34),51),"^",2)
SET OCXOERR=$$FILE(DFN,31,"105")
if OCXOERR
QUIT
+32 IF (OCXDF(1)="DC")
IF $LENGTH(OCXDF(2))
IF (OCXDF(2)="RA")
IF $LENGTH(OCXDF(34))
SET OCXDF(105)=$PIECE($$TEXT^ORKOR(OCXDF(34),51),"^",2)
SET OCXOERR=$$FILE(DFN,32,"105")
if OCXOERR
QUIT
+33 IF (OCXDF(1)="CA")
IF $LENGTH(OCXDF(2))
IF ($EXTRACT(OCXDF(2),1,2)="LR")
IF $LENGTH(OCXDF(34))
SET OCXDF(105)=$PIECE($$TEXT^ORKOR(OCXDF(34),51),"^",2)
SET OCXOERR=$$FILE(DFN,40,"105")
if OCXOERR
QUIT
+34 IF $$LIST(OCXDF(1),"NW,SN,XO")
IF $LENGTH(OCXDF(37))
SET OCXDF(146)=$PIECE($$PATLOC(OCXDF(37)),"^",1)
IF $LENGTH(OCXDF(146))
IF $LENGTH(OCXDF(34))
DO CHK131^OCXOZ07
+35 IF $$LIST(OCXDF(1),"NW,SN")
IF $LENGTH(OCXDF(34))
SET OCXDF(148)=$PIECE($$FOODDRG(OCXDF(34)),"^",1)
IF $LENGTH(OCXDF(148))
IF (OCXDF(148))
IF $LENGTH(OCXDF(37))
DO CHK269^OCXOZ0B
+36 IF $$LIST(OCXDF(1),"DC,CA,OD,OC")
IF $LENGTH(OCXDF(37))
SET OCXDF(147)=$PIECE($$PATLOC(OCXDF(37)),"^",2)
SET OCXOERR=$$FILE(DFN,126,"147")
if OCXOERR
QUIT
+37 IF $$LIST(OCXDF(1),"OC,OD")
IF $LENGTH(OCXDF(2))
IF (OCXDF(2)="PS")
SET OCXOERR=$$FILE(DFN,142,"")
if OCXOERR
QUIT
+38 QUIT
+39 ;
CHK23 ; Look through the current environment for valid Event/Elements for this patient.
+1 ; Called from UPDATE+11^OCXOZ01.
+2 ;
+3 if $GET(OCXOERR)
QUIT
+4 ;
+5 ; Local CHK23 Variables
+6 ; OCXDF(25) ---> Data Field: PATIENT MOVEMENT TYPE CURRENT (FREE TEXT)
+7 ; OCXDF(92) ---> Data Field: PATIENT MOVEMENT WARD IEN CURRENT (NUMERIC)
+8 ; OCXDF(93) ---> Data Field: PATIENT MOVEMENT WARD IEN PREVIOUS (NUMERIC)
+9 ; OCXDF(94) ---> Data Field: PATIENT MOVEMENT SERVICE PREVIOUS (FREE TEXT)
+10 ;
+11 ; Local Extrinsic Functions
+12 ; POINTER( ---------> RETURN POINTED TO VALUE
+13 ; WARDSERV( --------> GET WARD SERVICE
+14 ;
+15 SET OCXDF(25)=$$POINTER(405.3,$PIECE($GET(DGPMA),"^",2))
IF $LENGTH(OCXDF(25))
DO CHK25^OCXOZ04
+16 SET OCXDF(93)=$PIECE($GET(DGPM0),"^",6)
IF $LENGTH(OCXDF(93))
SET OCXDF(94)=$$WARDSERV(OCXDF(93))
IF $LENGTH(OCXDF(94))
IF (OCXDF(94)="PSYCHIATRY")
SET OCXDF(92)=$PIECE($GET(DGPMA),"^",6)
DO CHK87^OCXOZ05
+17 QUIT
+18 ;
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 ;
FOODDRG(OCXOR) ;func rtns 1^<med name> if OCXOR is food-drug med
+1 NEW OCXTL,OCXT,OCXFD,OCXOI
+2 SET OCXOI=$$OI(OCXOR)
+3 if '$LENGTH(OCXOI)
QUIT "0^"
+4 if '$$TERMLKUP("FOOD-DRUG INTERACTION MED",.OCXTL)
QUIT "0^"
+5 SET OCXFD=""
SET OCXT=0
FOR
SET OCXT=$ORDER(OCXTL(OCXT))
if 'OCXT
QUIT
Begin DoDot:1
+6 IF OCXT=OCXOI
SET OCXFD="1^"_OCXTL(OCXT)
End DoDot:1
if $LENGTH(OCXFD)
QUIT
+7 if '$LENGTH(OCXFD)
QUIT "0^"
+8 QUIT OCXFD
+9 ;
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 ;
OI(OCXOR) ;func rtns orderable item for an order number (OCXOR)
+1 if +$GET(OCXOR)<1
QUIT ""
+2 NEW OCXOI
SET OCXOI=""
+3 SET OCXOI=+$GET(^OR(100,+$GET(OCXOR),.1,1,0))
+4 QUIT OCXOI
+5 ;
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 ;
POINTER(OCXFILE,D0) ; This Local Extrinsic Function gets the value of the name field
+1 ; of record D0 in file OCXFILE
+2 if '$GET(D0)
QUIT ""
if '$LENGTH($GET(OCXFILE))
QUIT ""
+3 NEW GLREF
+4 IF '(OCXFILE=(+OCXFILE))
SET GLREF=U_OCXFILE
+5 IF '$TEST
SET GLREF=$$FILE^OCXBDTD(+OCXFILE,"GLOBAL NAME")
if '$LENGTH(GLREF)
QUIT ""
+6 QUIT $PIECE($GET(@(GLREF_(+D0)_",0)")),U,1)
+7 ;
TERMLKUP(OCXTERM,OCXLIST) ;
+1 QUIT $$TERM^OCXOZ01(OCXTERM,.OCXLIST)
+2 ;
WARDSERV(WARD) ; Compiler Function: GET WARD SERVICE
+1 ;
+2 NEW CODESET,PC,SERV,DIC,X,Y,DA
+3 SET CODESET="M:MEDICINE;S:SURGERY;P:PSYCHIATRY;NH:NHCU;NE:NEUROLOGY;I:INTERMEDIATE MED;R:REHAB MEDICINE;SCI:SPINAL CORD INJURY;D:DOMICILIARY;B:BLIND REHAB;NC:NON-COUNT"
+4 SET DIC=42
SET DIC(0)="NZ"
SET X="`"_(+WARD)
DO ^DIC
if (Y<1)
QUIT ""
+5 SET SERV=$PIECE($GET(Y(0)),U,3)
+6 if '$LENGTH(SERV)
QUIT ""
if '$LENGTH(CODESET)
QUIT ""
+7 FOR PC=1:1:$LENGTH(CODESET,";"),0
IF PC
IF ($PIECE($PIECE(CODESET,";",PC),":",1)=SERV)
QUIT
+8 if 'PC
QUIT ""
QUIT $PIECE($PIECE(CODESET,";",PC),":",2)
+9 ;