Produced by Araxis Merge on 4/16/2019 12:20:47 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | C:\AraxisMergeCompare\Pri_un\CPRS_32_P2_PCE\OR_30_405V60_SRC\Womens Health | oWVController.pas | Wed Dec 12 14:04:42 2018 UTC |
2 | C:\AraxisMergeCompare\Pri_re\CPRS v32 P2 PCE Standardization-redacted\CPRS_32_P2_PCE\OR_30_405V60_SRC\Womens Health | oWVController.pas | Fri Apr 12 13:47:14 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 700 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | unit oWVCo ntroller; | |
2 | { | |
3 | ======== ========== ========== ========== ========== ========== ========== ========== == | |
4 | * | |
5 | * Applicatio n: TDrugs Patch OR* 3*377 and WV*1*24 | |
6 | * Developer: PII | |
7 | * Site: Salt L ake City I SC | |
8 | * | |
9 | * Descriptio n: Primar y controll er accesse d via the WVControll er | |
10 | * method in iWVInt erface.pas as IWVCon troller. | |
11 | * | |
12 | * Notes: Implem entation u ses clause contains non-standa rd link to | |
13 | * CPRS f ile ORNet. pas for us e with CPR S. | |
14 | * | |
15 | ======== ========== ========== ========== ========== ========== ========== ========== == | |
16 | } | |
17 | ||
18 | interface | |
19 | ||
20 | uses | |
21 | Dialogs, | |
22 | System.C lasses, | |
23 | System.G enerics.Co llections, | |
24 | System.S ysUtils, | |
25 | System.U ITypes, | |
26 | iWVInter face, | |
27 | oWVWebSi te; | |
28 | ||
29 | type | |
30 | TWVContr oller = cl ass(TInter facedObjec t, IWVCont roller) | |
31 | private | |
32 | { Priv ate decler ations } | |
33 | // fEDD Method: st ring; | |
34 | // fEDD MethodAcce ssible: st ring; | |
35 | calcED D: integer ; | |
36 | fIniti alized: bo olean; | |
37 | fLastE rror: stri ng; | |
38 | fWebSi teListName : string; | |
39 | fWebSi tes: TObje ctList<TWV WebSite>; | |
40 | ||
41 | functi on getWebS ite(aIndex : integer) : IWVWebSi te; | |
42 | functi on getWebS iteCount: integer; | |
43 | functi on getWebS iteListNam e: string; | |
44 | protecte d | |
45 | { Prot ected decl arations } | |
46 | functi on GetLast Error: str ing; | |
47 | ||
48 | functi on EditPre gLacData(a DFN: strin g): boolea n; | |
49 | functi on GetReco rdIDType(a RecordID: string; va r aType: s tring): bo olean; | |
50 | functi on GetWebS iteURL(aWe bSiteName: string): string; | |
51 | functi on InitCon troller(aF orceInit: boolean = False): bo olean; vir tual; | |
52 | functi on IsValid WVPatient( aDFN: stri ng): boole an; | |
53 | functi on MarkAsE nteredInEr ror(aItemI D: string) : boolean; | |
54 | functi on OpenExt ernalWebsi te(aWebsit e: IWVWebS ite): bool ean; | |
55 | functi on SavePre gnancyAndL actationDa ta(aList: TStrings): boolean; | |
56 | public | |
57 | constr uctor Crea te; | |
58 | destru ctor Destr oy; overri de; | |
59 | ||
60 | end; | |
61 | ||
62 | implementa tion | |
63 | ||
64 | uses | |
65 | fWVPregL acStatusUp date, // U pdate Form | |
66 | fWVEIERe asonsDlg, // Reason Selection Dialog | |
67 | oDelimit edString, | |
68 | ORNet, / / Access t o CallVist A() method in CPRS s o RPC's ar e logged - Would lik e to route this thro ugh an eve nt. | |
69 | WinAPI.W indows, // Call to S hellExecut e for the WebSites | |
70 | ShellAPI , // Call to ShellEx ecute for the WebSit es | |
71 | VAUtils; | |
72 | ||
73 | const | |
74 | { VistA RPC's } | |
75 | RPC_CONS AVE = 'WVR PCOR CONSA VE'; | |
76 | RPC_COVE R = 'WVRPC OR COVER'; | |
77 | RPC_EIE = 'WVRPCOR EIE'; | |
78 | RPC_SAVE DATA = 'WV RPCOR SAVE DATA'; | |
79 | RPC_REAS ONS = 'WVR PCOR REASO NS'; | |
80 | RPC_WEBS ITES = 'WV RPCOR SITE S'; | |
81 | ||
82 | { TWVCon troller } | |
83 | ||
84 | constructo r TWVContr oller.Crea te; | |
85 | begin | |
86 | inherite d Create; | |
87 | fInitial ized := Fa lse; | |
88 | fLastErr or := ''; | |
89 | ||
90 | fWebSite s := TObje ctList<TWV WebSite>.C reate; | |
91 | fWebSite s.OwnsObje cts := Tru e; | |
92 | end; | |
93 | ||
94 | destructor TWVContro ller.Destr oy; | |
95 | begin | |
96 | inherite d; | |
97 | FreeAndN il(fWebSit es); | |
98 | end; | |
99 | ||
100 | function T WVControll er.EditPre gLacData(a DFN: strin g): boolea n; | |
101 | var | |
102 | aList: T StringList ; | |
103 | begin | |
104 | aList := TStringLi st.Create; | |
105 | Result : = False; | |
106 | try | |
107 | CallVi stA(RPC_CO NSAVE, [aD FN], aList ); | |
108 | if aLi st.Count > 1 then | |
109 | begin | |
110 | with NewDelimi tedString( aList[1]) do | |
111 | try | |
112 | ca lcEDD := S trToIntDef (GetPiece( 2),0); | |
113 | fina lly | |
114 | Fr ee; | |
115 | end; | |
116 | end | |
117 | else | |
118 | begin | |
119 | calc EDD := 0; | |
120 | end; | |
121 | ||
122 | if Cop y(aList[0] , 1, 2) = '1^' then // Get con firmation to result or exit. | |
123 | if M essageDlg( Copy(aList [0], 3, Le ngth(aList [0])), mtC onfirmatio n, [mbYes, mbNo], 0) <> mrYes then | |
124 | be gin | |
125 | Result := True; | |
126 | Exit; | |
127 | en d; | |
128 | ||
129 | if Cop y(aList[0] , 1, 3) = '-1^' then // Error from serve r, abort. | |
130 | begi n | |
131 | fL astError : = aList[0] ; | |
132 | Re sult := Fa lse; | |
133 | Ex it; | |
134 | end; | |
135 | ||
136 | with N ewPLUpdate Form(aDFN) do | |
137 | try | |
138 | EDD := cal cEDD; | |
139 | // if ScreenR eaderActiv e then | |
140 | // begin | |
141 | // stxtEDDM ethod.Capt ion := get EDDMethodA ccessible; | |
142 | // end | |
143 | // else | |
144 | // begin | |
145 | // stxtEDDM ethod.Capt ion := get EDDMethod; | |
146 | // end; | |
147 | ||
148 | if Execute t hen | |
149 | begin | |
150 | if GetDa ta(aList) then | |
151 | Result := SavePr egnancyAnd LactationD ata(aList) | |
152 | else | |
153 | begin | |
154 | fLas tError := Copy(aList [0], 3, Le ngth(aList [0])); | |
155 | Resu lt := Fals e; | |
156 | end | |
157 | end | |
158 | el se | |
159 | Result := True; | |
160 | fina lly | |
161 | Fr ee; | |
162 | end; | |
163 | except | |
164 | on E: Exception do | |
165 | fLas tError := E.Message; | |
166 | end; | |
167 | FreeAndN il(aList); | |
168 | end; | |
169 | ||
170 | function T WVControll er.GetLast Error: str ing; | |
171 | begin | |
172 | Result : = fLastErr or; | |
173 | end; | |
174 | ||
175 | function T WVControll er.GetReco rdIDType(a RecordID: string; va r aType: s tring): bo olean; | |
176 | begin | |
177 | try | |
178 | case S trToInt(Co py(aRecord ID, 1, Pos (';', aRec ordID) - 1 )) of | |
179 | 4: | |
180 | be gin | |
181 | aType := ' Pregnancy Status'; | |
182 | Result := True; | |
183 | en d; | |
184 | 5: | |
185 | be gin | |
186 | aType := ' Lactation Status'; | |
187 | Result := True; | |
188 | en d; | |
189 | else | |
190 | begi n | |
191 | aT ype := 'Un known Reco rd ID Type ' + aReco rdID; | |
192 | Re sult := Fa lse; | |
193 | end; | |
194 | end; | |
195 | except | |
196 | on E: Exception do | |
197 | begi n | |
198 | aT ype := 'Er ror gettin g Record I D Type ' + E.Message ; | |
199 | Re sult := Fa lse; | |
200 | end; | |
201 | end; | |
202 | end; | |
203 | ||
204 | ||
205 | function T WVControll er.getWebS ite(aIndex : integer) : IWVWebSi te; | |
206 | begin | |
207 | InitCont roller; | |
208 | try | |
209 | fWebSi tes.Items[ aIndex].Ge tInterface (IWVWebSit e, Result) ; | |
210 | except | |
211 | Result := nil; | |
212 | end; | |
213 | end; | |
214 | ||
215 | function T WVControll er.GetWebS iteURL(aWe bSiteName: string): string; | |
216 | var | |
217 | aWebsite : TWVWebSi te; | |
218 | begin | |
219 | for aWeb site in fW ebSites do | |
220 | if Com pareStr(aW ebsite.Get Name, aWeb SiteName) = 0 then | |
221 | begi n | |
222 | Re sult := aW ebsite.Get URL; | |
223 | Br eak; | |
224 | end; | |
225 | end; | |
226 | ||
227 | function T WVControll er.getWebS iteCount: integer; | |
228 | begin | |
229 | InitCont roller; | |
230 | Result : = fWebSite s.Count; | |
231 | end; | |
232 | ||
233 | function T WVControll er.getWebS iteListNam e: string; | |
234 | begin | |
235 | InitCont roller; | |
236 | Result : = fWebSite ListName; | |
237 | end; | |
238 | ||
239 | function T WVControll er.InitCon troller(aF orceInit: boolean = False): bo olean; | |
240 | var | |
241 | aReturn: TStringLi st; | |
242 | i: integ er; | |
243 | begin | |
244 | if not f Initialize d then | |
245 | begin | |
246 | aRet urn := TSt ringList.C reate; | |
247 | try | |
248 | Ca llVistA(RP C_WEBSITES , [], aRet urn); | |
249 | if aReturn.C ount < 1 t hen | |
250 | fWebSiteLi stName := 'Error loa ding Web S ites!' | |
251 | el se | |
252 | begin | |
253 | fWebSite ListName : = aReturn[ 0]; | |
254 | for i := 1 to aRet urn.Count - 1 do | |
255 | fWebSi tes.Add(TW VWebSite.C reate(aRet urn[i])); | |
256 | end; | |
257 | fI nitialized := True; | |
258 | fina lly | |
259 | Fr eeAndNil(a Return); | |
260 | end; | |
261 | end; | |
262 | Result : = fInitial ized; | |
263 | end; | |
264 | ||
265 | function T WVControll er.IsValid WVPatient( aDFN: stri ng): boole an; | |
266 | var | |
267 | aList: T StringList ; | |
268 | begin | |
269 | aList := TStringLi st.Create; | |
270 | try | |
271 | CallVi stA(RPC_CO VER, [aDFN ], aList); | |
272 | Result := aList[ 0] <> '0'; | |
273 | except | |
274 | Result := False; | |
275 | end; | |
276 | FreeAndN il(aList); | |
277 | end; | |
278 | ||
279 | function T WVControll er.MarkAsE nteredInEr ror(aItemI D: string) : boolean; | |
280 | var | |
281 | aList: T StringList ; | |
282 | begin | |
283 | fLastErr or := ''; | |
284 | aList := TStringLi st.Create; | |
285 | with New WVEIEReaso nsDlg do | |
286 | try | |
287 | Call VistA(RPC_ REASONS, [ ], aList); | |
288 | AddR eason(aLis t); | |
289 | if E xecute the n | |
290 | tr y | |
291 | GetReasons (aList); | |
292 | CallVistA( RPC_EIE, [ aItemID, a List], aLi st); | |
293 | with NewDe limitedStr ing(aList[ 0]) do | |
294 | try | |
295 | Result := GetPie ceAsIntege r(1) = 1; | |
296 | if not Result th en | |
297 | fLas tError := GetPiece(2 ); | |
298 | finally | |
299 | Free; | |
300 | end; | |
301 | ex cept | |
302 | on E: Exce ption do | |
303 | begin | |
304 | fLastE rror := E. Message; | |
305 | Result := False; | |
306 | end; | |
307 | en d | |
308 | else | |
309 | Re sult := Tr ue; | |
310 | finall y | |
311 | Free ; | |
312 | end; | |
313 | FreeAndN il(aList); | |
314 | end; | |
315 | ||
316 | function T WVControll er.OpenExt ernalWebsi te(aWebsit e: IWVWebS ite): bool ean; | |
317 | begin | |
318 | try | |
319 | ShellE xecute(0, 'open', PW ideChar(aW ebsite.URL ), nil, ni l, SW_SHOW NORMAL); | |
320 | Result := True; | |
321 | except | |
322 | on E: Exception do | |
323 | begi n | |
324 | fL astError : = E.Messag e; | |
325 | Re sult := Fa lse; | |
326 | end; | |
327 | end; | |
328 | end; | |
329 | ||
330 | function T WVControll er.SavePre gnancyAndL actationDa ta(aList: TStrings): boolean; | |
331 | begin | |
332 | try | |
333 | CallVi stA(RPC_SA VEDATA, [a List], aLi st); | |
334 | with N ewDelimite dString(aL ist[0]) do | |
335 | try | |
336 | Re sult := (G etPieceAsI nteger(1) = 1); | |
337 | if not Resul t then | |
338 | fLastError := GetPie ce(2); | |
339 | fina lly | |
340 | Fr ee; | |
341 | end; | |
342 | except | |
343 | on E: Exception do | |
344 | begi n | |
345 | fL astError : = E.Messag e; | |
346 | Re sult := Fa lse; | |
347 | end; | |
348 | end; | |
349 | end; | |
350 | ||
351 | end. |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.