ORQOAUIB ;EPIP/RTW - LIST ANTI-MICROBIAL ORDER, ANTIMICROBIAL QUICK ORDER & NON-QUICK ORDER ; 12/28/17 2:20pm
;;3.0;ORDER ENTRY/RESULTS REPORTING;**441**;Dec 17, 1997;Build 52
;QUICK ORDER AUDIT MONTHLY REPORT AND QUICK ORDER AUDIT PRINT
;ICR# Type Description
;----- ---- -------------------------------------
;10086 Sup ^%ZIS
;10089 Sup ^%ZISC
;10063 Sup ^%ZTLOAD
;1456 Sup ^DIC
;10103 Sup $$FMDIFF^XLFDT
;10103 Sup $$FMTE^XLFDT
N ORSDATE,OREDATE,ORI,ORJ,ORCDSS,ORDIV,ORMISLOC,ORI1,OR2,Y,X2,ORWHO,%DT,%IS,DIC,ZTIO,ZTRTN,ZTSAVE,ZTSK
K ^TMP($J)
I '$O(^OR(100.953,0)) W !,"No Groups Created in the QUICK ORDER DIVISION GROUPS File" Q
START W ! W !,"Past date ranges can be entered covering 31 days at a time.",!
S %DT="AE",%DT("A")="Enter Starting Date: " D ^%DT Q:+Y'>0 S ORSDATE=+Y
S %DT="AE",%DT("A")="Enter Ending Date: " D ^%DT Q:+Y'>0 S OREDATE=+Y
I OREDATE<ORSDATE W !,"** ERROR ** - Ending Date needs to follow Starting Date",! G START
S ORDIV="" I $O(^OR(100.953,0))>0 S DIC(0)="AEQM",DIC="^OR(100.953,",DIC("A")="Select MEDICAL CENTER DIVISION GROUP: " D ^DIC Q:+Y'>0
S ORDIV=+Y
I $$FMDIFF^XLFDT(OREDATE,ORSDATE,1)>31 W !,"** ERROR ** - Only 31 days at a time is permitted",! G START
K DIR S DIR("A")="Do you want a delimited report to a printer or home device",DIR(0)="Y",DIR("B")="NO" D ^DIR S ORDELIMT=Y
K DIR S DIR("A")="Do you want to print orders with MISSING LOCATIONS",DIR(0)="Y",DIR("B")="NO" D ^DIR S ORMISLOC=Y
I 'ORDELIMT S %IS="MQ" D ^%ZIS
I ORDELIMT S %IS="MQ",%ZIS("A")=("DELIMITED REPORT DEVICE: ") D ^%ZIS
I $D(IO("Q")) S ZTRTN="DQ^ORQOAUIB",ZTSAVE("ORSDATE")="",ZTSAVE("ORDELIMT")="",ZTSAVE("OREDATE")="",ZTIO=ION,ZTSAVE("IO*")="",ZTSAVE("ORDIV")="" D ^%ZTLOAD W !,"Task Queued: ",ZTSK Q
U IO
DQ ; QUEUED ENTRY POINT
S ORI=ORSDATE F S ORI=$O(^OR(100,"AF",ORI)) Q:+ORI'>0!(+ORI>OREDATE) S ORJ=0 F S ORJ=$O(^OR(100,"AF",ORI,ORJ)) Q:+ORJ'>0 D
. Q:'$$DIVMATCH(ORJ) ; QUIT IF NOT FOR ONE OF REQUESTED DIVISIONS
. Q:'$$ANTIMIC(ORJ) ; QUIT IF NOT ANTI-MICROBIAL ORDER
. S ORQUICK=$$ORQOAM(ORJ) ; DETERMINE WHETHER QUICK ORDER OR NON-QUICK ORDER
. I ORQUICK S ^TMP($J,"QUICK",ORJ)=ORQUICK
. E S ^TMP($J,"NON-QUICK",ORJ)=""
D PRINT("QUICK") ; PRINT ANTIMICROBIAL QUICK ORDERS
D PRINT("NON-QUICK") ; PRINT NON-QUICK ORDERS
K ^TMP($J),ORDRUGFN,ORPHDN,ORAM
D ^%ZISC ; CLOSE OUTPUT DEVICE
Q
DIVMATCH(ORRD) ; DETERMINE IF ORDER IS FOR REQUESTED DIVISION
N ORLLOC,ORRQDIV
I ORDIV="" Q 1 ; NO DIVISIONS REQUESTED
S ORLLOC=$P(^OR(100,ORRD,0),U,10) I +ORLLOC>0,ORLLOC["SC" S ORRQDIV=$P(^SC(+ORLLOC,0),U,15)
I ORMISLOC,+ORLLOC=0 Q 1 ;RTW ADD MISSING LOCATION TO MONTHLY
I $G(ORRQDIV)>0,$D(^OR(100.953,ORDIV,1,"B",ORRQDIV)) Q 1
E Q 0
ANTIMIC(ORRD) ; DETERMINE IF ORDER HAS ANY ANTIMICROBIAL ITEMS
N ORI,ORJ
S (ORI,ORAM)=0 F S ORI=$O(^OR(100,ORRD,.1,"B",ORI)) Q:+ORI'>0 D
. S ORPHDN=$P($P(^ORD(101.43,ORI,0),"^",2),";",1)
. Q:$P($P(^ORD(101.43,ORI,0),"^",2),";",2)'["PS"
. S ORDRUGFN=0,ORDRUGFN=$O(^PS(50.7,"A50",ORPHDN,ORDRUGFN))
. Q:'$G(ORDRUGFN)
. S:$P(^PSDRUG(ORDRUGFN,0),"^",2)["AM" ORAM=1
Q ORAM
ORQOAM(ORKK0) ; DETERMINE IF ORDER IS QUICK ORDER OR NOT
;LOOK FOR AUDIT IFN IN COMMENTS, STORE IFN OF ORDER IN AUDIT FILE
N ORK,ORKK,ORQUICK
S ORQUICK=0 ; INITIALIZE TO NON-QUICK ORDER
I ORKK0]"",ORKK0["** Pharmacy Confirmation #: " S ORQUICK=1_"^"_ORKK0 ;IDENTIFIED AS QUICK ORDER
I $D(^OR(100,ORJ,8,0)) S ORK=0 F S ORK=$O(^OR(100,ORJ,8,ORK)) Q:+ORK'>0 I $D(^OR(100,ORJ,8,ORK,.1,0)) S ORKK=0 F S ORKK=$O(^OR(100,ORJ,8,ORK,.1,ORKK)) Q:ORKK'>0 D
.S ORKK0=^OR(100,ORJ,8,ORK,.1,ORKK,0) I ORKK0["** Pharmacy Confirmation" S ORQUICK=1_"^"_ORKK0 ; IDENTIFIED AS QUICK ORDER
Q ORQUICK
PRINT(ORZ) ; PRINT RESULTS
; ORWHO = 'WHO ENTERED' field
; ORCNUM = Pharmacy Confirmation No (Record # in file 100.95)
; OR2EDAT = 'WHEN ENTERED' field
; OR2PAT = Patient Name and last 4 of SSN
; OR2PRB = 'CURRENT AGENT/PROVIDER' field
; OR2LOC = 'PATIENT LOCATION' field
N ORX0,X8,ORI,ORK,OR2DOTS,OR2PROV,ORCNUM,OR2EDAT,OR2HFS,OR2PAT,DFN,OR2SSN,OR2LOC,OR2OITEM
S OR2HFS=$$HFS() ; DETERMINE WHETHER PRINTER OR HFS DEVICE
I OR2HFS,ORZ="QUICK" W "Type"_U_"Order #"_U_"Patient"_U_"Who Entered"_U_"Confirm #"_U_"When Entered"_U_"Provider"_U_"Location"_U_"Orderable Item"
I ORDELIMT,ORZ="QUICK" W "Type"_U_"Order #"_U_"Patient"_U_"Who Entered"_U_"Confirm #"_U_"When Entered"_U_"Provider"_U_"Location"_U_"Orderable Item"
I 'ORDELIMT,'OR2HFS,ORZ="QUICK" W !!,"Anti-Microbial Orders",?65 D ^%D W:ORDIV]"" !,"Division Group: ",$P(^OR(100.953,ORDIV,0),"^",1) W !,ORZ," Orders" S $P(OR2DOTS,"-",81)="" D
.W !!,"Order #",?12,"Patient" W:ORZ="QUICK" ?30,"Confirm #" W ?42,"Who Entered",?68,"When Entered",!?12,"Location",?42,"Provider",!?42,"Orderable Item",!,OR2DOTS
.W !
I OR2HFS,ORZ="NON-QUICK" W !,"Type"_U_"Order #"_U_"Patient"_U_"Who Entered"_U_"Confirm #"_U_"When Entered"_U_"Provider"_U_"Location"_U_"Orderable Item"
I ORDELIMT,ORZ="NON-QUICK" W !,"Type"_U_"Order #"_U_"Patient"_U_"Who Entered"_U_"Confirm #"_U_"When Entered"_U_"Provider"_U_"Location"_U_"Orderable Item"
I 'ORDELIMT,'OR2HFS,ORZ="NON-QUICK" W !!,"Anti-Microbial Orders",?65 D ^%D W:ORDIV]"" !,"Division Group: ",$P(^OR(100.953,ORDIV,0),"^",1) W !,ORZ," Orders" S $P(OR2DOTS,"-",81)="" D
.W !!,"Order #",?12,"Patient" W:ORZ="NON-QUICK" ?30,"Confirm #" W ?42,"Who Entered",?68,"When Entered",!?12,"Location",?42,"Provider",!?42,"Orderable Item",!,OR2DOTS
.W !
S ORI=0 F S ORI=$O(^TMP($J,ORZ,ORI)) Q:+ORI'>0 D
.S ORX0=$G(^OR(100,ORI,0))
.S ORWHO=$P(ORX0,"^",6),ORWHO=$E($P(^VA(200,ORWHO,0),U,1),1,20)
.S ORCNUM=^TMP($J,ORZ,ORI) I ORCNUM]"" S ORCNUM=$P($P(ORCNUM,"Confirmation #: ",2)," ",1)
.S OR2EDAT=$P(ORX0,U,7) I OR2EDAT<ORSDATE!(OR2EDAT>OREDATE) Q ; ORDER NOT ENTERED WITHIN DATE RANGE
.S OR2PAT=$P(ORX0,U,2),DFN=+OR2PAT
.I +DFN>0 S OR2PAT=$P(^DPT(DFN,0),U,1),OR2SSN=$E($P(^DPT(DFN,0),U,9),6,9),OR2PAT=$P(OR2PAT,",",1),OR2PAT=OR2PAT_" ("_OR2SSN_")"
.E S OR2PAT="No Patient"
.S OR2EDAT=$$FMTE^XLFDT(OR2EDAT,"2D")
.S OR2PROV=$P(ORX0,U,4) S:+OR2PROV>0 OR2PROV=$P(^VA(200,OR2PROV,0),U,1)
.S OR2LOC=$P(ORX0,U,10) I +OR2LOC>0 S X2=$P(OR2LOC,";",2) S OR2LOC=$P(@("^"_X2_+OR2LOC_",0)"),U,1)
.D ITEM
.I ORMISLOC,$P(OR2LOC,";",1)=0 S OR2LOC="MISSING LOCATION" ;RTW
.I ORDELIMT!OR2HFS W !,ORZ_U_ORI_U_OR2PAT_U_ORWHO_U_ORCNUM_U_OR2EDAT_U_OR2PROV_U_OR2LOC_U_OR2OITEM
.E W !,ORI,?12,OR2PAT,?32,ORCNUM,?42,ORWHO,?71,OR2EDAT,!?12,OR2LOC,?42,OR2PROV,!?42,OR2OITEM,!!
Q
HFS() ; RETURN '1' IF OUTPUTTING TO A FILE, '0' FOR DEVICE
I $P(^%ZIS(1,IOS,"TYPE"),U,1)="HFS" Q 1
Q 0
ITEM ;Define the antimicrobial drug name.
I $G(ORDRUGFN) D
. S OR2OITEM="",ORQQ=0
. I $D(^OR(100,ORI,.1)) S ORI1=0 F S ORI1=$O(^OR(100,ORI,.1,"B",ORI1)) Q:ORI1'>0 Q:ORQQ D
. . S ORPHDN=$P($P(^ORD(101.43,ORI1,0),"^",2),";",1)
. . S ORDRUGFN=0,ORDRUGFN=$O(^PS(50.7,"A50",ORPHDN,ORDRUGFN))
. . Q:'$G(ORDRUGFN)
. . S:$P(^PSDRUG(ORDRUGFN,0),"^",2)["AM" OR2OITEM=$P(^PSDRUG(ORDRUGFN,0),U,1),ORQQ=1
K ORQQ Q
QOAP ;This is the Quick Order Audit Print Option Entry point, The report is designed to show whether the entry in file 100.95 was a poke or an order
N L,BY,FLDS
S DIC="100.95",L=0,BY="[OR QUICK ORDER AUDIT REPORT]",FLDS="[OR QUICK ORDER AUDIT REPORT]" D EN1^DIP
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORQOAUIB 7344 printed Dec 13, 2024@02:33:14 Page 2
ORQOAUIB ;EPIP/RTW - LIST ANTI-MICROBIAL ORDER, ANTIMICROBIAL QUICK ORDER & NON-QUICK ORDER ; 12/28/17 2:20pm
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**441**;Dec 17, 1997;Build 52
+2 ;QUICK ORDER AUDIT MONTHLY REPORT AND QUICK ORDER AUDIT PRINT
+3 ;ICR# Type Description
+4 ;----- ---- -------------------------------------
+5 ;10086 Sup ^%ZIS
+6 ;10089 Sup ^%ZISC
+7 ;10063 Sup ^%ZTLOAD
+8 ;1456 Sup ^DIC
+9 ;10103 Sup $$FMDIFF^XLFDT
+10 ;10103 Sup $$FMTE^XLFDT
+11 NEW ORSDATE,OREDATE,ORI,ORJ,ORCDSS,ORDIV,ORMISLOC,ORI1,OR2,Y,X2,ORWHO,%DT,%IS,DIC,ZTIO,ZTRTN,ZTSAVE,ZTSK
+12 KILL ^TMP($JOB)
+13 IF '$ORDER(^OR(100.953,0))
WRITE !,"No Groups Created in the QUICK ORDER DIVISION GROUPS File"
QUIT
START WRITE !
WRITE !,"Past date ranges can be entered covering 31 days at a time.",!
+1 SET %DT="AE"
SET %DT("A")="Enter Starting Date: "
DO ^%DT
if +Y'>0
QUIT
SET ORSDATE=+Y
+2 SET %DT="AE"
SET %DT("A")="Enter Ending Date: "
DO ^%DT
if +Y'>0
QUIT
SET OREDATE=+Y
+3 IF OREDATE<ORSDATE
WRITE !,"** ERROR ** - Ending Date needs to follow Starting Date",!
GOTO START
+4 SET ORDIV=""
IF $ORDER(^OR(100.953,0))>0
SET DIC(0)="AEQM"
SET DIC="^OR(100.953,"
SET DIC("A")="Select MEDICAL CENTER DIVISION GROUP: "
DO ^DIC
if +Y'>0
QUIT
+5 SET ORDIV=+Y
+6 IF $$FMDIFF^XLFDT(OREDATE,ORSDATE,1)>31
WRITE !,"** ERROR ** - Only 31 days at a time is permitted",!
GOTO START
+7 KILL DIR
SET DIR("A")="Do you want a delimited report to a printer or home device"
SET DIR(0)="Y"
SET DIR("B")="NO"
DO ^DIR
SET ORDELIMT=Y
+8 KILL DIR
SET DIR("A")="Do you want to print orders with MISSING LOCATIONS"
SET DIR(0)="Y"
SET DIR("B")="NO"
DO ^DIR
SET ORMISLOC=Y
+9 IF 'ORDELIMT
SET %IS="MQ"
DO ^%ZIS
+10 IF ORDELIMT
SET %IS="MQ"
SET %ZIS("A")=("DELIMITED REPORT DEVICE: ")
DO ^%ZIS
+11 IF $DATA(IO("Q"))
SET ZTRTN="DQ^ORQOAUIB"
SET ZTSAVE("ORSDATE")=""
SET ZTSAVE("ORDELIMT")=""
SET ZTSAVE("OREDATE")=""
SET ZTIO=ION
SET ZTSAVE("IO*")=""
SET ZTSAVE("ORDIV")=""
DO ^%ZTLOAD
WRITE !,"Task Queued: ",ZTSK
QUIT
+12 USE IO
DQ ; QUEUED ENTRY POINT
+1 SET ORI=ORSDATE
FOR
SET ORI=$ORDER(^OR(100,"AF",ORI))
if +ORI'>0!(+ORI>OREDATE)
QUIT
SET ORJ=0
FOR
SET ORJ=$ORDER(^OR(100,"AF",ORI,ORJ))
if +ORJ'>0
QUIT
Begin DoDot:1
+2 ; QUIT IF NOT FOR ONE OF REQUESTED DIVISIONS
if '$$DIVMATCH(ORJ)
QUIT
+3 ; QUIT IF NOT ANTI-MICROBIAL ORDER
if '$$ANTIMIC(ORJ)
QUIT
+4 ; DETERMINE WHETHER QUICK ORDER OR NON-QUICK ORDER
SET ORQUICK=$$ORQOAM(ORJ)
+5 IF ORQUICK
SET ^TMP($JOB,"QUICK",ORJ)=ORQUICK
+6 IF '$TEST
SET ^TMP($JOB,"NON-QUICK",ORJ)=""
End DoDot:1
+7 ; PRINT ANTIMICROBIAL QUICK ORDERS
DO PRINT("QUICK")
+8 ; PRINT NON-QUICK ORDERS
DO PRINT("NON-QUICK")
+9 KILL ^TMP($JOB),ORDRUGFN,ORPHDN,ORAM
+10 ; CLOSE OUTPUT DEVICE
DO ^%ZISC
+11 QUIT
DIVMATCH(ORRD) ; DETERMINE IF ORDER IS FOR REQUESTED DIVISION
+1 NEW ORLLOC,ORRQDIV
+2 ; NO DIVISIONS REQUESTED
IF ORDIV=""
QUIT 1
+3 SET ORLLOC=$PIECE(^OR(100,ORRD,0),U,10)
IF +ORLLOC>0
IF ORLLOC["SC"
SET ORRQDIV=$PIECE(^SC(+ORLLOC,0),U,15)
+4 ;RTW ADD MISSING LOCATION TO MONTHLY
IF ORMISLOC
IF +ORLLOC=0
QUIT 1
+5 IF $GET(ORRQDIV)>0
IF $DATA(^OR(100.953,ORDIV,1,"B",ORRQDIV))
QUIT 1
+6 IF '$TEST
QUIT 0
ANTIMIC(ORRD) ; DETERMINE IF ORDER HAS ANY ANTIMICROBIAL ITEMS
+1 NEW ORI,ORJ
+2 SET (ORI,ORAM)=0
FOR
SET ORI=$ORDER(^OR(100,ORRD,.1,"B",ORI))
if +ORI'>0
QUIT
Begin DoDot:1
+3 SET ORPHDN=$PIECE($PIECE(^ORD(101.43,ORI,0),"^",2),";",1)
+4 if $PIECE($PIECE(^ORD(101.43,ORI,0),"^",2),";",2)'["PS"
QUIT
+5 SET ORDRUGFN=0
SET ORDRUGFN=$ORDER(^PS(50.7,"A50",ORPHDN,ORDRUGFN))
+6 if '$GET(ORDRUGFN)
QUIT
+7 if $PIECE(^PSDRUG(ORDRUGFN,0),"^",2)["AM"
SET ORAM=1
End DoDot:1
+8 QUIT ORAM
ORQOAM(ORKK0) ; DETERMINE IF ORDER IS QUICK ORDER OR NOT
+1 ;LOOK FOR AUDIT IFN IN COMMENTS, STORE IFN OF ORDER IN AUDIT FILE
+2 NEW ORK,ORKK,ORQUICK
+3 ; INITIALIZE TO NON-QUICK ORDER
SET ORQUICK=0
+4 ;IDENTIFIED AS QUICK ORDER
IF ORKK0]""
IF ORKK0["** Pharmacy Confirmation #: "
SET ORQUICK=1_"^"_ORKK0
+5 IF $DATA(^OR(100,ORJ,8,0))
SET ORK=0
FOR
SET ORK=$ORDER(^OR(100,ORJ,8,ORK))
if +ORK'>0
QUIT
IF $DATA(^OR(100,ORJ,8,ORK,.1,0))
SET ORKK=0
FOR
SET ORKK=$ORDER(^OR(100,ORJ,8,ORK,.1,ORKK))
if ORKK'>0
QUIT
Begin DoDot:1
+6 ; IDENTIFIED AS QUICK ORDER
SET ORKK0=^OR(100,ORJ,8,ORK,.1,ORKK,0)
IF ORKK0["** Pharmacy Confirmation"
SET ORQUICK=1_"^"_ORKK0
End DoDot:1
+7 QUIT ORQUICK
PRINT(ORZ) ; PRINT RESULTS
+1 ; ORWHO = 'WHO ENTERED' field
+2 ; ORCNUM = Pharmacy Confirmation No (Record # in file 100.95)
+3 ; OR2EDAT = 'WHEN ENTERED' field
+4 ; OR2PAT = Patient Name and last 4 of SSN
+5 ; OR2PRB = 'CURRENT AGENT/PROVIDER' field
+6 ; OR2LOC = 'PATIENT LOCATION' field
+7 NEW ORX0,X8,ORI,ORK,OR2DOTS,OR2PROV,ORCNUM,OR2EDAT,OR2HFS,OR2PAT,DFN,OR2SSN,OR2LOC,OR2OITEM
+8 ; DETERMINE WHETHER PRINTER OR HFS DEVICE
SET OR2HFS=$$HFS()
+9 IF OR2HFS
IF ORZ="QUICK"
WRITE "Type"_U_"Order #"_U_"Patient"_U_"Who Entered"_U_"Confirm #"_U_"When Entered"_U_"Provider"_U_"Location"_U_"Orderable Item"
+10 IF ORDELIMT
IF ORZ="QUICK"
WRITE "Type"_U_"Order #"_U_"Patient"_U_"Who Entered"_U_"Confirm #"_U_"When Entered"_U_"Provider"_U_"Location"_U_"Orderable Item"
+11 IF 'ORDELIMT
IF 'OR2HFS
IF ORZ="QUICK"
WRITE !!,"Anti-Microbial Orders",?65
DO ^%D
if ORDIV]""
WRITE !,"Division Group: ",$PIECE(^OR(100.953,ORDIV,0),"^",1)
WRITE !,ORZ," Orders"
SET $PIECE(OR2DOTS,"-",81)=""
Begin DoDot:1
+12 WRITE !!,"Order #",?12,"Patient"
if ORZ="QUICK"
WRITE ?30,"Confirm #"
WRITE ?42,"Who Entered",?68,"When Entered",!?12,"Location",?42,"Provider",!?42,"Orderable Item",!,OR2DOTS
+13 WRITE !
End DoDot:1
+14 IF OR2HFS
IF ORZ="NON-QUICK"
WRITE !,"Type"_U_"Order #"_U_"Patient"_U_"Who Entered"_U_"Confirm #"_U_"When Entered"_U_"Provider"_U_"Location"_U_"Orderable Item"
+15 IF ORDELIMT
IF ORZ="NON-QUICK"
WRITE !,"Type"_U_"Order #"_U_"Patient"_U_"Who Entered"_U_"Confirm #"_U_"When Entered"_U_"Provider"_U_"Location"_U_"Orderable Item"
+16 IF 'ORDELIMT
IF 'OR2HFS
IF ORZ="NON-QUICK"
WRITE !!,"Anti-Microbial Orders",?65
DO ^%D
if ORDIV]""
WRITE !,"Division Group: ",$PIECE(^OR(100.953,ORDIV,0),"^",1)
WRITE !,ORZ," Orders"
SET $PIECE(OR2DOTS,"-",81)=""
Begin DoDot:1
+17 WRITE !!,"Order #",?12,"Patient"
if ORZ="NON-QUICK"
WRITE ?30,"Confirm #"
WRITE ?42,"Who Entered",?68,"When Entered",!?12,"Location",?42,"Provider",!?42,"Orderable Item",!,OR2DOTS
+18 WRITE !
End DoDot:1
+19 SET ORI=0
FOR
SET ORI=$ORDER(^TMP($JOB,ORZ,ORI))
if +ORI'>0
QUIT
Begin DoDot:1
+20 SET ORX0=$GET(^OR(100,ORI,0))
+21 SET ORWHO=$PIECE(ORX0,"^",6)
SET ORWHO=$EXTRACT($PIECE(^VA(200,ORWHO,0),U,1),1,20)
+22 SET ORCNUM=^TMP($JOB,ORZ,ORI)
IF ORCNUM]""
SET ORCNUM=$PIECE($PIECE(ORCNUM,"Confirmation #: ",2)," ",1)
+23 ; ORDER NOT ENTERED WITHIN DATE RANGE
SET OR2EDAT=$PIECE(ORX0,U,7)
IF OR2EDAT<ORSDATE!(OR2EDAT>OREDATE)
QUIT
+24 SET OR2PAT=$PIECE(ORX0,U,2)
SET DFN=+OR2PAT
+25 IF +DFN>0
SET OR2PAT=$PIECE(^DPT(DFN,0),U,1)
SET OR2SSN=$EXTRACT($PIECE(^DPT(DFN,0),U,9),6,9)
SET OR2PAT=$PIECE(OR2PAT,",",1)
SET OR2PAT=OR2PAT_" ("_OR2SSN_")"
+26 IF '$TEST
SET OR2PAT="No Patient"
+27 SET OR2EDAT=$$FMTE^XLFDT(OR2EDAT,"2D")
+28 SET OR2PROV=$PIECE(ORX0,U,4)
if +OR2PROV>0
SET OR2PROV=$PIECE(^VA(200,OR2PROV,0),U,1)
+29 SET OR2LOC=$PIECE(ORX0,U,10)
IF +OR2LOC>0
SET X2=$PIECE(OR2LOC,";",2)
SET OR2LOC=$PIECE(@("^"_X2_+OR2LOC_",0)"),U,1)
+30 DO ITEM
+31 ;RTW
IF ORMISLOC
IF $PIECE(OR2LOC,";",1)=0
SET OR2LOC="MISSING LOCATION"
+32 IF ORDELIMT!OR2HFS
WRITE !,ORZ_U_ORI_U_OR2PAT_U_ORWHO_U_ORCNUM_U_OR2EDAT_U_OR2PROV_U_OR2LOC_U_OR2OITEM
+33 IF '$TEST
WRITE !,ORI,?12,OR2PAT,?32,ORCNUM,?42,ORWHO,?71,OR2EDAT,!?12,OR2LOC,?42,OR2PROV,!?42,OR2OITEM,!!
End DoDot:1
+34 QUIT
HFS() ; RETURN '1' IF OUTPUTTING TO A FILE, '0' FOR DEVICE
+1 IF $PIECE(^%ZIS(1,IOS,"TYPE"),U,1)="HFS"
QUIT 1
+2 QUIT 0
ITEM ;Define the antimicrobial drug name.
+1 IF $GET(ORDRUGFN)
Begin DoDot:1
+2 SET OR2OITEM=""
SET ORQQ=0
+3 IF $DATA(^OR(100,ORI,.1))
SET ORI1=0
FOR
SET ORI1=$ORDER(^OR(100,ORI,.1,"B",ORI1))
if ORI1'>0
QUIT
if ORQQ
QUIT
Begin DoDot:2
+4 SET ORPHDN=$PIECE($PIECE(^ORD(101.43,ORI1,0),"^",2),";",1)
+5 SET ORDRUGFN=0
SET ORDRUGFN=$ORDER(^PS(50.7,"A50",ORPHDN,ORDRUGFN))
+6 if '$GET(ORDRUGFN)
QUIT
+7 if $PIECE(^PSDRUG(ORDRUGFN,0),"^",2)["AM"
SET OR2OITEM=$PIECE(^PSDRUG(ORDRUGFN,0),U,1)
SET ORQQ=1
End DoDot:2
End DoDot:1
+8 KILL ORQQ
QUIT
QOAP ;This is the Quick Order Audit Print Option Entry point, The report is designed to show whether the entry in file 100.95 was a poke or an order
+1 NEW L,BY,FLDS
+2 SET DIC="100.95"
SET L=0
SET BY="[OR QUICK ORDER AUDIT REPORT]"
SET FLDS="[OR QUICK ORDER AUDIT REPORT]"
DO EN1^DIP
+3 QUIT