ORDV06 ; SLC/DCM - OE/RR Report Extracts ;Dec 02, 2021@12:46:52
;;3.0;ORDER ENTRY RESULTS REPORTING;**109,118,167,208,215,274,243,312,405**;Dec 17, 1997;Build 211
;Pharmacy Extracts
RXA(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Active Outpatient Pharmacy
;Call to PSOHCSUM
;
I $L($T(GCPR^OMGCOAS1)) D ; Call if FHIE station 200
. N BEG,END,MAX
. S BEG=0,END=9999999,MAX=9999
. D GCPR^OMGCOAS1(DFN,"RXA",BEG,END,MAX)
;
N ORRXSTAT,GO,PSOACT
Q:'$L(OREXT)
S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
Q:'$L($T(@GO))
;COMMENTED OUT THE NEXT LINE OF V32 CODE FOR NEXT LINE OF PAPI CODE
;S PSOACT=1,ORRXSTAT="^ACTIVE^ACTIVE/SUSP^"
S PSOACT=1,ORRXSTAT="^ACTIVE^ACTIVE/SUSP^ACTIVE/PARKED^" ;PAPI MODIFIED CODE
D GET(0,9999999)
Q
RXOP(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;All Outpatient Pharmacy
;Call to PSOHCSUM
I $L($T(GCPR^OMGCOAS1)) D ; Call if FHIE station 200
. D GCPR^OMGCOAS1(DFN,"RXOP",ORDBEG,ORDEND,9999)
N ORRXSTAT,GO
K PSOACT
Q:'$L(OREXT)
S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
Q:'$L($T(@GO))
S ORRXSTAT=""
D GET(ORDBEG,ORDEND)
Q
GET(ORSTDT,OREDDT) ;
N J,ORDT,ORI,ORDRGIEN,ORDRG,ORRXNO,ORSTAT,ORQTY,OREXP,ORISSUE,ORLAST,ORREF,ORPRVD,ORCOST,ORSIG
N ECD,GMR,GMW,IX,PSOBEGIN,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE
S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
S PSOBEGIN=ORSTDT
K ^TMP("ORDATA",$J)
I '$L($T(GCPR^OMGCOAS1)) D
. K ^TMP("PSOO",$J)
. D @GO
S ORI=0,ORDT=$S(OREDDT\1<DT:9999999-(OREDDT\1),1:0)
F S ORDT=$O(^TMP("PSOO",$J,ORDT)) Q:(ORDT'>0) S ORX0=$G(^(ORDT,0)) I ORX0'="" D
. I $L(ORRXSTAT),ORRXSTAT'[(U_$P($P(ORX0,U,5),";",2)) Q ;Check status
. S ORI=ORI+1
. S SITE=$S($L($G(^TMP("PSOO",$J,ORDT,"facility"))):^("facility"),1:ORSITE)
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",1)="1^"_SITE ;Station ID
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",2)="2^"_$P($P(ORX0,U,3),";",2) ;Drug Name
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",3)="3^"_$P($P(ORX0,U,3),";") ;Drug IEN
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",4)="4^"_$P(ORX0,U,6) ;RX #
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",5)="5^"_$P($P(ORX0,U,5),";",2) ;Status
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",6)="6^"_$P(ORX0,U,7) ;Quantity
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",7)="7^"_$$DATE^ORDVU($P(ORX0,U,11)) ;Exp/Cancel Date
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",8)="8^"_$$DATE^ORDVU($P(ORX0,U)) ;Issue Date
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",9)="9^"_$$DATE^ORDVU($P(ORX0,U,2)) ;Last Fill Date
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",10)="10^"_$P(ORX0,U,8) ;#Refills
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",11)="11^"_$P($P(ORX0,U,4),";",2) ;Provider
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",12)="12^"_$P(ORX0,U,10) ;Cost-fill
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",15)="15^"_$P(ORX0,U,9) ;PharmID
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",16)="16^"_$P(ORX0,U,11) ;Order Number
. S J=0
. F S J=$O(^TMP("PSOO",$J,ORDT,J)) Q:'J D
..S X=^(J,0),^TMP("ORDATA",$J,ORDT,ORI,"WP",14,J)="14^"_X
K ^TMP("PSOO",$J)
S ROOT=$NA(^TMP("ORDATA",$J))
Q
RXAV(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Active IV Pharmacy
;Call to ENHS^PSJEEU0
N ORIVSTAT,GO
Q:'$L(OREXT)
S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
Q:'$L($T(@GO))
S ORIVSTAT="^ACTIVE^"
D GET1
Q
RXIV(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;All IV Pharmcy
;Call to ENHS^PSJEEU0
N ORIVSTAT,GO
Q:'$L(OREXT)
S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
Q:'$L($T(@GO))
S ORIVSTAT=""
D GET1
Q
GET1 ;
N ORDT,ORI,ORX0,ORIDRG,ORDRGIEN,ORDRG,ORDOSE,ORREC,ORSTAT,ORSTRTDT,ORSTOPDT,ORROUT,ORSIG,ORWII,ORMORE
N GMI,GMTSIDT,MAX,ON,PS,PSIVREA,PSJEDT,PSJNKF,PSJPFWD,TN,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE
S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
S PSJEDT=1,PSJNKF=1
K ^TMP("ORDATA",$J),^UTILITY("PSG",$J),^UTILITY("PSIV",$J)
D @GO
S ORDT=-9999999,ORI=0
F S ORDT=$O(^UTILITY("PSIV",$J,ORDT)) Q:(ORDT="") S ORX0=$G(^(ORDT,0)) I ORX0'="" D
. I $L(ORIVSTAT),ORIVSTAT'[(U_$P($P(ORX0,U,4),";",2)_U) Q ;Check status
. S ORI=ORI+1
. S ORMORE=0,SITE=$S($L($G(^UTILITY("PSIV",$J,ORDT,"facility"))):^("facility"),1:ORSITE)
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",1)="1^"_SITE ;Station ID
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",6)="6^"_$$DATE^ORDVU($P(ORX0,U)) ;Start Date
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",7)="7^"_$$DATE^ORDVU($P(ORX0,U,2)) ;Stop Date
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",4)="4^"_$P(ORX0,U,5) ;Rate
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",5)="5^"_$P(ORX0,U,6) ;Schedule JEH
. S ORIDRG=0
. F S ORIDRG=$O(^UTILITY("PSIV",$J,ORDT,"A",ORIDRG)) Q:'ORIDRG S ORREC=$G(^(ORIDRG)) S:ORIDRG>1 ORMORE=1 D ;Additives
.. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",2,ORIDRG)="2^"_$P($P(ORREC,U),";",2)_" "_$P(ORREC,U,2) ;Additive Dose
. S ORIDRG=0
. F S ORIDRG=$O(^UTILITY("PSIV",$J,ORDT,"S",ORIDRG)) Q:'ORIDRG S ORREC=$G(^(ORIDRG)) S:ORIDRG>1 ORMORE=1 D ;Solutions
.. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",3,ORIDRG)="3^"_$P($P(ORREC,U),";",2)_" "_$P(ORREC,U,2) ;Solution Dose
. I ORMORE S ^TMP("ORDATA",$J,ORDT,ORI,"WP",8)="8^[+]" ;flag for detail
K ^UTILITY("PSG",$J),^UTILITY("PSIV",$J)
S ROOT=$NA(^TMP("ORDATA",$J))
Q
RXUD(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Get Unit Dose Pharmacy Component
;Call to ENHS^PSJEEU0
N J,ORDT,ORI,ORX0,ORDRGIEN,ORDRG,ORDOSE,ORSTAT,ORSTRTDT,ORSTOPDT,ORROUT,ORSIG,GO
N GMI,IX,MAX,ON,PS,PSIVREA,PSJEDT,PSJNKF,PSJPFWD,GMR,TN,UDS,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE
Q:'$L(OREXT)
S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
Q:'$L($T(@GO))
S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
S PSJEDT=1,PSJNKF=1
K ^TMP("ORDATA",$J),^UTILITY("PSG",$J),^UTILITY("PSIV",$J)
D @GO
S ORDT=-9999999,ORI=0
F S ORDT=$O(^UTILITY("PSG",$J,ORDT)) Q:(ORDT="") S ORX0=$G(^(ORDT)) I ORX0'="" D
. S SITE=$S($L($G(^UTILITY("PSG",$J,ORDT,"facility"))):^("facility"),1:ORSITE)
. S ORI=ORI+1
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",1)="1^"_SITE ;Station ID
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",2)="2^"_$P($P(ORX0,U,3),":") ;DRUG IEN
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",3)="3^"_$P($P(ORX0,U,3),";",2) ;Drug Name
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",4)="4^"_$P(ORX0,U,6) ;Dose
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",5)="5^"_$P($P(ORX0,U,5),";",2) ;Status
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",6)="6^"_$$DATE^ORDVU($P(ORX0,U)) ;START Date
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",7)="7^"_$$DATE^ORDVU($P(ORX0,U,2)) ;Stop Date
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",8)="8^"_$P($P(ORX0,U,7),";",3) ;Route
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",9)="9^"_$P(ORX0,U,8) ;SIG
K ^UTILITY("PSG",$J),^UTILITY("PSIV",$J)
S ROOT=$NA(^TMP("ORDATA",$J))
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORDV06 6578 printed Nov 22, 2024@17:40:13 Page 2
ORDV06 ; SLC/DCM - OE/RR Report Extracts ;Dec 02, 2021@12:46:52
+1 ;;3.0;ORDER ENTRY RESULTS REPORTING;**109,118,167,208,215,274,243,312,405**;Dec 17, 1997;Build 211
+2 ;Pharmacy Extracts
RXA(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Active Outpatient Pharmacy
+1 ;Call to PSOHCSUM
+2 ;
+3 ; Call if FHIE station 200
IF $LENGTH($TEXT(GCPR^OMGCOAS1))
Begin DoDot:1
+4 NEW BEG,END,MAX
+5 SET BEG=0
SET END=9999999
SET MAX=9999
+6 DO GCPR^OMGCOAS1(DFN,"RXA",BEG,END,MAX)
End DoDot:1
+7 ;
+8 NEW ORRXSTAT,GO,PSOACT
+9 if '$LENGTH(OREXT)
QUIT
+10 SET GO=$PIECE(OREXT,";")_"^"_$PIECE(OREXT,";",2)
+11 if '$LENGTH($TEXT(@GO))
QUIT
+12 ;COMMENTED OUT THE NEXT LINE OF V32 CODE FOR NEXT LINE OF PAPI CODE
+13 ;S PSOACT=1,ORRXSTAT="^ACTIVE^ACTIVE/SUSP^"
+14 ;PAPI MODIFIED CODE
SET PSOACT=1
SET ORRXSTAT="^ACTIVE^ACTIVE/SUSP^ACTIVE/PARKED^"
+15 DO GET(0,9999999)
+16 QUIT
RXOP(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;All Outpatient Pharmacy
+1 ;Call to PSOHCSUM
+2 ; Call if FHIE station 200
IF $LENGTH($TEXT(GCPR^OMGCOAS1))
Begin DoDot:1
+3 DO GCPR^OMGCOAS1(DFN,"RXOP",ORDBEG,ORDEND,9999)
End DoDot:1
+4 NEW ORRXSTAT,GO
+5 KILL PSOACT
+6 if '$LENGTH(OREXT)
QUIT
+7 SET GO=$PIECE(OREXT,";")_"^"_$PIECE(OREXT,";",2)
+8 if '$LENGTH($TEXT(@GO))
QUIT
+9 SET ORRXSTAT=""
+10 DO GET(ORDBEG,ORDEND)
+11 QUIT
GET(ORSTDT,OREDDT) ;
+1 NEW J,ORDT,ORI,ORDRGIEN,ORDRG,ORRXNO,ORSTAT,ORQTY,OREXP,ORISSUE,ORLAST,ORREF,ORPRVD,ORCOST,ORSIG
+2 NEW ECD,GMR,GMW,IX,PSOBEGIN,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE
+3 SET ORSITE=$$SITE^VASITE
SET ORSITE=$PIECE(ORSITE,"^",2)_";"_$PIECE(ORSITE,"^",3)
+4 SET PSOBEGIN=ORSTDT
+5 KILL ^TMP("ORDATA",$JOB)
+6 IF '$LENGTH($TEXT(GCPR^OMGCOAS1))
Begin DoDot:1
+7 KILL ^TMP("PSOO",$JOB)
+8 DO @GO
End DoDot:1
+9 SET ORI=0
SET ORDT=$SELECT(OREDDT\1<DT:9999999-(OREDDT\1),1:0)
+10 FOR
SET ORDT=$ORDER(^TMP("PSOO",$JOB,ORDT))
if (ORDT'>0)
QUIT
SET ORX0=$GET(^(ORDT,0))
IF ORX0'=""
Begin DoDot:1
+11 ;Check status
IF $LENGTH(ORRXSTAT)
IF ORRXSTAT'[(U_$PIECE($PIECE(ORX0,U,5),";",2))
QUIT
+12 SET ORI=ORI+1
+13 SET SITE=$SELECT($LENGTH($GET(^TMP("PSOO",$JOB,ORDT,"facility"))):^("facility"),1:ORSITE)
+14 ;Station ID
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",1)="1^"_SITE
+15 ;Drug Name
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",2)="2^"_$PIECE($PIECE(ORX0,U,3),";",2)
+16 ;Drug IEN
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",3)="3^"_$PIECE($PIECE(ORX0,U,3),";")
+17 ;RX #
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",4)="4^"_$PIECE(ORX0,U,6)
+18 ;Status
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",5)="5^"_$PIECE($PIECE(ORX0,U,5),";",2)
+19 ;Quantity
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",6)="6^"_$PIECE(ORX0,U,7)
+20 ;Exp/Cancel Date
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",7)="7^"_$$DATE^ORDVU($PIECE(ORX0,U,11))
+21 ;Issue Date
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",8)="8^"_$$DATE^ORDVU($PIECE(ORX0,U))
+22 ;Last Fill Date
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",9)="9^"_$$DATE^ORDVU($PIECE(ORX0,U,2))
+23 ;#Refills
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",10)="10^"_$PIECE(ORX0,U,8)
+24 ;Provider
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",11)="11^"_$PIECE($PIECE(ORX0,U,4),";",2)
+25 ;Cost-fill
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",12)="12^"_$PIECE(ORX0,U,10)
+26 ;PharmID
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",15)="15^"_$PIECE(ORX0,U,9)
+27 ;Order Number
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",16)="16^"_$PIECE(ORX0,U,11)
+28 SET J=0
+29 FOR
SET J=$ORDER(^TMP("PSOO",$JOB,ORDT,J))
if 'J
QUIT
Begin DoDot:2
+30 SET X=^(J,0)
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",14,J)="14^"_X
End DoDot:2
End DoDot:1
+31 KILL ^TMP("PSOO",$JOB)
+32 SET ROOT=$NAME(^TMP("ORDATA",$JOB))
+33 QUIT
RXAV(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Active IV Pharmacy
+1 ;Call to ENHS^PSJEEU0
+2 NEW ORIVSTAT,GO
+3 if '$LENGTH(OREXT)
QUIT
+4 SET GO=$PIECE(OREXT,";")_"^"_$PIECE(OREXT,";",2)
+5 if '$LENGTH($TEXT(@GO))
QUIT
+6 SET ORIVSTAT="^ACTIVE^"
+7 DO GET1
+8 QUIT
RXIV(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;All IV Pharmcy
+1 ;Call to ENHS^PSJEEU0
+2 NEW ORIVSTAT,GO
+3 if '$LENGTH(OREXT)
QUIT
+4 SET GO=$PIECE(OREXT,";")_"^"_$PIECE(OREXT,";",2)
+5 if '$LENGTH($TEXT(@GO))
QUIT
+6 SET ORIVSTAT=""
+7 DO GET1
+8 QUIT
GET1 ;
+1 NEW ORDT,ORI,ORX0,ORIDRG,ORDRGIEN,ORDRG,ORDOSE,ORREC,ORSTAT,ORSTRTDT,ORSTOPDT,ORROUT,ORSIG,ORWII,ORMORE
+2 NEW GMI,GMTSIDT,MAX,ON,PS,PSIVREA,PSJEDT,PSJNKF,PSJPFWD,TN,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE
+3 SET ORSITE=$$SITE^VASITE
SET ORSITE=$PIECE(ORSITE,"^",2)_";"_$PIECE(ORSITE,"^",3)
+4 SET PSJEDT=1
SET PSJNKF=1
+5 KILL ^TMP("ORDATA",$JOB),^UTILITY("PSG",$JOB),^UTILITY("PSIV",$JOB)
+6 DO @GO
+7 SET ORDT=-9999999
SET ORI=0
+8 FOR
SET ORDT=$ORDER(^UTILITY("PSIV",$JOB,ORDT))
if (ORDT="")
QUIT
SET ORX0=$GET(^(ORDT,0))
IF ORX0'=""
Begin DoDot:1
+9 ;Check status
IF $LENGTH(ORIVSTAT)
IF ORIVSTAT'[(U_$PIECE($PIECE(ORX0,U,4),";",2)_U)
QUIT
+10 SET ORI=ORI+1
+11 SET ORMORE=0
SET SITE=$SELECT($LENGTH($GET(^UTILITY("PSIV",$JOB,ORDT,"facility"))):^("facility"),1:ORSITE)
+12 ;Station ID
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",1)="1^"_SITE
+13 ;Start Date
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",6)="6^"_$$DATE^ORDVU($PIECE(ORX0,U))
+14 ;Stop Date
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",7)="7^"_$$DATE^ORDVU($PIECE(ORX0,U,2))
+15 ;Rate
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",4)="4^"_$PIECE(ORX0,U,5)
+16 ;Schedule JEH
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",5)="5^"_$PIECE(ORX0,U,6)
+17 SET ORIDRG=0
+18 ;Additives
FOR
SET ORIDRG=$ORDER(^UTILITY("PSIV",$JOB,ORDT,"A",ORIDRG))
if 'ORIDRG
QUIT
SET ORREC=$GET(^(ORIDRG))
if ORIDRG>1
SET ORMORE=1
Begin DoDot:2
+19 ;Additive Dose
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",2,ORIDRG)="2^"_$PIECE($PIECE(ORREC,U),";",2)_" "_$PIECE(ORREC,U,2)
End DoDot:2
+20 SET ORIDRG=0
+21 ;Solutions
FOR
SET ORIDRG=$ORDER(^UTILITY("PSIV",$JOB,ORDT,"S",ORIDRG))
if 'ORIDRG
QUIT
SET ORREC=$GET(^(ORIDRG))
if ORIDRG>1
SET ORMORE=1
Begin DoDot:2
+22 ;Solution Dose
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",3,ORIDRG)="3^"_$PIECE($PIECE(ORREC,U),";",2)_" "_$PIECE(ORREC,U,2)
End DoDot:2
+23 ;flag for detail
IF ORMORE
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",8)="8^[+]"
End DoDot:1
+24 KILL ^UTILITY("PSG",$JOB),^UTILITY("PSIV",$JOB)
+25 SET ROOT=$NAME(^TMP("ORDATA",$JOB))
+26 QUIT
RXUD(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Get Unit Dose Pharmacy Component
+1 ;Call to ENHS^PSJEEU0
+2 NEW J,ORDT,ORI,ORX0,ORDRGIEN,ORDRG,ORDOSE,ORSTAT,ORSTRTDT,ORSTOPDT,ORROUT,ORSIG,GO
+3 NEW GMI,IX,MAX,ON,PS,PSIVREA,PSJEDT,PSJNKF,PSJPFWD,GMR,TN,UDS,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE
+4 if '$LENGTH(OREXT)
QUIT
+5 SET GO=$PIECE(OREXT,";")_"^"_$PIECE(OREXT,";",2)
+6 if '$LENGTH($TEXT(@GO))
QUIT
+7 SET ORSITE=$$SITE^VASITE
SET ORSITE=$PIECE(ORSITE,"^",2)_";"_$PIECE(ORSITE,"^",3)
+8 SET PSJEDT=1
SET PSJNKF=1
+9 KILL ^TMP("ORDATA",$JOB),^UTILITY("PSG",$JOB),^UTILITY("PSIV",$JOB)
+10 DO @GO
+11 SET ORDT=-9999999
SET ORI=0
+12 FOR
SET ORDT=$ORDER(^UTILITY("PSG",$JOB,ORDT))
if (ORDT="")
QUIT
SET ORX0=$GET(^(ORDT))
IF ORX0'=""
Begin DoDot:1
+13 SET SITE=$SELECT($LENGTH($GET(^UTILITY("PSG",$JOB,ORDT,"facility"))):^("facility"),1:ORSITE)
+14 SET ORI=ORI+1
+15 ;Station ID
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",1)="1^"_SITE
+16 ;DRUG IEN
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",2)="2^"_$PIECE($PIECE(ORX0,U,3),":")
+17 ;Drug Name
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",3)="3^"_$PIECE($PIECE(ORX0,U,3),";",2)
+18 ;Dose
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",4)="4^"_$PIECE(ORX0,U,6)
+19 ;Status
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",5)="5^"_$PIECE($PIECE(ORX0,U,5),";",2)
+20 ;START Date
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",6)="6^"_$$DATE^ORDVU($PIECE(ORX0,U))
+21 ;Stop Date
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",7)="7^"_$$DATE^ORDVU($PIECE(ORX0,U,2))
+22 ;Route
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",8)="8^"_$PIECE($PIECE(ORX0,U,7),";",3)
+23 ;SIG
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",9)="9^"_$PIECE(ORX0,U,8)
End DoDot:1
+24 KILL ^UTILITY("PSG",$JOB),^UTILITY("PSIV",$JOB)
+25 SET ROOT=$NAME(^TMP("ORDATA",$JOB))
+26 QUIT