source: FOIAVistA/trunk/r/BAR_CODE_MED_ADMIN-ALPB-PSB/PSBOML.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: 5.3 KB
Line 
1PSBOML ;BIRMINGHAM/EFC-MEDICATION LOG ;Mar 2004
2 ;;3.0;BAR CODE MED ADMIN;**3,11**;Mar 2004
3 ;
4 ; Reference/IA
5 ; ^DPT/10035
6 ;
7 ;
8EN ; Begin printing
9 N PSBSTRT,PSBSTOP,PSBHDR,DFN
10 S PSBSTRT=$P(PSBRPT(.1),U,6)+$P(PSBRPT(.1),U,7)
11 S PSBSTOP=$P(PSBRPT(.1),U,8)+$P(PSBRPT(.1),U,9)
12 S PSBAUDF=$P(PSBRPT(.2),U,9)
13 S PSBHDR(0)="Medication Log Report"
14 S PSBHDR(1)="Continuing/PRN/Stat/One Time Medication/Treatment Record (Detailed Log) (VAF 10-2970 B, C, D)"
15 ;
16 ; Patient Report
17 ;
18 D:$P(PSBRPT(.1),U,1)="P"
19 .S PSBHDR(2)="Log Type: INDIVIDUAL PATIENT"
20 .S DFN=+$P(PSBRPT(.1),U,2)
21 .W $$PTHDR()
22 .S X=$O(^PSB(53.79,"AADT",DFN,PSBSTRT-.0000001))
23 .I X>PSBSTOP!(X="") W !!?10,"<<<< NO MEDICATIONS FOUND FOR THIS TIME FRAME >>>>",!! Q
24 .S PSBGBL=$NAME(^PSB(53.79,"AADT",DFN,PSBSTRT-.0000001))
25 .F S PSBGBL=$Q(@PSBGBL) Q:PSBGBL="" Q:$QS(PSBGBL,2)'="AADT"!($QS(PSBGBL,3)'=DFN)!($QS(PSBGBL,4)>PSBSTOP) D
26 ..S PSBIEN=$QS(PSBGBL,5) Q:'$D(^PSB(53.79,PSBIEN))
27 ..I $P(^PSB(53.79,PSBIEN,0),U,6)'=$QS(PSBGBL,4) Q
28 ..I $Y>(IOSL-10) W $$PTFTR^PSBOHDR(),$$PTHDR()
29 ..W $$LINE(PSBIEN)
30 .W $$PTFTR^PSBOHDR()
31 ;
32 ; Ward Output
33 ;
34 D:$P(PSBRPT(.1),U,1)="W"
35 .S PSBHDR(2)="LOG TYPE: WARD"
36 .W $$WDHDR(PSBWRD)
37 .S PSBTMPG=$NAME(^TMP("PSBO",$J,"B"))
38 .F S PSBTMPG=$Q(@PSBTMPG) Q:PSBTMPG="" Q:$QS(PSBTMPG,1)'="PSBO"!($QS(PSBTMPG,2)'=$J) D
39 ..S DFN=$QS(PSBTMPG,5)
40 ..I $Y>(IOSL-14) W $$WDHDR(PSBWRD)
41 ..W !,$P(^DPT(DFN,0),U)," (",$P(^(0),U,9),")"
42 ..W !,"Ward: ",$G(^DPT(DFN,.1),"***")," Rm-Bed: ",$G(^DPT(DFN,.101),"***"),!
43 ..S X=$O(^PSB(53.79,"AADT",DFN,PSBSTRT-.0000001))
44 ..I X>PSBSTOP!(X="") W !!?10,"<<<< NO MEDICATIONS FOUND FOR THIS TIME FRAME >>>>",!! Q
45 ..S PSBGBL=$NAME(^PSB(53.79,"AADT",DFN,PSBSTRT-.0000001))
46 ..F S PSBGBL=$Q(@PSBGBL) Q:PSBGBL="" Q:$QS(PSBGBL,2)'="AADT"!($QS(PSBGBL,3)'=DFN)!($QS(PSBGBL,4)>PSBSTOP) D
47 ...S PSBIEN=$QS(PSBGBL,5) I $P(^PSB(53.79,PSBIEN,0),U,6)'=$QS(PSBGBL,4) Q
48 ...W:$Y>(IOSL-10) $$WDHDR(PSBWRD)
49 ...W $$LINE(PSBIEN)
50 Q
51 ;
52LINE(PSBIEN) ; Displays the med log entry in PSBIEN
53 N PSBX,PSBASTUS
54 S X=$P($G(^PSB(53.79,PSBIEN,.1)),U)
55 I X="" W !,"Error: Med Log Entry ",PSBIEN," has no order reference number!" Q ""
56 I 'PSBAUDF,$P(^PSB(53.79,PSBIEN,0),U,9)="N" Q ""
57 D CLEAN^PSBVT
58 D PSJ1^PSBVT(DFN,X)
59 I PSBDFN="-1" W !,"Error: Inpatient Meds API Failure!" Q ""
60 M PSBX=^PSB(53.79,PSBIEN)
61 S Y=$P(PSBX(0),U,4)+.0000001
62 W !,$E(Y,4,5),"/",$E(Y,6,7),"/",$E(Y,2,3)
63 W " ",$E(Y,9,10),":",$E(Y,11,12)
64 S Y=$$GET1^DIQ(53.79,PSBIEN_",",.08)
65 S Y=Y_" ["_PSBDOSE_PSBIFR_" "_PSBSCH
66 S Y=Y_" "_PSBMRAB
67 S:$P($G(^PSB(53.79,PSBIEN,.1)),U,6)]"" Y=Y_" Inj Site: "_$P(^(.1),U,6)
68 S Y=Y_"]"
69 W $$WRAP^PSBO(16,32,Y)
70 W ?50,$$GET1^DIQ(53.79,PSBIEN_",","ACTION BY:INITIAL")
71 S X=$P(PSBX(0),U,9)
72 S PSBASTUS=$S(X="G":"Given",X="H":"Held",X="R":"Refused",X="I":"Infusing",X="C":"Completed",X="S":"Stopped",X="N":"Not Given",X="RM":"Removed",X="M":"Missing dose",1:"Status Unknown")
73 S Y=$P(PSBX(0),U,6)+.0000001
74 S Y=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3)_" "_$E(Y,9,10)_":"_$E(Y,11,12)
75 S Y=Y_" "_PSBASTUS
76 W $$WRAP^PSBO(57,15,Y)
77 W:$P(PSBX(.1),U)["V" ?75,"Bag ID #",$$GET1^DIQ(53.79,PSBIEN,"IV UNIQUE ID")
78 W:$P(PSBX(.1),U)["V" ?107,"NA",?115,"NA",?120,"NA"
79 W !,$TR($$FMTE^XLFDT(PSBOST,2),"@"," ")_">"
80 F PSBZ=.5,.6,.7 S PSBDHIT=0 F PSBY=0:0 S PSBY=$O(PSBX(PSBZ,PSBY)) Q:'PSBY D
81 .W:$X>75 !
82 .S PSBDD=$S(PSBZ=.5:53.795,PSBZ=.6:53.796,1:53.797)
83 .S Y=$$EXTERNAL^DILFD(PSBDD,.01,"",$P(PSBX(PSBZ,PSBY,0),U,1))
84 .W $$WRAP^PSBO(75,28,Y)
85 .I $P(PSBX(.1),U)["U" W ?105,$J($P(PSBX(PSBZ,PSBY,0),U,2),6,2),?113,$J($P(PSBX(PSBZ,PSBY,0),U,3),6,2) W $$WRAP^PSBO(120,12,$P(PSBX(PSBZ,PSBY,0),U,4)) S PSBDHIT=1
86 .W:$P(PSBX(.1),U)["V"&($X+3+$L($P(PSBX(PSBZ,PSBY,0),U,3))>105) !?75
87 .W:$P(PSBX(.1),U)["V" " - ",$P(PSBX(PSBZ,PSBY,0),U,3)
88 D:$P($G(^PSB(53.79,PSBIEN,.1)),U,2)="P"
89 .W !?16,"PRN Reason: ",?30,$$GET1^DIQ(53.79,PSBIEN_",",.21)
90 .W !?16,"PRN Effectiveness: "
91 .I $P($G(^PSB(53.79,PSBIEN,.2)),U,2)="" W "<No PRN Effectiveness Entered>" Q
92 .W $$WRAP^PSBO(20,100,$$GET1^DIQ(53.79,PSBIEN_",",.22))
93 .W !?20,"Entered By: ",$$GET1^DIQ(53.79,PSBIEN_",",.23)
94 .W " Date/Time: ",$$GET1^DIQ(53.79,PSBIEN_",",.24)
95 .W " Minutes: ",$$GET1^DIQ(53.79,PSBIEN_",",.25)
96 D:$P(PSBRPT(.2),U,8)
97 .W !?16,"Comments: ",?30 I '$O(PSBX(.3,0)) W "<No Comments>"
98 .F PSBY=0:0 S PSBY=$O(PSBX(.3,PSBY)) Q:'PSBY D
99 ..W:$X>30 !?30
100 ..S Y=$P(PSBX(.3,PSBY,0),U,3)+.0000001
101 ..W $E(Y,4,5),"/",$E(Y,6,7),"/",$E(Y,2,3)
102 ..W " ",$E(Y,9,10),":",$E(Y,11,12)
103 ..W ?46,$$GET1^DIQ(53.793,PSBY_","_PSBIEN_",","ENTERED BY:INITIAL")
104 ..W $$WRAP^PSBO(52,70,$P(PSBX(.3,PSBY,0),U,1))
105 W !,$TR($$FMTE^XLFDT(PSBOSP,2),"@"," ")_"<"
106 D:PSBAUDF
107 .W !?16,"Audits: ",?30 I '$O(PSBX(.9,0)) W "<No Audits>" Q
108 .F PSBY=0:0 S PSBY=$O(PSBX(.9,PSBY)) Q:'PSBY D
109 ..W:$X>30 !?30
110 ..S Y=$P(PSBX(.9,PSBY,0),U,1)+.0000001
111 ..W $E(Y,4,5),"/",$E(Y,6,7),"/",$E(Y,2,3)
112 ..W " ",$E(Y,9,10),":",$E(Y,11,12)
113 ..W ?46,$$GET1^DIQ(53.799,PSBY_","_PSBIEN_",","USER:INITIAL")
114 ..W $$WRAP^PSBO(52,70,$P(PSBX(.9,PSBY,0),U,3))
115 W !,$TR($J("",IOM)," ","-")
116 Q ""
117 ;
118WDHDR(PSBWARD) ;
119 D WARD^PSBOHDR(PSBWARD,.PSBHDR)
120 W $$SUB()
121 Q ""
122 ;
123PTHDR() ;
124 D PT^PSBOHDR(DFN,.PSBHDR)
125 W $$SUB()
126 Q ""
127 ;
128SUB() ; Med Log Sub Header
129 W:$X>1 !
130 W "Activity Date",?16,"Orderable Item",?50,"Action",?57,"Action"
131 W !,"Start Date>",?16,"[Dose/Sched/Route/Inj Site]",?50,"By"
132 W ?57,"Date/Time",?75,"Drug/Additive/Solution",?105," U/Ord"
133 W ?113," U/Gvn",?120,"Unit",!,"Stop Date<"
134 W !,$TR($J("",IOM)," ","-")
135 Q ""
136 ;
Note: See TracBrowser for help on using the repository browser.