Produced by Araxis Merge on 2/17/2017 12:43:23 PM Central Standard 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 | CPRS_V32_T20_cif.zip\OR_30_405V20_SRC.zip\CPRS-chart\Womens Health | oWVController.pas | Thu Dec 15 14:28:36 2016 UTC |
| 2 | CPRS_V32_T20_cif.zip\OR_30_405V20_SRC.zip\CPRS-chart\Womens Health | oWVController.pas | Fri Feb 17 17:22:08 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 642 |
| 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 | fIniti alized: bo olean; | |
| 34 | fLastE rror: stri ng; | |
| 35 | fWebSi teListName : string; | |
| 36 | fWebSi tes: TObje ctList<TWV WebSite>; | |
| 37 | ||
| 38 | functi on getWebS ite(aIndex : integer) : IWVWebSi te; | |
| 39 | functi on getWebS iteCount: integer; | |
| 40 | functi on getWebS iteListNam e: string; | |
| 41 | protecte d | |
| 42 | { Prot ected decl arations } | |
| 43 | functi on GetLast Error: str ing; | |
| 44 | ||
| 45 | functi on EditPre gLacData(a DFN: strin g): boolea n; | |
| 46 | functi on GetReco rdIDType(a RecordID: string; va r aType: s tring): bo olean; | |
| 47 | functi on GetWebS iteURL(aWe bSiteName: string): string; | |
| 48 | functi on InitCon troller(aF orceInit: boolean = False): bo olean; vir tual; | |
| 49 | functi on IsValid WVPatient( aDFN: stri ng): boole an; | |
| 50 | functi on MarkAsE nteredInEr ror(aItemI D: string) : boolean; | |
| 51 | functi on OpenExt ernalWebsi te(aWebsit e: IWVWebS ite): bool ean; | |
| 52 | functi on SavePre gnancyAndL actationDa ta(aList: TStrings): boolean; | |
| 53 | public | |
| 54 | constr uctor Crea te; | |
| 55 | destru ctor Destr oy; overri de; | |
| 56 | end; | |
| 57 | ||
| 58 | implementa tion | |
| 59 | ||
| 60 | uses | |
| 61 | fWVPregL acStatusUp date, // U pdate Form | |
| 62 | fWVEIERe asonsDlg, // Reason Selection Dialog | |
| 63 | oDelimit edString, | |
| 64 | 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. | |
| 65 | WinAPI.W indows, // Call to S hellExecut e for the WebSites | |
| 66 | ShellAPI ; // Call to ShellEx ecute for the WebSit es | |
| 67 | ||
| 68 | const | |
| 69 | { VistA RPC's } | |
| 70 | RPC_CONS AVE = 'WVR PCOR CONSA VE'; | |
| 71 | RPC_COVE R = 'WVRPC OR COVER'; | |
| 72 | RPC_EIE = 'WVRPCOR EIE'; | |
| 73 | RPC_SAVE DATA = 'WV RPCOR SAVE DATA'; | |
| 74 | RPC_REAS ONS = 'WVR PCOR REASO NS'; | |
| 75 | RPC_WEBS ITES = 'WV RPCOR SITE S'; | |
| 76 | ||
| 77 | { TWVCon troller } | |
| 78 | ||
| 79 | constructo r TWVContr oller.Crea te; | |
| 80 | begin | |
| 81 | inherite d Create; | |
| 82 | fInitial ized := Fa lse; | |
| 83 | fLastErr or := ''; | |
| 84 | ||
| 85 | fWebSite s := TObje ctList<TWV WebSite>.C reate; | |
| 86 | fWebSite s.OwnsObje cts := Tru e; | |
| 87 | end; | |
| 88 | ||
| 89 | destructor TWVContro ller.Destr oy; | |
| 90 | begin | |
| 91 | inherite d; | |
| 92 | FreeAndN il(fWebSit es); | |
| 93 | end; | |
| 94 | ||
| 95 | function T WVControll er.EditPre gLacData(a DFN: strin g): boolea n; | |
| 96 | var | |
| 97 | aList: T StringList ; | |
| 98 | aStr: st ring; | |
| 99 | begin | |
| 100 | try | |
| 101 | Result := False; | |
| 102 | CallVi stA(RPC_CO NSAVE, [aD FN], aStr) ; | |
| 103 | ||
| 104 | if Cop y(aStr, 1, 2) = '1^' then // G et confirm ation to r esult or e xit. | |
| 105 | if M essageDlg( Copy(aStr, 3, Length (aStr)), m tConfirmat ion, [mbYe s, mbNo], 0) <> mrYe s then | |
| 106 | be gin | |
| 107 | Result := True; | |
| 108 | Exit; | |
| 109 | en d; | |
| 110 | ||
| 111 | if Cop y(aStr, 1, 3) = '-1^ ' then // Error from server, a bort. | |
| 112 | begi n | |
| 113 | fL astError : = aStr; | |
| 114 | Ex it; | |
| 115 | end; | |
| 116 | except | |
| 117 | on E: Exception do | |
| 118 | fLas tError := E.Message; | |
| 119 | end; | |
| 120 | ||
| 121 | aList := TStringLi st.Create; | |
| 122 | with New PLUpdateFo rm(aDFN) d o | |
| 123 | try | |
| 124 | if E xecute the n | |
| 125 | be gin | |
| 126 | if GetData (aList) th en | |
| 127 | Result : = SavePreg nancyAndLa ctationDat a(aList) | |
| 128 | else | |
| 129 | begin | |
| 130 | fLastE rror := Co py(aList[0 ], 3, Leng th(aList[0 ])); | |
| 131 | Result := False; | |
| 132 | end | |
| 133 | en d | |
| 134 | else | |
| 135 | Re sult := Tr ue; | |
| 136 | finall y | |
| 137 | Free ; | |
| 138 | Free AndNil(aLi st); | |
| 139 | end | |
| 140 | end; | |
| 141 | ||
| 142 | function T WVControll er.GetLast Error: str ing; | |
| 143 | begin | |
| 144 | Result : = fLastErr or; | |
| 145 | end; | |
| 146 | ||
| 147 | function T WVControll er.GetReco rdIDType(a RecordID: string; va r aType: s tring): bo olean; | |
| 148 | begin | |
| 149 | try | |
| 150 | case S trToInt(Co py(aRecord ID, 1, Pos (';', aRec ordID) - 1 )) of | |
| 151 | 4: | |
| 152 | be gin | |
| 153 | aType := ' Pregnancy Status'; | |
| 154 | Result := True; | |
| 155 | en d; | |
| 156 | 5: | |
| 157 | be gin | |
| 158 | aType := ' Lactation Status'; | |
| 159 | Result := True; | |
| 160 | en d; | |
| 161 | else | |
| 162 | begi n | |
| 163 | aT ype := 'Un known Reco rd ID Type ' + aReco rdID; | |
| 164 | Re sult := Fa lse; | |
| 165 | end; | |
| 166 | end; | |
| 167 | except | |
| 168 | on E: Exception do | |
| 169 | begi n | |
| 170 | aT ype := 'Er ror gettin g Record I D Type ' + E.Message ; | |
| 171 | Re sult := Fa lse; | |
| 172 | end; | |
| 173 | end; | |
| 174 | end; | |
| 175 | ||
| 176 | function T WVControll er.getWebS ite(aIndex : integer) : IWVWebSi te; | |
| 177 | begin | |
| 178 | InitCont roller; | |
| 179 | try | |
| 180 | fWebSi tes.Items[ aIndex].Ge tInterface (IWVWebSit e, Result) ; | |
| 181 | except | |
| 182 | Result := nil; | |
| 183 | end; | |
| 184 | end; | |
| 185 | ||
| 186 | function T WVControll er.GetWebS iteURL(aWe bSiteName: string): string; | |
| 187 | var | |
| 188 | aWebsite : TWVWebSi te; | |
| 189 | begin | |
| 190 | for aWeb site in fW ebSites do | |
| 191 | if Com pareStr(aW ebsite.Get Name, aWeb SiteName) = 0 then | |
| 192 | begi n | |
| 193 | Re sult := aW ebsite.Get URL; | |
| 194 | Br eak; | |
| 195 | end; | |
| 196 | end; | |
| 197 | ||
| 198 | function T WVControll er.getWebS iteCount: integer; | |
| 199 | begin | |
| 200 | InitCont roller; | |
| 201 | Result : = fWebSite s.Count; | |
| 202 | end; | |
| 203 | ||
| 204 | function T WVControll er.getWebS iteListNam e: string; | |
| 205 | begin | |
| 206 | InitCont roller; | |
| 207 | Result : = fWebSite ListName; | |
| 208 | end; | |
| 209 | ||
| 210 | function T WVControll er.InitCon troller(aF orceInit: boolean = False): bo olean; | |
| 211 | var | |
| 212 | aReturn: TStringLi st; | |
| 213 | i: integ er; | |
| 214 | begin | |
| 215 | if not f Initialize d then | |
| 216 | begin | |
| 217 | aRet urn := TSt ringList.C reate; | |
| 218 | try | |
| 219 | Ca llVistA(RP C_WEBSITES , [], aRet urn); | |
| 220 | if aReturn.C ount < 1 t hen | |
| 221 | fWebSiteLi stName := 'Error loa ding Web S ites!' | |
| 222 | el se | |
| 223 | begin | |
| 224 | fWebSite ListName : = aReturn[ 0]; | |
| 225 | for i := 1 to aRet urn.Count - 1 do | |
| 226 | fWebSi tes.Add(TW VWebSite.C reate(aRet urn[i])); | |
| 227 | end; | |
| 228 | fI nitialized := True; | |
| 229 | fina lly | |
| 230 | Fr eeAndNil(a Return); | |
| 231 | end; | |
| 232 | end; | |
| 233 | Result : = fInitial ized; | |
| 234 | end; | |
| 235 | ||
| 236 | function T WVControll er.IsValid WVPatient( aDFN: stri ng): boole an; | |
| 237 | var | |
| 238 | aList: T StringList ; | |
| 239 | begin | |
| 240 | aList := TStringLi st.Create; | |
| 241 | try | |
| 242 | CallVi stA(RPC_CO VER, [aDFN ], aList); | |
| 243 | Result := aList[ 0] <> '0'; | |
| 244 | except | |
| 245 | Result := False; | |
| 246 | end; | |
| 247 | FreeAndN il(aList); | |
| 248 | end; | |
| 249 | ||
| 250 | function T WVControll er.MarkAsE nteredInEr ror(aItemI D: string) : boolean; | |
| 251 | var | |
| 252 | aList: T StringList ; | |
| 253 | begin | |
| 254 | fLastErr or := ''; | |
| 255 | aList := TStringLi st.Create; | |
| 256 | with New WVEIEReaso nsDlg do | |
| 257 | try | |
| 258 | Call VistA(RPC_ REASONS, [ ], aList); | |
| 259 | AddR eason(aLis t); | |
| 260 | if E xecute the n | |
| 261 | tr y | |
| 262 | GetReasons (aList); | |
| 263 | CallVistA( RPC_EIE, [ aItemID, a List], aLi st); | |
| 264 | with NewDe limitedStr ing(aList[ 0]) do | |
| 265 | try | |
| 266 | Result := GetPie ceAsIntege r(1) = 1; | |
| 267 | if not Result th en | |
| 268 | fLas tError := GetPiece(2 ); | |
| 269 | finally | |
| 270 | Free; | |
| 271 | end; | |
| 272 | ex cept | |
| 273 | on E: Exce ption do | |
| 274 | begin | |
| 275 | fLastE rror := E. Message; | |
| 276 | Result := False; | |
| 277 | end; | |
| 278 | en d | |
| 279 | else | |
| 280 | Re sult := Tr ue; | |
| 281 | finall y | |
| 282 | Free ; | |
| 283 | end; | |
| 284 | FreeAndN il(aList); | |
| 285 | end; | |
| 286 | ||
| 287 | function T WVControll er.OpenExt ernalWebsi te(aWebsit e: IWVWebS ite): bool ean; | |
| 288 | begin | |
| 289 | try | |
| 290 | ShellE xecute(0, 'open', PW ideChar(aW ebsite.URL ), nil, ni l, SW_SHOW NORMAL); | |
| 291 | Result := True; | |
| 292 | except | |
| 293 | on E: Exception do | |
| 294 | begi n | |
| 295 | fL astError : = E.Messag e; | |
| 296 | Re sult := Fa lse; | |
| 297 | end; | |
| 298 | end; | |
| 299 | end; | |
| 300 | ||
| 301 | function T WVControll er.SavePre gnancyAndL actationDa ta(aList: TStrings): boolean; | |
| 302 | begin | |
| 303 | try | |
| 304 | CallVi stA(RPC_SA VEDATA, [a List], aLi st); | |
| 305 | with N ewDelimite dString(aL ist[0]) do | |
| 306 | try | |
| 307 | Re sult := (G etPieceAsI nteger(1) = 1); | |
| 308 | if not Resul t then | |
| 309 | fLastError := GetPie ce(2); | |
| 310 | fina lly | |
| 311 | Fr ee; | |
| 312 | end; | |
| 313 | except | |
| 314 | on E: Exception do | |
| 315 | begi n | |
| 316 | fL astError : = E.Messag e; | |
| 317 | Re sult := Fa lse; | |
| 318 | end; | |
| 319 | end; | |
| 320 | end; | |
| 321 | ||
| 322 | end. |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.