source: WorldVistAEHR/trunk/r/ASISTS-OOPS/OOPSGUI2.m@ 1154

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

initial load of WorldVistAEHR

File size: 9.2 KB
RevLine 
[613]1OOPSGUI2 ;WIOFO/CVW-RPC routines ;9/19/01
2 ;;2.0;ASISTS;**2,4,8**;Jun 03, 2002
3 ;
4GET(RESULTS,INPUT) ; Get Case data from 2260 or 2264
5 ;NOTE: changed in patch 5 to set the file to retrieve data from
6 ; based on the form sent in.
7 ; Input: INPUT - IEN^FORM where IEN = ASISTS IEN and
8 ; FORM = Either "CA1","CA2","CA7","2162", or "DUAL"
9 ; Output: RESULTS - Array of data from the file, each element in the
10 ; is based on the field number in the file.
11 N NODE,PIECE,FNUM,IEN,VAR,FORM,FLDCNT,INVFLDS,FILE
12 ;Define fields that should never be returned
13 S INVFLDS="^19^20^21^22^23^24^25^122^224^"
14 S IEN=+$G(INPUT),FORM=$P($G(INPUT),U,2),FLDCNT=0
15 I '$G(IEN) Q
16 S FILE=2260 I $G(FORM)="CA7" S FILE=2264,INVFLDS=""
17 I '$D(^OOPS(FILE,$G(IEN),0)) D Q
18 . S (RESULTS,RESULTS(1))="-1^IEN:"_IEN_" not found in the file"
19 I "CA1^CA2^CA7^2162^DUAL"'[FORM!(FORM="") D Q
20 . S (RESULTS,RESULTS(1))="-2^FORM:"_FORM_" not valid, must be CA1, CA2, CA7, DUAL or 2162"
21 S NODE="" F S NODE=$O(^DD(FILE,"GL",NODE)) Q:NODE="" D
22 .S PIECE=0 F S PIECE=$O(^DD(FILE,"GL",NODE,PIECE)) Q:PIECE="" D
23 ..S FNUM=0 F S FNUM=$O(^DD(FILE,"GL",NODE,PIECE,FNUM)) Q:FNUM="" D
24 ...I INVFLDS[("^"_FNUM_"^") Q
25 ...I ($E(NODE,1,$L(FORM))'=FORM),(NODE'=0),(NODE'="CA"),(NODE'["WC"),(NODE'["DUAL") Q
26 ...;patch 5 if form = DUAL, only get DUAL nodes (there are 2) data
27 ...I FORM["DUAL",($E(NODE,1,4)="DUAL") D
28 ....S RESULTS(FNUM)=$$GET1^DIQ(FILE,IEN,FNUM)
29 ...I FORM'="DUAL",($E(NODE,1,4)'="DUAL") D
30 ....S RESULTS(FNUM)=$$GET1^DIQ(FILE,IEN,FNUM)
31 ....I FILE=2260 D
32 .....I FNUM=13 S RESULTS(FNUM)=RESULTS(FNUM)_" = "_$$GET1^DIQ(2260,IEN,FNUM_":99")
33 .....I FNUM=53!(FNUM=53.1) S RESULTS(FNUM)=RESULTS(FNUM)_"^"_$$GET1^DIQ(2260,IEN,FNUM,"I")
34 .....I FNUM=76!(FNUM=79) S RESULTS(FNUM)=$$GET1^DIQ(2260,IEN,FNUM,"I")
35 ...S FLDCNT=FLDCNT+1
36 Q
37WITR(RESULTS,IEN) ;Return entries from the witness multiple
38 ; Input: IEN - The ASISTS IEN used to pull info from file 2260.
39 ; Output: RESULTS - array with Witness data and associated comment
40 ;
41 N SUBN,COUNT,STATE,WDT
42 S (SUBN,COUNT)=0,(STATE,WDT)=""
43 F S SUBN=$O(^OOPS(2260,IEN,"CA1W",SUBN)) Q:'SUBN D
44 . S RESULTS(COUNT)=$G(^OOPS(2260,IEN,"CA1W",SUBN,0))
45 . S STATE=$$EXTERNAL^DILFD(2260.0125,3,"",$P(RESULTS(COUNT),U,4))
46 . S WDT=$$EXTERNAL^DILFD(2260.0125,5,"",$P(RESULTS(COUNT),U,6))
47 . S $P(RESULTS(COUNT),U,4)=STATE,$P(RESULTS(COUNT),U,6)=WDT
48 . S $P(RESULTS(COUNT),U,7)=SUBN
49 . S COUNT=COUNT+1
50 . S RESULTS(COUNT)=$G(^OOPS(2260,IEN,"CA1W",SUBN,1))
51 . S COUNT=COUNT+1
52 Q
53DEFMD(RESULTS,IEN) ;
54 ;Send in the Case IEN, return an array of
55 ;(0)="1^Valid Results" or "0^No Valid Results"
56 ;(1)=PROVIDER NAME
57 ;(2)=PROVIDER ADDRESS
58 ;(3)=PROVIDER CITY
59 ;(4)=PROVIDER STATE
60 ;(5)=PROVIDER ZIP CODE
61 ;(6)=PROVIDER TITLE
62 N STA,PSTA,PIEN
63 S (STA,PSTA,PIEN)=""
64 S RESULTS(0)="0^No Valid Results"
65 Q:+IEN'>0
66 S STA=$P($G(^OOPS(2260,IEN,"2162A")),U,9)
67 Q:+STA'>0
68 S PIEN=$O(^OOPS(2262,1,1,"B",STA,PIEN))
69 Q:+PIEN'>0
70 I $P($G(^OOPS(2262,1,1,PIEN,0)),U,2)'="" D
71 .S RESULTS(0)="1^Valid Results"
72 .S RESULTS(1)=$P($G(^OOPS(2262,1,1,PIEN,0)),U,2)
73 .S RESULTS(2)=$P($G(^OOPS(2262,1,1,PIEN,0)),U,3)
74 .S RESULTS(3)=$P($G(^OOPS(2262,1,1,PIEN,0)),U,4)
75 .S PSTA=$$FIND1^DIC(2262.03,",1,","Q",STA)
76 .I PSTA S PSTA=PSTA_",1," S RESULTS(4)=$$GET1^DIQ(2262.03,PSTA,"4:.01")
77 .S RESULTS(5)=$P($G(^OOPS(2262,1,1,PIEN,0)),U,6)
78 .S RESULTS(6)=$P($G(^OOPS(2262,1,1,PIEN,0)),U,7)
79 .S RESULTS(6)=$$EXTERNAL^DILFD(2262.03,6,"",RESULTS(6))
80 Q
81REPLWP(RESULTS,INPUT,DATA) ;
82 ;Replace Word Processing Fields
83 ; Input: INPUT - The file, field and IEN of record to WP field to
84 ; be changed in the format FILE^FIELD^IEN
85 ; Input DATA - List or pointer for data that is to replace the
86 ; existing WP data.
87 ; Output: RESULTS - array with results or messages.
88 ; Retrieve file and field information.
89 N FILE,FIELD,IEN,ROOT,NODE,LINE,CNT,NEWTXT
90 S FILE=$P($G(INPUT),U),FIELD=$P($G(INPUT),U,2),IEN=$P($G(INPUT),U,3)
91 S ROOT=$$ROOT^DILFD(FILE,0,"GL")
92 S NODE=$$GET1^DID(FILE,FIELD,"","GLOBAL SUBSCRIPT LOCATION")
93 S NODE=$P(NODE,";",1)
94 ; Kill the existing WP data/node
95 K @(ROOT_"IEN,NODE)")
96 ; Insert the new data
97 S (LINE,CNT)=0
98 K NEWTXT
99 F D Q:+LINE'>0
100 .S LINE=$O(DATA(LINE)) Q:+LINE'>0 S CNT=LINE
101 .S NEWTXT=$G(DATA(LINE))
102 .S @(ROOT_"IEN,NODE,LINE,0)")=NEWTXT
103 S @(ROOT_"IEN,NODE,0)")="^^"_CNT_"^"_CNT_"^"_DT_"^^"
104 Q
105DTVALID(RESULTS,IDT,PDT,FLAG) ;Compare Date(s)/Time(s)
106 ; Input IDT - This is the base date/time in external form
107 ; PDT - This is the compare date/time in external form
108 ; FLAG - -2 means PDT must be < IDT (The DAY only)
109 ; FLAG - -1 means PDT must be < IDT (The DAY&TIME)
110 ; FLAG - 1 means PDT must be > IDT (The DAY&TIME)
111 ; FLAG - 2 means PDT must be > IDT (The DAY only)
112 ;Output RESULTS - "VALID DATE" for valid, "DATE ERROR" for invalid
113 S FLAG=+$G(FLAG)
114 I FLAG="" S RESULTS(0)="FLAG ERROR" Q
115 I IDT="" S RESULTS(0)="DATE ERROR" Q
116 I PDT="" S RESULTS(0)="DATE ERROR" Q
117 S IDT=$$DTI^OOPSGUI2(IDT)
118 S PDT=$$DTI^OOPSGUI2(PDT)
119 I FLAG=-2 D
120 .S IDT=$P(IDT,"."),PDT=$P(PDT,".")
121 .I (PDT<IDT)!(PDT=IDT) S RESULTS(0)="VALID DATE" Q
122 .I PDT>IDT S RESULTS(0)="DATE ERROR" Q
123 I FLAG=-1 D
124 .I PDT<IDT S RESULTS(0)="VALID DATE" Q
125 .I (PDT>IDT)!(PDT=IDT) S RESULTS(0)="DATE ERROR" Q
126 I FLAG=0 D
127 .I PDT=IDT S RESULTS(0)="VALID DATE" Q
128 .I (PDT<IDT)!(PDT>IDT) S RESULTS(0)="DATE ERROR" Q
129 I FLAG=1 D
130 .I PDT>IDT S RESULTS(0)="VALID DATE" Q
131 .I (PDT<IDT)!(PDT=IDT) S RESULTS(0)="DATE ERROR" Q
132 I FLAG=2 D
133 .S IDT=$P(IDT,"."),PDT=$P(PDT,".")
134 .I (PDT>IDT)!(PDT=IDT) S RESULTS(0)="VALID DATE" Q
135 .I PDT<IDT S RESULTS(0)="DATE ERROR" Q
136 Q
137DTI(X) ;Convert and External date to an internal one
138 N Y,%DT
139 S %DT="T" D ^%DT
140 Q Y
141SETFIELD(RESULTS,INPUT,VALUE) ;Set a single field in file 2260
142 ;Input - INPUT Contains the IEN of the record and the field number to
143 ; be modified in the format IEN^FIELD
144 ; VALUE This required parm is the external value to be used.
145 ;Output - RESULTS - status message of the file/set.
146 N DA,DIE,DR,IEN,FLDNUM
147 S DR=""
148 S RESULTS(0)="UPDATE FAILED"
149 S IEN=$P($G(INPUT),U)
150 I '$G(IEN) Q
151 S FLDNUM=$P($G(INPUT),U,2)
152 I '$D(^OOPS(2260,IEN,0))!(FLDNUM="") Q
153 S DIE="^OOPS(2260,",DA=IEN
154 S DR(1,2260,1)=FLDNUM_"///^S X=VALUE"
155 D ^DIE
156 I $G(Y)="" D
157 . S RESULTS(0)="UPDATE COMPLETE"
158 . ; if setting field 71, need to send bulletin
159 . I FLDNUM=71,($$GET1^DIQ(2260,IEN,71,"I")'="Y") D WCPBOR^OOPSMBUL(IEN)
160 . ; 01/02/04 Patch 4 llh - if case closed, sent bulletin
161 . I FLDNUM=51,(VALUE="Closed") D CLSCASE^OOPSMBUL(IEN)
162 Q
163ADDWITN(RESULTS,IEN,INFO,COMMENT) ;Add Witness info for IEN in 2260
164 ; Input - IEN - IEN of case that needs witness info created.
165 ; INFO - Name, Street, City, State, Zip, Date of Witness in
166 ; format, NAME^STREET^CITY^STATE^ZIP
167 ; COMMENT - Witness Comment Text
168 ; Output - RESULTS Text indicating status of insert
169 N DR,DIE,DA,DIC,DD,DO,DLAYGO,INPUT,NAME,STREET,CITY,STATE,ZIP,WITDATE
170 S RESULTS(0)="WITNESS CREATION FAILED"
171 I '$G(IEN) Q
172 I '$D(^OOPS(2260,IEN,0)) Q
173 S DA(1)=IEN
174 S DLAYGO=2260,DIC="^OOPS(2260,"_DA(1)_",""CA1W"","
175 S DIC(0)="L"
176 S X=$P(INFO,U)
177 D FILE^DICN
178 S DA=+Y
179 S DIE="^OOPS(2260,"_DA(1)_",""CA1W"",",DR=""
180 I DA=-1 Q
181 S NAME=$P($G(INFO),U)
182 S STREET=$P($G(INFO),U,2)
183 S CITY=$P($G(INFO),U,3)
184 S STATE=$P($G(INFO),U,4)
185 S ZIP=$P($G(INFO),U,5)
186 S WITDATE=$P($G(INFO),U,6)
187 S DR(1,2260.0125,1)=".01///^S X=NAME"
188 S DR(1,2260.0125,2)="1///^S X=STREET"
189 S DR(1,2260.0125,3)="2///^S X=CITY"
190 S DR(1,2260.0125,4)="3///^S X=STATE"
191 S DR(1,2260.0125,5)="4///^S X=ZIP"
192 S DR(1,2260.0125,6)="5///^S X=WITDATE"
193 D ^DIE
194 S DR="6///^S X=COMMENT"
195 D ^DIE
196 S RESULTS(0)="WITNESS CREATION SUCCESSFUL"
197 Q
198DELWITN(RESULTS,INPUT) ;Deletes the Witness information for a claim
199 ; Input - INPUT, this is the IEN for the case and the witness number
200 ; format IEN^witness number for the selected witness
201 ; Output - RESULTS - String indicating the status of the delete
202 N DA,DIK,IEN,WITNO
203 S RESULTS(0)="DELETION FAILED"
204 I INPUT="" Q
205 S IEN=$P($G(INPUT),U)
206 I '$G(IEN) Q
207 S WITNO=$P($G(INPUT),U,2)
208 I '$G(WITNO) Q
209 I '$D(^OOPS(2260,IEN,"CA1W",WITNO,0)) Q
210 S DA(1)=IEN
211 S DA=WITNO
212 S DIK="^OOPS(2260,"_DA(1)_",""CA1W"","
213 D ^DIK
214 I $G(Y)'="" D Q
215 .S RESULTS(0)="SUCCESSFULLY DELETED"
216 Q
217EDTWITN(RESULTS,INPUT,INFO,COMMENT) ;Update Witness Info for 2260 rec
218 ; Input:INPUT - IEN and Witness Number in format IEN^WIT
219 ; INFO - Name, Street, City, State, Zip, Date of Witness in
220 ; format, NAME^STREET^CITY^STATE^ZIP
221 ; COMMENT - Text of Witness comment
222 ; Output:RESULTS - String listing result of update.
223 N DA,DIE,DR,NAME,STREET,CITY,STATE,ZIP,WITDATE,IEN,WITNO
224 S RESULTS(0)="EDIT FAILED"
225 S IEN=$P($G(INPUT),U)
226 S WITNO=$P($G(INPUT),U,2)
227 I '$D(^OOPS(2260,IEN,"CA1W",WITNO,0)) Q
228 S DA(1)=IEN,DR=""
229 S DA=WITNO
230 S DIE="^OOPS(2260,"_DA(1)_",""CA1W"","
231 S NAME=$P($G(INFO),U)
232 S STREET=$P($G(INFO),U,2)
233 S CITY=$P($G(INFO),U,3)
234 S STATE=$P($G(INFO),U,4)
235 S ZIP=$P($G(INFO),U,5)
236 S WITDATE=$P($G(INFO),U,6)
237 S DR(1,2260.0125,1)=".01///^S X=NAME"
238 S DR(1,2260.0125,2)="1///^S X=STREET"
239 S DR(1,2260.0125,3)="2///^S X=CITY"
240 S DR(1,2260.0125,4)="3///^S X=STATE"
241 S DR(1,2260.0125,5)="4///^S X=ZIP"
242 S DR(1,2260.0125,6)="5///^S X=WITDATE"
243 D ^DIE
244 S DR="6///^S X=COMMENT"
245 D ^DIE
246 S RESULTS(0)="EDIT SUCCESSFULL"
247 Q
Note: See TracBrowser for help on using the repository browser.