source: FOIAVistA/trunk/r/BAR_CODE_MED_ADMIN-ALPB-PSB/ALPBFRMU.m@ 1751

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

initial load of FOIAVistA 6/30/08 version

File size: 3.8 KB
Line 
1ALPBFRMU ;OIFO-DALLAS MW,SED,KC-PRINT FORMATTING UTILITIES;01/01/03
2 ;;3.0;BAR CODE MED ADMIN;**8**;Mar 2004
3 ;
4FTEXT(COL,TEXT,RESULTS) ; format TEXT array...
5 ; COL = number of columns (line length)
6 ; TEXT = array to be reformatted. the array should be in
7 ; standard FM format: TEXT(1,0)=text
8 ; TEXT(2,0)=text
9 ; TEXT(n,0)=text
10 ; RESULT = array passed by reference into which reformatted text
11 ; will be returned: RESULTS(1,0)=formatted text to COL length
12 ; RESULTS(2,0)=formatted text to COL length
13 I +$G(COL)=0!('$D(TEXT)) Q
14 N ALPBTEMP,I,J,L,M,FSTRING,XSTRING
15 S (I,J)=0
16 S XSTRING=""
17 F S I=$O(TEXT(I)) Q:'I D
18 .S DATA=$G(TEXT(I,0))
19 .I DATA="" D Q
20 ..S J=J+1
21 ..S ALPBTEMP(J,0)=""
22 .F L=1:1:$L(DATA) D
23 ..S XSTRING=XSTRING_$E(DATA,L)
24 ..I $L(XSTRING)=COL D
25 ...S FSTRING=XSTRING
26 ...F M=$L(XSTRING):-1:1 Q:$A($E(XSTRING,M))'>32
27 ...S FSTRING=$E(XSTRING,1,M-1)
28 ...S XSTRING=$E(XSTRING,M+1,$L(XSTRING))
29 ...S J=J+1
30 ...S ALPBTEMP(J,0)=FSTRING
31 ...S FSTRING=""
32 ...I $L(XSTRING)=COL S XSTRING=""
33 I $L(XSTRING)>0 D
34 .S J=J+1
35 .S ALPBTEMP(J,0)=XSTRING
36 M RESULTS=ALPBTEMP
37 Q
38 ;
39HDR(DATA,PG,RESULTS) ; print page header...
40 ; DATA = an array passed by reference containing the nodes in
41 ; a patient's record in ^ALPB(53.7,...)
42 ; PG = page number to use
43 ; RESULTS = an array passed by reference that will be used to return
44 ; the formated data
45 ; returns data in formated 132-column output
46 N ALPBALG,ALPBALGL,ALPBALGX,ALPBX,LINE
47 I $G(PG)="" S PG=0
48 S RESULTS(1)="MAR Ran: "_$$FMTE^XLFDT($$NOW^XLFDT())
49 S RESULTS(1)=$$PAD^ALPBUTL(RESULTS(1),32)_"Inpatient Pharmacy Orders (Backup)"
50 S RESULTS(1)=$$PAD^ALPBUTL(RESULTS(1),122)_"Page: "_$J(PG,3)
51 S RESULTS(2)=$P($G(DATA(0)),"^")
52 S RESULTS(2)=$$PAD^ALPBUTL(RESULTS(2),33)_"SSN: "_$P($G(DATA(0)),"^",2)
53 S RESULTS(2)=$$PAD^ALPBUTL(RESULTS(2),50)_"DOB: "_$S($P($G(DATA(0)),"^",3)'="":$$FMTE^XLFDT($P(DATA(0),"^",3)),1:"not on file")
54 S RESULTS(2)=$$PAD^ALPBUTL(RESULTS(2),70)_"Sex: "_$P($G(DATA(0)),"^",4)
55 S RESULTS(3)="Ward: "_$P($G(DATA(0)),"^",5)
56 S RESULTS(3)=$$PAD^ALPBUTL(RESULTS(3),32)_"Room: "_$P($G(DATA(0)),"^",6)
57 S RESULTS(3)=$$PAD^ALPBUTL(RESULTS(3),50)_"Bed: "_$P($G(DATA(0)),"^",7)
58 S RESULTS(4)=""
59 S RESULTS(4)=$$PAD^ALPBUTL(RESULTS(4),12)_"This record last updated: "
60 S RESULTS(4)=RESULTS(4)_$S($P(DATA(0),"^",8)'="":$$FMTE^XLFDT($P(DATA(0),"^",8)),1:"<date not on file>")
61 S LINE=4
62 ; report allergies...
63 I '$D(DATA(1,0)) D
64 .;no allergies reported
65 .S LINE=LINE+1,RESULTS(LINE)=""
66 .S RESULTS(LINE)="No allergies reported to the Contingency"
67 I +$O(DATA(1,0)) D
68 .S LINE=LINE+1
69 .S RESULTS(LINE)=""
70 .S ALPBALGX="Allergies: "
71 .S ALPBALGL=$L(ALPBALGX)-1
72 .S (ALPBCNT,ALPBX)=0
73 .F S ALPBX=$O(DATA(1,ALPBX)) Q:'ALPBX D
74 ..S ALPBALG=$P($G(DATA(1,ALPBX,0)),"^",2)
75 ..I ALPBALG="" K ALPBALG Q
76 ..I $L(ALPBALGX_ALPBALG_"; ")>90 D
77 ...S LINE=LINE+1
78 ...S RESULTS(LINE)=""
79 ...S ALPBALGX=""
80 ...S ALPBALGX=$$PAD^ALPBUTL(ALPBALGX,ALPBALGL)
81 ..S ALPBALGX=ALPBALGX_ALPBALG_$S(+$O(DATA(1,ALPBX)):"; ",1:"")
82 ..S RESULTS(LINE)=ALPBALGX
83 S RESULTS(0)=LINE
84 Q
85 ;
86FOOT ; print page footer (note: output is 5 lines)...
87 ; code adapted from original routine ^ALPFOOT by FD@NJHCS, May 2002
88 W !,"|"
89 W ?13,"SIGNATURE/TITLE"
90 W ?40,"| INIT"
91 W ?48,"|"
92 W ?50,"INJECTION SITES (Right or Left)"
93 W ?88,"VA FORM 10-2970"
94 W !,"|"
95 W $$REPEAT^XLFSTR("_",38)
96 W ?40,"|_______| 1. DELTOID"
97 W ?71,"4. MED (ANTERIOR) THIGH"
98 W ?96,"7. ABDOMEN"
99 W !,"|"
100 W $$REPEAT^XLFSTR("_",38)
101 W ?40,"|_______| 2. VENTRAL GLUTEAL"
102 W ?71,"5. VASTUS LATERALIS"
103 W ?96,"8. THIGH"
104 W !,"|"
105 W $$REPEAT^XLFSTR("_",38)
106 W ?40,"|_______| 3. GLUTEUS MEDIUS"
107 W ?71,"6. UPPER ARM"
108 W ?96,"9. BUTTOCK"
109 W !,"|"
110 W $$REPEAT^XLFSTR("_",38)
111 W ?40,"|_______|10. UPPER BACK PRN: E=Effective N=Not Effective"
112 Q
Note: See TracBrowser for help on using the repository browser.