source: WorldVistAEHR/trunk/r/ASISTS-OOPS/OOPSNDBX.m@ 1801

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

initial load of WorldVistAEHR

File size: 4.9 KB
RevLine 
[613]1OOPSNDBX ;WCIOFO/LLH-Extract data to MailMan message ;10/12/99
2 ;;2.0;ASISTS;;Jun 03, 2002
3 ;
4 ; Retrieves data from ^OOPS(2260, for 2162
5 ; Variables used
6 ; OOPDA IEN of Case
7 ; OOPSAR Array holding data
8 ; OPL Last Line number written in message text
9 ; XMZ Message Number
10EN ; Entry
11 N ARR,MESS,OPC,OPDATA,OPFLD,OPI,OPJ,OPSAR,OPT,OPX,SEG,TL,NCHAR
12 S RSIZE=0,ARR=0
13 S OPSAR(0)=$G(^OOPS(2260,OOPDA,0))
14 S OPSAR("2162A")=$G(^OOPS(2260,OOPDA,"2162A"))
15 S OPSAR("2162B")=$G(^OOPS(2260,OOPDA,"2162B"))
16 S OPSAR("2162D")=$G(^OOPS(2260,OOPDA,"2162D"))
17 S OPSAR("2162S")=$G(^OOPS(2260,OOPDA,"2162S"))
18OP1 ; Seg OP1
19 N TIME
20 S TIME=$P($P(OPSAR(0),U,5),".",2)
21 S OPX="OP1^"_$P(OPSAR(0),U)_U_$P(OPSAR(0),U,2)_U_$P(OPSAR(0),U,3)
22 S OPX=OPX_U_$$GET1^DIQ(2260,OOPDA,"3:1")
23 S OPX=OPX_U_$$DC($P($P(OPSAR(0),U,5),"."))
24 S OPX=OPX_U_TIME_$E("0000",$L(TIME)+1,4)
25 S OPX=OPX_U_$P(OPSAR("2162A"),U)_U_$$DC($P(OPSAR("2162A"),U,2))
26 S OPX=OPX_U_$P(OPSAR("2162A"),U,3)
27 S OPX=OPX_U_$$GET1^DIQ(4,$P(OPSAR("2162A"),U,9),99)
28 S OPX=OPX_U_$P(OPSAR("2162A"),U,10)_U_$P(OPSAR("2162A"),U,11)
29 S OPX=OPX_U_$P(OPSAR("2162A"),U,12)_U_$P(OPSAR("2162A"),U,13)
30 S OPX=OPX_U_$P(OPSAR("2162A"),U,14)
31 S OPX=OPX_U_$P(OPSAR("2162B"),U)_U_$$GET1^DIQ(2260,OOPDA,"27:1")
32 S OPX=OPX_U_$$GET1^DIQ(2260,OOPDA,"29:1")
33 S OPX=OPX_U_$$GET1^DIQ(2260,OOPDA,"30:1")
34 S OPX=OPX_U_$$GET1^DIQ(2260,OOPDA,"30.1:1")_U_$P(OPSAR("2162B"),U,5)
35 S OPX=OPX_U_$P(OPSAR("2162B"),U,6)_U_$P(OPSAR("2162B"),U,7)
36 S OPX=OPX_U_$P(OPSAR("2162D"),U)_U_$P(OPSAR("2162D"),U,2)
37 S OPX=OPX_U_$$GET1^DIQ(2260,OOPDA,"36:1")
38 S OPX=OPX_U_$$GET1^DIQ(2260,OOPDA,"37:1")
39 S OPX=OPX_U_$$GET1^DIQ(2260,OOPDA,"38:1")
40 S OPX=OPX_U_$$GET1^DIQ(2260,OOPDA,"41:1")
41 S OPX=OPX_U_$P(OPSAR("2162D"),U,8)
42 S OPX=OPX_U_$P(OPSAR(0),U,7)_"^|"
43 S ARR=ARR+1,MESS(ARR)=OPX
44 S RSIZE=RSIZE+$L(OPX)+2
45 ;
46OP2 ; Seg OP2 - Description of Incident (Word Processing)
47 S OPFLD=28,SEG="OP2"
48 D WP
49OP3 ; Seg OP3 - Equipment Device Failure
50 K OPX
51 I $P($G(OPSAR("2162D")),U,7)'="" D
52 . S OPX="OP3"_U_$P(OPSAR("2162D"),U,7)_"^|"
53 . S ARR=ARR+1,MESS(ARR)=OPX
54 . S RSIZE=RSIZE+$L(OPX)+2
55OP4 ; Seg OP4 - Corrective Action - Word Processing
56 S OPFLD=47,SEG="OP4"
57 D WP
58OP5 ; Seg OP5 - Safety Officer Comments - Word Processing
59 S OPFLD=55,SEG="OP5"
60 D WP
61OP6 ; Seg OP6 - Area Exposed to Bodily Fluid - Multiple
62 K OPX
63 S OPDATA=""
64 S TL=0 F OPI=0:1 S TL=$O(^OOPS(2260,OOPDA,"2162E",TL)) Q:'TL
65 I OPI S TL=0 F OPJ=1:1 S TL=$O(^OOPS(2260,OOPDA,"2162E",TL)) Q:'TL D
66 . S OPDATA=$G(^OOPS(2260,OOPDA,"2162E",TL,0)) Q:(OPDATA="")
67 . I OPJ=1 S OPX="OP6"_U_OPDATA
68 . I OPJ>1 S OPX=OPX_","_OPDATA
69 I $D(OPX) S OPX=OPX_"^|" D
70 . S ARR=ARR+1,MESS(ARR)=OPX
71 . S RSIZE=RSIZE+$L(OPX)+2
72OP7 ; Seg OP7 - Personal Protective Equipment - Multiple
73 K OPX
74 S OPDATA=""
75 S TL=0 F OPI=0:1 S TL=$O(^OOPS(2260,OOPDA,"2162F",TL)) Q:'TL
76 I OPI S TL=0 F OPJ=1:1 S TL=$O(^OOPS(2260,OOPDA,"2162F",TL)) Q:'TL D
77 . S OPDATA=$G(^OOPS(2260,OOPDA,"2162F",TL,0)) Q:(OPDATA="")
78 . I OPJ=1 S OPX="OP7"_U_OPDATA
79 . I OPJ>1 S OPX=OPX_","_OPDATA
80 I $D(OPX) S OPX=OPX_"^|" D
81 . S ARR=ARR+1,MESS(ARR)=OPX
82 . S RSIZE=RSIZE+$L(OPX)+2
83OP8 ; Seg OP8 - new needlestick fields
84 K OPX
85 S OPDATA=""
86 S OPX="OP8"_U_$$GET1^DIQ(2260,OOPDA,"82:.01")_U_$$GET1^DIQ(2260,OOPDA,"83:.01")
87 S OPX=OPX_U_$$GET1^DIQ(2260,OOPDA,"84:.01")
88 S OPX=OPX_U_$P(OPSAR("2162B"),U,13)_U_"|"
89 S ARR=ARR+1,MESS(ARR)=OPX
90 S RSIZE=RSIZE+$L(OPX)+2
91OP9 ; Seg OP9 - Word processing field for field 85
92 N NSEG
93 K OPX
94 S NCHAR=$L(OPSAR("2162S"))
95 S NSEG=$S((NCHAR>210):4,(NCHAR>140&(NCHAR<211)):3,(NCHAR>70&(NCHAR<141)):2,1:0)
96 I NCHAR D
97 . S OPX="OP9^1^"_NSEG_"^"_$E(OPSAR("2162S"),1,70)_U_"|"
98 . S ARR=ARR+1,MESS(ARR)=OPX,RSIZE=RSIZE+$L(OPX)+2
99 I NCHAR>70 D
100 . S OPX="OP9^2^"_NSEG_"^"_$E(OPSAR("2162S"),71,140)_U_"|"
101 . S ARR=ARR+1,MESS(ARR)=OPX,RSIZE=RSIZE+$L(OPX)+2
102 I NCHAR>140 D
103 . S OPX="OP9^3^"_NSEG_"^"_$E(OPSAR("2162S"),141,210)_U_"|"
104 . S ARR=ARR+1,MESS(ARR)=OPX,RSIZE=RSIZE+$L(OPX)+2
105 I NCHAR>210 D
106 . S OPX="OP9^4^"_NSEG_"^"_$E(OPSAR("2162S"),211,250)_U_"|"
107 . S ARR=ARR+1,MESS(ARR)=OPX,RSIZE=RSIZE+$L(OPX)+2
108 ;
109EXIT ; Loads the message and Quits the routine
110 I RSIZE+MSIZE>31500 D
111 . S END=$P($P(^OOPS(2260,OPAST,0),U),"-",2)
112 . D SEND^OOPSNDB,CREATE^OOPSNDB
113 . S (START,END)=""
114 F I=1:1:ARR I $G(MESS(I))'="" D
115 . S OPL=OPL+1,^XMB(3.9,XMZ,2,OPL,0)=MESS(I)
116 . I START="" S START=$P($P(OPSAR(0),U),"-",2)
117 S MSIZE=MSIZE+RSIZE
118 K ARR,MESS,OPDT,RSIZE
119 Q
120WP ; Word Processing Fields
121 N DIWL,DIWR,DIWF,OPGLB,OPNODE,X
122 S OPI=0
123 K ^UTILITY($J,"W")
124 S DIWL=1,DIWR="",DIWF="|C70"
125 S OPNODE=$P($$GET1^DID(2260,OPFLD,"","GLOBAL SUBSCRIPT LOCATION"),";")
126 S OPI=0 F S OPI=$O(^OOPS(2260,OOPDA,OPNODE,OPI)) Q:'OPI S X=$G(^OOPS(2260,OOPDA,OPNODE,OPI,0)) D:X]"" ^DIWP
127 S OPT=$G(^UTILITY($J,"W",1))+0
128 I OPT S OPI=0 F OPC=1:1 S OPI=$O(^UTILITY($J,"W",1,OPI)) Q:'OPI D
129 . S OPX=SEG_U_OPC_U_OPT_U_$E(^UTILITY($J,"W",1,OPI,0),1,220)_"^|"
130 . S ARR=ARR+1,MESS(ARR)=OPX
131 . S RSIZE=RSIZE+$L(OPX)+2
132 K ^UTILITY($J,"W"),X
133 Q
134DC(OPDT) ; Convert Date to YYYYMMDD
135 S:OPDT]"" OPDT=OPDT+17000000\1
136 Q OPDT
Note: See TracBrowser for help on using the repository browser.