source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORDV06.m@ 1154

Last change on this file since 1154 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 6.1 KB
Line 
1ORDV06 ; slc/dkm - OE/RR Report Extracts ;10/8/03 11:17
2 ;;3.0;ORDER ENTRY RESULTS REPORTING;**109,118,167,208,215,274**;Dec 17, 1997;Build 20
3 ;Pharmacy Extracts
4RXA(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Active Outpatient Pharmacy
5 ;Call to PSOHCSUM
6 ;
7 I $L($T(GCPR^OMGCOAS1)) D ; Call if FHIE station 200
8 . N BEG,END,MAX
9 . S BEG=0,END=9999999,MAX=9999
10 . D GCPR^OMGCOAS1(DFN,"RXA",BEG,END,MAX)
11 ;
12 N ORRXSTAT,GO,PSOACT
13 Q:'$L(OREXT)
14 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
15 Q:'$L($T(@GO))
16 S PSOACT=1,ORRXSTAT="^ACTIVE^ACTIVE/SUSP^"
17 D GET
18 Q
19RXOP(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;All Outpatient Pharmacy
20 ;Call to PSOHCSUM
21 ;
22 I $L($T(GCPR^OMGCOAS1)) D ; Call if FHIE station 200
23 . N BEG,END,MAX
24 . S BEG=0,END=9999999,MAX=9999
25 . D GCPR^OMGCOAS1(DFN,"RXOP",BEG,END,MAX)
26 ;
27 N ORRXSTAT,GO
28 Q:'$L(OREXT)
29 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
30 Q:'$L($T(@GO))
31 S ORRXSTAT=""
32 D GET
33 Q
34GET N J,ORDT,ORI,ORDRGIEN,ORDRG,ORRXNO,ORSTAT,ORQTY,OREXP,ORISSUE,ORLAST,ORREF,ORPRVD,ORCOST,ORSIG
35 N ECD,GMR,GMW,IX,PSOBEGIN,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE
36 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
37 S PSOBEGIN=0
38 K ^TMP("ORDATA")
39 I '$L($T(GCPR^OMGCOAS1)) D
40 . K ^TMP("PSOO",$J)
41 . D @GO
42 S (ORDT,ORI)=0
43 F S ORDT=$O(^TMP("PSOO",$J,ORDT)) Q:(ORDT'>0) S ORX0=$G(^(ORDT,0)) I ORX0'="" D
44 . I $L(ORRXSTAT),ORRXSTAT'[(U_$P($P(ORX0,U,5),";",2)) Q ;Check status
45 . S ORI=ORI+1
46 . S SITE=$S($L($G(^TMP("PSOO",$J,ORDT,"facility"))):^("facility"),1:ORSITE)
47 . S ^TMP("ORDATA",$J,ORDT,"WP",1)="1^"_SITE ;Station ID
48 . S ^TMP("ORDATA",$J,ORDT,"WP",2)="2^"_$P($P(ORX0,U,3),";",2) ;Drug Name
49 . S ^TMP("ORDATA",$J,ORDT,"WP",3)="3^"_$P($P(ORX0,U,3),";") ;Drug IEN
50 . S ^TMP("ORDATA",$J,ORDT,"WP",4)="4^"_$P(ORX0,U,6) ;RX #
51 . S ^TMP("ORDATA",$J,ORDT,"WP",5)="5^"_$P($P(ORX0,U,5),";",2) ;Status
52 . S ^TMP("ORDATA",$J,ORDT,"WP",6)="6^"_$P(ORX0,U,7) ;Quantity
53 . S ^TMP("ORDATA",$J,ORDT,"WP",7)="7^"_$$DATE^ORDVU($P(ORX0,U,11)) ;Exp/Cancel Date
54 . S ^TMP("ORDATA",$J,ORDT,"WP",8)="8^"_$$DATE^ORDVU($P(ORX0,U)) ;Issue Date
55 . S ^TMP("ORDATA",$J,ORDT,"WP",9)="9^"_$$DATE^ORDVU($P(ORX0,U,2)) ;Last Fill Date
56 . S ^TMP("ORDATA",$J,ORDT,"WP",10)="10^"_$P(ORX0,U,8) ;#Refills
57 . S ^TMP("ORDATA",$J,ORDT,"WP",11)="11^"_$P($P(ORX0,U,4),";",2) ;Provider
58 . S ^TMP("ORDATA",$J,ORDT,"WP",12)="12^"_$P(ORX0,U,10) ;Cost-fill
59 . S ^TMP("ORDATA",$J,ORDT,"WP",15)="15^"_$P(ORX0,U,9) ;PharmID
60 . S ^TMP("ORDATA",$J,ORDT,"WP",16)="16^"_$P(ORX0,U,11) ;Order Number
61 . S J=0
62 . F S J=$O(^TMP("PSOO",$J,ORDT,J)) Q:'J S X=^(J,0),^TMP("ORDATA",$J,ORDT,"WP",14,J)="14^"_X
63 . I $O(^TMP("PSOO",$J,ORDT,1)) S ^TMP("ORDATA",$J,ORDT,"WP",13)="13^[+]" ;flag for detail
64 K ^TMP("PSOO",$J)
65 S ROOT=$NA(^TMP("ORDATA",$J))
66 Q
67RXAV(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ;Active IV Pharmacy
68 ;Call to ENHS^PSJEEU0
69 N ORIVSTAT,GO
70 Q:'$L(OREXT)
71 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
72 Q:'$L($T(@GO))
73 S ORIVSTAT="^ACTIVE^"
74 D GET1
75 Q
76RXIV(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ; All IV Pharmcy
77 ;Call to ENHS^PSJEEU0
78 N ORIVSTAT,GO
79 Q:'$L(OREXT)
80 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
81 Q:'$L($T(@GO))
82 S ORIVSTAT=""
83 D GET1
84 Q
85GET1 N ORDT,ORI,ORX0,ORIDRG,ORDRGIEN,ORDRG,ORDOSE,ORREC,ORSTAT,ORSTRTDT,ORSTOPDT,ORROUT,ORSIG,ORWII,ORMORE
86 N GMI,GMTSIDT,MAX,ON,PS,PSIVREA,PSJEDT,PSJNKF,PSJPFWD,TN,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE
87 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
88 S PSJEDT=1,PSJNKF=1
89 K ^TMP("ORDATA"),^UTILITY("PSG",$J),^UTILITY("PSIV",$J)
90 D @GO
91 S ORDT=-9999999,ORI=0
92 F S ORDT=$O(^UTILITY("PSIV",$J,ORDT)) Q:(ORDT="") S ORX0=$G(^(ORDT,0)) I ORX0'="" D
93 . I $L(ORIVSTAT),ORIVSTAT'[(U_$P($P(ORX0,U,4),";",2)_U) Q ;Check status
94 . S ORMORE=0,SITE=$S($L($G(^UTILITY("PSIV",$J,ORDT,"facility"))):^("facility"),1:ORSITE)
95 . S ^TMP("ORDATA",$J,ORDT,"WP",1)="1^"_SITE ;Station ID
96 . S ^TMP("ORDATA",$J,ORDT,"WP",2)="2^"_$$DATE^ORDVU($P(ORX0,U)) ;Start Date
97 . S ^TMP("ORDATA",$J,ORDT,"WP",3)="3^"_$$DATE^ORDVU($P(ORX0,U,2)) ;Stop Date
98 . S ^TMP("ORDATA",$J,ORDT,"WP",4)="4^"_$P(ORX0,U,5) ;Rate
99 . S ORIDRG=0
100 . F S ORIDRG=$O(^UTILITY("PSIV",$J,ORDT,"A",ORIDRG)) Q:'ORIDRG S ORREC=$G(^(ORIDRG)) S:ORIDRG>1 ORMORE=1 D ;Additives
101 .. S ^TMP("ORDATA",$J,ORDT,"WP",5,ORIDRG)="5^"_$P($P(ORREC,U),";",2)_" "_$P(ORREC,U,2) ;Additive Dose
102 . S ORIDRG=0
103 . F S ORIDRG=$O(^UTILITY("PSIV",$J,ORDT,"S",ORIDRG)) Q:'ORIDRG S ORREC=$G(^(ORIDRG)) S:ORIDRG>1 ORMORE=1 D ;Solutions
104 .. S ^TMP("ORDATA",$J,ORDT,"WP",6,ORIDRG)="6^"_$P($P(ORREC,U),";",2)_" "_$P(ORREC,U,2) ;Solution Dose
105 . I ORMORE S ^TMP("ORDATA",$J,ORDT,"WP",7)="7^[+]" ;flag for detail
106 K ^UTILITY("PSG",$J),^UTILITY("PSIV",$J)
107 S ROOT=$NA(^TMP("ORDATA",$J))
108 Q
109RXUD(ROOT,ORALPHA,OROMEGA,ORMAX,ORDBEG,ORDEND,OREXT) ; Get Unit Dose Pharmacy Component
110 ;Call to ENHS^PSJEEU0
111 N J,ORDT,ORI,ORX0,ORDRGIEN,ORDRG,ORDOSE,ORSTAT,ORSTRTDT,ORSTOPDT,ORROUT,ORSIG,GO
112 N GMI,IX,MAX,ON,PS,PSIVREA,PSJEDT,PSJNKF,PSJPFWD,GMR,TN,UDS,GMTSNDM,GMTS1,GMTS2,ORSITE,SITE
113 Q:'$L(OREXT)
114 S GO=$P(OREXT,";")_"^"_$P(OREXT,";",2)
115 Q:'$L($T(@GO))
116 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
117 S PSJEDT=1,PSJNKF=1
118 K ^TMP("ORDATA",$J),^UTILITY("PSG",$J),^UTILITY("PSIV",$J)
119 D @GO
120 S ORDT=-9999999,ORI=0
121 F S ORDT=$O(^UTILITY("PSG",$J,ORDT)) Q:(ORDT="") S ORX0=$G(^(ORDT)) I ORX0'="" D
122 . S SITE=$S($L($G(^UTILITY("PSG",$J,ORDT,"facility"))):^("facility"),1:ORSITE)
123 . S ^TMP("ORDATA",$J,ORDT,"WP",1)="1^"_SITE ;Station ID
124 . S ^TMP("ORDATA",$J,ORDT,"WP",2)="2^"_$P($P(ORX0,U,3),":") ;DRUG IEN
125 . S ^TMP("ORDATA",$J,ORDT,"WP",3)="3^"_$P($P(ORX0,U,3),";",2) ;Drug Name
126 . S ^TMP("ORDATA",$J,ORDT,"WP",4)="4^"_$P(ORX0,U,6) ;Dose
127 . S ^TMP("ORDATA",$J,ORDT,"WP",5)="5^"_$P($P(ORX0,U,5),";",2) ;Status
128 . S ^TMP("ORDATA",$J,ORDT,"WP",6)="6^"_$$DATE^ORDVU($P(ORX0,U)) ;START Date
129 . S ^TMP("ORDATA",$J,ORDT,"WP",7)="7^"_$$DATE^ORDVU($P(ORX0,U,2)) ;Stop Date
130 . S ^TMP("ORDATA",$J,ORDT,"WP",8)="8^"_$P($P(ORX0,U,7),";",3) ;Route
131 . S J=0,ORI=ORI+1
132 . F S J=$O(^UTILITY("PSG",$J,ORDT,J)) Q:'J S X=^(J,0),^TMP("ORDATA",$J,ORDT,"WP",10,J)="10^"_X ;SIG
133 . I $O(^UTILITY("PSG",$J,ORDT,1)) S ^TMP("ORDATA",$J,ORDT,"WP",9)="9^[+]" ;flag for detail
134 K ^UTILITY("PSG",$J),^UTILITY("PSIV",$J)
135 S ROOT=$NA(^TMP("ORDATA",$J))
136 Q
Note: See TracBrowser for help on using the repository browser.