ORDV06A ; slc/dcm - OE/RR Report Extracts ;7/31/13 10:35
;;3.0;ORDER ENTRY RESULTS REPORTING;**215,243,312**;Dec 17, 1997;Build 31
;Pharmacy Extracts
NVA(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Outpatient Pharmacy Non-VA Meds
;Call to PSOHCSUM
;^TMP("PSOO",$J,"NVA",n,0)=Herbal/OTC/Non VA Medication^status (active or discontinued)^start date(fm format)^cprs order # (ptr to 100)
; ^date/time documented (fm format)^documented by (ptr to 200_";"_.01)^dc date/time(fm format)
;^TMP("PSOO",$J,"NVA",n,1,0)=dosage^med route^schedule (previous 3 fields are Instructions)^drug (file #50_";"_.01)^clinic (file #44_";"_.01)
;^TMP("PSOO",$J,"NVA",n,"DSC",nn,0)=statement/explanation/comments
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,"RXOP",BEG,END,MAX)
;
N GO
Q:'$L(OREXT)
S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
Q:'$L($T(@GO))
D GET
Q
GET ;
N J,ORDT,ORDRGIEN,ORDRG,ORRXNO,ORSTAT,ORQTY,OREXP,ORISSUE,ORLAST,ORREF,ORPRVD,ORCOST,ORSIG,ORX0,ORX1
N ECD,GMR,GMW,IX,PSOBEGIN,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE,ORI
S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
S PSOBEGIN=0
K ^TMP("ORDATA",$J)
I '$L($T(GCPR^OMGCOAS1)) D
. K ^TMP("PSOO",$J)
. D @GO
S ORDT=0,ORI=0
F S ORDT=$O(^TMP("PSOO",$J,"NVA",ORDT)) Q:(ORDT'>0) S ORX0=$G(^(ORDT,0)) I ORX0'="" S ORX1=$G(^(1,0)) D
. S SITE=$S($L($G(^TMP("PSOO",$J,"NVA",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(ORX0,U) ;Herbal/OTC/Non VA Medication
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",3)="3^"_$P(ORX0,U,2) ;Status
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",4)="4^"_$$DATE^ORDVU($P(ORX0,U,3)) ;Start Date
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",5)="5^"_$$DATE^ORDVU($P(ORX0,U,5)) ;Date Documented
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",6)="6^"_$P($P(ORX0,U,6),";",2) ;Documented By
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",7)="7^"_$$DATE^ORDVU($P(ORX0,U,7)) ;Date DC'd
. S ^TMP("ORDATA",$J,ORDT,ORI,"WP",8)="8^"_$P(ORX1,U)_" "_$P(ORX1,U,2)_" "_$P(ORX1,U,3) ;SIG dose + route + schedule
. S J=0
. F S J=$O(^TMP("PSOO",$J,"NVA",ORDT,"DSC",J)) Q:'J S X=^(J,0),^TMP("ORDATA",$J,ORDT,ORI,"WP",10,J)="10^"_X
. I $O(^TMP("PSOO",$J,"NVA",ORDT,"DSC",1)) S ^TMP("ORDATA",$J,ORDT,ORI,"WP",9)="9^[+]" ;flag for detail
K ^TMP("PSOO",$J)
S ROOT=$NA(^TMP("ORDATA",$J))
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORDV06A 2505 printed Oct 16, 2024@18:30:51 Page 2
ORDV06A ; slc/dcm - OE/RR Report Extracts ;7/31/13 10:35
+1 ;;3.0;ORDER ENTRY RESULTS REPORTING;**215,243,312**;Dec 17, 1997;Build 31
+2 ;Pharmacy Extracts
NVA(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Outpatient Pharmacy Non-VA Meds
+1 ;Call to PSOHCSUM
+2 ;^TMP("PSOO",$J,"NVA",n,0)=Herbal/OTC/Non VA Medication^status (active or discontinued)^start date(fm format)^cprs order # (ptr to 100)
+3 ; ^date/time documented (fm format)^documented by (ptr to 200_";"_.01)^dc date/time(fm format)
+4 ;^TMP("PSOO",$J,"NVA",n,1,0)=dosage^med route^schedule (previous 3 fields are Instructions)^drug (file #50_";"_.01)^clinic (file #44_";"_.01)
+5 ;^TMP("PSOO",$J,"NVA",n,"DSC",nn,0)=statement/explanation/comments
+6 ; Call if FHIE station 200
IF $LENGTH($TEXT(GCPR^OMGCOAS1))
Begin DoDot:1
+7 NEW BEG,END,MAX
+8 SET BEG=0
SET END=9999999
SET MAX=9999
+9 DO GCPR^OMGCOAS1(DFN,"RXOP",BEG,END,MAX)
End DoDot:1
+10 ;
+11 NEW GO
+12 if '$LENGTH(OREXT)
QUIT
+13 SET GO=$PIECE(OREXT,";")_"^"_$PIECE(OREXT,";",2)
+14 if '$LENGTH($TEXT(@GO))
QUIT
+15 DO GET
+16 QUIT
GET ;
+1 NEW J,ORDT,ORDRGIEN,ORDRG,ORRXNO,ORSTAT,ORQTY,OREXP,ORISSUE,ORLAST,ORREF,ORPRVD,ORCOST,ORSIG,ORX0,ORX1
+2 NEW ECD,GMR,GMW,IX,PSOBEGIN,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE,ORI
+3 SET ORSITE=$$SITE^VASITE
SET ORSITE=$PIECE(ORSITE,"^",2)_";"_$PIECE(ORSITE,"^",3)
+4 SET PSOBEGIN=0
+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 ORDT=0
SET ORI=0
+10 FOR
SET ORDT=$ORDER(^TMP("PSOO",$JOB,"NVA",ORDT))
if (ORDT'>0)
QUIT
SET ORX0=$GET(^(ORDT,0))
IF ORX0'=""
SET ORX1=$GET(^(1,0))
Begin DoDot:1
+11 SET SITE=$SELECT($LENGTH($GET(^TMP("PSOO",$JOB,"NVA",ORDT,"facility"))):^("facility"),1:ORSITE)
+12 SET ORI=ORI+1
+13 ;Station ID
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",1)="1^"_SITE
+14 ;Herbal/OTC/Non VA Medication
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",2)="2^"_$PIECE(ORX0,U)
+15 ;Status
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",3)="3^"_$PIECE(ORX0,U,2)
+16 ;Start Date
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",4)="4^"_$$DATE^ORDVU($PIECE(ORX0,U,3))
+17 ;Date Documented
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",5)="5^"_$$DATE^ORDVU($PIECE(ORX0,U,5))
+18 ;Documented By
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",6)="6^"_$PIECE($PIECE(ORX0,U,6),";",2)
+19 ;Date DC'd
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",7)="7^"_$$DATE^ORDVU($PIECE(ORX0,U,7))
+20 ;SIG dose + route + schedule
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",8)="8^"_$PIECE(ORX1,U)_" "_$PIECE(ORX1,U,2)_" "_$PIECE(ORX1,U,3)
+21 SET J=0
+22 FOR
SET J=$ORDER(^TMP("PSOO",$JOB,"NVA",ORDT,"DSC",J))
if 'J
QUIT
SET X=^(J,0)
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",10,J)="10^"_X
+23 ;flag for detail
IF $ORDER(^TMP("PSOO",$JOB,"NVA",ORDT,"DSC",1))
SET ^TMP("ORDATA",$JOB,ORDT,ORI,"WP",9)="9^[+]"
End DoDot:1
+24 KILL ^TMP("PSOO",$JOB)
+25 SET ROOT=$NAME(^TMP("ORDATA",$JOB))
+26 QUIT