OCXOZ06 ;SLC/RJS,CLA - Order Check Scan ;JUL 1,2021 at 11:27
;;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
;
CHK95 ; Look through the current environment for valid Event/Elements for this patient.
; Called from UPDATE+13^OCXOZ01.
;
Q:$G(OCXOERR)
;
; Local CHK95 Variables
; OCXDF(27) ---> Data Field: ORDER FLAGGED FOR CLARIFICATION (BOOLEAN)
; OCXDF(28) ---> Data Field: ORDER REQ. CHART SIGN. (BOOLEAN)
; OCXDF(29) ---> Data Field: SERV. ORDER REQ CHART SIG. (BOOLEAN)
; OCXDF(30) ---> Data Field: ORDER REQ. CO-SIG. (BOOLEAN)
; OCXDF(31) ---> Data Field: ORDER REQ. ELEC. SIG. (BOOLEAN)
;
; Local Extrinsic Functions
; FILE(DFN,45, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER REQUIRES CHART SIGNATURE)
; FILE(DFN,46, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: SERVICE ORDER REQUIRES CHART SIGNATURE)
; FILE(DFN,47, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER REQUIRES CO-SIGNATURE)
; FILE(DFN,48, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER REQUIRES ELECTRONIC SIGNATURE)
;
S OCXDF(27)=$P($G(OCXORD),"^",4) I $L(OCXDF(27)) D CHK97
S OCXDF(28)=$P($G(OCXORD),"^",5) I $L(OCXDF(28)),(OCXDF(28)) S OCXOERR=$$FILE(DFN,45,"") Q:OCXOERR
S OCXDF(29)=$P($G(OCXORD),"^",6) I $L(OCXDF(29)),(OCXDF(29)) S OCXOERR=$$FILE(DFN,46,"") Q:OCXOERR
S OCXDF(30)=$P($G(OCXORD),"^",7) I $L(OCXDF(30)),(OCXDF(30)) S OCXOERR=$$FILE(DFN,47,"") Q:OCXOERR
S OCXDF(31)=$P($G(OCXORD),"^",8) I $L(OCXDF(31)),(OCXDF(31)) S OCXOERR=$$FILE(DFN,48,"") Q:OCXOERR
Q
;
CHK97 ; Look through the current environment for valid Event/Elements for this patient.
; Called from CHK95+18.
;
Q:$G(OCXOERR)
;
; Local CHK97 Variables
; OCXDF(27) ---> Data Field: ORDER FLAGGED FOR CLARIFICATION (BOOLEAN)
; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
; OCXDF(115) --> Data Field: CURRENT DATE/TIME (FREE TEXT)
;
; Local Extrinsic Functions
; DT2INT( ----------> CONVERT DATE FROM FILEMAN FORMAT TO OCX FORMAT
; FILE(DFN,134, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER UNFLAGGED)
; FILE(DFN,44, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER FLAGGED)
; INT2DT( ----------> CONVERT DATE FROM OCX FORMAT TO READABLE FORMAT
;
I (OCXDF(27)) S OCXDF(37)=$P($G(OCXORD),"^",1),OCXDF(115)=$$INT2DT($$DT2INT("N"),0),OCXOERR=$$FILE(DFN,44,"37,115") Q:OCXOERR
I '(OCXDF(27)) S OCXDF(37)=$P($G(OCXORD),"^",1),OCXDF(115)=$$INT2DT($$DT2INT("N"),0),OCXOERR=$$FILE(DFN,134,"37,115") Q:OCXOERR
Q
;
CHK113 ; Look through the current environment for valid Event/Elements for this patient.
; Called from CHK1+32^OCXOZ02.
;
Q:$G(OCXOERR)
;
; Local CHK113 Variables
; OCXDF(32) ---> Data Field: ORDER FLAGGED FOR RESULTS (BOOLEAN)
; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
; OCXDF(105) --> Data Field: ORDER TEXT (51 CHARS) (FREE TEXT)
; OCXDF(112) --> Data Field: ORDERED BY (FREE TEXT)
; OCXDF(149) --> Data Field: ORDER CANCELED BY (FREE TEXT)
;
; Local Extrinsic Functions
; CANCELER( --------> ORDER CANCELING PROVIDER
; FILE(DFN,49, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER FLAGGED FOR RESULTS)
; ORDERER( ---------> ORDERING PROVIDER
; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
;
S OCXDF(32)=$$RSLTFLG^ORQOR2(OCXDF(34)) I $L(OCXDF(32)),(OCXDF(32)) S OCXDF(96)=$$ORDITEM(OCXDF(34)),OCXOERR=$$FILE(DFN,49,"96") Q:OCXOERR
S OCXDF(112)=$$ORDERER(OCXDF(34)),OCXDF(149)=$$CANCELER(OCXDF(34)) I '(OCXDF(112)=OCXDF(149)) S OCXDF(105)=$P($$TEXT^ORKOR(OCXDF(34),51),"^",2) D CHK292^OCXOZ0B
Q
;
CANCELER(ORNUM) ; Compiler Function: ORDER CANCELING PROVIDER
;
Q:'$G(ORNUM) ""
S ORNUM=+$G(ORNUM)
N ORQDUZ
Q:'$D(^OR(100,ORNUM,6)) ""
S ORQDUZ=$P(^OR(100,ORNUM,6),U,2)
Q ORQDUZ
;
DT2INT(OCXDT) ; This Local Extrinsic Function converts a date into an integer
; By taking the Years, Months, Days, Hours and Minutes converting
; Them into Seconds and then adding them all together into one big integer
;
Q:'$L($G(OCXDT)) ""
N OCXDIFF,OCXVAL S (OCXDIFF,OCXVAL)=0
;
I $L(OCXDT),'OCXDT,(OCXDT[" at ") D ; EXTERNAL EXPERT SYSTEM FORMAT 1 TO EXTERNAL FORMAT
.N OCXHR,OCXMIN,OCXTIME
.S OCXTIME=$P($P(OCXDT," at ",2),".",1),OCXHR=$P(OCXTIME,":",1),OCXMIN=$P(OCXTIME,":",2)
.S:(OCXDT["Midnight") OCXHR=00
.S:(OCXDT["PM") OCXHR=OCXHR+12
.S OCXDT=$P(OCXDT," at ")_"@"_$E(OCXHR+100,2,3)_$E(OCXMIN+100,2,3)
;
I $L(OCXDT),(OCXDT?1.2N1"/"1.2N.1" ".2N.1":".2N) D ; EXTERNAL EXPERT SYSTEM FORMAT 2 TO EXTERNAL FORMAT
.N OCXMON
.S OCXMON=$P("January^February^March^April^May^June^July^August^September^October^November^December",U,$P(OCXDT,"/",1))
.I $L($P(OCXDT," ",2)) S OCXDT=OCXMON_" "_$P($P(OCXDT," ",1),"/",2)_"@"_$TR($P(OCXDT," ",2),":","")
.E S OCXDT=OCXMON_" "_$P($P(OCXDT," ",1),"/",2)
;
I $L(OCXDT),(OCXDT?1.2N1"/"1.2N1"/"1.2N.1" ".2N.1":".2N) D ; EXTERNAL EXPERT SYSTEM FORMAT 3 TO EXTERNAL FORMAT
.N OCXMON
.S OCXMON=$P("January^February^March^April^May^June^July^August^September^October^November^December",U,$P(OCXDT,"/",1))
.I $L($P(OCXDT," ",2)) S OCXDT=OCXMON_" "_$P($P(OCXDT," ",1),"/",2)_","_$P($P(OCXDT," ",1),"/",3)_"@"_$TR($P(OCXDT," ",2),":","")
.E S OCXDT=OCXMON_" "_$P($P(OCXDT," ",1),"/",2)_", "_$P($P(OCXDT," ",1),"/",3)
;
I $L(OCXDT),'OCXDT D ; EXTERNAL FORMAT TO INTERNAL FILEMAN FORMAT
.I (OCXDT["@0000") S OCXDT=$P(OCXDT,"@",1),OCXDIFF=1
.N %DT,X,Y S X=OCXDT,%DT="" S:(OCXDT["@")!(OCXDT="N") %DT="T" D ^%DT S OCXDT=+Y
;
I ($L(OCXDT\1)>7) S OCXDT=$$HL7TFM^XLFDT(OCXDT) ; HL7 FORMAT TO INTERNAL FILEMAN FORMAT
;
I ($L(OCXDT\1)=7) S OCXDT=$$FMTH^XLFDT(+OCXDT) ; INTERNAL FILEMAN FORMAT TO $H FORMAT
;
I (OCXDT?5N1","1.5N) S OCXVAL=(OCXDT*86400)+$P(OCXDT,",",2) ; $H FORMAT TO EXPERT SYSTEM INTERNAL FORMAT
;
Q OCXVAL
;
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
;
INT2DT(OCXDT,OCXF) ; This Local Extrinsic Function converts an OCX internal format
; date into an Externl Format (Human Readable) date. 'OCXF=SHORT FORMAT OCXF=LONG FORMAT
;
Q:'$L($G(OCXDT)) "" S OCXF=+$G(OCXF)
N OCXYR,OCXLPYR,OCXMON,OCXDAY,OCXHR,OCXMIN,OCXSEC,OCXCYR
S (OCXYR,OCXLPYR,OCXMON,OCXDAY,OCXHR,OCXMIN,OCXSEC,OCXAP)=""
S OCXSEC=$E(OCXDT#60+100,2,3),OCXDT=OCXDT\60
S OCXMIN=$E(OCXDT#60+100,2,3),OCXDT=OCXDT\60
S OCXHR=$E(OCXDT#24+100,2,3),OCXDT=OCXDT\24
S OCXCYR=($H\1461)*4+1841+(($H#1461)\365)
S OCXYR=(OCXDT\1461)*4+1841,OCXDT=OCXDT#1461
S OCXLPYR=(OCXDT\365),OCXDT=OCXDT-(OCXLPYR*365),OCXYR=OCXYR+OCXLPYR
S OCXCNT="031^059^090^120^151^181^212^243^273^304^334^365"
S:(OCXLPYR=3) OCXCNT="031^060^091^121^152^182^213^244^274^305^335^366"
F OCXMON=1:1:12 Q:(OCXDT<$P(OCXCNT,U,OCXMON))
S OCXDAY=OCXDT-$P(OCXCNT,U,OCXMON-1)+1
I OCXF S OCXMON=$P("January^February^March^April^May^June^July^August^September^October^November^December",U,OCXMON)
E S OCXMON=$E(OCXMON+100,2,3)
S OCXAP=$S('OCXHR:"Midnight",(OCXHR=12):"Noon",(OCXHR<12):"AM",1:"PM")
I OCXF S OCXHR=OCXHR#12 S:'OCXHR OCXHR=12
Q:'OCXF $E(OCXMON+100,2,3)_"/"_$E(OCXDAY+100,2,3)_$S((OCXCYR=OCXYR):" "_OCXHR_":"_OCXMIN,1:"/"_$E(OCXYR,3,4))
Q:(OCXHR+OCXMIN+OCXSEC) OCXMON_" "_OCXDAY_","_OCXYR_" at "_OCXHR_":"_OCXMIN_"."_OCXSEC_" "_OCXAP
Q OCXMON_" "_OCXDAY_","_OCXYR
;
ORDERER(ORNUM) ; Compiler Function: ORDERING PROVIDER
;
Q:'$G(ORNUM) ""
S ORNUM=+$G(ORNUM)
N ORQDUZ,ORQI S ORQDUZ=""
I $L($G(^OR(100,ORNUM,8,0))) D
.S ORQI=0,ORQI=$O(^OR(100,ORNUM,8,"C","NW",ORQI))
Q:+$G(ORQI)<1 ""
S ORQDUZ=$P(^OR(100,ORNUM,8,ORQI,0),U,3)
Q ORQDUZ
;
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)
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HOCXOZ06 8831 printed Oct 16, 2024@18:26:29 Page 2
OCXOZ06 ;SLC/RJS,CLA - Order Check Scan ;JUL 1,2021 at 11:27
+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 ;
CHK95 ; Look through the current environment for valid Event/Elements for this patient.
+1 ; Called from UPDATE+13^OCXOZ01.
+2 ;
+3 if $GET(OCXOERR)
QUIT
+4 ;
+5 ; Local CHK95 Variables
+6 ; OCXDF(27) ---> Data Field: ORDER FLAGGED FOR CLARIFICATION (BOOLEAN)
+7 ; OCXDF(28) ---> Data Field: ORDER REQ. CHART SIGN. (BOOLEAN)
+8 ; OCXDF(29) ---> Data Field: SERV. ORDER REQ CHART SIG. (BOOLEAN)
+9 ; OCXDF(30) ---> Data Field: ORDER REQ. CO-SIG. (BOOLEAN)
+10 ; OCXDF(31) ---> Data Field: ORDER REQ. ELEC. SIG. (BOOLEAN)
+11 ;
+12 ; Local Extrinsic Functions
+13 ; FILE(DFN,45, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER REQUIRES CHART SIGNATURE)
+14 ; FILE(DFN,46, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: SERVICE ORDER REQUIRES CHART SIGNATURE)
+15 ; FILE(DFN,47, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER REQUIRES CO-SIGNATURE)
+16 ; FILE(DFN,48, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER REQUIRES ELECTRONIC SIGNATURE)
+17 ;
+18 SET OCXDF(27)=$PIECE($GET(OCXORD),"^",4)
IF $LENGTH(OCXDF(27))
DO CHK97
+19 SET OCXDF(28)=$PIECE($GET(OCXORD),"^",5)
IF $LENGTH(OCXDF(28))
IF (OCXDF(28))
SET OCXOERR=$$FILE(DFN,45,"")
if OCXOERR
QUIT
+20 SET OCXDF(29)=$PIECE($GET(OCXORD),"^",6)
IF $LENGTH(OCXDF(29))
IF (OCXDF(29))
SET OCXOERR=$$FILE(DFN,46,"")
if OCXOERR
QUIT
+21 SET OCXDF(30)=$PIECE($GET(OCXORD),"^",7)
IF $LENGTH(OCXDF(30))
IF (OCXDF(30))
SET OCXOERR=$$FILE(DFN,47,"")
if OCXOERR
QUIT
+22 SET OCXDF(31)=$PIECE($GET(OCXORD),"^",8)
IF $LENGTH(OCXDF(31))
IF (OCXDF(31))
SET OCXOERR=$$FILE(DFN,48,"")
if OCXOERR
QUIT
+23 QUIT
+24 ;
CHK97 ; Look through the current environment for valid Event/Elements for this patient.
+1 ; Called from CHK95+18.
+2 ;
+3 if $GET(OCXOERR)
QUIT
+4 ;
+5 ; Local CHK97 Variables
+6 ; OCXDF(27) ---> Data Field: ORDER FLAGGED FOR CLARIFICATION (BOOLEAN)
+7 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
+8 ; OCXDF(115) --> Data Field: CURRENT DATE/TIME (FREE TEXT)
+9 ;
+10 ; Local Extrinsic Functions
+11 ; DT2INT( ----------> CONVERT DATE FROM FILEMAN FORMAT TO OCX FORMAT
+12 ; FILE(DFN,134, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER UNFLAGGED)
+13 ; FILE(DFN,44, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER FLAGGED)
+14 ; INT2DT( ----------> CONVERT DATE FROM OCX FORMAT TO READABLE FORMAT
+15 ;
+16 IF (OCXDF(27))
SET OCXDF(37)=$PIECE($GET(OCXORD),"^",1)
SET OCXDF(115)=$$INT2DT($$DT2INT("N"),0)
SET OCXOERR=$$FILE(DFN,44,"37,115")
if OCXOERR
QUIT
+17 IF '(OCXDF(27))
SET OCXDF(37)=$PIECE($GET(OCXORD),"^",1)
SET OCXDF(115)=$$INT2DT($$DT2INT("N"),0)
SET OCXOERR=$$FILE(DFN,134,"37,115")
if OCXOERR
QUIT
+18 QUIT
+19 ;
CHK113 ; Look through the current environment for valid Event/Elements for this patient.
+1 ; Called from CHK1+32^OCXOZ02.
+2 ;
+3 if $GET(OCXOERR)
QUIT
+4 ;
+5 ; Local CHK113 Variables
+6 ; OCXDF(32) ---> Data Field: ORDER FLAGGED FOR RESULTS (BOOLEAN)
+7 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
+8 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
+9 ; OCXDF(105) --> Data Field: ORDER TEXT (51 CHARS) (FREE TEXT)
+10 ; OCXDF(112) --> Data Field: ORDERED BY (FREE TEXT)
+11 ; OCXDF(149) --> Data Field: ORDER CANCELED BY (FREE TEXT)
+12 ;
+13 ; Local Extrinsic Functions
+14 ; CANCELER( --------> ORDER CANCELING PROVIDER
+15 ; FILE(DFN,49, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: ORDER FLAGGED FOR RESULTS)
+16 ; ORDERER( ---------> ORDERING PROVIDER
+17 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
+18 ;
+19 SET OCXDF(32)=$$RSLTFLG^ORQOR2(OCXDF(34))
IF $LENGTH(OCXDF(32))
IF (OCXDF(32))
SET OCXDF(96)=$$ORDITEM(OCXDF(34))
SET OCXOERR=$$FILE(DFN,49,"96")
if OCXOERR
QUIT
+20 SET OCXDF(112)=$$ORDERER(OCXDF(34))
SET OCXDF(149)=$$CANCELER(OCXDF(34))
IF '(OCXDF(112)=OCXDF(149))
SET OCXDF(105)=$PIECE($$TEXT^ORKOR(OCXDF(34),51),"^",2)
DO CHK292^OCXOZ0B
+21 QUIT
+22 ;
CANCELER(ORNUM) ; Compiler Function: ORDER CANCELING PROVIDER
+1 ;
+2 if '$GET(ORNUM)
QUIT ""
+3 SET ORNUM=+$GET(ORNUM)
+4 NEW ORQDUZ
+5 if '$DATA(^OR(100,ORNUM,6))
QUIT ""
+6 SET ORQDUZ=$PIECE(^OR(100,ORNUM,6),U,2)
+7 QUIT ORQDUZ
+8 ;
DT2INT(OCXDT) ; This Local Extrinsic Function converts a date into an integer
+1 ; By taking the Years, Months, Days, Hours and Minutes converting
+2 ; Them into Seconds and then adding them all together into one big integer
+3 ;
+4 if '$LENGTH($GET(OCXDT))
QUIT ""
+5 NEW OCXDIFF,OCXVAL
SET (OCXDIFF,OCXVAL)=0
+6 ;
+7 ; EXTERNAL EXPERT SYSTEM FORMAT 1 TO EXTERNAL FORMAT
IF $LENGTH(OCXDT)
IF 'OCXDT
IF (OCXDT[" at ")
Begin DoDot:1
+8 NEW OCXHR,OCXMIN,OCXTIME
+9 SET OCXTIME=$PIECE($PIECE(OCXDT," at ",2),".",1)
SET OCXHR=$PIECE(OCXTIME,":",1)
SET OCXMIN=$PIECE(OCXTIME,":",2)
+10 if (OCXDT["Midnight")
SET OCXHR=00
+11 if (OCXDT["PM")
SET OCXHR=OCXHR+12
+12 SET OCXDT=$PIECE(OCXDT," at ")_"@"_$EXTRACT(OCXHR+100,2,3)_$EXTRACT(OCXMIN+100,2,3)
End DoDot:1
+13 ;
+14 ; EXTERNAL EXPERT SYSTEM FORMAT 2 TO EXTERNAL FORMAT
IF $LENGTH(OCXDT)
IF (OCXDT?1.2N1"/"1.2N.1" ".2N.1":".2N)
Begin DoDot:1
+15 NEW OCXMON
+16 SET OCXMON=$PIECE("January^February^March^April^May^June^July^August^September^October^November^December",U,$PIECE(OCXDT,"/",1))
+17 IF $LENGTH($PIECE(OCXDT," ",2))
SET OCXDT=OCXMON_" "_$PIECE($PIECE(OCXDT," ",1),"/",2)_"@"_$TRANSLATE($PIECE(OCXDT," ",2),":","")
+18 IF '$TEST
SET OCXDT=OCXMON_" "_$PIECE($PIECE(OCXDT," ",1),"/",2)
End DoDot:1
+19 ;
+20 ; EXTERNAL EXPERT SYSTEM FORMAT 3 TO EXTERNAL FORMAT
IF $LENGTH(OCXDT)
IF (OCXDT?1.2N1"/"1.2N1"/"1.2N.1" ".2N.1":".2N)
Begin DoDot:1
+21 NEW OCXMON
+22 SET OCXMON=$PIECE("January^February^March^April^May^June^July^August^September^October^November^December",U,$PIECE(OCXDT,"/",1))
+23 IF $LENGTH($PIECE(OCXDT," ",2))
SET OCXDT=OCXMON_" "_$PIECE($PIECE(OCXDT," ",1),"/",2)_","_$PIECE($PIECE(OCXDT," ",1),"/",3)_"@"_$TRANSLATE($PIECE(OCXDT," ",2),":","")
+24 IF '$TEST
SET OCXDT=OCXMON_" "_$PIECE($PIECE(OCXDT," ",1),"/",2)_", "_$PIECE($PIECE(OCXDT," ",1),"/",3)
End DoDot:1
+25 ;
+26 ; EXTERNAL FORMAT TO INTERNAL FILEMAN FORMAT
IF $LENGTH(OCXDT)
IF 'OCXDT
Begin DoDot:1
+27 IF (OCXDT["@0000")
SET OCXDT=$PIECE(OCXDT,"@",1)
SET OCXDIFF=1
+28 NEW %DT,X,Y
SET X=OCXDT
SET %DT=""
if (OCXDT["@")!(OCXDT="N")
SET %DT="T"
DO ^%DT
SET OCXDT=+Y
End DoDot:1
+29 ;
+30 ; HL7 FORMAT TO INTERNAL FILEMAN FORMAT
IF ($LENGTH(OCXDT\1)>7)
SET OCXDT=$$HL7TFM^XLFDT(OCXDT)
+31 ;
+32 ; INTERNAL FILEMAN FORMAT TO $H FORMAT
IF ($LENGTH(OCXDT\1)=7)
SET OCXDT=$$FMTH^XLFDT(+OCXDT)
+33 ;
+34 ; $H FORMAT TO EXPERT SYSTEM INTERNAL FORMAT
IF (OCXDT?5N1","1.5N)
SET OCXVAL=(OCXDT*86400)+$PIECE(OCXDT,",",2)
+35 ;
+36 QUIT OCXVAL
+37 ;
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 ;
INT2DT(OCXDT,OCXF) ; This Local Extrinsic Function converts an OCX internal format
+1 ; date into an Externl Format (Human Readable) date. 'OCXF=SHORT FORMAT OCXF=LONG FORMAT
+2 ;
+3 if '$LENGTH($GET(OCXDT))
QUIT ""
SET OCXF=+$GET(OCXF)
+4 NEW OCXYR,OCXLPYR,OCXMON,OCXDAY,OCXHR,OCXMIN,OCXSEC,OCXCYR
+5 SET (OCXYR,OCXLPYR,OCXMON,OCXDAY,OCXHR,OCXMIN,OCXSEC,OCXAP)=""
+6 SET OCXSEC=$EXTRACT(OCXDT#60+100,2,3)
SET OCXDT=OCXDT\60
+7 SET OCXMIN=$EXTRACT(OCXDT#60+100,2,3)
SET OCXDT=OCXDT\60
+8 SET OCXHR=$EXTRACT(OCXDT#24+100,2,3)
SET OCXDT=OCXDT\24
+9 SET OCXCYR=($HOROLOG\1461)*4+1841+(($HOROLOG#1461)\365)
+10 SET OCXYR=(OCXDT\1461)*4+1841
SET OCXDT=OCXDT#1461
+11 SET OCXLPYR=(OCXDT\365)
SET OCXDT=OCXDT-(OCXLPYR*365)
SET OCXYR=OCXYR+OCXLPYR
+12 SET OCXCNT="031^059^090^120^151^181^212^243^273^304^334^365"
+13 if (OCXLPYR=3)
SET OCXCNT="031^060^091^121^152^182^213^244^274^305^335^366"
+14 FOR OCXMON=1:1:12
if (OCXDT<$PIECE(OCXCNT,U,OCXMON))
QUIT
+15 SET OCXDAY=OCXDT-$PIECE(OCXCNT,U,OCXMON-1)+1
+16 IF OCXF
SET OCXMON=$PIECE("January^February^March^April^May^June^July^August^September^October^November^December",U,OCXMON)
+17 IF '$TEST
SET OCXMON=$EXTRACT(OCXMON+100,2,3)
+18 SET OCXAP=$SELECT('OCXHR:"Midnight",(OCXHR=12):"Noon",(OCXHR<12):"AM",1:"PM")
+19 IF OCXF
SET OCXHR=OCXHR#12
if 'OCXHR
SET OCXHR=12
+20 if 'OCXF
QUIT $EXTRACT(OCXMON+100,2,3)_"/"_$EXTRACT(OCXDAY+100,2,3)_$SELECT((OCXCYR=OCXYR):" "_OCXHR_":"_OCXMIN,1:"/"_$EXTRACT(OCXYR,3,4))
+21 if (OCXHR+OCXMIN+OCXSEC)
QUIT OCXMON_" "_OCXDAY_","_OCXYR_" at "_OCXHR_":"_OCXMIN_"."_OCXSEC_" "_OCXAP
+22 QUIT OCXMON_" "_OCXDAY_","_OCXYR
+23 ;
ORDERER(ORNUM) ; Compiler Function: ORDERING PROVIDER
+1 ;
+2 if '$GET(ORNUM)
QUIT ""
+3 SET ORNUM=+$GET(ORNUM)
+4 NEW ORQDUZ,ORQI
SET ORQDUZ=""
+5 IF $LENGTH($GET(^OR(100,ORNUM,8,0)))
Begin DoDot:1
+6 SET ORQI=0
SET ORQI=$ORDER(^OR(100,ORNUM,8,"C","NW",ORQI))
End DoDot:1
+7 if +$GET(ORQI)<1
QUIT ""
+8 SET ORQDUZ=$PIECE(^OR(100,ORNUM,8,ORQI,0),U,3)
+9 QUIT ORQDUZ
+10 ;
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 ;