source: FOIAVistA/trunk/r/BAR_CODE_MED_ADMIN-ALPB-PSB/PSBOCM1.m@ 1755

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

initial load of FOIAVistA 6/30/08 version

File size: 4.4 KB
Line 
1PSBOCM1 ;BIRMINGHAM/TEJ-COVERSHEET MEDICATION OVERVIEW REPORT ;Mar 2004
2 ;;3.0;BAR CODE MED ADMIN;**32**;Mar 2004;Build 32
3 ;Per VHA Directive 2004-038 (or future revisions regarding same), this routine should not be modified.
4 ;
5BUILDLN ; Constr recs
6 K J S J(0)="" F PSBFLD=1:1:8 S J=1 D FORMDAT(PSBFLD) S J($O(PSBRPLN(""),-1))=""
7 ; Write administration info...
8 Q:'PSBXFLG
9 S J=($O(J(""),-1)+1),PSBRPLN(J)=PSBBLANK,J(J)="",J=J+1
10 S (N,Y)="",J=($O(J(""),-1)+1)
11 F S Y=$O(PSBADM(PSBX2X,Y)) Q:Y']"" D
12 .F S N=$O(PSBADM(PSBX2X,Y,N)) Q:N']"" D
13 ..I $D(PSBBID(PSBX2X,$P(N,U,2))) S PSBDATA(2,0)="BAG ID: "_PSBBID(PSBX2X,$P(N,U,2))
14 ..S $E(PSBDATA(2,0),25)="ACTION BY: "_$P(PSBADM(PSBX2X,Y,N),U,7)_" "_$$FMTDT^PSBOCE1($E($P(PSBADM(PSBX2X,Y,N),U,6),1,12))
15 ..S X=$P(PSBADM(PSBX2X,Y,N),U,5) S $E(PSBDATA(2,0),56)="ACTION: "_$S(X="G":"GIVEN",X="R":"REFUSED",X="RM":"REMOVED",X="H":"HELD",X="S":"STOPPED",X="I":"INFUSING",X="C":"COMPLETED",X="M":"MISSING DOSE",X=" ":"*UNKNOWN*",1:" ")
16 ..I $D(PSBPRNR(PSBX2X)) S $E(PSBDATA(2,0),72)="PRN REASON: "_PSBPRNR(PSBX2X,$P(N,U,2))
17 ..I $G(PSBDATA(2,0))]" " D WRAPPER(1,132-1,PSBDATA(2,0)) K PSBDATA(2) S J=J+1
18 ..I $D(PSBPRNEF(PSBX2X,$P(N,U,2))) S PSBDATA(2,0)="PRN EFFECTIVENESS: "_PSBPRNEF(PSBX2X,$P(N,U,2))
19 ..I $G(PSBDATA(2,0))]" " D WRAPPER(30,132-30,PSBDATA(2,0)) K PSBDATA(2) S J=J+1
20 ..I ('PSBCFLG)!('$D(PSBCMT(PSBX2X,$P(N,U,2)))) S PSBRPLN(J)=PSBBLANK,J(J)="",J=J+1 Q
21 ..S X="" F S X=$O(PSBCMT(PSBX2X,$P(N,U,2),X)) Q:X']"" D
22 ...S PSBDATA(2,0)="COMMENT BY: "_$S($P(PSBCMT(PSBX2X,$P(N,U,2),X),U,5)]"":$P(PSBCMT(PSBX2X,$P(N,U,2),X),U,5)_" "_$$FMTDT^PSBOCE1($E($P(PSBCMT(PSBX2X,$P(N,U,2),X),U,6),1,12)),1:" n/a ")
23 ...S PSBDATA(2,0)=PSBDATA(2,0)_" COMMENT: "_$S($P(PSBCMT(PSBX2X,$P(N,U,2),X),U,2)]"":$P(PSBCMT(PSBX2X,$P(N,U,2),X),U,2),1:" ")
24 ...I $G(PSBDATA(2,0))]" " D WRAPPER(30,132-30,PSBDATA(2,0)) K PSBDATA(2) S J=J+1
25 ..S PSBRPLN(J)=PSBBLANK,J(J)="",J=J+1
26 Q
27FORMDAT(FLD) ;
28 K PSBVAL
29 Q:'$D(PSBDATA(1,FLD))
30 S PSBVAL=PSBDATA(1,FLD)
31 D WRAPPER(@("PSBTAB"_(FLD-1))+1,((@("PSBTAB"_(FLD))-(@("PSBTAB"_(FLD-1))+1))),PSBVAL)
32 I FLD=4 S J=$O(J(""),-1)+1,PSBVAL=PSBDATA(1,4,0) D WRAPPER(@("PSBTAB"_(FLD-1))+1,((@("PSBTAB"_(FLD))-(@("PSBTAB"_(FLD-1))+1))),PSBVAL)
33 Q
34WRAPPER(X,Y,Z) ; Text WRAP
35 N PSB
36 I ($L(Z)>0),$F(Z,"""")>1 F Q:$F(Z,"""")'>1 S Z=$TR(Z,"""","^")
37 F Q:'$L(Z) D
38 .I $L(Z)<Y S $E(PSBRPLN(J),X)=Z S Z="" D Q
39 ..I $L(PSBRPLN(J),"^")>1 F X=1:1:$L(PSBRPLN(J),"^")-1 S $P(PSBRPLN(J),"^",X)=$P(PSBRPLN(J),"^",X)_""""
40 ..S PSBRPLN(J)=$TR(PSBRPLN(J),"^","""")
41 .F PSB=Y:-1:0 Q:($E(Z,PSB)=" ") Q:($E(Z,PSB)="-")
42 .S:PSB<1 PSB=Y
43 .S $E(PSBRPLN(J),X)=$E(Z,1,PSB)
44 .S Z=$E(Z,PSB+1,250)
45 .I $L(PSBRPLN(J),"^")>1 F X=1:1:$L(PSBRPLN(J),"^")-1 S $P(PSBRPLN(J),"^",X)=$P(PSBRPLN(J),"^",X)_""""
46 .S PSBRPLN(J)=$TR(PSBRPLN(J),"^","""")
47 .S J=J+1,J(J)=""
48 Q ""
49CREATHDR ;
50 K PSBHD1,PSBHD2
51 I IOM'<132 S PSBHD1=$P($T(HD132A),"~",2),PSBHD2=$P($T(HD132B),";",2),PSBBLANK=$P($T(C132BLK),";",2)
52 E S PSBHD1="THIS REPORT SUPPORTS >131 CHAR./LINE PRINT FORMATS ONLY" Q
53 ; reset tabs
54 S PSBTAB0=1 F PSBI=0:1:($L(PSBHD1,"|")-1) S:PSBI>0 @("PSBTAB"_PSBI)=($F(PSBHD1,"|",@("PSBTAB"_(PSBI-1))+1))-1
55 S PSBPGNUM=1
56 D HDR
57 Q
58HD132A ;~VDL | Order |Type| Medication; Dosage, Route | Schedule | Next Action | Order Start | Order Stop |
59 Q
60HD132B ;Tab | Status | | | | | Date | Date |
61 Q
62C132BLK ;;
63 Q
64WRTRPT ; writ
65 I $O(PSBOUTP(""),-1)<1 D Q
66 .X PSBOUTP($O(PSBOUTP(""),-1),14)
67 .D FTR
68 S PSBPGNUM=1
69 S PSBZ="" F S PSBZ=$O(PSBOUTP(PSBZ)) Q:PSBZ="" D
70 .I PSBPGNUM'=PSBZ D FTR S PSBPGNUM=PSBZ D HDR,SUBHDR^PSBOCE
71 .S PSBX2X="" F S PSBX2X=$O(PSBOUTP(PSBZ,PSBX2X)) Q:PSBX2X="" D
72 ..X PSBOUTP(PSBZ,PSBX2X)
73 D FTR
74 K ^XTMP("PSBO",$J,"PSBLIST"),PSBOUTP
75 Q
76HDR ; Header
77 W:$Y>1 @IOF
78 W:$X>1 !
79 S PSBRPNM="BCMA COVERSHEET MEDICATION OVERVIEW REPORT"
80 D:$P(PSBRPT(.1),U,1)="P"
81 .S PSBHDR(0)=PSBRPNM
82 .S PSBHDR(1)="Order Status(es): --"
83 .F Y=4,5,7,8 I $P(PSBFUTR,U,Y) S $P(PSBHDR(1),": ",2)=$P(PSBHDR(1),": ",2)_$S(PSBHDR(1)["--":"",1:"/ ")_$P("^^^Future^Active^^Expired^DC'd^^^^^^^^^^",U,Y)_" " S PSBHDR(1)=$TR(PSBHDR(1),"-","")
84 .I $P(PSBFUTR,U,11) S PSBHDR(2)="Include Action(s)"_$S(PSBCFLG:" & Comments/Reasons",1:"")
85 .D PT^PSBOHDR(PSBXDFN,.PSBHDR)
86 Q
87FTR ; Fter
88 D PTFTR^PSBOHDR()
89 S PSBPG="Page: "_PSBPGNUM_" of "_$S($O(PSBOUTP(""),-1)=0:1,1:$O(PSBOUTP(""),-1))
90 S PSBPGRM=PSBTAB8-($L(PSBPG))
91 W !,PSBRPNM," ",?(PSBPGRM-($L(PSBDTTM)+3)),PSBDTTM_" "_PSBPG
92 Q
Note: See TracBrowser for help on using the repository browser.