source: FOIAVistA/trunk/r/BAR_CODE_MED_ADMIN-ALPB-PSB/PSBVT.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: 9.6 KB
Line 
1PSBVT ;BIRMINGHAM/EFC-BCMA ORDER VARIABLES UTILITY ; 8/4/05 8:05am
2 ;;3.0;BAR CODE MED ADMIN;**6,3,38**;Mar 2004;Build 8
3 ;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 ; Reference/IA
6 ; EN^PSJBCMA1/2829
7 ; ^TMP("PSJ",$J/2828
8 ;
9PSJ(PSBX1) ;
10 S ^TMP("TK PSJ",PSBX1)=""
11 S PSBSCRT="^TMP(""PSB"",$J,""PSBORDA"")"
12 K @PSBSCRT M @PSBSCRT=^TMP("PSJ",$J,PSBX1)
13 S PSBDFN=DFN
14 S PSBSCRT=$G(^TMP("PSB",$J,"PSBORDA",0))
15 S PSBON=+$P(PSBSCRT,U,3) ; ord num w/o type
16 S PSBONX=$P(PSBSCRT,U,3) ; ord num w/ type "U" or "V"
17 S PSBOTYP=$E(PSBONX,$L(PSBONX))
18 S PSBPONX=$P(PSBSCRT,U,4) ; prev ord num
19 S PSBFON=$P(PSBSCRT,U,5) ; foll ord num
20 S PSBIVT=$P(PSBSCRT,U,6) ; IV type
21 S PSBISYR=$P(PSBSCRT,U,7) ; intermit syrg
22 S PSBCHEMT=$P(PSBSCRT,U,8) ; chemo type
23 S PSBCPRS=$P(PSBSCRT,U,9) ; ords file entry (CPRS order #)
24 S PSBFOR=$P(PSBSCRT,U,10) ; reason for foll order
25 Q:PSBSCRT=-1
26 S PSBSCRT=$G(^TMP("PSB",$J,"PSBORDA",1))
27 S PSBMR=$P($G(^TMP("PSB",$J,"PSBORDA",1,0)),U,2) ;med rt
28 S PSBMRAB=$P(PSBSCRT,U,1) ;med rt abbr
29 S PSBNJECT=+$G(^TMP("PSB",$J,"PSBORDA",1,0)) ;Inj site
30 S PSBIVPSH=+$P($G(^TMP("PSB",$J,"PSBORDA",1,0)),U,3) ;IV PUSH
31 S PSBSCHT=$P(PSBSCRT,U,2) ; sched type conversion
32 S PSBSCH=$P(PSBSCRT,U,3) ; sched
33 S PSBOST=$P(PSBSCRT,U,4) ; strt dte FM
34 S PSBOSP=$P(PSBSCRT,U,5) ; stp dte FM
35 S PSBADST=$P(PSBSCRT,U,6) ; admin times strin in NNNN- format
36 S PSBOSTS=$P(PSBSCRT,U,7) ; status
37 S PSBNGF=$P(PSBSCRT,U,8) ; not to be given flag
38 S PSBOSCHT=$P(PSBSCRT,U,9) ; origin sched type
39 S PSBSCRT=$G(^TMP("PSB",$J,"PSBORDA",2))
40 S PSBDOSE=$P(PSBSCRT,U,1) ; dosage ordered
41 S PSBIFR=$P(PSBSCRT,U,2) ; infusn rate
42 S PSBSM=$P(PSBSCRT,U,3) ; self med
43 S PSBHSM=$P(PSBSCRT,U,4) ; hospital supplied self med
44 S PSBSCRT=$G(^TMP("PSB",$J,"PSBORDA",3))
45 S PSBOIT=$P(PSBSCRT,U,1) ; order item IEN - > ^ORD(101.43)
46 S PSBOITX=$P(PSBSCRT,U,2) ; order item (expanded)_" "_dosage form
47 I PSBOITX="" S PSBOITX="ZZZZ NO ORDERABLE ITEM"
48 S PSBDOSEF=$P(PSBSCRT,U,3) ; dosage form
49 S PSBSCRT=$G(^TMP("PSB",$J,"PSBORDA",4))
50 S PSBOTXT=PSBSCRT ; special inst/other print info
51 ; get disp drug
52 I $G(^TMP("PSB",$J,"PSBORDA",700,0)) F PSBX2=1:1:^TMP("PSB",$J,"PSBORDA",700,0) M PSBDDA(PSBX2)=^TMP("PSB",$J,"PSBORDA",700,PSBX2,0) S PSBDDA(PSBX2)="DD^"_PSBDDA(PSBX2) ; # of DDrug
53 ; "DD"^dispensed drug IEN -> ^PSDRUG() DRUG^dispensed drug name^units per dose^inactive date
54 ; build unique id list
55 ; add addits
56 I $D(^TMP("PSB",$J,"PSBORDA",800)) S PSBX2="" F S PSBX2=$O(^TMP("PSB",$J,"PSBORDA",800,PSBX2)) Q:PSBX2=""!(PSBX2="ERROR") D
57 .S PSBUIDA(PSBX2)="ID^"_PSBX2 F J=1:1:^TMP("PSB",$J,"PSBORDA",800,PSBX2,0) S PSBUIDA(PSBX2)=PSBUIDA(PSBX2)_"^"_"ADD;"_$P(^TMP("PSB",$J,"PSBORDA",800,PSBX2,J),U,1)
58 ; add solutions
59 I $D(^TMP("PSB",$J,"PSBORDA",900)) S PSBX2="" F S PSBX2=$O(^TMP("PSB",$J,"PSBORDA",900,PSBX2)) Q:PSBX2=""!(PSBX2="ERROR") D
60 .I '$D(PSBUIDA(PSBX2)) S PSBUIDA(PSBX2)="ID^"_PSBX2
61 .F J=1:1:^TMP("PSB",$J,"PSBORDA",900,PSBX2,0) S PSBUIDA(PSBX2)=PSBUIDA(PSBX2)_"^"_"SOL;"_$P(^TMP("PSB",$J,"PSBORDA",900,PSBX2,J),U,1)
62 ; "ID" ^ (piece 2,3,)... = type;IEN of each add/sol for this ID ex. "SOL;4"
63 ; get addits
64 I $G(^TMP("PSB",$J,"PSBORDA",850,0)) F PSBX2=1:1:^TMP("PSB",$J,"PSBORDA",850,0) D
65 .M PSBADA(PSBX2)=^TMP("PSB",$J,"PSBORDA",850,PSBX2,0) ; number od additives (exists only for IV)
66 .S PSBADA(PSBX2)="ADD^"_PSBADA(PSBX2)
67 .S PSBBAGS=$P(PSBADA(PSBX2),U,5) I PSBBAGS'="" S PSBBAG=" IN BAG "_$P(PSBBAGS,",",1) F I=2:1 S X=$P(PSBBAGS,",",I) Q:X="" S PSBBAG=PSBBAG_" AND "_X
68 .S:PSBBAGS'="" $P(PSBADA(PSBX2),U,5)=PSBBAG,$P(PSBADA(PSBX2),U,6)=PSBBAGS
69 ; "ADD"^additive IEN -> ^PS(52.6) IV ADDITIVES^additive name^strength ^bottle
70 ; get soluts
71 I $G(^TMP("PSB",$J,"PSBORDA",950,0)) F PSBX2=1:1:^TMP("PSB",$J,"PSBORDA",950,0) M PSBSOLA(PSBX2)=^TMP("PSB",$J,"PSBORDA",950,PSBX2,0) S PSBSOLA(PSBX2)="SOL^"_PSBSOLA(PSBX2) ; # of SOL
72 ; "SOL"^solution IEN -> ^PS(52.7) IV SOLUTIONS^solution name^volume
73 K ^TMP("PSB",$J,"PSBORDA"),PSBX1,PSBX2
74 Q
75 ;
76PSJ1(PSBPAR1,PSBPAR2) ; set the variables for an individual order
77 S ^TMP("TK PSJ1",PSBPAR1,PSBPAR2)=""
78 ; PSBPAR1 = DFN
79 ; PSBPAR2 = ORDNER NUMBER
80 S PSBSCRT="^TMP(""PSB"",$J,""PSBORDA"")"
81 K @PSBSCRT
82 N PSBX
83 K ^TMP("PSJ1",$J) D EN^PSJBCMA1(PSBPAR1,PSBPAR2,1)
84 M @PSBSCRT=^TMP("PSJ1",$J) K ^TMP("PSJ1",$J)
85 S PSBSCRT=$G(^TMP("PSB",$J,"PSBORDA",0))
86 S PSBDFN=PSBPAR1
87 S PSBON=+$P(PSBSCRT,U,3) ; ord num w/o type
88 S PSBONX=$P(PSBSCRT,U,3) ; ord num w/ type "U" or "V"
89 S PSBOTYP=$E(PSBONX,$L(PSBONX))
90 S PSBPONX=$P(PSBSCRT,U,4) ; prev ord num
91 S PSBFON=$P(PSBSCRT,U,5) ; foll ord num
92 S PSBIVT=$P(PSBSCRT,U,6) ; IV type
93 S PSBISYR=$P(PSBSCRT,U,7) ; intermit syrg
94 S PSBCHEMT=$P(PSBSCRT,U,8) ; chemo type
95 S PSBCPRS=$P(PSBSCRT,U,0) ; ord file entry (CPRS order #)
96 Q:PSBSCRT=-1
97 S PSBSCRT=$G(^TMP("PSB",$J,"PSBORDA",1))
98 S PSBMD=$P(PSBSCRT,U,1) ; prov IEN -> ^VA(200)
99 S PSBMDX=$P(PSBSCRT,U,2) ; prov name
100 S PSBMR=$P(PSBSCRT,U,3) ; med rt IEN -> ^PS(51.2)
101 I $G(PSBMR)'="" S PSBMR=$P(PSBSCRT,U,13) ;med rt
102 S PSBMRAB=$P(PSBSCRT,U,4) ;med rt abbr
103 S PSBNJECT=+$G(^TMP("PSB",$J,"PSBORDA",1,0)) ;Inj site
104 S PSBIVPSH=+$P($G(^TMP("PSB",$J,"PSBORDA",1,0)),U,2) ;IV PUSH
105 S PSBSM=$P(PSBSCRT,U,5) ; self med
106 S PSBSMX=$P(PSBSCRT,U,6) ; expnd to YES/NO
107 S PSBHSM=$P(PSBSCRT,U,7) ; hospital supplied self med
108 S PSBHSMX=$P(PSBSCRT,U,8) ; expnd to YES/NO
109 S PSBNGF=$P(PSBSCRT,U,9) ; not to be given flag
110 S PSBOSTS=$P(PSBSCRT,U,10) ; ord status
111 S PSBOSTSX=$P(PSBSCRT,U,11) ; ord status expans
112 S PSBSCRT=$G(^TMP("PSB",$J,"PSBORDA",2))
113 S PSBOIT=$P(PSBSCRT,U,1) ; orderable item IEN -> ^ORD(101.43) ORDERABLE ITEM
114 S PSBOITX=$P(PSBSCRT,U,2) ; orderable item (expaned)_" "_ dosage form
115 I PSBOITX="" S PSBOITX="ZZZZ NO ORDERABLE ITEM"
116 S PSBDOSE=$P(PSBSCRT,U,3) ; dosage ordered
117 S PSBIFR=$P(PSBSCRT,U,4) ; infusion rate
118 S PSBSCH=$P(PSBSCRT,U,5) ; sched
119 S PSBDOSEF=$P(PSBSCRT,U,6) ; dosage form
120 S PSBSCRT=$G(^TMP("PSB",$J,"PSBORDA",3))
121 S PSBOTXT=$P(PSBSCRT,U,1) ; UD special inst or IV other print info
122 S PSBSCRT=$G(^TMP("PSB",$J,"PSBORDA",4))
123 S PSBSCHT=$P(PSBSCRT,U,1) ; sched type conversion
124 S PSBSCHTX=$P(PSBSCRT,U,2) ; sched type expansion
125 S PSBLDT=$P(PSBSCRT,U,3) ; log-in date FM
126 S PSBLDTX=$P(PSBSCRT,U,4) ; exp MM/DD/YYYY HH:MM
127 S PSBOST=$P(PSBSCRT,U,5) ; start date FM
128 S PSBOSTX=$P(PSBSCRT,U,6) ; exp MM/DD/YYYY HH:MM
129 S PSBOSP=$P(PSBSCRT,U,7) ; stop date FM
130 S PSBOSPX=$P(PSBSCRT,U,8) ; exp MM/DD/YYYY HH:MM
131 S PSBADST=$P(PSBSCRT,U,9) ; admin times string in NNNN- format
132 S PSBOSCHT=$P(PSBSCRT,U,10) ; original schedule type
133 S PSBFREQ=$P(PSBSCRT,U,11) ; frequency
134 S PSBSCRT=$G(^TMP("PSB",$J,"PSBORDA",5))
135 S PSBVN=$P(PSBSCRT,U,1) ; verify nurse IEN -> ^VA(200)
136 S PSBVNX=$P(PSBSCRT,U,2) ; nurse name
137 S PSBVNI=$P(PSBSCRT,U,3) ; nurse initials
138 S PSBVPH=$P(PSBSCRT,U,4) ; verify pharm IEN -> ^VA(200)
139 S PSBVPHX=$P(PSBSCRT,U,5) ; pharm name
140 S PSBVPHI=$P(PSBSCRT,U,6) ; pharm initials
141 S PSBSCRT=$G(^TMP("PSB",$J,"PSBORDA",6))
142 S PSBRMRK=$G(PSBSCRT)
143 ;If DayOFWeek set frequen to NULL
144 I $$PSBDCHK1^PSBVT1(PSBSCH) S PSBFREQ=""
145 ; get dispensed drug
146 I $G(^TMP("PSB",$J,"PSBORDA",700,0)) F PSBX=1:1:^TMP("PSB",$J,"PSBORDA",700,0) M PSBDDA(PSBX)=^TMP("PSB",$J,"PSBORDA",700,PSBX,0) S PSBDDA(PSBX)="DD^"_PSBDDA(PSBX) ; # of DDrug
147 ; "DD"^dispensed drug IEN -> ^PSDRUG() DRUG^dispensed drug name^units per dose^inactive date
148 ; build unique id list
149 ; add addits
150 I $D(^TMP("PSB",$J,"PSBORDA",800)) S PSBX2="" F S PSBX2=$O(^TMP("PSB",$J,"PSBORDA",800,PSBX2)) Q:PSBX2=""!(PSBX2="ERROR") D
151 .S PSBUIDA(PSBX2)="ID^"_PSBX2 F J=1:1:^TMP("PSB",$J,"PSBORDA",800,PSBX2,0) S PSBUIDA(PSBX2)=PSBUIDA(PSBX2)_"^"_"ADD;"_$P(^TMP("PSB",$J,"PSBORDA",800,PSBX2,J),U,1)
152 ; add soluts
153 I $D(^TMP("PSB",$J,"PSBORDA",900)) S PSBX2="" F S PSBX2=$O(^TMP("PSB",$J,"PSBORDA",900,PSBX2)) Q:PSBX2=""!(PSBX2="ERROR") D
154 .I '$D(PSBUIDA(PSBX2)) S PSBUIDA(PSBX2)="ID^"_PSBX2
155 .F J=1:1:^TMP("PSB",$J,"PSBORDA",900,PSBX2,0) S PSBUIDA(PSBX2)=PSBUIDA(PSBX2)_"^"_"SOL;"_$P(^TMP("PSB",$J,"PSBORDA",900,PSBX2,J),U,1)
156 ; "ID" ^ (piece 2,3),... = type;IEN of each add/sol for this ID ex. "SOL;4"
157 ; get addits
158 I $G(^TMP("PSB",$J,"PSBORDA",850,0)) F PSBX=1:1:^TMP("PSB",$J,"PSBORDA",850,0) D
159 .M PSBADA(PSBX)=^TMP("PSB",$J,"PSBORDA",850,PSBX,0) ; num of addits
160 .S PSBADA(PSBX)="ADD^"_PSBADA(PSBX)
161 .S PSBBAGS=$P(PSBADA(PSBX),U,5) I PSBBAGS'="" S PSBBAG=" IN BAG "_$P(PSBBAGS,",",1) D
162 ..F I=2:1 S X=$P(PSBBAGS,",",I) Q:X="" S PSBBAG=PSBBAG_" AND "_X
163 .S:PSBBAGS'="" $P(PSBADA(PSBX),U,5)=PSBBAG
164 ; "ADD"^additive IEN -> ^PS(52.6) IV ADDITIVES^additive name^strength^bottle
165 ; get soluts
166 I $G(^TMP("PSB",$J,"PSBORDA",950,0)) F PSBX=1:1:^TMP("PSB",$J,"PSBORDA",950,0) M PSBSOLA(PSBX)=^TMP("PSB",$J,"PSBORDA",950,PSBX,0) S PSBSOLA(PSBX)="SOL^"_PSBSOLA(PSBX) ; # of SOLs
167 ; "SOL" ^ solution IEN -> ^PS(52.7) IV SOLUTIONS^solution name^volume
168 ; get label
169 I $D(^TMP("PSB",$J,"PSBORDA",1000)) M PSBLBLA=^TMP("PSB",$J,"PSBORDA",1000)
170 K ^TMP("PSB",$J,"PSBORDA")
171 Q
172 ;
173LACTION ; get last action info
174 S (PSBLADT,PSBLAIEN,PSBLASTS)=""
175 I '$D(^PSB(53.79,"AORDX",PSBDFN,PSBONX)) Q
176 S PSBLADT=$O(^PSB(53.79,"AORDX",PSBDFN,PSBONX,""),-1)
177 S PSBLAIEN=$O(^PSB(53.79,"AORDX",PSBDFN,PSBONX,PSBLADT,""))
178 S PSBLASTS=$P(^PSB(53.79,PSBLAIEN,0),U,9)
179 Q
180 ;
181CLEAN ;
182 K PSBONX,PSBPONX,PSBFON,PSBOTYP,PSBIVT,PSBISYR,PSBCHEMT,PSBMD,PSBMDX,PSBMR,PSBMRAB,PSBSM,PSBSMX,PSBHSM,PSBHSMX
183 K PSBDFN,PSBNGF,PSBOSTS,PSBOSTSX,PSBOIT,PSBOITX,PSBDOSE,PSBIFR,PSBSCH,PSBDOSEF,PSBOTXT,PSBSCHT,PSBSCHTX
184 K PSBLDT,PSBLDTX,PSBOST,PSBOSTX,PSBOSP,PSBOSPX,PSBADST,PSBOSCHT,PSBFREQ,PSBVN,PSBVNX,PSBVNI
185 K PSBVPH,PSBVPHX,PSBVPHI,PSBDDA,PSBADA,PSBSOLA,PSBUIDA,PSBCPRS,PSBON,PSBRMRK,PSBNJECT,PSBIVPSH
186 K PSBLADT,PSBLAIEN,PSBLASTS,PSBBAG,PSBBAGS,PSBLBLA,PSBFOR,PSBSCRT
187 Q
Note: See TracBrowser for help on using the repository browser.