Produced by Araxis Merge on 5/13/2019 2:40:11 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\MPDU\Code\CPRS-chart-master-20181214\CPRS-chart-master\Encounter | uPCE.pas | Fri Dec 14 18:30:40 2018 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\MPDU\MPDU\Code\CPRS-chart-master-20181214\CPRS-chart-master\Encounter | uPCE.pas | Tue May 7 12:19:00 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 7208 |
| 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 uPCE; | |
| 2 | ||
| 3 | interface | |
| 4 | ||
| 5 | uses Windo ws, SysUti ls, Classe s, ORFn, u Const, ORC trls, ORCl asses,UBAG lobals, Co mCtrls; | |
| 6 | ||
| 7 | type | |
| 8 | TPCEProv iderRec = record | |
| 9 | IEN: i nt64; | |
| 10 | Name: string; | |
| 11 | Primar y: boolean ; | |
| 12 | Delete : boolean; | |
| 13 | end; | |
| 14 | ||
| 15 | TPCEProv iderList = class(TOR StringList ) | |
| 16 | private | |
| 17 | FNoUpd ate: boole an; | |
| 18 | FOnPri maryChange d: TNotify Event; | |
| 19 | FPendi ngDefault: string; | |
| 20 | FPendi ngUser: st ring; | |
| 21 | FPCEPr oviderIEN: Int64; | |
| 22 | FPCEPr oviderName : string; | |
| 23 | functi on GetProv iderData(I ndex: inte ger): TPCE ProviderRe c; | |
| 24 | proced ure SetPro viderData( Index: int eger; cons t Value: T PCEProvide rRec); | |
| 25 | functi on GetPrim aryIdx: in teger; | |
| 26 | proced ure SetPri maryIdx(co nst Value: integer); | |
| 27 | proced ure SetPri mary(index : integer; Primary: boolean); | |
| 28 | public | |
| 29 | functi on Add(con st S: stri ng): Integ er; overri de; | |
| 30 | functi on AddProv ider(AIEN, AName: st ring; APri mary: bool ean): inte ger; | |
| 31 | proced ure Assign (Source: T Persistent ); overrid e; | |
| 32 | functi on PCEProv ider: Int6 4; | |
| 33 | functi on PCEProv iderName: string; | |
| 34 | functi on IndexOf Provider(A IEN: strin g): intege r; | |
| 35 | proced ure Merge( AList: TPC EProviderL ist); | |
| 36 | proced ure Clear; override; | |
| 37 | proced ure Delete (Index: In teger); ov erride; | |
| 38 | functi on Primary IEN: int64 ; | |
| 39 | functi on Primary Name: stri ng; | |
| 40 | functi on Pending IEN(ADefau lt: boolea n): Int64; | |
| 41 | functi on Pending Name(ADefa ult: boole an): strin g; | |
| 42 | proper ty Provide rData[Inde x: integer ]: TPCEPro viderRec r ead GetPro viderData | |
| 43 | wr ite SetPro viderData; default; | |
| 44 | proper ty Primary Idx: integ er read Ge tPrimaryId x write Se tPrimaryId x; | |
| 45 | proper ty OnPrima ryChanged: TNotifyEv ent read F OnPrimaryC hanged | |
| 46 | write F OnPrimaryC hanged; | |
| 47 | end; | |
| 48 | ||
| 49 | TPCEItem = class(T Object) | |
| 50 | {base cl ass for PC E items} | |
| 51 | private | |
| 52 | FDelet e: Boole an; / /flag for deletion | |
| 53 | FSend: Boole an; / /flag to s end to bro ker | |
| 54 | FComme nt: Strin g; | |
| 55 | protecte d | |
| 56 | proced ure SetCom ment(const Value: St ring); | |
| 57 | public | |
| 58 | // Prov ider: Int 64; | |
| 59 | Provid er: Int64 ; | |
| 60 | Code: strin g; | |
| 61 | Catego ry: strin g; | |
| 62 | Narrat ive: strin g; | |
| 63 | FGecRe m: string; | |
| 64 | proced ure Assign (Src: TPCE Item); vir tual; | |
| 65 | proced ure Clear; virtual; | |
| 66 | functi on Delimit edStr: str ing; virtu al; | |
| 67 | functi on Delimit edStr2: st ring; virt ual; | |
| 68 | functi on ItemStr : string; virtual; | |
| 69 | functi on Match(A nItem: TPC EItem): Bo olean; | |
| 70 | functi on MatchPO V(AnItem: TPCEItem): Boolean; | |
| 71 | // func tion Match Provider(A nItem: TPC EItem):Boo lean; | |
| 72 | functi on MatchPr ovider(AnI tem: TPCEI tem):Boole an; | |
| 73 | proced ure SetFro mString(co nst x: str ing); virt ual; | |
| 74 | functi on HasCPTS tr: string ; virtual; | |
| 75 | proper ty Comment : String r ead FComme nt write S etComment; | |
| 76 | proper ty GecRem: string re ad FGecRem write FGe cRem; | |
| 77 | end; | |
| 78 | ||
| 79 | TPCEItem Class = cl ass of TPC EItem; | |
| 80 | ||
| 81 | TPCEProc = class(T PCEItem) | |
| 82 | {class f or procedu res} | |
| 83 | public | |
| 84 | FIsOld Procedure: boolean; | |
| 85 | Quanti ty: Integ er; | |
| 86 | Modifi ers: strin g; // Form at Modifie r1IEN;Modi fier2IEN;M odifier3IE N; Trailin g ; needed | |
| 87 | // Prov ider: Int6 4; {jm 9/8 /99} | |
| 88 | Provid er: Int64; {jm 9/8/9 9} | |
| 89 | proced ure Assign (Src: TPCE Item); ove rride; | |
| 90 | proced ure Clear; override; | |
| 91 | functi on Delimit edStr: str ing; overr ide; | |
| 92 | // func tion Delim itedStrC: string; | |
| 93 | // func tion Match (AnItem: T PCEProc): Boolean; | |
| 94 | functi on ModText : string; | |
| 95 | functi on ItemStr : string; override; | |
| 96 | proced ure SetFro mString(co nst x: str ing); over ride; | |
| 97 | proced ure CopyPr oc(Dest: T PCEProc); | |
| 98 | functi on Empty: boolean; | |
| 99 | end; | |
| 100 | ||
| 101 | TPCEDiag = class(T PCEItem) | |
| 102 | {class f or diagnos is} | |
| 103 | public | |
| 104 | fProvi der: Int64 ; | |
| 105 | Primar y: Boole an; | |
| 106 | AddPro b: Boole an; | |
| 107 | OldCom ment: stri ng; | |
| 108 | SaveCo mment: boo lean; | |
| 109 | proced ure Assign (Src: TPCE Item); ove rride; | |
| 110 | proced ure Clear; override; | |
| 111 | functi on Delimit edStr: str ing; overr ide; | |
| 112 | functi on Delimit edStr2: st ring; over ride; | |
| 113 | // func tion delim itedStrC: string; | |
| 114 | functi on ItemStr : string; override; | |
| 115 | proced ure SetFro mString(co nst x: str ing); over ride; | |
| 116 | proced ure Send; | |
| 117 | end; | |
| 118 | ||
| 119 | TPCEExam s = class( TPCEItem) | |
| 120 | {class f or Examina tions} | |
| 121 | public | |
| 122 | // Prov ider: Int6 4; | |
| 123 | Result s: Strin g; | |
| 124 | proced ure Assign (Src: TPCE Item); ove rride; | |
| 125 | proced ure Clear; override; | |
| 126 | functi on Delimit edStr: str ing; overr ide; | |
| 127 | // func tion delim itedStrC: string; | |
| 128 | functi on ItemStr : string; override; | |
| 129 | proced ure SetFro mString(co nst x: str ing); over ride; | |
| 130 | functi on HasCPTS tr: string ; override ; | |
| 131 | end; | |
| 132 | ||
| 133 | ||
| 134 | TPCEHeal th = class (TPCEItem) | |
| 135 | {class f or Health Factors} | |
| 136 | public | |
| 137 | // Prov ider: Int6 4; {jm 9/8 /99} | |
| 138 | Level: string; | |
| 139 | proced ure Assign (Src: TPCE Item); ove rride; | |
| 140 | proced ure Clear; override; | |
| 141 | functi on Delimit edStr: str ing; overr ide; | |
| 142 | // func tion delim itedStrC: string; | |
| 143 | functi on ItemStr : string; override; | |
| 144 | proced ure SetFro mString(co nst x: str ing); over ride; | |
| 145 | functi on HasCPTS tr: string ; override ; | |
| 146 | end; | |
| 147 | ||
| 148 | TPCEImm = class(TP CEItem) | |
| 149 | {class f or immuniz ations} | |
| 150 | public | |
| 151 | // Prov ider: Int64; {jm 9/8/99 } | |
| 152 | Series : String; | |
| 153 | Reacti on: String; | |
| 154 | Refuse d: Boolean; //not curr ently used | |
| 155 | Contra indicated: Boolean; | |
| 156 | proced ure Assign (Src: TPCE Item); ove rride; | |
| 157 | proced ure Clear; override; | |
| 158 | functi on Delimit edStr: str ing; overr ide; | |
| 159 | // func tion delim itedStrC: string; | |
| 160 | functi on ItemStr : string; override; | |
| 161 | proced ure SetFro mString(co nst x: str ing); over ride; | |
| 162 | functi on HasCPTS tr: string ; override ; | |
| 163 | end; | |
| 164 | ||
| 165 | TPCEPat = class(TP CEItem) | |
| 166 | {class f or patient Education } | |
| 167 | public | |
| 168 | // Prov ider: Int6 4; {jm 9/8 /99} | |
| 169 | Level: String; | |
| 170 | proced ure Assign (Src: TPCE Item); ove rride; | |
| 171 | proced ure Clear; override; | |
| 172 | functi on Delimit edStr: str ing; overr ide; | |
| 173 | // func tion delim itedStrC: string; | |
| 174 | functi on ItemStr : string; override; | |
| 175 | proced ure SetFro mString(co nst x: str ing); over ride; | |
| 176 | functi on HasCPTS tr: string ; override ; | |
| 177 | end; | |
| 178 | ||
| 179 | TPCESkin = class(T PCEItem) | |
| 180 | {class f or skin te sts} | |
| 181 | public | |
| 182 | // Prov ider: Int 64; {jm 9/ 8/99} | |
| 183 | Result s: Strin g; //Do not confuse fo r reserved word "res ult" | |
| 184 | Readin g: Integ er; | |
| 185 | DTRead : TFMDa teTime; | |
| 186 | DTGive n: TFMDa teTime; | |
| 187 | proced ure Assign (Src: TPCE Item); ove rride; | |
| 188 | proced ure Clear; override; | |
| 189 | functi on Delimit edStr: str ing; overr ide; | |
| 190 | // func tion delim itedStrC: string; | |
| 191 | functi on ItemStr : string; override; | |
| 192 | proced ure SetFro mString(co nst x: str ing); over ride; | |
| 193 | functi on HasCPTS tr: string ; override ; | |
| 194 | end; | |
| 195 | ||
| 196 | // TPCEDa ta = class ; | |
| 197 | ||
| 198 | tRequire dPCEDataTy pe = (ndDi ag, ndProc , ndSC); { jm 9/9/99} | |
| 199 | tRequire dPCEDataTy pes = set of tRequir edPCEDataT ype; | |
| 200 | ||
| 201 | //modifi ed: 6/9/99 | |
| 202 | //By: Ro bert Bott | |
| 203 | //Locati on: ISL | |
| 204 | //Purpos e: Changed to allow capture of multiple providers. | |
| 205 | TPCEData = class | |
| 206 | {class f or data to be passed to and fr om broker} | |
| 207 | private | |
| 208 | FUpdat ed: b oolean; | |
| 209 | FEncDa teTime: T FMDateTime ; //encount er date & time | |
| 210 | FNoteD ateTime: T FMDateTime ; //Note da te & time | |
| 211 | FEncLo cation: I nteger; //encount er locatio n | |
| 212 | FEncSv cCat: C har; // | |
| 213 | FEncIn patient: B oolean; //Inpatie nt flag | |
| 214 | FEncUs eCurr: B oolean; // | |
| 215 | FSCCha nged: B oolean; // | |
| 216 | FSCRel ated: I nteger; //service con. rela ted? | |
| 217 | FAORel ated: I nteger; // | |
| 218 | FIRRel ated: I nteger; // | |
| 219 | FECRel ated: I nteger; // | |
| 220 | FMSTRe lated: I nteger; // | |
| 221 | FHNCRe lated: I nteger; // | |
| 222 | FCVRel ated: I nteger; // | |
| 223 | FSHADR elated: Integer; // | |
| 224 | FCLRel ated: I nteger; // | |
| 225 | FVisit Type: T PCEProc; // | |
| 226 | FProvi ders: T PCEProvide rList; | |
| 227 | FDiagn oses: T List; //pointer list for diagnosis | |
| 228 | FProce dures: T List; //pointer list for Procedures | |
| 229 | FImmun izations: TList; //pointer list for Immunizati ons | |
| 230 | FSkinT ests: TList; //pointer list for skin tests | |
| 231 | FPatie ntEds: TList; | |
| 232 | FHealt hFactors: TList; | |
| 233 | fExams : TList; | |
| 234 | FNoteT itle: I nteger; | |
| 235 | FNoteI EN: I nteger; | |
| 236 | FParen t: s tring; // Parent Visit for secondary encounter s | |
| 237 | FHisto ricalLocat ion: strin g; // Instit ution IEN^ Name (if I EN=0 Piece 4 = outsi de locatio n) | |
| 238 | FStand Alone: boo lean; | |
| 239 | FStand AloneLoade d: boolean ; | |
| 240 | FProbl emAdded: B oolean; // Flag set when o ne or more Dx are ad ded to PL | |
| 241 | ||
| 242 | functi on GetVisi tString: s tring; | |
| 243 | functi on GetCPTR equired: B oolean; | |
| 244 | functi on getDocC ount: Inte ger; | |
| 245 | functi on MatchIt em(AList: TList; AnI tem: TPCEI tem): Inte ger; | |
| 246 | functi on MatchPO VItems(ALi st: TList; AnItem: T PCEItem): Integer; | |
| 247 | proced ure MarkDe letions(Pr eList: TLi st; PostLi st: TStrin gs); | |
| 248 | proced ure SetSCR elated(Val ue: Intege r); | |
| 249 | proced ure SetAOR elated(Val ue: Intege r); | |
| 250 | proced ure SetIRR elated(Val ue: Intege r); | |
| 251 | proced ure SetECR elated(Val ue: Intege r); | |
| 252 | proced ure SetMST Related(Va lue: Integ er); | |
| 253 | proced ure SetHNC Related(Va lue: Integ er); | |
| 254 | proced ure SetCVR elated(Val ue: Intege r); | |
| 255 | proced ure SetSHA DRelated(V alue: Inte ger); | |
| 256 | proced ure SetCLR elated(Val ue: Intege r); | |
| 257 | proced ure SetEnc UseCurr(Va lue: Boole an); | |
| 258 | functi on GetHasD ata: Boole an; | |
| 259 | proced ure GetHas CPTList(AL ist: TStri ngs); | |
| 260 | proced ure CopyPC EItems(Src : TList; D est: TObje ct; ItemCl ass: TPCEI temClass); | |
| 261 | public | |
| 262 | constr uctor Crea te; | |
| 263 | destru ctor Destr oy; overri de; | |
| 264 | proced ure Clear; | |
| 265 | proced ure CopyPC EData(Dest : TPCEData ); | |
| 266 | functi on Empty: boolean; | |
| 267 | proced ure PCEFor Note(NoteI EN: Intege r; EditObj : TPCEData );(* overl oad; | |
| 268 | proced ure PCEFor Note(NoteI EN: Intege r; EditObj : TPCEData ; DCSummAd mitString: string); overload;* ) | |
| 269 | proced ure Save; | |
| 270 | proced ure CopyDi agnoses(De st: TCapti onListView ); // ICDcode^P| S^Category ^Narrative ^P|S Text | |
| 271 | proced ure CopyPr ocedures(D est: TCapt ionListVie w); // CPTcode^Qt y^Category ^Narrative ^Qty Text | |
| 272 | proced ure CopyIm munization s(Dest: TC aptionList View); // | |
| 273 | proced ure CopySk inTests(De st: TCapti onListView ); // | |
| 274 | proced ure CopyPa tientEds(D est: TCapt ionListVie w); | |
| 275 | proced ure CopyHe althFactor s(Dest: TC aptionList View); | |
| 276 | proced ure CopyEx ams(Dest: TCaptionLi stView); | |
| 277 | proced ure SetDia gnoses(Src : TStrings ; FromForm : boolean = TRUE); // IC Dcode^P|S^ Category^N arrative^P |S Text | |
| 278 | proced ure SetExa ms(Src: TS trings; Fr omForm: bo olean = TR UE); | |
| 279 | Proced ure SetHea lthFactors (Src: TStr ings; From Form: bool ean = TRUE ); | |
| 280 | proced ure SetImm unizations (Src: TStr ings; From Form: bool ean = TRUE ); // IM Mcode^ | |
| 281 | Proced ure SetPat ientEds(Sr c: TString s; FromFor m: boolean = TRUE); | |
| 282 | proced ure SetSki nTests(Src : TStrings ; FromForm : boolean = TRUE); // | |
| 283 | proced ure SetPro cedures(Sr c: TString s; FromFor m: boolean = TRUE); // CP Tcode^Qty^ Category^N arrative^Q ty Text | |
| 284 | ||
| 285 | proced ure SetVis itType(Val ue: TPCEPr oc); / / CPTcode^ 1^Category ^Narrative | |
| 286 | functi on StrDiag noses: str ing; / / Diagnose s: ... | |
| 287 | functi on StrImmu nizations: string; / / Immunizz ations: .. . | |
| 288 | functi on StrProc edures: st ring; / / Procedur es: ... | |
| 289 | functi on StrSkin Tests: str ing; | |
| 290 | functi on StrPati entEds: st ring; | |
| 291 | functi on StrHeal thFactors: string; | |
| 292 | functi on StrExam s: string; | |
| 293 | functi on StrVisi tType(cons t ASCRelat ed, AAORel ated, AIRR elated, AE CRelated, | |
| 294 | AMSTRela ted, AHNCR elated, AC VRelated, ASHADRelat ed, ACLRel ated: Inte ger): stri ng; overlo ad; | |
| 295 | functi on StrVisi tType: str ing; overl oad; | |
| 296 | functi on StandAl one: boole an; | |
| 297 | proced ure AddStr Data(List: TStrings) ; | |
| 298 | proced ure AddVit alData(Dat a, List: T Strings); | |
| 299 | ||
| 300 | functi on NeededP CEData: tR equiredPCE DataTypes; | |
| 301 | functi on OK2Sign Note: bool ean; | |
| 302 | ||
| 303 | functi on PersonC lassDate: TFMDateTim e; | |
| 304 | functi on VisitDa teTime: TF MDateTime; | |
| 305 | functi on IsSecon daryVisit: boolean; | |
| 306 | functi on NeedPro viderInfo: boolean; | |
| 307 | ||
| 308 | proper ty HasData : Boo lean read GetHasDat a; | |
| 309 | proper ty CPTRequ ired: Boo lean read GetCPTReq uired; | |
| 310 | proper ty Problem Added: Boo lean read FProblemA dded; | |
| 311 | proper ty Inpatie nt: Boo lean read FEncInpat ient; | |
| 312 | proper ty UseEnco unter: Boo lean read FEncUseCu rr write SetEncUseC urr; | |
| 313 | proper ty SCRelat ed: Int eger read FSCRelate d write SetSCRelat ed; | |
| 314 | proper ty AORelat ed: Int eger read FAORelate d write SetAORelat ed; | |
| 315 | proper ty IRRelat ed: Int eger read FIRRelate d write SetIRRelat ed; | |
| 316 | proper ty ECRelat ed: Int eger read FECRelate d write SetECRelat ed; | |
| 317 | proper ty MSTRela ted: Int eger read FMSTRelat ed write SetMSTRela ted; | |
| 318 | proper ty HNCRela ted: Int eger read FHNCRelat ed write SetHNCRela ted; | |
| 319 | proper ty CVRelat ed: Int eger read FCVRelate d write S etCVRelate d; | |
| 320 | proper ty SHADRel ated: In teger rea d FSHADRel ated write SetSHADRe lated; | |
| 321 | proper ty CLRelat ed: Int eger read FCLRelate d write S etCLRelate d; | |
| 322 | proper ty VisitTy pe: TPC EProc read FVisitTyp e write SetVisitTy pe; | |
| 323 | proper ty VisitSt ring: str ing read GetVisitS tring; | |
| 324 | proper ty VisitCa tegory:cha r read FEncSvcCa t write FEncSvcCat ; | |
| 325 | proper ty DateTim e: TFM DateTime r ead FEncDa teTime wri te FEncDat eTime; | |
| 326 | proper ty NoteDat eTime: TFM DateTime r ead FNoteD ateTime wr ite FNoteD ateTime; | |
| 327 | proper ty Locatio n: Int eger Read FencLocat ion; | |
| 328 | proper ty NoteTit le: Int eger read FNoteTitle write FNo teTitle; | |
| 329 | proper ty NoteIEN : Int eger read FNoteIEN w rite FNote IEN; | |
| 330 | proper ty DocCOun t: Int eger read GetDocCoun t; | |
| 331 | proper ty Provide rs: TPC EProviderL ist read F Providers; | |
| 332 | proper ty Parent: str ing read F Parent wri te FParent ; | |
| 333 | proper ty Histori calLocatio n: string read FHist oricalLoca tion write FHistoric alLocation ; | |
| 334 | proper ty Updated : boolean read FUpda ted write FUpdated; | |
| 335 | end; | |
| 336 | ||
| 337 | type | |
| 338 | TPCEType = (ptEnco unter, ptR eminder, p tTemplate) ; | |
| 339 | ||
| 340 | const | |
| 341 | PCETypeT ext: array [TPCEType] of string = ('encou nter', 're minder', ' template') ; | |
| 342 | ||
| 343 | function I nvalidPCEP roviderTxt (AIEN: Int 64; ADate: TFMDateTi me): strin g; | |
| 344 | function M issingProv iderInfo(P CEEdit: TP CEData; PC EType: TPC EType = pt Encounter) : boolean; | |
| 345 | function I sOK2Sign(c onst PCEDa ta: TPCEDa ta; const IEN: integ er) :boole an; | |
| 346 | function F utureEncou nter(APCED ata: TPCED ata): bool ean; | |
| 347 | function C anEditPCE( APCEData: TPCEData): boolean; | |
| 348 | procedure GetPCECode s(List: TS trings; Co deType: in teger); | |
| 349 | procedure GetComboBo xMinMax(de st: TORCom boBox; var Min, Max: integer); | |
| 350 | procedure PCELoadORC ombo(dest: TORComboB ox); overl oad; | |
| 351 | procedure PCELoadORC ombo(dest: TORComboB ox; var Mi n, Max: in teger); ov erload; | |
| 352 | function G etPCEDispl ayText(ID: string; T ag: intege r): string ; | |
| 353 | procedure SetDefault Provider(P roviderLis t: TPCEPro viderList; APCEData: TPCEData) ; | |
| 354 | function V alidateGAF Date(var G afDate: TF MDateTime) : string; | |
| 355 | procedure GetVitalsF romDate(Vi talStr: TS trings; PC EObj: TPCE Data); | |
| 356 | procedure GetVitalsF romNote(Vi talStr: TS trings; PC EObj: TPCE Data; ANot eIEN: Int6 4); | |
| 357 | ||
| 358 | type | |
| 359 | TPCEData Cat = (pdc Visit, pdc Diag, pdcP roc, pdcIm m, pdcSkin , pdcPED, pdcHF, | |
| 360 | pdc Exam, pdcV ital, pdcO rder, pdcM H, pdcMST, pdcHNC, p dcWHR, pdc WH); | |
| 361 | ||
| 362 | function G etPCEDataT ext(Cat: T PCEDataCat ; Code, Ca tegory, Na rrative: s tring; | |
| 363 | Primary Diag: bool ean = FALS E; Qty: in teger = 0) : string; | |
| 364 | ||
| 365 | const | |
| 366 | PCEDataC atText: ar ray[TPCEDa taCat] of string = | |
| 367 | { dcVi sit } ('', | |
| 368 | { dcDi ag } 'Di agnoses: ' , | |
| 369 | { dcPr oc } 'Pr ocedures: ', | |
| 370 | { dcIm m } 'Im munization s: ', | |
| 371 | { dcSk in } 'Sk in Tests: ', | |
| 372 | { dcPE D } 'Pa tient Educ ations: ', | |
| 373 | { dcHF } 'He alth Facto rs: ', | |
| 374 | { dcEx am } 'Ex aminations : ', | |
| 375 | { dcVi tal } '', | |
| 376 | { dcOr der } 'Or ders: ', | |
| 377 | { dcMH } 'Me ntal Healt h: ', | |
| 378 | { dcMS T } 'MS T History: ', | |
| 379 | { dcHN C } 'He ad and/or Neck Cance r: ', | |
| 380 | { dcWH R } 'Wo men''s Hea lth Proced ure: ', | |
| 381 | { dcWH } 'WH Notificat ion: '); | |
| 382 | ||
| 383 | NoPCEVal ue = '@'; | |
| 384 | TAB_STOP _CHARS = 7 ; | |
| 385 | TX_NO_VI SIT = 'I nsufficien t Visit In formation' ; | |
| 386 | TX_NEED_ PROV1 = ' The provid er respons ible for t his encoun ter must b e entered before '; | |
| 387 | TX_NEED_ PROV2 = ' informati on may be entered.'; | |
| 388 | // TX_NEE D_PROV3 = 'you can sign the n ote.'; | |
| 389 | TX_NO_PR OV = 'M issing Pro vider'; | |
| 390 | TX_BAD_P ROV = 'I nvalid Pro vider'; | |
| 391 | TX_NOT_A CTIVE = ' does not h ave an act ive person class.'; | |
| 392 | TX_NOT_P ROV = ' is not a k nown Provi der.'; | |
| 393 | TX_MISSI NG = 'R equired In formation Missing'; | |
| 394 | TX_REQ1 = 'T he followi ng require d fields h ave not be en entered :' + CRLF; | |
| 395 | TC_REQ = 'R equired Fi elds'; | |
| 396 | TX_ADDEN D_AD = 'C annot make an addend um to an a ddendum' + CRLF + | |
| 397 | 'P lease sele ct the par ent note o r document , and try again.'; | |
| 398 | TX_ADDEN D_MK = 'U nable to M ake Addend um'; | |
| 399 | TX_DEL_C NF = 'C onfirm Del etion'; | |
| 400 | TX_IN_AU TH = 'I nsufficien t Authoriz ation'; | |
| 401 | TX_NOPCE = '< No encount er informa tion enter ed>'; | |
| 402 | TX_NEED_ T = 'M issing Enc ounter Inf ormation'; | |
| 403 | TX_NEED1 = 'T his note t itle is ma rked to pr ompt for t he followi ng missing ' + CRLF + | |
| 404 | 'e ncounter i nformation :' + CRLF; | |
| 405 | TX_NEED_ DIAG = ' A diagnos is.'; | |
| 406 | TX_NEED_ PROC = ' A visit t ype or pro cedure.'; | |
| 407 | TX_NEED_ SC = ' One or mo re service connected questions .'; | |
| 408 | TX_NEED2 = 'W ould you l ike to ent er encount er informa tion now?' ; | |
| 409 | TX_NEED3 = 'Y ou must en ter the en counter in formation before you can sign the note.' ; | |
| 410 | TX_NEEDA BORT = 'D ocument no t signed.' ; | |
| 411 | TX_COS_R EQ = 'A cosigner is require d for this document. '; | |
| 412 | TX_COS_S ELF = 'Y ou cannot make yours elf a cosi gner.'; | |
| 413 | TX_COS_A UTH = ' is not aut horized to cosign th is documen t.'; | |
| 414 | TC_COS = 'S elect Cosi gner'; | |
| 415 | ||
| 416 | TAG_IMMS ERIES = 1 0; | |
| 417 | TAG_IMMR EACTION= 2 0; | |
| 418 | TAG_SKRE SULTS = 3 0; | |
| 419 | TAG_PEDL EVEL = 4 0; | |
| 420 | TAG_HFLE VEL = 5 0; | |
| 421 | TAG_XAMR ESULTS = 6 0; | |
| 422 | TAG_HIST LOC = 7 0; | |
| 423 | ||
| 424 | { These pi ece number s are used by both t he PCE obj ects and r eminders } | |
| 425 | pnumCode = 2; | |
| 426 | pnumPrvd rIEN = 2; | |
| 427 | pnumCate gory = 3; | |
| 428 | pnumNarr ative = 4; | |
| 429 | pnumExam Results = 5; | |
| 430 | pnumSkin Results = 5; | |
| 431 | pnumHFLe vel = 5; | |
| 432 | pnumImmS eries = 5; | |
| 433 | pnumProc Qty = 5; | |
| 434 | pnumPEDL evel = 5; | |
| 435 | pnumDiag Primary = 5; | |
| 436 | pnumPrvd rName = 5; | |
| 437 | pnumProv ider = 6; | |
| 438 | pnumPrvd rPrimary = 6; | |
| 439 | pnumSkin Reading = 7; | |
| 440 | pnumImmR eaction = 7; | |
| 441 | pnumDiag Add2PL = 7; | |
| 442 | pnumSkin DTRead = 8; | |
| 443 | pnumImmC ontra = 8; | |
| 444 | pnumSkin DTGiven = 9; | |
| 445 | pnumImmR efused = 9; | |
| 446 | pnumCPTM ods = 9; | |
| 447 | pnumComm ent = 10; | |
| 448 | pnumWHPa pResult =11; | |
| 449 | pnumWHNo tPurp =12; | |
| 450 | ||
| 451 | USE_CURR ENT_VISITS TR = -2; | |
| 452 | ||
| 453 | implementa tion | |
| 454 | ||
| 455 | uses uCore , rPCE, rC ore, rTIU, fEncounte rFrame, uV itals, fFr ame, | |
| 456 | fPCEP rovider, r Vitals, uR eminders, rMisc, uGl obalVar; | |
| 457 | ||
| 458 | const | |
| 459 | FN_NEW_P ERSON = 20 0; | |
| 460 | ||
| 461 | function I nvalidPCEP roviderTxt (AIEN: Int 64; ADate: TFMDateTi me): strin g; | |
| 462 | begin | |
| 463 | Result : = ''; | |
| 464 | if(not C heckActive Person(Int ToStr(AIEN ), ADate)) then | |
| 465 | Result := TX_NOT _ACTIVE | |
| 466 | else | |
| 467 | if(not I sUserAProv ider(AIEN, ADate)) t hen | |
| 468 | Result := TX_NOT _PROV; | |
| 469 | end; | |
| 470 | ||
| 471 | function M issingProv iderInfo(P CEEdit: TP CEData; PC EType: TPC EType = pt Encounter) : boolean; | |
| 472 | begin | |
| 473 | if(PCEEd it.Empty a nd (PCEEdi t.Location <> Encoun ter.Locati on) and (n ot Encount er.NeedVis it)) then | |
| 474 | PCEEdi t.UseEncou nter := TR UE; | |
| 475 | Result : = NoPrimar yPCEProvid er(PCEEdit .Providers , PCEEdit) ; | |
| 476 | if(Resul t) then | |
| 477 | InfoBo x(TX_NEED_ PROV1 + PC ETypeText[ PCEType] + TX_NEED_P ROV2, | |
| 478 | TX_NO_PR OV, MB_OK or MB_ICON WARNING); | |
| 479 | end; | |
| 480 | ||
| 481 | var | |
| 482 | UNxtComm SeqNum: in teger; | |
| 483 | ||
| 484 | function I sOK2Sign(c onst PCEDa ta: TPCEDa ta; const IEN: integ er) :boole an; | |
| 485 | var | |
| 486 | TmpPCEDa ta: TPCEDa ta; | |
| 487 | ||
| 488 | begin | |
| 489 | if(assig ned(PCEDat a)) then | |
| 490 | PCEDat a.FUpdated := FALSE; | |
| 491 | if(assig ned(PCEDat a) and (PC EData.Visi tString <> '') and | |
| 492 | (Visi tStrForNot e(IEN) = P CEData.Vis itString)) then | |
| 493 | begin | |
| 494 | if(PCE Data.FNote IEN <= 0) then | |
| 495 | PCED ata.FNoteI EN := IEN; | |
| 496 | Result := PCEDat a.OK2SignN ote | |
| 497 | end | |
| 498 | else | |
| 499 | begin | |
| 500 | TmpPCE Data := TP CEData.Cre ate; | |
| 501 | try | |
| 502 | TmpP CEData.PCE ForNote(IE N, nil); | |
| 503 | Resu lt := TmpP CEData.OK2 SignNote; | |
| 504 | finall y | |
| 505 | TmpP CEData.Fre e; | |
| 506 | end; | |
| 507 | end; | |
| 508 | end; | |
| 509 | ||
| 510 | function F utureEncou nter(APCED ata: TPCED ata): bool ean; | |
| 511 | begin | |
| 512 | Result : = (Int(APC EData.FEnc DateTime + 0.0000001 ) > Int(FM Today + 0. 0000001)); | |
| 513 | end; | |
| 514 | ||
| 515 | function C anEditPCE( APCEData: TPCEData): boolean; | |
| 516 | begin | |
| 517 | if(GetAs kPCE(APCED ata.FEncLo cation) = apDisable) then | |
| 518 | Result := FALSE | |
| 519 | else | |
| 520 | Result := (not F utureEncou nter(APCED ata)); | |
| 521 | end; | |
| 522 | ||
| 523 | procedure GetComboBo xMinMax(de st: TORCom boBox; var Min, Max: integer); | |
| 524 | var | |
| 525 | DC: HDC; | |
| 526 | SaveFont : HFont; | |
| 527 | TextSize : TSize; | |
| 528 | TLen, i: integer; | |
| 529 | x: strin g; | |
| 530 | ||
| 531 | begin | |
| 532 | Min := M axInt; | |
| 533 | Max := 0 ; | |
| 534 | DC := Ge tDC(0); | |
| 535 | try | |
| 536 | SaveFo nt := Sele ctObject(D C, dest.Fo nt.Handle) ; | |
| 537 | try | |
| 538 | for i := 0 to dest.Items .Count-1 d o | |
| 539 | begi n | |
| 540 | x := dest.Di splayText[ i]; | |
| 541 | Ge tTextExten tPoint32(D C, PChar(x ), Length( x), TextSi ze); | |
| 542 | TL en := Text Size.cx; | |
| 543 | if (TLen > 0) and (Min > TLen) th en | |
| 544 | Min := TLe n; | |
| 545 | if (Max < TLe n) then | |
| 546 | Max := TLe n; | |
| 547 | end; | |
| 548 | finall y | |
| 549 | Sele ctObject(D C, SaveFon t); | |
| 550 | end; | |
| 551 | finally | |
| 552 | Releas eDC(0, DC) ; | |
| 553 | end; | |
| 554 | if(Min > Max) then Min := Ma x; | |
| 555 | ||
| 556 | inc(Min, ScrollBar Width + 8) ; | |
| 557 | inc(Max, ScrollBar Width + 8) ; | |
| 558 | end; | |
| 559 | ||
| 560 | type | |
| 561 | TListMin Max = (mmM in, mmMax, mmFont); | |
| 562 | ||
| 563 | var | |
| 564 | PCESetsO fCodes: TS tringList = nil; | |
| 565 | HistLoca tions: TOR StringList = nil; | |
| 566 | WHNotPur pose: TORS tringList = nil; | |
| 567 | WHPapRes ult: TORSt ringList = nil; | |
| 568 | WHMammRe sult: TORS tringList = nil; | |
| 569 | WHUltraR esult: TOR StringList = nil; | |
| 570 | const | |
| 571 | SetOfCod esHeader = '{^~Codes ~^}'; | |
| 572 | SOCHeade rLen = len gth(SetOfC odesHeader ); | |
| 573 | ListMinM ax: array[ 1..7, TLis tMinMax] o f integer = | |
| 574 | ((0, 0,-1), // TAG_IMMSE RIES | |
| 575 | (0, 0,-1), // TAG_IMMRE ACTION | |
| 576 | (0, 0,-1), // TAG_SKRES ULTS | |
| 577 | (0, 0,-1), // TAG_PEDLE VEL | |
| 578 | (0, 0,-1), // TAG_HFLEV EL | |
| 579 | (0, 0,-1), // TAG_XAMRE SULTS | |
| 580 | (0, 0,-1)); / / TAG_HIST LOC | |
| 581 | ||
| 582 | function C odeSetInde x(CodeType : integer) : integer; | |
| 583 | var | |
| 584 | TempSL: TStringLis t; | |
| 585 | Hdr: str ing; | |
| 586 | ||
| 587 | begin | |
| 588 | Hdr := S etOfCodesH eader + In tToStr(Cod eType); | |
| 589 | Result : = PCESetsO fCodes.Ind exOf(Hdr); | |
| 590 | if(Resul t < 0) the n | |
| 591 | begin | |
| 592 | TempSL := TStrin gList.Crea te; | |
| 593 | try | |
| 594 | case CodeType of | |
| 595 | TA G_IMMSERIE S: LoadI mmSeriesIt ems(TempSL ); | |
| 596 | TA G_IMMREACT ION: LoadI mmReaction Items(Temp SL); | |
| 597 | TA G_SKRESULT S: LoadS kResultsIt ems(TempSL ); | |
| 598 | TA G_PEDLEVEL : LoadP EDLevelIte ms(TempSL) ; | |
| 599 | TA G_HFLEVEL: LoadH FLevelItem s(TempSL); | |
| 600 | TA G_XAMRESUL TS: LoadX AMResultsI tems(TempS L); | |
| 601 | el se | |
| 602 | KillObj(@T empSL); | |
| 603 | end; | |
| 604 | if(a ssigned(Te mpSL)) the n | |
| 605 | begi n | |
| 606 | Re sult := PC ESetsOfCod es.Add(Hdr ); | |
| 607 | Fa stAddStrin gs(TempSL, PCESetsOf Codes); | |
| 608 | end; | |
| 609 | finall y | |
| 610 | Kill Obj(@TempS L); | |
| 611 | end; | |
| 612 | end; | |
| 613 | end; | |
| 614 | ||
| 615 | procedure GetPCECode s(List: TS trings; Co deType: in teger); | |
| 616 | var | |
| 617 | idx: int eger; | |
| 618 | ||
| 619 | begin | |
| 620 | if(CodeT ype = TAG_ HISTLOC) t hen | |
| 621 | begin | |
| 622 | if(not assigned( HistLocati ons)) then | |
| 623 | begin | |
| 624 | Hist Locations := TORStri ngList.Cre ate; | |
| 625 | Load HistLocati ons(HistLo cations); | |
| 626 | Hist Locations. SortByPiec e(2); | |
| 627 | Hist Locations. Insert(0,' 0'); | |
| 628 | end; | |
| 629 | FastAd dStrings(H istLocatio ns, List); | |
| 630 | end | |
| 631 | else | |
| 632 | begin | |
| 633 | if(not assigned( PCESetsOfC odes)) the n | |
| 634 | PCES etsOfCodes := TStrin gList.Crea te; | |
| 635 | idx := CodeSetIn dex(CodeTy pe); | |
| 636 | if(idx >= 0) the n | |
| 637 | begin | |
| 638 | inc( idx); | |
| 639 | whil e((idx < P CESetsOfCo des.Count) and | |
| 640 | (copy(PC ESetsOfCod es[idx],1, SOCHeaderL en) <> Set OfCodesHea der)) do | |
| 641 | begi n | |
| 642 | Li st.Add(PCE SetsOfCode s[idx]); | |
| 643 | in c(idx); | |
| 644 | end; | |
| 645 | end; | |
| 646 | end; | |
| 647 | end; | |
| 648 | ||
| 649 | function G etPCECodeS tring(Code Type: inte ger; ID: s tring): st ring; | |
| 650 | var | |
| 651 | idx: int eger; | |
| 652 | ||
| 653 | begin | |
| 654 | Result : = ''; | |
| 655 | if(CodeT ype <> TAG _HISTLOC) then | |
| 656 | begin | |
| 657 | if(not assigned( PCESetsOfC odes)) the n | |
| 658 | PCES etsOfCodes := TStrin gList.Crea te; | |
| 659 | idx := CodeSetIn dex(CodeTy pe); | |
| 660 | if(idx >= 0) the n | |
| 661 | begin | |
| 662 | inc( idx); | |
| 663 | whil e((idx < P CESetsOfCo des.Count) and | |
| 664 | (copy(PC ESetsOfCod es[idx],1, SOCHeaderL en) <> Set OfCodesHea der)) do | |
| 665 | begi n | |
| 666 | if (Piece(PCE SetsOfCode s[idx], U, 1) = ID) then | |
| 667 | be gin | |
| 668 | Result := Piece(PCES etsOfCodes [idx], U, 2); | |
| 669 | break; | |
| 670 | en d; | |
| 671 | in c(idx); | |
| 672 | end; | |
| 673 | end; | |
| 674 | end; | |
| 675 | end; | |
| 676 | ||
| 677 | procedure PCELoadORC omboData(d est: TORCo mboBox; Ge tMinMax: b oolean; va r Min, Max : integer) ; | |
| 678 | var | |
| 679 | idx: int eger; | |
| 680 | ||
| 681 | begin | |
| 682 | if(dest. items.coun t < 1) the n | |
| 683 | begin | |
| 684 | dest.C lear; | |
| 685 | GetPCE Codes(dest .Items, de st.Tag); | |
| 686 | dest.i temindex : = 0; | |
| 687 | if(Get MinMax) an d (dest.It ems.Count > 0) then | |
| 688 | begin | |
| 689 | idx := dest.Ta g div 10; | |
| 690 | if(i dx > 0) an d (idx < 8 ) then | |
| 691 | begi n | |
| 692 | if (ListMinMa x[idx, mmF ont] <> in teger(dest .Font.Hand le)) then | |
| 693 | be gin | |
| 694 | GetComboBo xMinMax(de st, Min, M ax); | |
| 695 | ListMinMax [idx, mmMi n] := Min; | |
| 696 | ListMinMax [idx, mmMa x] := Max; | |
| 697 | en d | |
| 698 | el se | |
| 699 | be gin | |
| 700 | Min := Lis tMinMax[id x, mmMin]; | |
| 701 | Max := Lis tMinMax[id x, mmMax]; | |
| 702 | en d; | |
| 703 | end; | |
| 704 | end; | |
| 705 | end; | |
| 706 | end; | |
| 707 | ||
| 708 | procedure PCELoadORC ombo(dest: TORComboB ox); | |
| 709 | var | |
| 710 | tmp: int eger; | |
| 711 | ||
| 712 | begin | |
| 713 | PCELoadO RComboData (dest, FAL SE, tmp, t mp); | |
| 714 | end; | |
| 715 | ||
| 716 | procedure PCELoadORC ombo(dest: TORComboB ox; var Mi n, Max: in teger); | |
| 717 | begin | |
| 718 | PCELoadO RComboData (dest, TRU E, Min, Ma x); | |
| 719 | end; | |
| 720 | ||
| 721 | function G etPCEDispl ayText(ID: string; T ag: intege r): string ; | |
| 722 | var | |
| 723 | Hdr: str ing; | |
| 724 | idx: int eger; | |
| 725 | TempSL: TStringLis t; | |
| 726 | ||
| 727 | begin | |
| 728 | Result : = ''; | |
| 729 | if(Tag = TAG_HISTL OC) then | |
| 730 | begin | |
| 731 | if(not assigned( HistLocati ons)) then | |
| 732 | begin | |
| 733 | Hist Locations := TORStri ngList.Cre ate; | |
| 734 | Load HistLocati ons(HistLo cations); | |
| 735 | Hist Locations. SortByPiec e(2); | |
| 736 | Hist Locations. Insert(0,' 0'); | |
| 737 | end; | |
| 738 | idx := HistLocat ions.Index OfPiece(ID ); | |
| 739 | if(idx >= 0) the n | |
| 740 | Resu lt := Piec e(HistLoca tions[idx] , U, 2); | |
| 741 | end | |
| 742 | else | |
| 743 | begin | |
| 744 | if(not assigned( PCESetsOfC odes)) the n | |
| 745 | PCES etsOfCodes := TStrin gList.Crea te; | |
| 746 | Hdr := SetOfCode sHeader + IntToStr(T ag); | |
| 747 | idx := PCESetsOf Codes.Inde xOf(Hdr); | |
| 748 | if(idx < 0) then | |
| 749 | begin | |
| 750 | Temp SL := TStr ingList.Cr eate; | |
| 751 | try | |
| 752 | ca se Tag of | |
| 753 | TAG_IMMSER IES: Loa dImmSeries Items(Temp SL); | |
| 754 | TAG_IMMREA CTION: Loa dImmReacti onItems(Te mpSL); | |
| 755 | TAG_SKRESU LTS: Loa dSkResults Items(Temp SL); | |
| 756 | TAG_PEDLEV EL: Loa dPEDLevelI tems(TempS L); | |
| 757 | TAG_HFLEVE L: Loa dHFLevelIt ems(TempSL ); | |
| 758 | TAG_XAMRES ULTS: Loa dXAMResult sItems(Tem pSL); | |
| 759 | else | |
| 760 | KillObj( @TempSL); | |
| 761 | en d; | |
| 762 | if (assigned( TempSL)) t hen | |
| 763 | be gin | |
| 764 | idx := PCE SetsOfCode s.Add(Hdr) ; | |
| 765 | FastAddStr ings(TempS L, PCESets OfCodes); | |
| 766 | en d; | |
| 767 | fina lly | |
| 768 | Ki llObj(@Tem pSL); | |
| 769 | end; | |
| 770 | end; | |
| 771 | if(idx >= 0) the n | |
| 772 | begin | |
| 773 | inc( idx); | |
| 774 | whil e((idx < P CESetsOfCo des.Count) and | |
| 775 | (copy(PC ESetsOfCod es[idx],1, SOCHeaderL en) <> Set OfCodesHea der)) do | |
| 776 | begi n | |
| 777 | if (Piece(PCE SetsOfCode s[idx], U, 1) = ID) then | |
| 778 | be gin | |
| 779 | Result := Piece(PCES etsOfCodes [idx], U, 2); | |
| 780 | break; | |
| 781 | en d; | |
| 782 | in c(idx); | |
| 783 | end; | |
| 784 | end; | |
| 785 | end; | |
| 786 | end; | |
| 787 | ||
| 788 | function G etPCEDataT ext(Cat: T PCEDataCat ; Code, Ca tegory, Na rrative: s tring; | |
| 789 | Primary Diag: bool ean = FALS E; Qty: in teger = 0) : string; | |
| 790 | begin | |
| 791 | Result : = ''; | |
| 792 | case Cat of | |
| 793 | pdcVis it: if Cod e <> '' th en Result := Categor y + ' ' + Narrative; | |
| 794 | pdcDia g: begin | |
| 795 | Resul t := GetDi agnosisTex t(Narrativ e, Code); | |
| 796 | if Pr imaryDiag then Resul t := Resul t + ' (Pri mary)'; | |
| 797 | end; | |
| 798 | pdcPro c: begin | |
| 799 | Result := Narrat ive; | |
| 800 | if Qty > 1 then Result := Result + ' (' + IntT oStr(Qty) + ' times) '; | |
| 801 | end; | |
| 802 | else R esult := N arrative; | |
| 803 | end; | |
| 804 | end; | |
| 805 | ||
| 806 | procedure SetDefault Provider(P roviderLis t: TPCEPro viderList; APCEData: TPCEData) ; | |
| 807 | var | |
| 808 | SIEN, tm p: string; | |
| 809 | DefUser, AUser: In t64; | |
| 810 | UserName: AI ; | |
| 811 | ||
| 812 | begin | |
| 813 | DefUser := Encount er.Provide r; | |
| 814 | if(DefUs er <> 0) a nd (Invali dPCEProvid erTxt(DefU ser, APCED ata.Person ClassDate) <> '') th en | |
| 815 | DefUse r := 0; | |
| 816 | if(DefUs er <> 0) t hen | |
| 817 | begin | |
| 818 | AUser := DefUser ; | |
| 819 | UserNa me := Enco unter.Prov iderName; | |
| 820 | end | |
| 821 | else | |
| 822 | if(Inval idPCEProvi derTxt(Use r.DUZ, APC EData.Pers onClassDat e) = '') t hen | |
| 823 | begin | |
| 824 | AUser := User.DU Z; | |
| 825 | UserNa me := User .Name; | |
| 826 | end | |
| 827 | else | |
| 828 | begin | |
| 829 | AUser := 0; | |
| 830 | UserNa me := ''; | |
| 831 | end; | |
| 832 | if(AUser = 0) then | |
| 833 | Provid erList.FPe ndingUser := '' | |
| 834 | else | |
| 835 | Provid erList.FPe ndingUser := IntToSt r(AUser) + U + UserN ame; | |
| 836 | Provider List.FPend ingDefault := ''; | |
| 837 | tmp := D efaultProv ider(APCED ata.Locati on, DefUse r, APCEDat a.PersonCl assDate, A PCEData.No teIEN); | |
| 838 | SIEN := IntToStr(S trToIntDef (Piece(tmp ,U,1),0)); | |
| 839 | if(SIEN <> '0') th en | |
| 840 | begin | |
| 841 | if(Che ckActivePe rson(SIEN, APCEData. PersonClas sDate)) th en | |
| 842 | begin | |
| 843 | if(p iece(TIUSi teParams, U, 8) = '1 ') and // Check to s ee if DEFA ULT PRIMAR Y PROVIDER is by Loc ation | |
| 844 | (S IEN = IntT oStr(User. DUZ)) then | |
| 845 | Pr oviderList .AddProvid er(SIEN, P iece(tmp,U ,2) ,TRUE) | |
| 846 | else | |
| 847 | Pr oviderList .FPendingD efault := tmp; | |
| 848 | end; | |
| 849 | end; | |
| 850 | end; | |
| 851 | ||
| 852 | function V alidateGAF Date(var G afDate: TF MDateTime) : string; | |
| 853 | var | |
| 854 | DateMsg: string; | |
| 855 | OKDate: TFMDateTim e; | |
| 856 | ||
| 857 | begin | |
| 858 | Result : = ''; | |
| 859 | if(Patie nt.DateDie d > 0) and (FMToday > Patient. DateDied) then | |
| 860 | begin | |
| 861 | DateMs g := 'Date of Death' ; | |
| 862 | OKDate := Patien t.DateDied ; | |
| 863 | end | |
| 864 | else | |
| 865 | begin | |
| 866 | DateMs g := 'Toda y'; | |
| 867 | OKDate := FMToda y; | |
| 868 | end; | |
| 869 | if(GafDa te <= 0) t hen | |
| 870 | begin | |
| 871 | Result := 'A dat e is requi red to ent er a GAF s core. Dat e Determin ed changed to ' + Da teMsg + '. '; | |
| 872 | GafDat e := OKDat e; | |
| 873 | end | |
| 874 | else | |
| 875 | if(Patie nt.DateDie d > 0) and (GafDate > Patient. DateDied) then | |
| 876 | begin | |
| 877 | Result := 'This patient di ed ' + For matFMDateT ime('mmm d d, yyyy hh :nn', Pati ent.DateDi ed) + | |
| 878 | '. Date GAF determ ined can n ot ' + CRL F + | |
| 879 | 'be later than the date of de ath, and h as been ch anged to ' + DateMsg + '.'; | |
| 880 | GafDat e := OKDat e; | |
| 881 | end; | |
| 882 | end; | |
| 883 | ||
| 884 | procedure GetVitalsF romDate(Vi talStr: TS trings; PC EObj: TPCE Data); | |
| 885 | var | |
| 886 | dte: TFM DateTime; | |
| 887 | ||
| 888 | begin | |
| 889 | if(PCEOb j.IsSecond aryVisit) then | |
| 890 | dte := PCEObj.No teDateTime | |
| 891 | else | |
| 892 | dte := PCEObj.Da teTime; | |
| 893 | GetVital sFromEncDa teTime(Vit alStr, Pat ient.DFN, dte); | |
| 894 | end; | |
| 895 | ||
| 896 | procedure GetVitalsF romNote(Vi talStr: TS trings; PC EObj: TPCE Data; ANot eIEN: Int6 4); | |
| 897 | begin | |
| 898 | if(PCEOb j.IsSecond aryVisit) then | |
| 899 | GetVit alsFromEnc DateTime(V italStr, P atient.DFN , PCEObj.N oteDateTim e) | |
| 900 | else | |
| 901 | GetVit alFromNote IEN(VitalS tr, Patien t.DFN, ANo teIEN); | |
| 902 | end; | |
| 903 | ||
| 904 | { TPCEItem methods - ---------- ---------- ---------- ---------- ---------- ---------- ---------- -- } | |
| 905 | ||
| 906 | //function TPCEItem. DelimitedS tr2: strin g; | |
| 907 | //added: 6 /17/98 | |
| 908 | //By: Robe rt Bott | |
| 909 | //Location : ISL | |
| 910 | //Purpose: Return co mment stri ng to be p assed in R PC call. | |
| 911 | function T PCEItem.De limitedStr 2: string; | |
| 912 | {created d elimited s tring to p ass to bro ker} | |
| 913 | begin | |
| 914 | If Comme nt = '' th en | |
| 915 | begin | |
| 916 | result := 'COM' + U + Int ToStr(UNxt CommSeqNum ) + U + No PCEValue; | |
| 917 | end | |
| 918 | else | |
| 919 | begin | |
| 920 | Result := 'COM' + U + Int ToStr(UNxt CommSeqNum ) + U + Co mment; | |
| 921 | end; | |
| 922 | ||
| 923 | Inc(UNxt CommSeqNum ); //set u p for next comment | |
| 924 | end; | |
| 925 | ||
| 926 | procedure TPCEItem.A ssign(Src: TPCEItem) ; | |
| 927 | begin | |
| 928 | FDelete := Src.F Delete; | |
| 929 | FSend := Src.F Send; | |
| 930 | Code := Src.C ode; | |
| 931 | Category := Src.C ategory; | |
| 932 | Narrativ e := Src.N arrative; | |
| 933 | Provider := Src.P rovider; | |
| 934 | Comment := Src.C omment; | |
| 935 | end; | |
| 936 | ||
| 937 | procedure TPCEItem.S etComment( const Valu e: String) ; | |
| 938 | begin | |
| 939 | FComment := Value; | |
| 940 | while (l ength(FCom ment) > 0) and (FCom ment[1] = '?') do | |
| 941 | delete (FComment, 1,1); | |
| 942 | end; | |
| 943 | ||
| 944 | ||
| 945 | //procedur e TPCEItem .Clear; | |
| 946 | //modified : 6/17/98 | |
| 947 | //By: Robe rt Bott | |
| 948 | //Location : ISL | |
| 949 | //Purpose: Add Comme nts to PCE Items. | |
| 950 | procedure TPCEItem.C lear; | |
| 951 | {clear fie lds(proper ties) of c lass} | |
| 952 | begin | |
| 953 | FDelete := False ; | |
| 954 | FSend := False ; | |
| 955 | Code := ''; | |
| 956 | Category := ''; | |
| 957 | Narrativ e := ''; | |
| 958 | Provider := 0; | |
| 959 | Comment := ''; | |
| 960 | end; | |
| 961 | ||
| 962 | //function TPCEItem. DelimitedS tr: string ; | |
| 963 | //modified : 6/17/98 | |
| 964 | //By: Robe rt Bott | |
| 965 | //Location : ISL | |
| 966 | //Purpose: Add Comme nts to PCE Items. | |
| 967 | function T PCEItem.De limitedStr : string; | |
| 968 | {created d elimited s tring to p ass to bro ker} | |
| 969 | var | |
| 970 | DelFlag: Char; | |
| 971 | begin | |
| 972 | if FDele te then De lFlag := ' -' else De lFlag := ' +'; | |
| 973 | Result : = DelFlag + U + Code + U + Cat egory + U + Narrativ e; | |
| 974 | end; | |
| 975 | ||
| 976 | function T PCEItem.It emStr: str ing; | |
| 977 | {returns s tring to b e assigned to Tlist in PCEData object} | |
| 978 | begin | |
| 979 | Result : = Narrativ e; | |
| 980 | end; | |
| 981 | ||
| 982 | function T PCEItem.Ma tch(AnItem : TPCEItem ): Boolean ; | |
| 983 | {checks fo r match of Code, Cat egory. and Item} | |
| 984 | begin | |
| 985 | Result : = False; | |
| 986 | if (Code = AnItem. Code) and (Category = AnItem.C ategory) a nd (Narrat ive = AnIt em.Narrati ve) | |
| 987 | then R esult := T rue; | |
| 988 | end; | |
| 989 | ||
| 990 | function T PCEItem.Ha sCPTStr: s tring; | |
| 991 | begin | |
| 992 | Result : = ''; | |
| 993 | end; | |
| 994 | ||
| 995 | //procedur e TPCEItem .SetFromSt ring(const x: string ); | |
| 996 | //modified : 6/17/98 | |
| 997 | //By: Robe rt Bott | |
| 998 | //Location : ISL | |
| 999 | //Purpose: Add Comme nts to PCE Items. | |
| 1000 | procedure TPCEItem.S etFromStri ng(const x : string); | |
| 1001 | { sets fie lds to pie ces passed from serv er: TYP ^ Code ^ Ca tegory ^ N arrative } | |
| 1002 | begin | |
| 1003 | Code := Piece (x, U, pnu mCode); | |
| 1004 | Category := Piece (x, U, pnu mCategory) ; | |
| 1005 | Narrativ e := Piece (x, U, pnu mNarrative ); | |
| 1006 | Provider := StrTo Int64Def(P iece(x, U, pnumProvi der), 0); | |
| 1007 | Comment := Piece (x, U, pnu mComment); | |
| 1008 | end; | |
| 1009 | ||
| 1010 | ||
| 1011 | { TPCEExam s methods ---------- ---------- ---------- ---------- ---------- ---------- ---------- --- } | |
| 1012 | ||
| 1013 | procedure TPCEExams. Assign(Src : TPCEItem ); | |
| 1014 | begin | |
| 1015 | inherite d Assign(S rc); | |
| 1016 | Results := TPCEExa ms(Src).Re sults; | |
| 1017 | if Resul ts = '' th en Results := NoPCEV alue; | |
| 1018 | end; | |
| 1019 | ||
| 1020 | procedure TPCEExams. Clear; | |
| 1021 | {clear fie lds(proper ties) of c lass} | |
| 1022 | begin | |
| 1023 | inherite d Clear; | |
| 1024 | // Provid er := 0; | |
| 1025 | Results := NoPCEV alue; | |
| 1026 | end; | |
| 1027 | ||
| 1028 | //function TPCEExams .Delimited Str: strin g; | |
| 1029 | //modified : 6/17/98 | |
| 1030 | //By: Robe rt Bott | |
| 1031 | //Location : ISL | |
| 1032 | //Purpose: Add Comme nts to PCE Items. | |
| 1033 | function T PCEExams.D elimitedSt r: string; | |
| 1034 | {created d elimited s tring to p ass to bro ker} | |
| 1035 | begin | |
| 1036 | Result : = inherite d Delimite dStr; | |
| 1037 | //Result := 'XAM' + Result + U + Resul ts + U + I ntToStr(Pr ovider) +U + U + U + | |
| 1038 | Result : = 'XAM' + Result + U + Results + U +U + U + U + | |
| 1039 | U + Int ToStr(UNxt CommSeqNum ); | |
| 1040 | end; | |
| 1041 | ||
| 1042 | (*function TPCEExams .delimited StrC: stri ng; | |
| 1043 | begin | |
| 1044 | Result : = inherite d Delimite dStr; | |
| 1045 | Result : = 'XAM' + Result + U + Results + U + Int ToStr(Prov ider) +U + U + U + | |
| 1046 | U + com ment; | |
| 1047 | end; | |
| 1048 | *) | |
| 1049 | function T PCEExams.H asCPTStr: string; | |
| 1050 | begin | |
| 1051 | Result : = Code + ' ;AUTTEXAM( '; | |
| 1052 | end; | |
| 1053 | ||
| 1054 | function T PCEExams.I temStr: st ring; | |
| 1055 | {returns s tring to b e assigned to Tlist in PCEData object} | |
| 1056 | begin | |
| 1057 | if(Resul ts <> NoPC EValue) th en | |
| 1058 | Result := GetPCE CodeString (TAG_XAMRE SULTS, Res ults) | |
| 1059 | else | |
| 1060 | Result := ''; | |
| 1061 | Result : = Result + U + inher ited ItemS tr; | |
| 1062 | end; | |
| 1063 | ||
| 1064 | procedure TPCEExams. SetFromStr ing(const x: string) ; | |
| 1065 | { sets fie lds to pie ces passed from serv er: TYP ^ Code ^ Ca tegory ^ N arrative ^ Qty ^ Pro v } | |
| 1066 | begin | |
| 1067 | inherite d SetFromS tring(x); | |
| 1068 | // Provid er := StrT oInt64Def( Piece(x, U , pnumProv ider), 0); | |
| 1069 | Results := Piece( x, U, pnum ExamResult s); | |
| 1070 | If resul ts = '' th en results := NoPCEV alue; | |
| 1071 | end; | |
| 1072 | ||
| 1073 | ||
| 1074 | { TPCESkin methods - ---------- ---------- ---------- ---------- ---------- ---------- ---------- -- } | |
| 1075 | ||
| 1076 | procedure TPCESkin.A ssign(Src: TPCEItem) ; | |
| 1077 | var | |
| 1078 | SKSrc: T PCESkin; | |
| 1079 | ||
| 1080 | begin | |
| 1081 | inherite d Assign(S rc); | |
| 1082 | SKSrc := TPCESkin( Src); | |
| 1083 | Results := SKSrc.R esults; | |
| 1084 | Reading := SKSrc.R eading; | |
| 1085 | DTRead := SKSrc.D TRead; | |
| 1086 | DTGiven := SKSrc.D TGiven; | |
| 1087 | if Resul ts = '' th en Results := NoPCEV alue; | |
| 1088 | end; | |
| 1089 | ||
| 1090 | procedure TPCESkin.C lear; | |
| 1091 | {clear fie lds(proper ties) of c lass} | |
| 1092 | begin | |
| 1093 | inherite d Clear; | |
| 1094 | // Provid er := 0; | |
| 1095 | Results := NoPCEVa lue; | |
| 1096 | Reading := 0; | |
| 1097 | DTRead := 0.0; //W hat should dates be ititialize d to? | |
| 1098 | DTGiven := 0.0; | |
| 1099 | end; | |
| 1100 | ||
| 1101 | //function TPCESkin. DelimitedS tr: string ; | |
| 1102 | //modified : 6/17/98 | |
| 1103 | //By: Robe rt Bott | |
| 1104 | //Location : ISL | |
| 1105 | //Purpose: Add Comme nts to PCE Items. | |
| 1106 | function T PCESkin.De limitedStr : string; | |
| 1107 | {created d elimited s tring to p ass to bro ker} | |
| 1108 | begin | |
| 1109 | Result : = inherite d Delimite dStr; | |
| 1110 | //Result := 'SK' + Result + U + result s + U + In tToStr(Pro vider) + U + | |
| 1111 | Result : = 'SK' + R esult + U + results + U + U + | |
| 1112 | IntToSt r(Reading) + U + U + U + IntTo Str(UNxtCo mmSeqNum); | |
| 1113 | //+ Fl oatToStr(D TRead) + U + FloatTo Str(DTGive n); | |
| 1114 | end; | |
| 1115 | ||
| 1116 | (*function TPCESkin. delimitedS trC: strin g; | |
| 1117 | begin | |
| 1118 | Result : = inherite d Delimite dStr; | |
| 1119 | Result : = 'SK' + R esult + U + results + U + IntT oStr(Provi der) + U + | |
| 1120 | IntToSt r(Reading) + U + U + U + comme nt; | |
| 1121 | end; | |
| 1122 | *) | |
| 1123 | function T PCESkin.Ha sCPTStr: s tring; | |
| 1124 | begin | |
| 1125 | Result : = Code + ' ;AUTTSK('; | |
| 1126 | end; | |
| 1127 | ||
| 1128 | function T PCESkin.It emStr: str ing; | |
| 1129 | {returns s tring to b e assigned to Tlist in PCEData object} | |
| 1130 | begin | |
| 1131 | if(Resul ts <> NoPC EValue) th en | |
| 1132 | Result := GetPCE CodeString (TAG_SKRES ULTS, Resu lts) | |
| 1133 | else | |
| 1134 | Result := ''; | |
| 1135 | Result : = Result + U; | |
| 1136 | if(Readi ng <> 0) t hen | |
| 1137 | Result := Result + IntToSt r(Reading) ; | |
| 1138 | Result : = Result + U + inher ited ItemS tr; | |
| 1139 | end; | |
| 1140 | ||
| 1141 | procedure TPCESkin.S etFromStri ng(const x : string); | |
| 1142 | { sets fie lds to pie ces passed from serv er: TYP ^ Code ^ Ca tegory ^ N arrative ^ Qty ^ Pro v } | |
| 1143 | var | |
| 1144 | sRead, s DTRead, sD TGiven: St ring; | |
| 1145 | begin | |
| 1146 | inherite d SetFromS tring(x); | |
| 1147 | // Provid er := StrT oInt64Def( Piece(x, U , pnumProv ider), 0); | |
| 1148 | Results := Piece( x, U, pnum SkinResult s); | |
| 1149 | sRead := Piece( x, U, pnum SkinReadin g); | |
| 1150 | sDTRead := Piece( x, U, pnum SkinDTRead ); | |
| 1151 | sDtGiven := Piece( x, U, pnum SkinDTGive n); | |
| 1152 | If resul ts = '' th en results := NoPCEV alue; | |
| 1153 | ||
| 1154 | if sRead <> '' the n | |
| 1155 | Readin g := StrT oInt(sRead ); | |
| 1156 | if sDTRe ad <> '' t hen | |
| 1157 | DTRead := StrT oFMDateTim e(sDTRead) ; | |
| 1158 | if sDTGi ven <> '' then | |
| 1159 | DTGive n := StrT oFMDateTim e(sDTGiven ); | |
| 1160 | ||
| 1161 | end; | |
| 1162 | ||
| 1163 | ||
| 1164 | { TPCEHeal th methods --------- ---------- ---------- ---------- ---------- ---------- ---------- ---- } | |
| 1165 | ||
| 1166 | procedure TPCEHealth .Assign(Sr c: TPCEIte m); | |
| 1167 | begin | |
| 1168 | inherite d Assign(S rc); | |
| 1169 | Level := TPCEHealt h(Src).Lev el; | |
| 1170 | if Level = '' then Level := NoPCEValue ; | |
| 1171 | end; | |
| 1172 | ||
| 1173 | procedure TPCEHealth .Clear; | |
| 1174 | {clear fie lds(proper ties) of c lass} | |
| 1175 | begin | |
| 1176 | inherite d Clear; | |
| 1177 | // Provid er := 0; | |
| 1178 | Level := NoPCEV alue; | |
| 1179 | end; | |
| 1180 | ||
| 1181 | //function TPCEHealt h.Delimite dStr: stri ng; | |
| 1182 | //modified : 6/17/98 | |
| 1183 | //By: Robe rt Bott | |
| 1184 | //Location : ISL | |
| 1185 | //Purpose: Add Comme nts to PCE Items. | |
| 1186 | function T PCEHealth. DelimitedS tr: string ; | |
| 1187 | {created d elimited s tring to p ass to bro ker} | |
| 1188 | begin | |
| 1189 | Result : = inherite d Delimite dStr; | |
| 1190 | // Result := 'HF' + Result + U + Level + U + IntT oStr(Provi der) + U + U + U + | |
| 1191 | Result : = 'HF' + R esult + U + Level + U + U + U + U + | |
| 1192 | U + Int ToStr(UNxt CommSeqNum )+ U + Gec Rem; | |
| 1193 | end; | |
| 1194 | ||
| 1195 | (*function TPCEHealt h.delimite dStrC: str ing; | |
| 1196 | begin | |
| 1197 | Result : = inherite d Delimite dStr; | |
| 1198 | Result : = 'HF' + R esult + U + Level + U + IntToS tr(Provide r) + U + U + U + | |
| 1199 | U + com ment; | |
| 1200 | end; | |
| 1201 | *) | |
| 1202 | function T PCEHealth. HasCPTStr: string; | |
| 1203 | begin | |
| 1204 | Result : = Code + ' ;AUTTHF('; | |
| 1205 | end; | |
| 1206 | ||
| 1207 | function T PCEHealth. ItemStr: s tring; | |
| 1208 | {returns s tring to b e assigned to Tlist in PCEData object} | |
| 1209 | begin | |
| 1210 | if(Level <> NoPCEV alue) then | |
| 1211 | Result := GetPCE CodeString (TAG_HFLEV EL, Level) | |
| 1212 | else | |
| 1213 | Result := ''; | |
| 1214 | Result : = Result + U + inher ited ItemS tr; | |
| 1215 | end; | |
| 1216 | ||
| 1217 | procedure TPCEHealth .SetFromSt ring(const x: string ); | |
| 1218 | { sets fie lds to pie ces passed from serv er: TYP ^ Code ^ Ca tegory ^ N arrative ^ Qty ^ Pro v } | |
| 1219 | begin | |
| 1220 | inherite d SetFromS tring(x); | |
| 1221 | // Provid er := StrT oInt64Def( Piece(x, U , pnumProv ider), 0); | |
| 1222 | Level := Piece( x, U, pnum HFLevel); | |
| 1223 | if level = '' then level := NoPCEValue ; | |
| 1224 | end; | |
| 1225 | ||
| 1226 | ||
| 1227 | { TPCEImm methods -- ---------- ---------- ---------- ---------- ---------- ---------- ---------- - } | |
| 1228 | ||
| 1229 | procedure TPCEImm.As sign(Src: TPCEItem); | |
| 1230 | var | |
| 1231 | IMMSrc: TPCEImm; | |
| 1232 | ||
| 1233 | begin | |
| 1234 | inherite d Assign(S rc); | |
| 1235 | IMMSrc : = TPCEImm( Src); | |
| 1236 | Series := IMMSrc.Se ries; | |
| 1237 | Reaction := IMMSrc.Re action; | |
| 1238 | Refused := IMMSrc.Re fused; | |
| 1239 | Contrain dicated := IMMSrc.Co ntraindica ted; | |
| 1240 | if Serie s = '' the n Series : = NoPCEVal ue; | |
| 1241 | if React ion ='' th en Reactio n := NoPCE Value; | |
| 1242 | end; | |
| 1243 | ||
| 1244 | procedure TPCEImm.Cl ear; | |
| 1245 | {clear fie lds(proper ties) of c lass} | |
| 1246 | begin | |
| 1247 | inherite d Clear; | |
| 1248 | // Provid er := 0; | |
| 1249 | Series := NoPCEV alue; | |
| 1250 | Reaction := NoPCEV alue; | |
| 1251 | Refused := False; //not cur rently use d | |
| 1252 | Contrain dicated := false; | |
| 1253 | end; | |
| 1254 | ||
| 1255 | //function TPCEImm.D elimitedSt r: string; | |
| 1256 | //modified : 6/17/98 | |
| 1257 | //By: Robe rt Bott | |
| 1258 | //Location : ISL | |
| 1259 | //Purpose: Add Comme nts to PCE Items. | |
| 1260 | function T PCEImm.Del imitedStr: string; | |
| 1261 | {created d elimited s tring to p ass to bro ker} | |
| 1262 | begin | |
| 1263 | Result : = inherite d Delimite dStr; | |
| 1264 | //Result := 'IMM' + Result + U + Serie s + U + In tToStr(Pro vider) + U + Reactio n; | |
| 1265 | Result : = 'IMM' + Result + U + Series + U + U + Reaction; | |
| 1266 | if Contr aindicated then Resu lt := Resu lt + U + ' 1' | |
| 1267 | else Res ult := Res ult + U + '0'; | |
| 1268 | Result : = Result + U + U + I ntToStr(UN xtCommSeqN um); | |
| 1269 | {the fol lowing two lines are not yet i mplemented in PCE si de} | |
| 1270 | //if Ref used then Result := Result + U + '1' | |
| 1271 | //else R esult := R esult + U + '0'; | |
| 1272 | end; | |
| 1273 | ||
| 1274 | (*function TPCEImm.d elimitedSt rC: string ; | |
| 1275 | begin | |
| 1276 | Result : = inherite d Delimite dStr; | |
| 1277 | Result : = 'IMM' + Result + U + Series + U + IntT oStr(Provi der) + U + Reaction; | |
| 1278 | if Contr aindicated then Resu lt := Resu lt + U + ' 1' | |
| 1279 | else Res ult := Res ult + U + '0'; | |
| 1280 | Result : = Result + U + U + c omment; | |
| 1281 | {the f ollowing t wo lines a re not yet implement ed in PCE side} | |
| 1282 | //if Ref used then Result := Result + U + '1' | |
| 1283 | //else R esult := R esult + U + '0'; | |
| 1284 | end; | |
| 1285 | *) | |
| 1286 | function T PCEImm.Has CPTStr: st ring; | |
| 1287 | begin | |
| 1288 | Result : = Code + ' ;AUTTIMM(' ; | |
| 1289 | end; | |
| 1290 | ||
| 1291 | function T PCEImm.Ite mStr: stri ng; | |
| 1292 | {returns s tring to b e assigned to Tlist in PCEData object} | |
| 1293 | begin | |
| 1294 | if(Serie s <> NoPCE Value) the n | |
| 1295 | Result := GetPCE CodeString (TAG_IMMSE RIES, Seri es) | |
| 1296 | else | |
| 1297 | Result := ''; | |
| 1298 | Result : = Result + U; | |
| 1299 | if(React ion <> NoP CEValue) t hen | |
| 1300 | Result := Result + GetPCEC odeString( TAG_IMMREA CTION, Rea ction); | |
| 1301 | Result : = Result + U; | |
| 1302 | if(Contr aindicated ) then | |
| 1303 | Result := Result + 'X'; | |
| 1304 | Result : = Result + U + inher ited ItemS tr; | |
| 1305 | end; | |
| 1306 | ||
| 1307 | procedure TPCEImm.Se tFromStrin g(const x: string); | |
| 1308 | { sets fie lds to pie ces passed from serv er: TYP ^ Code ^ Ca tegory ^ N arrative ^ Qty ^ Pro v } | |
| 1309 | var | |
| 1310 | temp: St ring; | |
| 1311 | begin | |
| 1312 | inherite d SetFromS tring(x); | |
| 1313 | // Provid er := StrT oInt64Def( Piece(x, U , pnumProv ider), 0); | |
| 1314 | Series := Piece( x, U, pnum ImmSeries) ; | |
| 1315 | Reaction := Piece( x, U, pnum ImmReactio n); | |
| 1316 | temp := Piece( x, U, pnum ImmRefused ); | |
| 1317 | if temp = '1' then refused := true el se refused := false; | |
| 1318 | temp := Piece( x, U, pnum ImmContra) ; | |
| 1319 | if temp = '1' then Contraind icated := true else Contraindi cated := f alse; | |
| 1320 | if Serie s = '' the n series : = NoPCEVal ue; | |
| 1321 | if React ion ='' th en reactio n := NoPCE Value; | |
| 1322 | end; | |
| 1323 | ||
| 1324 | ||
| 1325 | ||
| 1326 | { TPCEProc methods - ---------- ---------- ---------- ---------- ---------- ---------- ---------- -- } | |
| 1327 | ||
| 1328 | procedure TPCEProc.A ssign(Src: TPCEItem) ; | |
| 1329 | begin | |
| 1330 | inherite d Assign(S rc); | |
| 1331 | Quantity := TPCEPr oc(Src).Qu antity; | |
| 1332 | Modifier s := TPCEP roc(Src).M odifiers; | |
| 1333 | Provider := TPCEPr oc(Src).Pr ovider; | |
| 1334 | end; | |
| 1335 | ||
| 1336 | procedure TPCEProc.C lear; | |
| 1337 | {clear fie lds(proper ties) of c lass} | |
| 1338 | begin | |
| 1339 | inherite d Clear; | |
| 1340 | Quantity := 0; | |
| 1341 | Modifier s := ''; | |
| 1342 | // Provid er := 0; | |
| 1343 | Provider := 0; | |
| 1344 | end; | |
| 1345 | ||
| 1346 | procedure TPCEProc.C opyProc(De st: TPCEPr oc); | |
| 1347 | begin | |
| 1348 | Dest.FDe lete := FDelete; | |
| 1349 | Dest.FSe nd := Fsend; //flag to send t o broker | |
| 1350 | // Dest.P rovider := Provide r; | |
| 1351 | Dest.Pro vider := Provider; | |
| 1352 | Dest.Cod e := Code; | |
| 1353 | Dest.Cat egory := Category; | |
| 1354 | Dest.Nar rative := Narrative ; | |
| 1355 | Dest.Com ment := Comment; | |
| 1356 | Dest.Mod ifiers := Modifiers ; | |
| 1357 | end; | |
| 1358 | ||
| 1359 | //function TPCEProc. DelimitedS tr: string ; | |
| 1360 | //modified : 6/17/98 | |
| 1361 | //By: Robe rt Bott | |
| 1362 | //Location : ISL | |
| 1363 | //Purpose: Add Comme nts to PCE Items. | |
| 1364 | function T PCEProc.De limitedStr : string; | |
| 1365 | var | |
| 1366 | i, cnt: integer; | |
| 1367 | Mods, Mo dIEN, tmpP rov: strin g; | |
| 1368 | ||
| 1369 | {created d elimited s tring to p ass to bro ker} | |
| 1370 | begin | |
| 1371 | i := 1; | |
| 1372 | cnt := 0 ; | |
| 1373 | Mods := ''; | |
| 1374 | repeat | |
| 1375 | ModIEN := piece( Modifiers, ';', i); | |
| 1376 | if(Mod IEN <> '') then | |
| 1377 | begin | |
| 1378 | inc( cnt); | |
| 1379 | Mods := Mods + ';' + Mod ifierCode( ModIEN) + '/' + ModI EN; | |
| 1380 | inc( i); | |
| 1381 | end; | |
| 1382 | until (M odIEN = '' ); | |
| 1383 | ||
| 1384 | Result : = inherite d Delimite dStr; | |
| 1385 | if Provi der > 0 th en tmpProv := IntToS tr(Provide r) else tm pProv := ' '; | |
| 1386 | Result : = 'CPT' + Result + U + IntToSt r(Quantity ) + U + tm pProv | |
| 1387 | + U + U + U + Int ToStr(cnt) + Mods + U + IntToS tr(UNxtCom mSeqNum) + U; | |
| 1388 | if Lengt h(Result) > 250 then SetPiece( Result, U, 4, ''); | |
| 1389 | end; | |
| 1390 | ||
| 1391 | (*function TPCEProc. delimitedS trC: strin g; | |
| 1392 | begin | |
| 1393 | Result : = inherite d Delimite dStr; | |
| 1394 | Result : = 'CPT' + Result + U + IntToSt r(Quantity ) + U + In tToStr(Pro vider) + | |
| 1395 | U + U + U + U + co mment; | |
| 1396 | end; | |
| 1397 | *) | |
| 1398 | ||
| 1399 | function T PCEProc.Em pty: boole an; | |
| 1400 | begin | |
| 1401 | Result : = (Code = '') and (C ategory = '') and (N arrative = '') and | |
| 1402 | (Comment = '') and (Quantity = 0) and (Provider = 0) and ( Modifiers = ''); | |
| 1403 | end; | |
| 1404 | ||
| 1405 | (*function TPCEProc. Match(AnIt em: TPCEPr oc): Boole an; {NEW CODE - v20 tes ting only - RV} | |
| 1406 | begin | |
| 1407 | Result : = inherite d Match(An Item) and (Modifiers = AnItem. Modifiers) ; | |
| 1408 | end;*) | |
| 1409 | ||
| 1410 | function T PCEProc.Mo dText: str ing; | |
| 1411 | var | |
| 1412 | i: integ er; | |
| 1413 | tmp: str ing; | |
| 1414 | ||
| 1415 | begin | |
| 1416 | Result : = ''; | |
| 1417 | if(Modif iers <> '' ) then | |
| 1418 | begin | |
| 1419 | i := 1 ; | |
| 1420 | repeat | |
| 1421 | tmp := Piece(M odifiers,' ;',i); | |
| 1422 | if(t mp <> '') then | |
| 1423 | begi n | |
| 1424 | tm p := Modif ierName(tm p); | |
| 1425 | Re sult := Re sult + ' - ' + tmp; | |
| 1426 | end; | |
| 1427 | inc( i); | |
| 1428 | until (tmp = '') ; | |
| 1429 | end; | |
| 1430 | end; | |
| 1431 | ||
| 1432 | function T PCEProc.It emStr: str ing; | |
| 1433 | {returns s tring to b e assigned to Tlist in PCEData object} | |
| 1434 | begin | |
| 1435 | if(Quant ity > 1) t hen | |
| 1436 | Result := IntToS tr(Quantit y) + ' tim es' | |
| 1437 | else | |
| 1438 | Result := ''; | |
| 1439 | Result : = Result + U + inher ited ItemS tr + ModTe xt; | |
| 1440 | end; | |
| 1441 | ||
| 1442 | procedure TPCEProc.S etFromStri ng(const x : string); | |
| 1443 | var | |
| 1444 | i, cnt: integer; | |
| 1445 | Mods: st ring; | |
| 1446 | { sets fie lds to pie ces passed from serv er: TYP ^ Code ^ Ca tegory ^ N arrative ^ Qty ^ Pro v } | |
| 1447 | begin | |
| 1448 | inherite d SetFromS tring(x); | |
| 1449 | Quantity := StrToI ntDef(Piec e(x, U, pn umProcQty) , 1); | |
| 1450 | // Provid er := StrT oInt64Def( Piece(x, U , pnumProv ider), 0); | |
| 1451 | Provider := StrToI nt64Def(Pi ece(x, U, pnumProvid er), 0); | |
| 1452 | Modifier s := ''; | |
| 1453 | Mods := Piece(x, U , pnumCPTM ods); | |
| 1454 | cnt := S trToIntDef (Piece(Mod s, ';', 1) , 0); | |
| 1455 | if(cnt > 0) then | |
| 1456 | for i : = 1 to cnt do | |
| 1457 | Modif iers := Mo difiers + Piece(Piec e(Mods, '; ' , i+1), '/', 2) + ';'; | |
| 1458 | end; | |
| 1459 | ||
| 1460 | ||
| 1461 | { TPCEPat methods -- ---------- ---------- ---------- ---------- ---------- ---------- ---------- - } | |
| 1462 | ||
| 1463 | procedure TPCEPat.As sign(Src: TPCEItem); | |
| 1464 | begin | |
| 1465 | inherite d Assign(S rc); | |
| 1466 | Level := TPCEPat(S rc).Level; | |
| 1467 | if Level = '' then Level := NoPCEValue ; | |
| 1468 | end; | |
| 1469 | ||
| 1470 | procedure TPCEPat.Cl ear; | |
| 1471 | {clear fie lds(proper ties) of c lass} | |
| 1472 | begin | |
| 1473 | inherite d Clear; | |
| 1474 | // Provid er := 0; | |
| 1475 | Level := NoPCEV alue; | |
| 1476 | end; | |
| 1477 | ||
| 1478 | //function TPCEPat.D elimitedSt r: string; | |
| 1479 | //modified : 6/17/98 | |
| 1480 | //By: Robe rt Bott | |
| 1481 | //Location : ISL | |
| 1482 | //Purpose: Add Comme nts to PCE Items. | |
| 1483 | function T PCEPat.Del imitedStr: string; | |
| 1484 | {created d elimited s tring to p ass to bro ker} | |
| 1485 | begin | |
| 1486 | Result : = inherite d Delimite dStr; | |
| 1487 | //Result := 'PED' + Result + U + Level + U + Int ToStr(Prov ider) + U + U + U + | |
| 1488 | Result : = 'PED' + Result + U + Level + U+ U + U + U + | |
| 1489 | U + Int ToStr(UNxt CommSeqNum ); | |
| 1490 | end; | |
| 1491 | ||
| 1492 | (*function TPCEPat.d elimitedSt rC: string ; | |
| 1493 | begin | |
| 1494 | Result : = inherite d Delimite dStr; | |
| 1495 | Result : = 'PED' + Result + U + Level + U + IntTo Str(Provid er) + U + U + U + | |
| 1496 | U + com ment; | |
| 1497 | end; | |
| 1498 | *) | |
| 1499 | function T PCEPat.Has CPTStr: st ring; | |
| 1500 | begin | |
| 1501 | Result : = Code + ' ;AUTTEDT(' ; | |
| 1502 | end; | |
| 1503 | ||
| 1504 | function T PCEPat.Ite mStr: stri ng; | |
| 1505 | {returns s tring to b e assigned to Tlist in PCEData object} | |
| 1506 | begin | |
| 1507 | if(Level <> NoPCEV alue) then | |
| 1508 | Result := GetPCE CodeString (TAG_PEDLE VEL, Level ) | |
| 1509 | else | |
| 1510 | Result := ''; | |
| 1511 | Result : = Result + U + inher ited ItemS tr; | |
| 1512 | end; | |
| 1513 | ||
| 1514 | procedure TPCEPat.Se tFromStrin g(const x: string); | |
| 1515 | { sets fie lds to pie ces passed from serv er: TYP ^ Code ^ Ca tegory ^ N arrative ^ Qty ^ Pro v } | |
| 1516 | begin | |
| 1517 | inherite d SetFromS tring(x); | |
| 1518 | // Provid er := StrT oInt64Def( Piece(x, U , pnumProv ider), 0); | |
| 1519 | Level := Piece( x, U, pnum PEDLevel); | |
| 1520 | if level = '' then level := NoPCEValue ; | |
| 1521 | end; | |
| 1522 | ||
| 1523 | { TPCEDiag methods - ---------- ---------- ---------- ---------- ---------- ---------- ---------- -- } | |
| 1524 | ||
| 1525 | procedure TPCEDiag.A ssign(Src: TPCEItem) ; | |
| 1526 | begin | |
| 1527 | inherite d Assign(S rc); | |
| 1528 | Primary := TPCE Diag(Src). Primary; | |
| 1529 | AddProb := TPCE Diag(Src). AddProb; | |
| 1530 | end; | |
| 1531 | ||
| 1532 | //procedur e TPCEDiag .Clear; | |
| 1533 | //modified : 6/17/98 | |
| 1534 | //By: Robe rt Bott | |
| 1535 | //Location : ISL | |
| 1536 | //Purpose: Clear a d iagnosis o bject. | |
| 1537 | procedure TPCEDiag.C lear; | |
| 1538 | {clear fie lds(proper ties) of c lass} | |
| 1539 | begin | |
| 1540 | inherite d Clear; | |
| 1541 | Primary := False; | |
| 1542 | //Provid er := 0; | |
| 1543 | AddProb := False; | |
| 1544 | end; | |
| 1545 | ||
| 1546 | //function TPCEDiag. DelimitedS tr: string ; | |
| 1547 | //modified : 6/17/98 | |
| 1548 | //By: Robe rt Bott | |
| 1549 | //Location : ISL | |
| 1550 | //Purpose: Create de limited st ring to pa ss to Brok er. | |
| 1551 | function T PCEDiag.De limitedStr : string; | |
| 1552 | {created d elimited s tring to p ass to bro ker} | |
| 1553 | var | |
| 1554 | Provider Str: strin g; {jm 9/8 /99} | |
| 1555 | begin | |
| 1556 | Result : = inherite d Delimite dStr; | |
| 1557 | if(AddPr ob) then | |
| 1558 | Provid erStr := I ntToStr(fP rovider) | |
| 1559 | else | |
| 1560 | Provid erStr := ' '; | |
| 1561 | Result : = 'POV' + Result + U + BOOLCHA R[Primary] + U + Pro viderStr + U + | |
| 1562 | BOOLCH AR[AddProb ] + U + U + U; | |
| 1563 | if(SaveC omment) th en Result := Result + IntToStr (UNxtCommS eqNum); | |
| 1564 | if Lengt h(Result) > 250 then SetPiece( Result, U, 4, ''); | |
| 1565 | end; | |
| 1566 | ||
| 1567 | function T PCEDiag.De limitedStr 2: string; | |
| 1568 | begin | |
| 1569 | If Comme nt = '' th en | |
| 1570 | begin | |
| 1571 | SaveCo mment := ( OldComment <> '') or (not AddP rob); | |
| 1572 | if(Sav eComment) then | |
| 1573 | resu lt := 'COM ' + U + I ntToStr(UN xtCommSeqN um) + U + NoPCEValue | |
| 1574 | else | |
| 1575 | resu lt := ''; | |
| 1576 | end | |
| 1577 | else | |
| 1578 | begin | |
| 1579 | Result := 'COM' + U + Int ToStr(UNxt CommSeqNum ) + U + Co mment; | |
| 1580 | SaveCo mment := T RUE; | |
| 1581 | end; | |
| 1582 | Inc(UNxt CommSeqNum ); | |
| 1583 | end; | |
| 1584 | ||
| 1585 | (*function TPCEDiag. DelimitedS trC: strin g; | |
| 1586 | {created d elimited s tring for internal u se - keep comment in same stri ng.} | |
| 1587 | begin | |
| 1588 | Result : = inherite d Delimite dStr; | |
| 1589 | Result : = 'POV' + Result + U + BOOLCHA R[Primary] + U + Int ToStr(Prov ider)+ | |
| 1590 | U + BOOL CHAR[AddPr ob] + U + U + U + co mment; | |
| 1591 | end; | |
| 1592 | *) | |
| 1593 | function T PCEDiag.It emStr: str ing; | |
| 1594 | {returns s tring to b e assigned to Tlist in PCEData object} | |
| 1595 | begin | |
| 1596 | if Prima ry then | |
| 1597 | Result := 'Prima ry' | |
| 1598 | else | |
| 1599 | Result := 'Secon dary'; | |
| 1600 | // This ma y change i n the futu re if we a dd a check box to th e grid | |
| 1601 | if(AddPr ob) then | |
| 1602 | Result := 'Add' + U + Resu lt | |
| 1603 | else | |
| 1604 | Result := U + Re sult; | |
| 1605 | ||
| 1606 | Result : = Result + U + GetDi agnosisTex t((inherit ed ItemStr ), Code); | |
| 1607 | end; | |
| 1608 | ||
| 1609 | procedure TPCEDiag.S end; | |
| 1610 | //marks di agnosis to be sent; | |
| 1611 | begin | |
| 1612 | Fsend := True; | |
| 1613 | end; | |
| 1614 | ||
| 1615 | //procedur e TPCEDiag .SetFromSt ring(const x: string ); | |
| 1616 | //modified : 6/17/98 | |
| 1617 | //By: Robe rt Bott | |
| 1618 | //Location : ISL | |
| 1619 | //Purpose: Sets fiel ds to piec es passed from serve r. | |
| 1620 | procedure TPCEDiag.S etFromStri ng(const x : string); | |
| 1621 | { sets fie lds to pie ces passed from serv er: TYP ^ Code ^ Ca tegory ^ N arrative ^ Primary ^ ^ ^ Comme nt } | |
| 1622 | begin | |
| 1623 | inherite d SetFromS tring(x); | |
| 1624 | OldComme nt := Comm ent; | |
| 1625 | Primary := (Piece( x, U, pnum DiagPrimar y) = '1'); | |
| 1626 | //Provid er := StrT oInt64Def( Piece(x, U , pnumProv ider),0); | |
| 1627 | AddProb := (Piece( x, U, pnum DiagAdd2PL ) = '1'); | |
| 1628 | end; | |
| 1629 | ||
| 1630 | { TPCEData methods - ---------- ---------- ---------- ---------- ---------- ---------- ---------- -- } | |
| 1631 | ||
| 1632 | constructo r TPCEData .Create; | |
| 1633 | begin | |
| 1634 | FDiagnos es := TL ist.Create ; | |
| 1635 | FProcedu res := TL ist.Create ; | |
| 1636 | FImmuniz ations := TList.Crea te; | |
| 1637 | FSkinTes ts := TL ist.Create ; | |
| 1638 | FVisitTy pe := TP CEProc.Cre ate; | |
| 1639 | FPatient Eds := TL ist.Create ; | |
| 1640 | FHealthF actors := TList.Crea te; | |
| 1641 | fExams := TL ist.Create ; | |
| 1642 | FProvide rs := TPCE ProviderLi st.Create; | |
| 1643 | FSCRelat ed := SC C_NA; | |
| 1644 | FAORelat ed := SC C_NA; | |
| 1645 | FIRRelat ed := SC C_NA; | |
| 1646 | FECRelat ed := SC C_NA; | |
| 1647 | FMSTRela ted := SC C_NA; | |
| 1648 | FHNCRela ted := SC C_NA; | |
| 1649 | FCVRelat ed := SC C_NA; | |
| 1650 | FSHADRel ated := SC C_NA; | |
| 1651 | FCLRelat ed := SC C_NA; | |
| 1652 | FSCChang ed := Fa lse; | |
| 1653 | end; | |
| 1654 | ||
| 1655 | destructor TPCEData. Destroy; | |
| 1656 | var | |
| 1657 | i: Integ er; | |
| 1658 | begin | |
| 1659 | with FDi agnoses d o for i := 0 to Coun t - 1 do T PCEDiag(It ems[i]).Fr ee; | |
| 1660 | with FPr ocedures d o for i := 0 to Coun t - 1 do T PCEProc(It ems[i]).Fr ee; | |
| 1661 | with FIm munization s do for i := 0 to C ount - 1 d o TPCEImm( Items[i]). Free; | |
| 1662 | with FSk inTests do for i := 0 to Count - 1 do TP CESkin(Ite ms[i]).Fre e; | |
| 1663 | with FPa tientEds d o for i := 0 to Coun t - 1 do T PCEPat(Ite ms[i]).Fre e; | |
| 1664 | with FHe althFactor s do for i := 0 to C ount - 1 d o TPCEHeal th(Items[i ]).Free; | |
| 1665 | with FEx ams do for i := 0 to Count - 1 do TPCEEx ams(Items[ i]).Free; | |
| 1666 | FVisitTy pe.Free; | |
| 1667 | FDiagnos es.Free; | |
| 1668 | FProcedu res.Free; | |
| 1669 | FImmuniz ations.Fre e; | |
| 1670 | FSkinTes ts.free; | |
| 1671 | FPatient Eds.Free; | |
| 1672 | FHealthF actors.Fre e; | |
| 1673 | FExams.F ree; | |
| 1674 | FProvide rs.Free; | |
| 1675 | inherite d Destroy; | |
| 1676 | end; | |
| 1677 | ||
| 1678 | procedure TPCEData.C lear; | |
| 1679 | ||
| 1680 | procedur e ClearLis t(AList: T List); | |
| 1681 | var | |
| 1682 | i: Int eger; | |
| 1683 | ||
| 1684 | begin | |
| 1685 | for i := 0 to AL ist.Count - 1 do | |
| 1686 | TObj ect(AList[ i]).Free; | |
| 1687 | AList. Clear; | |
| 1688 | end; | |
| 1689 | ||
| 1690 | begin | |
| 1691 | FEncDate Time := 0; | |
| 1692 | FNoteDat eTime := 0 ; | |
| 1693 | FEncLoca tion := 0; | |
| 1694 | FEncSvcC at := 'A '; | |
| 1695 | FEncInpa tient := F ALSE; | |
| 1696 | FProblem Added := F alse; | |
| 1697 | FEncUseC urr := F ALSE; | |
| 1698 | FStandAl one := FAL SE; | |
| 1699 | FStandAl oneLoaded := FALSE; | |
| 1700 | FParent := ' '; | |
| 1701 | FHistori calLocatio n := ''; | |
| 1702 | FSCRelat ed := SCC _NA; | |
| 1703 | FAORelat ed := SCC _NA; | |
| 1704 | FIRRelat ed := SCC _NA; | |
| 1705 | FECRelat ed := SCC _NA; | |
| 1706 | FMSTRela ted := SCC _NA; | |
| 1707 | FHNCRela ted := SCC _NA; | |
| 1708 | FCVRelat ed := SCC _NA; | |
| 1709 | FSHADRel ated := SC C_NA; | |
| 1710 | FCLRelat ed := SC C_NA; | |
| 1711 | ||
| 1712 | ClearLis t(FDiagnos es); | |
| 1713 | ClearLis t(FProcedu res); | |
| 1714 | ClearLis t(FImmuniz ations); | |
| 1715 | ClearLis t(FSkinTes ts); | |
| 1716 | ClearLis t(FPatient Eds); | |
| 1717 | ClearLis t(FHealthF actors); | |
| 1718 | ClearLis t(FExams); | |
| 1719 | ||
| 1720 | FVisitTy pe.Clear; | |
| 1721 | FProvide rs.Clear; | |
| 1722 | FSCChang ed := Fa lse; | |
| 1723 | FNoteIEN := 0; | |
| 1724 | FNoteTit le := 0; | |
| 1725 | end; | |
| 1726 | ||
| 1727 | procedure TPCEData.C opyDiagnos es(Dest: T CaptionLis tView); | |
| 1728 | begin | |
| 1729 | CopyPCEI tems(FDiag noses, Des t, TPCEDia g); | |
| 1730 | end; | |
| 1731 | ||
| 1732 | procedure TPCEData.C opyProcedu res(Dest: TCaptionLi stView); | |
| 1733 | begin | |
| 1734 | CopyPCEI tems(FProc edures, De st, TPCEPr oc); | |
| 1735 | end; | |
| 1736 | ||
| 1737 | procedure TPCEData.C opyImmuniz ations(Des t: TCaptio nListView) ; | |
| 1738 | begin | |
| 1739 | CopyPCEI tems(FImmu nizations, Dest, TPC EImm); | |
| 1740 | end; | |
| 1741 | ||
| 1742 | procedure TPCEData.C opySkinTes ts(Dest: T CaptionLis tView); | |
| 1743 | begin | |
| 1744 | CopyPCEI tems(FSkin Tests, Des t, TPCESki n); | |
| 1745 | end; | |
| 1746 | ||
| 1747 | procedure TPCEData.C opyPatient Eds(Dest: TCaptionLi stView); | |
| 1748 | begin | |
| 1749 | CopyPCEI tems(FPati entEds, De st, TPCEPa t); | |
| 1750 | end; | |
| 1751 | ||
| 1752 | procedure TPCEData.C opyHealthF actors(Des t: TCaptio nListView) ; | |
| 1753 | begin | |
| 1754 | CopyPCEI tems(FHeal thFactors, Dest, TPC EHealth); | |
| 1755 | end; | |
| 1756 | ||
| 1757 | procedure TPCEData.C opyExams(D est: TCapt ionListVie w); | |
| 1758 | begin | |
| 1759 | CopyPCEI tems(FExam s, Dest, T PCEExams); | |
| 1760 | end; | |
| 1761 | ||
| 1762 | function T PCEData.Ge tVisitStri ng: string ; | |
| 1763 | begin | |
| 1764 | Result : = IntToSt r(FEncLoca tion) + '; ' + FloatT oStr(Visit DateTime) + ';' + FE ncSvcCat; | |
| 1765 | end; | |
| 1766 | ||
| 1767 | function T PCEData.Ge tCPTRequir ed: Boolea n; | |
| 1768 | begin | |
| 1769 | Result : = (([ndDia g, ndProc] * NeededP CEData) <> []); | |
| 1770 | end; | |
| 1771 | ||
| 1772 | procedure TPCEData.P CEForNote( NoteIEN: I nteger; Ed itObj: TPC EData); | |
| 1773 | (*const | |
| 1774 | NULL_STR = ''; | |
| 1775 | begin | |
| 1776 | PCEForNo te(NoteIEN , EditObj, NULL_STR) ; | |
| 1777 | end; | |
| 1778 | ||
| 1779 | procedure TPCEData.P CEForNote( NoteIEN: I nteger; Ed itObj: TPC EData; DCS ummAdmitSt ring: stri ng);*) | |
| 1780 | var | |
| 1781 | i, j: In teger; | |
| 1782 | TmpCat, TmpVStr: s tring; | |
| 1783 | x: strin g; | |
| 1784 | DoCopy, IsVisit: B oolean; | |
| 1785 | PCEList, VisitType List: TStr ingList; | |
| 1786 | ADiagnos is: TPC EDiag; | |
| 1787 | AProcedu re: TPC EProc; | |
| 1788 | AImmuniz ation: TPC EImm; | |
| 1789 | ASkinTes t: TPC ESkin; | |
| 1790 | APatient Ed: TPC EPat; | |
| 1791 | AHealthF actor: TPC EHealth; | |
| 1792 | AExam: TPC EExams; | |
| 1793 | FileVStr : string; | |
| 1794 | FileIEN: integer; | |
| 1795 | GetCat, DoRestore: boolean; | |
| 1796 | FRestDat e: TFMDate Time; | |
| 1797 | // AProvi der: T PCEProvide r; {6/9/9 9} | |
| 1798 | ||
| 1799 | function SCCValue( x: string) : Integer; | |
| 1800 | begin | |
| 1801 | Result := SCC_NA ; | |
| 1802 | if Pie ce(x, U, 3 ) = '1' th en Result := SCC_YES ; | |
| 1803 | if Pie ce(x, U, 3 ) = '0' th en Result := SCC_NO; | |
| 1804 | end; | |
| 1805 | ||
| 1806 | function AppendCom ment(x: st ring): Str ing; | |
| 1807 | begin | |
| 1808 | //chec k for comm ent append string if a comment exists | |
| 1809 | If ((( i+1) <= (P CEList.Cou nt - 1)) a nd (Copy(P CEList[(i+ 1)], 1, 3) = 'COM')) then | |
| 1810 | begin | |
| 1811 | //re move last piece (com ment seque nce number ) from x. | |
| 1812 | Whil e x[length (x)] <> U do | |
| 1813 | x := Copy(X, 0,(length( x)-1)); | |
| 1814 | //ad d last pie ce of comm ent to x | |
| 1815 | x := X + Piece (PCEList[ (i+1)],U,3 ); | |
| 1816 | end; | |
| 1817 | result := x; | |
| 1818 | end; | |
| 1819 | ||
| 1820 | begin | |
| 1821 | (* if DCS ummAdmitSt ring <> '' then | |
| 1822 | TmpVSt r := DCSum mAdmitStri ng | |
| 1823 | else*) i f(NoteIEN < 1) then | |
| 1824 | TmpVSt r := Encou nter.Visit Str | |
| 1825 | else | |
| 1826 | begin | |
| 1827 | TmpVSt r := Visit StrForNote (NoteIEN); | |
| 1828 | if(FEn cSvcCat = #0) then | |
| 1829 | GetC at :=TRUE | |
| 1830 | else | |
| 1831 | if(Get VisitStrin g = '0;0;A ') then | |
| 1832 | begin | |
| 1833 | FEnc Location : = StrToInt Def(Piece( TmpVStr, ' ;', 1), 0) ; | |
| 1834 | FEnc DateTime : = StrToFlo atDef(Piec e(TmpVStr, ';', 2),0 ); | |
| 1835 | GetC at :=TRUE | |
| 1836 | end | |
| 1837 | else | |
| 1838 | GetC at := FALS E; | |
| 1839 | if(Get Cat) then | |
| 1840 | begin | |
| 1841 | TmpC at := Piec e(TmpVStr, ';', 3); | |
| 1842 | if(T mpCat <> ' ') then | |
| 1843 | FE ncSvcCat : = TmpCat[1 ]; | |
| 1844 | end; | |
| 1845 | end; | |
| 1846 | ||
| 1847 | if(assig ned(EditOb j)) then | |
| 1848 | begin | |
| 1849 | if(cop y(TmpVStr, 1,2) <> '0 ;') and // has loc ation | |
| 1850 | (pos (';0;',Tmp VStr) = 0) and / / has time | |
| 1851 | (Edi tObj.GetVi sitString = TmpVStr) then | |
| 1852 | begin | |
| 1853 | if(F EncSvcCat = 'H') and (FEncInpa tient) the n | |
| 1854 | Do Copy := (F NoteDateTi me = EditO bj.FNoteDa teTime) | |
| 1855 | else | |
| 1856 | Do Copy := TR UE; | |
| 1857 | if(D oCopy) the n | |
| 1858 | begi n | |
| 1859 | if (EditObj < > Self) th en | |
| 1860 | be gin | |
| 1861 | EditObj.Co pyPCEData( Self); | |
| 1862 | FNoteTitle := 0; | |
| 1863 | FNoteIEN : = 0; | |
| 1864 | en d; | |
| 1865 | ex it; | |
| 1866 | end; | |
| 1867 | end; | |
| 1868 | end; | |
| 1869 | ||
| 1870 | TmpCat : = Piece(Tm pVStr, ';' , 3); | |
| 1871 | if(TmpCa t <> '') t hen | |
| 1872 | FEncSv cCat := Tm pCat[1] | |
| 1873 | else | |
| 1874 | FEncSv cCat := #0 ; | |
| 1875 | FEncLoca tion := St rToIntDef( Piece(TmpV Str,';',1) ,0); | |
| 1876 | FEncDate Time := St rToFloatDe f(Piece(Tm pVStr, ';' , 2),0); | |
| 1877 | ||
| 1878 | if(IsSec ondaryVisi t and (FEn cLocation > 0)) then | |
| 1879 | begin | |
| 1880 | FileIE N := USE_C URRENT_VIS ITSTR; | |
| 1881 | FileVS tr := IntT oStr(FEncL ocation) + ';' + Flo atToStr(FN oteDateTim e) + ';' + | |
| 1882 | Get LocSeconda ryVisitCod e(FEncLoca tion); | |
| 1883 | DoRest ore := TRU E; | |
| 1884 | FRestD ate := FEn cDateTime; | |
| 1885 | end | |
| 1886 | else | |
| 1887 | begin | |
| 1888 | DoRest ore := FAL SE; | |
| 1889 | FRestD ate := 0; | |
| 1890 | FileIE N := NoteI EN; | |
| 1891 | (* if D CSummAdmit String <> '' then | |
| 1892 | File VStr := DC SummAdmitS tring | |
| 1893 | else*) if(FileIE N < 0) the n | |
| 1894 | File VStr := En counter.Vi sitStr | |
| 1895 | else | |
| 1896 | File VStr := '' ; | |
| 1897 | end; | |
| 1898 | ||
| 1899 | Clear; | |
| 1900 | PCEList := T StringList .Create; | |
| 1901 | VisitTyp eList := T StringList .Create; | |
| 1902 | try | |
| 1903 | LoadPC EDataForNo te(PCEList , FileIEN, FileVStr) ; / / calls br oker RPC t o load dat a | |
| 1904 | FNoteI EN := Note IEN; | |
| 1905 | for i := 0 to PC EList.Coun t - 1 do | |
| 1906 | begin | |
| 1907 | x := PCEList[i ]; | |
| 1908 | if C opy(x, 1, 4) = 'HDR^ ' then / / HDR ^ In patient ^ ProcReq ^ VStr ^ Pro vider | |
| 1909 | {hea der inform ation----- ---------- ---------- ---------- ---------- ---------- ------} | |
| 1910 | begi n | |
| 1911 | FE ncInpatien t := Piece (x, U, 2) = '1'; | |
| 1912 | // FCPTRequir ed := Pie ce(x, U, 3 ) = '1'; | |
| 1913 | // FNoteHasCP T := Pie ce(x, U, 6 ) = '1'; //4/21/9 9 error! P IECE 3 = c ptRequired , not HasC PT! | |
| 1914 | FE ncLocation := StrTo IntDef(Pie ce(Piece(x , U, 4), ' ;', 1), 0) ; | |
| 1915 | if DoRestore then | |
| 1916 | be gin | |
| 1917 | FEncSvcCat := 'H'; | |
| 1918 | FEncDateTi me := FRes tDate; | |
| 1919 | FNoteDateT ime := Mak eFMDateTim e(Piece(Pi ece(x, U, 4), ';', 2 )); | |
| 1920 | en d | |
| 1921 | el se | |
| 1922 | be gin | |
| 1923 | FEncDateTi me := Mak eFMDateTim e(Piece(Pi ece(x, U, 4), ';', 2 )); | |
| 1924 | FEncSvcCat := Cha rAt(Piece( Piece(x, U , 4), ';', 3), 1); | |
| 1925 | en d; | |
| 1926 | // FEncProvid er := Str ToInt64Def (Piece(x, U, 5), 0); | |
| 1927 | Li stVisitTyp eByLoc(Vis itTypeList , FEncLoca tion, FEnc DateTime); | |
| 1928 | // set the va lues neede d fot the RPCs | |
| 1929 | Se tRPCEncLoc ation(FEnc Location); | |
| 1930 | // SetRPCEncD ateTime(FE ncDateTime ); | |
| 1931 | end; | |
| 1932 | {vis it informa tion------ ---------- ---------- ---------- ---------- ---------- ------} | |
| 1933 | if C opy(x, 1, 7) = 'VST^ DT^' then | |
| 1934 | begi n | |
| 1935 | if DoRestore then | |
| 1936 | be gin | |
| 1937 | FEncDateTi me := FRes tDate; | |
| 1938 | FNoteDateT ime := Mak eFMDateTim e(Piece(x, U, 3)); | |
| 1939 | en d | |
| 1940 | el se | |
| 1941 | FEncDateTi me := Make FMDateTime (Piece(x, U, 3)); | |
| 1942 | end; | |
| 1943 | if C opy(x, 1, 7) = 'VST^ HL^' then FEncLocati on := StrT oIntDef(Pi ece(x, U, 3), 0); | |
| 1944 | if C opy(x, 1, 7) = 'VST^ VC^' then | |
| 1945 | begi n | |
| 1946 | if DoRestore then | |
| 1947 | FEncSvcCat := 'H' | |
| 1948 | el se | |
| 1949 | FEncSvcCat := CharAt (x, 8); | |
| 1950 | end; | |
| 1951 | if C opy(x, 1, 7) = 'VST^ PS^' then FEncInpati ent := Cha rAt(x, 8) = '1'; | |
| 1952 | {6/1 0/99}//if Copy(x, 1, 4) = 'PRV ^' then FEncProvi der := Str ToInt64Def (Piece(x, U, 2), 0); | |
| 1953 | if C opy(x, 1, 7) = 'VST^ SC^' then FSCRelate d := SCCVa lue(x); | |
| 1954 | if C opy(x, 1, 7) = 'VST^ AO^' then FAORelate d := SCCVa lue(x); | |
| 1955 | if C opy(x, 1, 7) = 'VST^ IR^' then FIRRelate d := SCCVa lue(x); | |
| 1956 | if C opy(x, 1, 7) = 'VST^ EC^' then FECRelate d := SCCVa lue(x); | |
| 1957 | if C opy(x, 1, 8) = 'VST^ MST^' then FMSTRelat ed := SCCV alue(x); | |
| 1958 | // if HNCOK and (Copy(x, 1, 8) = 'V ST^HNC^') then | |
| 1959 | if C opy(x, 1, 8) = 'VST^ HNC^' then FHNCRelat ed := SCCV alue(x); | |
| 1960 | if C opy(x, 1, 7) = 'VST^ CV^' then FCVRelated := SCCVal ue(x); | |
| 1961 | if I sLejeuneAc tive then | |
| 1962 | if Copy(x, 1 , 7) = 'VS T^CL^' the n FCLRelat ed := SCCV alue(x); | |
| 1963 | ||
| 1964 | if ( Copy(x, 1, 3) = 'PRV ') and (Ch arAt(x, 4) <> '-') t hen | |
| 1965 | {Pro viders---- ---------- ---------- ---------- ---------- ---------- ---------- -----} | |
| 1966 | begi n | |
| 1967 | FP roviders.A dd(x); | |
| 1968 | end; | |
| 1969 | ||
| 1970 | if ( Copy(x, 1, 3) = 'POV ') and (Ch arAt(x, 4) <> '-') t hen | |
| 1971 | {'PO V'=Diagnos is-------- ---------- ---------- ---------- ---------- ---------- ----} | |
| 1972 | begi n | |
| 1973 | // check for comment ap pend strin g if a com ment exist s | |
| 1974 | x := AppendC omment(x); | |
| 1975 | AD iagnosis : = TPCEDiag .Create; | |
| 1976 | AD iagnosis.S etFromStri ng(x); | |
| 1977 | FD iagnoses.A dd(ADiagno sis); | |
| 1978 | end; | |
| 1979 | if ( Copy(x, 1, 3) = 'CPT ') and (Ch arAt(x, 4) <> '-') t hen | |
| 1980 | {CPT (procedur e) informa tion------ ---------- ---------- ---------- ---------- ----} | |
| 1981 | begi n | |
| 1982 | x := AppendC omment(x); | |
| 1983 | ||
| 1984 | Is Visit := F alse; | |
| 1985 | wi th VisitTy peList do for j := 0 to Count - 1 do | |
| 1986 | if Pieces( x, U, 2, 4 ) = String s[j] then IsVisit := True; | |
| 1987 | if IsVisit a nd (FVisit Type.Code = '') then FVisitTyp e.SetFromS tring(x) e lse | |
| 1988 | be gin | |
| 1989 | AProcedure := TPCEPr oc.Create; | |
| 1990 | AProcedure .SetFromSt ring(x); | |
| 1991 | AProcedure .fIsOldPro cedure := TRUE; | |
| 1992 | FProcedure s.Add(APro cedure); | |
| 1993 | en d; {if IsV isit} | |
| 1994 | end; {if Copy} | |
| 1995 | if ( Copy(x, 1, 3) = 'IMM ') and (Ch arAt(x, 4) <> '-') t hen | |
| 1996 | {Imm unizations --------- ---------- ---------- ---------- ---------- ---------- ----} | |
| 1997 | begi n | |
| 1998 | x := AppendC omment(x); | |
| 1999 | AI mmunizatio n := TPCEI mm.Create; | |
| 2000 | AI mmunizatio n.SetFromS tring(x); | |
| 2001 | FI mmunizatio ns.Add(AIm munization ); | |
| 2002 | end; | |
| 2003 | if ( Copy(x, 1, 2) = 'SK' ) and (Cha rAt(x, 3) <> '-') th en | |
| 2004 | {Ski n Tests--- ---------- ---------- ---------- ---------- ---------- ---------- ----} | |
| 2005 | begi n | |
| 2006 | x := AppendC omment(x); | |
| 2007 | AS kinTest := TPCESkin. Create; | |
| 2008 | AS kinTest.Se tFromStrin g(x); | |
| 2009 | FS kinTests.A dd(ASkinTe st); | |
| 2010 | end; | |
| 2011 | if ( Copy(x, 1, 3) = 'PED ') and (Ch arAt(x, 3) <> '-') t hen | |
| 2012 | {Pat ient Educa tions----- ---------- ---------- ---------- ---------- ---------- -----} | |
| 2013 | begi n | |
| 2014 | x := AppendC omment(x); | |
| 2015 | AP atientEd : = TPCEpat. Create; | |
| 2016 | AP atientEd.S etFromStri ng(x); | |
| 2017 | Fp atientEds. Add(APatie ntEd); | |
| 2018 | end; | |
| 2019 | if ( Copy(x, 1, 2) = 'HF' ) and (Cha rAt(x, 3) <> '-') th en | |
| 2020 | {Hea lth Factor s--------- ---------- ---------- ---------- ---------- ---------- -----} | |
| 2021 | begi n | |
| 2022 | x := AppendC omment(x); | |
| 2023 | AH ealthFacto r := TPCEH ealth.Crea te; | |
| 2024 | AH ealthFacto r.SetFromS tring(x); | |
| 2025 | FH ealthFacto rs.Add(AHe althFactor ); | |
| 2026 | end; | |
| 2027 | if ( Copy(x, 1, 3) = 'XAM ') and (Ch arAt(x, 3) <> '-') t hen | |
| 2028 | {Exa ms ------- ---------- ---------- ---------- ---------- ---------- ---------- -----} | |
| 2029 | begi n | |
| 2030 | x := AppendC omment(x); | |
| 2031 | AE xam := TPC EExams.Cre ate; | |
| 2032 | AE xam.SetFro mString(x) ; | |
| 2033 | FE xams.Add(A Exam); | |
| 2034 | end; | |
| 2035 | ||
| 2036 | end; | |
| 2037 | finally | |
| 2038 | PCELis t.Free; | |
| 2039 | VisitT ypeList.Fr ee; | |
| 2040 | end; | |
| 2041 | end; | |
| 2042 | ||
| 2043 | //procedur e TPCEData .Save; | |
| 2044 | //modified : 6/17/98 | |
| 2045 | //By: Robe rt Bott | |
| 2046 | //Location : ISL | |
| 2047 | //Purpose: Add Comme nts to PCE Items. | |
| 2048 | procedure TPCEData.S ave; | |
| 2049 | { pass the changes t o the enco unter to D ATA2PCE, | |
| 2050 | Pieces: Subscript^ Code^Quali fier^Categ ory^Narrat ive^Delete } | |
| 2051 | var | |
| 2052 | i: Integ er; | |
| 2053 | x, AVisi tStr, EncN ame, Temp2 : string; | |
| 2054 | PCEList: TStringLi st; | |
| 2055 | FileCat: char; | |
| 2056 | FileDate : TFMDateT ime; | |
| 2057 | FileNote IEN: integ er; | |
| 2058 | dstring1 ,dstring2: pchar; // used to se parate for mer Delimi tedStr var iable | |
| 2059 | / / into two strings, the second being for the comme nt. | |
| 2060 | ||
| 2061 | begin | |
| 2062 | PCEList := TString List.Creat e; | |
| 2063 | UNxtComm SeqNum := 1; | |
| 2064 | try | |
| 2065 | with P CEList do | |
| 2066 | begin | |
| 2067 | if(I sSecondary Visit) the n | |
| 2068 | begi n | |
| 2069 | Fi leCat := G etLocSecon daryVisitC ode(FEncLo cation); | |
| 2070 | Fi leDate := FNoteDateT ime; | |
| 2071 | Fi leNoteIEN := NoteIEN ; | |
| 2072 | if ((NoteIEN > 0) and ( (FParent = '') or (F Parent = ' 0'))) then | |
| 2073 | FParent := GetVisitI EN(NoteIEN ); | |
| 2074 | end | |
| 2075 | else | |
| 2076 | begi n | |
| 2077 | Fi leCat := F EncSvcCat; | |
| 2078 | Fi leDate := FEncDateTi me; | |
| 2079 | Fi leNoteIEN := 0; | |
| 2080 | end; | |
| 2081 | AVis itStr := IntToStr(F EncLocatio n) + ';' + FloatToSt r(FileDate ) + ';' + FileCat; | |
| 2082 | Add( 'HDR^' + B OOLCHAR[FE ncInpatien t] + U + U + AVisitS tr); | |
| 2083 | // Ad d('HDR^' + BOOLCHAR[ FEncInpati ent] + U + BOOLCHAR[ FNoteHasCP T] + U + A VisitStr); | |
| 2084 | // s et up list that can be passed via broker to set up array for DATA2PCE | |
| 2085 | Add( 'VST^DT^' + FloatToS tr(FileDat e)); // E ncounter D ate/Time | |
| 2086 | Add( 'VST^PT^' + Patient. DFN); // Encount er Patient //*DFN * | |
| 2087 | if(F EncLocatio n > 0) the n | |
| 2088 | Ad d('VST^HL^ ' + IntToS tr(FEncLoc ation)); // Encou nter Locat ion | |
| 2089 | Add( 'VST^VC^' + FileCat) ; // Encounter Service Ca tegory | |
| 2090 | if(S trToIntDef (FParent,0 ) > 0) the n | |
| 2091 | Ad d('VST^PR^ ' + FParen t); // Parent for second ary visit | |
| 2092 | if(F ileCat = ' E') and (F Historical Location < > '') then | |
| 2093 | Ad d('VST^OL^ ' + FHisto ricalLocat ion); // Outside Location | |
| 2094 | Fast AddStrings (FProvider s, PCEList ); | |
| 2095 | ||
| 2096 | if F SCChanged then | |
| 2097 | begi n | |
| 2098 | if FSCRelate d <> SCC_ NA then A dd('VST^SC ^' + IntT oStr(FSCRe lated)); | |
| 2099 | if FAORelate d <> SCC_ NA then A dd('VST^AO ^' + IntT oStr(FAORe lated)); | |
| 2100 | if FIRRelate d <> SCC_ NA then A dd('VST^IR ^' + IntT oStr(FIRRe lated)); | |
| 2101 | if FECRelate d <> SCC_ NA then A dd('VST^EC ^' + IntT oStr(FECRe lated)); | |
| 2102 | if FMSTRelat ed <> SCC_ NA then A dd('VST^MS T^' + IntT oStr(FMSTR elated)); | |
| 2103 | if FHNCRelat ed <> SCC _NA then A dd('VST^HN C^'+ IntTo Str(FHNCRe lated)); | |
| 2104 | if FCVRelate d <> SCC _NA then A dd('VST^CV ^' + IntTo Str(FCVRel ated)); | |
| 2105 | if FSHADRela ted <> SCC _NA then A dd('VST^SH D^'+ IntTo Str(FSHADR elated)); | |
| 2106 | if IsLejeune Active the n | |
| 2107 | i f FCLRelat ed <> SC C_NA then Add('VST^C L^'+ IntTo Str(FCLRel ated)); | |
| 2108 | end; | |
| 2109 | with FDiagnoses do for i := 0 to C ount - 1 d o with TPC EDiag(Item s[i]) do | |
| 2110 | if FSend the n | |
| 2111 | be gin | |
| 2112 | Temp2 := D elimitedSt r2; // Cal l first to make sure SaveComme nt is set. | |
| 2113 | if(SaveCom ment) then | |
| 2114 | dec(UNxt CommSeqNum ); | |
| 2115 | fProvider := FProvid ers.PCEPro vider; | |
| 2116 | // Provide s user wit h list of dx when si gning orde rs - Billi ng Aware | |
| 2117 | PCEList.Ad d(Delimite dStr); | |
| 2118 | if(SaveCom ment) then | |
| 2119 | begin | |
| 2120 | inc(UNxt CommSeqNum ); | |
| 2121 | if(Temp2 <> '') th en | |
| 2122 | PCELis t.Add(Temp 2); | |
| 2123 | end; | |
| 2124 | end; | |
| 2125 | with FProcedur es do for i := 0 to Count - 1 do with TP CEProc(Ite ms[i]) do | |
| 2126 | if FSend the n | |
| 2127 | be gin | |
| 2128 | PCEList.Ad d(Delimite dStr); | |
| 2129 | PCEList.Ad d(Delimite dStr2); | |
| 2130 | en d; | |
| 2131 | with FImmuniza tions do f or i := 0 to Count - 1 do with TPCEImm(I tems[i]) d o | |
| 2132 | if FSend the n | |
| 2133 | be gin | |
| 2134 | PCEList.Ad d(Delimite dStr); | |
| 2135 | PCEList.Ad d(Delimite dStr2); | |
| 2136 | en d; | |
| 2137 | with FSkinTest s do for i := 0 to C ount - 1 d o with TPC ESkin(Item s[i]) do | |
| 2138 | if FSend the n | |
| 2139 | be gin | |
| 2140 | PCEList.Ad d(Delimite dStr); | |
| 2141 | PCEList.Ad d(Delimite dStr2); | |
| 2142 | en d; | |
| 2143 | with FPatientE ds do for i := 0 to Count - 1 do with TP CEPat(Item s[i]) do | |
| 2144 | if FSend the n | |
| 2145 | be gin | |
| 2146 | PCEList.Ad d(Delimite dStr); | |
| 2147 | PCEList.Ad d(Delimite dStr2); | |
| 2148 | en d; | |
| 2149 | with FHealthFa ctors do f or i := 0 to Count - 1 do with TPCEHealt h(Items[i] ) do | |
| 2150 | if FSend the n | |
| 2151 | be gin | |
| 2152 | PCEList.Ad d(Delimite dStr); | |
| 2153 | PCEList.Ad d(Delimite dStr2); | |
| 2154 | en d; | |
| 2155 | with FExams do for i := 0 to Count - 1 do wi th TPCEExa ms(Items[i ]) do | |
| 2156 | if FSend the n | |
| 2157 | be gin | |
| 2158 | PCEList.Ad d(Delimite dStr); | |
| 2159 | PCEList.Ad d(Delimite dStr2); | |
| 2160 | en d; | |
| 2161 | ||
| 2162 | with FVisitTyp e do | |
| 2163 | begi n | |
| 2164 | if Code = '' then Fsen d := false ; | |
| 2165 | if FSend the n | |
| 2166 | be gin | |
| 2167 | PCEList.Ad d(Delimite dStr); | |
| 2168 | PCEList.Ad d(Delimite dStr2); | |
| 2169 | en d; | |
| 2170 | end; | |
| 2171 | // c all DATA2P CE (in bac kground) | |
| 2172 | Save PCEData(PC EList, Fil eNoteIEN, FEncLocati on); | |
| 2173 | ||
| 2174 | // t urn off 'S end' flags and remov e items th at were de leted | |
| 2175 | with FDiagnose s do for i := Count - 1 downt o 0 do wit h TPCEDiag (Items[i]) do | |
| 2176 | begi n | |
| 2177 | FS end := Fal se; | |
| 2178 | // for diags , toggle o ff AddProb flag as w ell | |
| 2179 | Ad dProb := F alse; | |
| 2180 | if FDelete t hen | |
| 2181 | be gin | |
| 2182 | TPCEDiag(I tems[i]).F ree; | |
| 2183 | Delete(i); | |
| 2184 | en d; | |
| 2185 | end; | |
| 2186 | with FProcedur es do for i := Count - 1 downt o 0 do wit h TPCEProc (Items[i]) do | |
| 2187 | begi n | |
| 2188 | FS end := Fal se; | |
| 2189 | if FDelete t hen | |
| 2190 | be gin | |
| 2191 | TPCEProc(I tems[i]).F ree; | |
| 2192 | Delete(i); | |
| 2193 | en d; | |
| 2194 | end; | |
| 2195 | with FImmuniza tions do f or i := Co unt - 1 do wnto 0 do with TPCEI mm(Items[i ]) do | |
| 2196 | begi n | |
| 2197 | FS end := Fal se; | |
| 2198 | if FDelete t hen | |
| 2199 | be gin | |
| 2200 | TPCEImm(It ems[i]).Fr ee; | |
| 2201 | Delete(i); | |
| 2202 | en d; | |
| 2203 | end; | |
| 2204 | with FSkinTest s do for i := Count - 1 downto 0 do with TPCESkin( Items[i]) do | |
| 2205 | begi n | |
| 2206 | FS end := Fal se; | |
| 2207 | if FDelete t hen | |
| 2208 | be gin | |
| 2209 | TPCESkin(I tems[i]).F ree; | |
| 2210 | Delete(i); | |
| 2211 | en d; | |
| 2212 | end; | |
| 2213 | with FPatientE ds do for i := Count - 1 downt o 0 do wit h TPCEPat( Items[i]) do | |
| 2214 | begi n | |
| 2215 | FS end := Fal se; | |
| 2216 | if FDelete t hen | |
| 2217 | be gin | |
| 2218 | TPCEPat(It ems[i]).Fr ee; | |
| 2219 | Delete(i); | |
| 2220 | en d; | |
| 2221 | end; | |
| 2222 | with FHealthFa ctors do f or i := Co unt - 1 do wnto 0 do with TPCEH ealth(Item s[i]) do | |
| 2223 | begi n | |
| 2224 | FS end := Fal se; | |
| 2225 | if FDelete t hen | |
| 2226 | be gin | |
| 2227 | TPCEHealth (Items[i]) .Free; | |
| 2228 | Delete(i); | |
| 2229 | en d; | |
| 2230 | end; | |
| 2231 | with FExams do for i := Count - 1 downto 0 d o with TPC EExams(Ite ms[i]) do | |
| 2232 | begi n | |
| 2233 | FS end := Fal se; | |
| 2234 | if FDelete t hen | |
| 2235 | be gin | |
| 2236 | TPCEExams( Items[i]). Free; | |
| 2237 | Delete(i); | |
| 2238 | en d; | |
| 2239 | end; | |
| 2240 | ||
| 2241 | for i := FProv iders.Coun t - 1 down to 0 do | |
| 2242 | begi n | |
| 2243 | if (FProvider s.Provider Data[i].De lete) then | |
| 2244 | FProviders .Delete(i) ; | |
| 2245 | end; | |
| 2246 | ||
| 2247 | if F VisitType. FDelete th en FVisitT ype.Clear else FVisi tType.FSen d := False ; | |
| 2248 | end; { with PCELi st} | |
| 2249 | //if ( FProcedure s.Count > 0) or (FVi sitType.Co de <> '') then FCPTR equired := False; | |
| 2250 | ||
| 2251 | // upd ate the Ch anges obje ct | |
| 2252 | EncNam e := Forma tFMDateTim e('mmm dd, yy hh:nn', FileDate) ; | |
| 2253 | x := S trVisitTyp e; | |
| 2254 | if Len gth(x) > 0 then Chan ges.Add(CH _PCE, 'V' + AVisitSt r, x, EncN ame, CH_SI GN_NA); | |
| 2255 | x := S trProcedur es; | |
| 2256 | if Len gth(x) > 0 then Chan ges.Add(CH _PCE, 'P' + AVisitSt r, x, EncN ame, CH_SI GN_NA); | |
| 2257 | x := S trDiagnose s; | |
| 2258 | if Len gth(x) > 0 then Chan ges.Add(CH _PCE, 'D' + AVisitSt r, x, EncN ame, CH_SI GN_NA, | |
| 2259 | Par ent, User. DUZ, '', F alse, Fals e, Problem Added); | |
| 2260 | x := S trImmuniza tions; | |
| 2261 | if Len gth(x) > 0 then Chan ges.Add(CH _PCE, 'I' + AVisitSt r, x, EncN ame, CH_SI GN_NA); | |
| 2262 | x := S trSkinTest s; | |
| 2263 | if Len gth(x) > 0 then Chan ges.Add(CH _PCE, 'S' + AVisitSt r, x, EncN ame, CH_SI GN_NA); | |
| 2264 | x := S trPatientE ds; | |
| 2265 | if Len gth(x) > 0 then Chan ges.Add(CH _PCE, 'A' + AVisitSt r, x, EncN ame, CH_SI GN_NA); | |
| 2266 | x := S trHealthFa ctors; | |
| 2267 | if Len gth(x) > 0 then Chan ges.Add(CH _PCE, 'H' + AVisitSt r, x, EncN ame, CH_SI GN_NA); | |
| 2268 | x := S trExams; | |
| 2269 | if Len gth(x) > 0 then Chan ges.Add(CH _PCE, 'E' + AVisitSt r, x, EncN ame, CH_SI GN_NA); | |
| 2270 | ||
| 2271 | ||
| 2272 | finally | |
| 2273 | PCELis t.Free; | |
| 2274 | end; | |
| 2275 | end; | |
| 2276 | ||
| 2277 | function T PCEData.Ma tchItem(AL ist: TList ; AnItem: TPCEItem): Integer; | |
| 2278 | { return i ndex in AL ist of mat ching item } | |
| 2279 | var | |
| 2280 | i: Integ er; | |
| 2281 | begin | |
| 2282 | Result : = -1; | |
| 2283 | with ALi st do for i := 0 to Count - 1 do with TP CEItem(Ite ms[i]) do if Match(A nItem) and MatchProv ider(AnIte m)then | |
| 2284 | begin | |
| 2285 | Result := i; | |
| 2286 | break; | |
| 2287 | end; | |
| 2288 | end; | |
| 2289 | ||
| 2290 | function T PCEData.Ma tchPOVItem s(AList: T List; AnIt em: TPCEIt em): Integ er; | |
| 2291 | var | |
| 2292 | i: Integ er; | |
| 2293 | begin | |
| 2294 | Result : = -1; | |
| 2295 | with ALi st do for i := 0 to Count - 1 do with TP CEItem(Ite ms[i]) do if MatchPO V(AnItem) and MatchP rovider(An Item)then | |
| 2296 | begin | |
| 2297 | Result := i; | |
| 2298 | break; | |
| 2299 | end; | |
| 2300 | end; | |
| 2301 | ||
| 2302 | procedure TPCEData.M arkDeletio ns(PreList : TList; P ostList: T Strings); | |
| 2303 | {mark item s that nee d deleted} | |
| 2304 | var | |
| 2305 | i, j: In teger; | |
| 2306 | MatchFou nd: Boolea n; | |
| 2307 | PreItem, PostItem: TPCEItem; | |
| 2308 | begin | |
| 2309 | with Pre List do fo r i := 0 t o Count - 1 do | |
| 2310 | begin | |
| 2311 | PreIte m := TPCEI tem(Items[ i]); | |
| 2312 | MatchF ound := Fa lse; | |
| 2313 | with P ostList do for j := 0 to Count - 1 do | |
| 2314 | begin | |
| 2315 | Post Item := TP CEItem(Obj ects[j]); | |
| 2316 | //fi x to not m ark the IC D-10 diagn osis for d eletion wh en selecte d to add t o the Prob lem List. | |
| 2317 | if ( Piece(Post Item.Delim itedStr, ' ^', 1)='PO V+') and ( Piece(Post Item.Delim itedStr, ' ^', 7)='1' ) and | |
| 2318 | (Pre Item.Code = PostItem .Code) and (Pos('SNO MED', Piec e(PostItem .Delimited Str, '^', 4)) > 0) t hen | |
| 2319 | MatchFound := True | |
| 2320 | else if (PreIt em.Match(P ostItem) a nd (PreIte m.MatchPro vider(Post Item))) th en MatchFo und := Tru e; | |
| 2321 | end; | |
| 2322 | if not MatchFoun d then | |
| 2323 | begin | |
| 2324 | PreI tem.FDelet e := True; | |
| 2325 | PreI tem.FSend := True; | |
| 2326 | end; | |
| 2327 | end; | |
| 2328 | end; | |
| 2329 | ||
| 2330 | procedure TPCEData.S etDiagnose s(Src: TSt rings; Fro mForm: boo lean = TRU E); | |
| 2331 | { load dia gnoses for this enco unter into TPCEDiag records, a ssumes all diagnoses for the | |
| 2332 | encounte r will be listed in Src and ma rks those that are n ot in Src for deleti on } | |
| 2333 | var | |
| 2334 | i, Match Index: Int eger; | |
| 2335 | SrcDiagn osis, CurD iagnosis, PrimaryDia g: TPCEDia g; | |
| 2336 | begin | |
| 2337 | if FromF orm then M arkDeletio ns(FDiagno ses, Src); | |
| 2338 | PrimaryD iag := nil ; | |
| 2339 | for i := 0 to Src. Count - 1 do | |
| 2340 | begin | |
| 2341 | SrcDia gnosis := TPCEDiag(S rc.Objects [i]); | |
| 2342 | MatchI ndex := Ma tchPOVItem s(FDiagnos es, SrcDia gnosis); | |
| 2343 | if Mat chIndex > -1 then //found i n fdiagnos es | |
| 2344 | begin | |
| 2345 | CurD iagnosis : = TPCEDiag (FDiagnose s.Items[Ma tchIndex]) ; | |
| 2346 | if ( (SrcDiagno sis.Primar y <> CurDi agnosis.Pr imary) or | |
| 2347 | (Sr cDiagnosis .Comment < > CurDiagn osis.Comme nt) or | |
| 2348 | (Sr cDiagnosis .AddProb < > CurDiagn osis.Addpr ob) or | |
| 2349 | (Sr cDiagnosis .Narrative <> CurDia gnosis.Nar rative)) t hen | |
| 2350 | begi n | |
| 2351 | Cu rDiagnosis .Primary := SrcDi agnosis.Pr imary; | |
| 2352 | Cu rDiagnosis .Comment := SrcDi agnosis.Co mment; | |
| 2353 | Cu rDiagnosis .AddProb := SrcDi agnosis.Ad dProb; | |
| 2354 | Cu rDiagnosis .Narrative := SrcDi agnosis.Na rrative; | |
| 2355 | Cu rDiagnosis .FSend := True; | |
| 2356 | end; | |
| 2357 | end | |
| 2358 | else | |
| 2359 | begin | |
| 2360 | CurD iagnosis : = TPCEDiag .Create; | |
| 2361 | CurD iagnosis.A ssign(SrcD iagnosis); | |
| 2362 | CurD iagnosis.F Send := Tr ue; | |
| 2363 | FDia gnoses.Add (CurDiagno sis); | |
| 2364 | end; { if MatchIn dex} | |
| 2365 | if(Cur Diagnosis. Primary an d (not ass igned(Prim aryDiag))) then | |
| 2366 | Prim aryDiag := CurDiagno sis; | |
| 2367 | if (Cu rDiagnosis .AddProb) then | |
| 2368 | FPro blemAdded := True; | |
| 2369 | end; {fo r} | |
| 2370 | if(assig ned(Primar yDiag)) th en | |
| 2371 | begin | |
| 2372 | for i := 0 to FD iagnoses.C ount - 1 d o | |
| 2373 | begin | |
| 2374 | CurD iagnosis : = TPCEDiag (FDiagnose s[i]); | |
| 2375 | if(C urDiagnosi s.Primary) and (CurD iagnosis < > PrimaryD iag) then | |
| 2376 | begi n | |
| 2377 | Cu rDiagnosis .Primary : = FALSE; | |
| 2378 | Cu rDiagnosis .FSend := True; | |
| 2379 | end; | |
| 2380 | end; | |
| 2381 | end; | |
| 2382 | end; | |
| 2383 | ||
| 2384 | procedure TPCEData.S etProcedur es(Src: TS trings; Fr omForm: bo olean = TR UE); | |
| 2385 | { load Pro cedures fo r this enc ounter int o TPCEProc records, assumes al l Procedur es for the | |
| 2386 | encounte r will be listed in Src and ma rks those that are n ot in Src for deleti on } | |
| 2387 | var | |
| 2388 | i, Match Index: Int eger; | |
| 2389 | SrcProce dure, CurP rocedure, OldProcedu re: TPCEPr oc; | |
| 2390 | begin | |
| 2391 | if FromF orm then M arkDeletio ns(FProced ures, Src) ; | |
| 2392 | for i := 0 to Src. Count - 1 do | |
| 2393 | begin | |
| 2394 | SrcPro cedure := TPCEProc(S rc.Objects [i]); | |
| 2395 | MatchI ndex := Ma tchItem(FP rocedures, SrcProced ure); | |
| 2396 | if Mat chIndex > -1 then | |
| 2397 | begin | |
| 2398 | CurP rocedure : = TPCEProc (FProcedur es.Items[M atchIndex] ); | |
| 2399 | (* if (SrcProce dure.Provi der <> Cur Procedure. Provider) then | |
| 2400 | begi n | |
| 2401 | Ol dProcedure := TPCEPr oc.Create; | |
| 2402 | Ol dProcedure .Assign(Cu rProcedure ); | |
| 2403 | Ol dProcedure .FDelete : = TRUE; | |
| 2404 | Ol dProcedure .FSend := TRUE; | |
| 2405 | FP rocedures. Add(OldPro cedure); | |
| 2406 | end; *) | |
| 2407 | if ( SrcProcedu re.Quantit y <> CurPr ocedure.Qu antity) or | |
| 2408 | ( SrcProcedu re.Provide r <> CurPr ocedure.Pr ovider) or | |
| 2409 | ( Curprocedu re.Comment <> SrcPro cedure.Com ment) or | |
| 2410 | ( Curprocedu re.Modifie rs <> SrcP rocedure.M odifiers)t hen | |
| 2411 | begi n | |
| 2412 | Ol dProcedure := TPCEPr oc.Create; | |
| 2413 | Ol dProcedure .Assign(Cu rProcedure ); | |
| 2414 | Ol dProcedure .FDelete : = TRUE; | |
| 2415 | Ol dProcedure .FSend := TRUE; | |
| 2416 | FP rocedures. Add(OldPro cedure); | |
| 2417 | Cu rProcedure .Quantity := SrcProc edure.Quan tity; | |
| 2418 | Cu rProcedure .Provider := SrcProc edure.Prov ider; | |
| 2419 | Cu rProcedure .Comment : = SrcProce dure.Comme nt; | |
| 2420 | Cu rProcedure .Modifiers := SrcPro cedure.Mod ifiers; | |
| 2421 | Cu rProcedure .FSend := True; | |
| 2422 | end; | |
| 2423 | end el se | |
| 2424 | begin | |
| 2425 | CurP rocedure : = TPCEProc .Create; | |
| 2426 | CurP rocedure.A ssign(SrcP rocedure); | |
| 2427 | CurP rocedure.F Send := Tr ue; | |
| 2428 | FPro cedures.Ad d(CurProce dure); | |
| 2429 | end; { if MatchIn dex} | |
| 2430 | end; {fo r} | |
| 2431 | end; | |
| 2432 | ||
| 2433 | ||
| 2434 | ||
| 2435 | procedure TPCEData.S etImmuniza tions(Src: TStrings; FromForm: boolean = TRUE); | |
| 2436 | { load Imm unizations for this encounter into TPCEI mm records , assumes all Immuni zations fo r the | |
| 2437 | encounte r will be listed in Src and ma rks those that are n ot in Src for deleti on } | |
| 2438 | var | |
| 2439 | i, Match Index: Int eger; | |
| 2440 | SrcImmun ization, C urImmuniza tion: TPCE Imm; | |
| 2441 | begin | |
| 2442 | if FromF orm then M arkDeletio ns(FImmuni zations, S rc); | |
| 2443 | for i := 0 to Src. Count - 1 do | |
| 2444 | begin | |
| 2445 | SrcImm unization := TPCEImm (Src.Objec ts[i]); | |
| 2446 | MatchI ndex := Ma tchItem(FI mmunizatio ns, SrcImm unization) ; | |
| 2447 | if Mat chIndex > -1 then | |
| 2448 | begin | |
| 2449 | CurI mmunizatio n := TPCEI mm(FImmuni zations.It ems[MatchI ndex]); | |
| 2450 | ||
| 2451 | //se t null str ings to No PCEValue | |
| 2452 | if S rcImmuniza tion.Serie s = '' the n SrcImmun ization.Se ries := No PCEValue; | |
| 2453 | if S rcImmuniza tion.React ion = '' t hen SrcImm unization. Reaction : = NoPCEVal ue; | |
| 2454 | if C urImmuniza tion.Serie s = '' the n CurImmun ization.Se ries := No PCEValue; | |
| 2455 | if C urImmuniza tion.React ion = '' t hen CurImm unization. Reaction : = NoPCEVal ue; | |
| 2456 | ||
| 2457 | if(S rcImmuniza tion.Serie s <> CurIm munization .Series) o r | |
| 2458 | (S rcImmuniza tion.React ion <> Cur Immunizati on.Reactio n) or | |
| 2459 | (S rcImmuniza tion.Refus ed <> CurI mmunizatio n.Refused) or | |
| 2460 | (S rcImmuniza tion.Contr aindicated <> CurImm unization. Contraindi cated) or | |
| 2461 | (C urImmuniza tion.Comme nt <> SrcI mmunizatio n.Comment) then | |
| 2462 | begi n | |
| 2463 | Cu rImmunizat ion.Series := SrcImmu nization.S eries; | |
| 2464 | Cu rImmunizat ion.Reacti on := SrcImmu nization.R eaction; | |
| 2465 | Cu rImmunizat ion.Refuse d := SrcImmu nization.R efused; | |
| 2466 | Cu rImmunizat ion.Contra indicated := SrcImmu nization.C ontraindic ated; | |
| 2467 | Cu rImmunizat ion.Commen t := SrcImmu nization.C omment; | |
| 2468 | Cu rImmunizat ion.FSend := True; | |
| 2469 | end; | |
| 2470 | end el se | |
| 2471 | begin | |
| 2472 | CurI mmunizatio n := TPCEI mm.Create; | |
| 2473 | CurI mmunizatio n.Assign(S rcImmuniza tion); | |
| 2474 | CurI mmunizatio n.FSend := True; | |
| 2475 | FImm unizations .Add(CurIm munization ); | |
| 2476 | end; { if MatchIn dex} | |
| 2477 | end; {fo r} | |
| 2478 | end; | |
| 2479 | ||
| 2480 | procedure TPCEData.S etSkinTest s(Src: TSt rings; Fro mForm: boo lean = TRU E); | |
| 2481 | { load Ski nTests for this enco unter into TPCESkin records, a ssumes all SkinTests for the | |
| 2482 | encounte r will be listed in Src and ma rks those that are n ot in Src for deleti on } | |
| 2483 | var | |
| 2484 | i, Match Index: Int eger; | |
| 2485 | SrcSkinT est, CurSk inTest: TP CESkin; | |
| 2486 | begin | |
| 2487 | if FromF orm then M arkDeletio ns(FSKinTe sts, Src); | |
| 2488 | for i := 0 to Src. Count - 1 do | |
| 2489 | begin | |
| 2490 | SrcSki nTest := T PCESkin(Sr c.Objects[ i]); | |
| 2491 | MatchI ndex := Ma tchItem(FS KinTests, SrcSkinTes t); | |
| 2492 | if Mat chIndex > -1 then | |
| 2493 | begin | |
| 2494 | CurS kinTest := TPCESKin( FSkinTests .Items[Mat chIndex]); | |
| 2495 | if C urSkinTest .Results = '' then C urSkinTest .Results : = NoPCEVal ue; | |
| 2496 | if S rcSkinTest .Results = '' then S rcSkinTest .Results : = NoPCEVal ue; | |
| 2497 | ||
| 2498 | if(S rcSkinTest .Results < > CurSkinT est.Result s) or | |
| 2499 | (S rcSkinTest .Reading < > CurSkinT est.Readin g) or | |
| 2500 | (C urSkinTest .Comment < > SrcSkinT est.Commen t) then | |
| 2501 | begi n | |
| 2502 | ||
| 2503 | Cu rSkinTest. Results := SrcSkinTe st.Results ; | |
| 2504 | Cu rSkinTest. Reading := SrcSkinTe st.Reading ; | |
| 2505 | Cu rSkinTest. Comment := SrcSkinTe st.Comment ; | |
| 2506 | Cu rSkinTest. FSend := T rue; | |
| 2507 | end; | |
| 2508 | end el se | |
| 2509 | begin | |
| 2510 | CurS KinTest := TPCESkin. Create; | |
| 2511 | CurS kinTest.As sign(SrcSk inTest); | |
| 2512 | CurS kinTest.FS end := Tru e; | |
| 2513 | FSki nTests.Add (CurSkinTe st); | |
| 2514 | end; { if MatchIn dex} | |
| 2515 | end; {fo r} | |
| 2516 | end; | |
| 2517 | ||
| 2518 | procedure TPCEData.S etPatientE ds(Src: TS trings; Fr omForm: bo olean = TR UE); | |
| 2519 | var | |
| 2520 | i, Match Index: Int eger; | |
| 2521 | SrcPatie ntEd, CurP atientEd: TPCEPat; | |
| 2522 | begin | |
| 2523 | if FromF orm then M arkDeletio ns(FPatien tEds, Src) ; | |
| 2524 | for i := 0 to Src. Count - 1 do | |
| 2525 | begin | |
| 2526 | SrcPat ientEd := TPCEPat(Sr c.Objects[ i]); | |
| 2527 | MatchI ndex := Ma tchItem(FP atientEds, SrcPatien tEd); | |
| 2528 | if Mat chIndex > -1 then | |
| 2529 | begin | |
| 2530 | CurP atientEd : = TPCEPat( FPatientEd s.Items[Ma tchIndex]) ; | |
| 2531 | ||
| 2532 | if C urPatientE d.level = '' then Cu rPatientEd .level := NoPCEValue ; | |
| 2533 | if S rcPatientE d.level = '' then Sr cPatientEd .level := NoPCEValue ; | |
| 2534 | if(S rcPatientE d.Level <> CurPatien tEd.Level) or | |
| 2535 | (C urPatientE d.Comment <> SrcPati entEd.Comm ent) then | |
| 2536 | begi n | |
| 2537 | Cu rPatientEd .Level := SrcPatien tEd.Level; | |
| 2538 | Cu rPatientEd .Comment : = SrcPatie ntEd.Comme nt; | |
| 2539 | Cu rPatientEd .FSend := True; | |
| 2540 | end; | |
| 2541 | end el se | |
| 2542 | begin | |
| 2543 | CurP atientEd : = TPCEPat. Create; | |
| 2544 | CurP atientEd.A ssign(SrcP atientEd); | |
| 2545 | CurP atientEd.F Send := Tr ue; | |
| 2546 | FPat ientEds.Ad d(CurPatie ntEd); | |
| 2547 | end; { if MatchIn dex} | |
| 2548 | end; {fo r} | |
| 2549 | end; | |
| 2550 | ||
| 2551 | ||
| 2552 | procedure TPCEData.S etHealthFa ctors(Src: TStrings; FromForm: boolean = TRUE); | |
| 2553 | ||
| 2554 | var | |
| 2555 | i, Match Index: Int eger; | |
| 2556 | SrcHealt hFactor, C urHealthFa ctor: TPCE Health; | |
| 2557 | begin | |
| 2558 | if FromF orm then M arkDeletio ns(FHealth Factors, S rc); | |
| 2559 | for i := 0 to Src. Count - 1 do | |
| 2560 | begin | |
| 2561 | SrcHea lthFactor := TPCEHea lth(Src.Ob jects[i]); | |
| 2562 | MatchI ndex := Ma tchItem(FH ealthFacto rs, SrcHea lthFactor) ; | |
| 2563 | if Mat chIndex > -1 then | |
| 2564 | begin | |
| 2565 | CurH ealthFacto r := TPCEH ealth(FHea lthFactors .Items[Mat chIndex]); | |
| 2566 | ||
| 2567 | if C urHealthFa ctor.level = '' then CurHealth Factor.lev el := NoPC EValue; | |
| 2568 | if S rcHealthFa ctor.level = '' then SrcHealth Factor.lev el := NoPC EValue; | |
| 2569 | if(S rcHealthFa ctor.Level <> CurHea lthFactor. Level) or | |
| 2570 | (C urHealthFa ctor.Comme nt <> SrcH ealthFacto r.Comment) then | |
| 2571 | begi n | |
| 2572 | Cu rHealthFac tor.Level := SrcHea lthFactor. Level; | |
| 2573 | Cu rHealthFac tor.Commen t := SrcHe althFactor .Comment; | |
| 2574 | Cu rHealthFac tor.FSend := True; | |
| 2575 | end; | |
| 2576 | if( SrcHealthF actor.GecR em <> CurH ealthFacto r.GecRem) then | |
| 2577 | CurHealthF actor.GecR em := SrcH ealthFacto r.GecRem; | |
| 2578 | end el se | |
| 2579 | begin | |
| 2580 | CurH ealthFacto r := TPCEH ealth.Crea te; | |
| 2581 | CurH ealthFacto r.Assign(S rcHealthFa ctor); | |
| 2582 | CurH ealthFacto r.FSend := True; | |
| 2583 | CurH ealthFacto r.GecRem : = SrcHealt hFactor.Ge cRem; | |
| 2584 | FHea lthFactors .Add(CurHe althFactor ); | |
| 2585 | end; { if MatchIn dex} | |
| 2586 | end; {fo r} | |
| 2587 | end; | |
| 2588 | ||
| 2589 | ||
| 2590 | procedure TPCEData.S etExams(Sr c: TString s; FromFor m: boolean = TRUE); | |
| 2591 | ||
| 2592 | var | |
| 2593 | i, Match Index: Int eger; | |
| 2594 | SrcExam, CurExam: TPCEExams; | |
| 2595 | begin | |
| 2596 | if FromF orm then M arkDeletio ns(FExams, Src); | |
| 2597 | for i := 0 to Src. Count - 1 do | |
| 2598 | begin | |
| 2599 | SrcExa m := TPCEE xams(Src.O bjects[i]) ; | |
| 2600 | MatchI ndex := Ma tchItem(FE xams, SrcE xam); | |
| 2601 | if Mat chIndex > -1 then | |
| 2602 | begin | |
| 2603 | CurE xam := TPC EExams(FEx ams.Items[ MatchIndex ]); | |
| 2604 | if C urExam.Res ults = '' then CurEx am.Results := NoPCEV alue; | |
| 2605 | if S rcExam.Res ults = '' then SrcEx am.Results := NoPCEV alue; | |
| 2606 | if(S rcExam.Res ults <> Cu rExam.Resu lts) or | |
| 2607 | (C urExam.Com ment <> Sr cExam.Comm ent) then | |
| 2608 | begi n | |
| 2609 | Cu rExam.Resu lts := Sr cExam.Resu lts; | |
| 2610 | Cu rExam.Comm ent := Src Exam.Comme nt; | |
| 2611 | Cu rExam.Fsen d := True; | |
| 2612 | end; | |
| 2613 | end el se | |
| 2614 | begin | |
| 2615 | CurE xam := TPC EExams.Cre ate; | |
| 2616 | CurE xam.Assign (SrcExam); | |
| 2617 | CurE xam.FSend := True; | |
| 2618 | FExa ms.Add(Cur Exam); | |
| 2619 | end; { if MatchIn dex} | |
| 2620 | end; {fo r} | |
| 2621 | end; | |
| 2622 | ||
| 2623 | ||
| 2624 | procedure TPCEData.S etVisitTyp e(Value: T PCEProc); | |
| 2625 | var | |
| 2626 | VisitDel ete: TPCEP roc; | |
| 2627 | begin | |
| 2628 | if (not FVisitType .Match(Val ue)) or | |
| 2629 | (FVisitT ype.Modifi ers <> Val ue.Modifie rs) then {causes CP T delete/r e-add} | |
| 2630 | begin | |
| 2631 | if FVi sitType.Co de <> '' t hen / / add old visit to p rocedures for deleti on | |
| 2632 | begin | |
| 2633 | Visi tDelete := TPCEProc. Create; | |
| 2634 | Visi tDelete.As sign(FVisi tType); | |
| 2635 | Visi tDelete.FD elete := T rue; | |
| 2636 | Visi tDelete.FS end := T rue; | |
| 2637 | FPro cedures.Ad d(VisitDel ete); | |
| 2638 | end; | |
| 2639 | FVisit Type.Assig n(Value); | |
| 2640 | FVisit Type.Quant ity := 1; | |
| 2641 | FVisit Type.FSend := True; | |
| 2642 | end; | |
| 2643 | end; | |
| 2644 | ||
| 2645 | procedure TPCEData.S etSCRelate d(Value: I nteger); | |
| 2646 | begin | |
| 2647 | if Value <> FSCRel ated then | |
| 2648 | begin | |
| 2649 | FSCRel ated := Va lue; | |
| 2650 | FSCCha nged := Tr ue; | |
| 2651 | end; | |
| 2652 | end; | |
| 2653 | ||
| 2654 | procedure TPCEData.S etAORelate d(Value: I nteger); | |
| 2655 | begin | |
| 2656 | if Value <> FAORel ated then | |
| 2657 | begin | |
| 2658 | FAORel ated := Va lue; | |
| 2659 | FSCCha nged := Tr ue; | |
| 2660 | end; | |
| 2661 | end; | |
| 2662 | ||
| 2663 | procedure TPCEData.S etIRRelate d(Value: I nteger); | |
| 2664 | begin | |
| 2665 | if Value <> FIRRel ated then | |
| 2666 | begin | |
| 2667 | FIRRel ated := Va lue; | |
| 2668 | FSCCha nged := Tr ue; | |
| 2669 | end; | |
| 2670 | end; | |
| 2671 | ||
| 2672 | procedure TPCEData.S etECRelate d(Value: I nteger); | |
| 2673 | begin | |
| 2674 | if Value <> FECRel ated then | |
| 2675 | begin | |
| 2676 | FECRel ated := Va lue; | |
| 2677 | FSCCha nged := Tr ue; | |
| 2678 | end; | |
| 2679 | end; | |
| 2680 | ||
| 2681 | procedure TPCEData.S etMSTRelat ed(Value: Integer); | |
| 2682 | begin | |
| 2683 | if Value <> FMSTRe lated then | |
| 2684 | begin | |
| 2685 | FMSTRe lated := V alue; | |
| 2686 | FSCCha nged := Tr ue; | |
| 2687 | end; | |
| 2688 | end; | |
| 2689 | ||
| 2690 | procedure TPCEData.S etHNCRelat ed(Value: Integer); | |
| 2691 | begin | |
| 2692 | // if HNC OK and (Va lue <> FHN CRelated) then | |
| 2693 | if Value <> FHNCRe lated then | |
| 2694 | begin | |
| 2695 | FHNCRe lated := V alue; | |
| 2696 | FSCCha nged := Tr ue; | |
| 2697 | end; | |
| 2698 | end; | |
| 2699 | ||
| 2700 | procedure TPCEData.S etCVRelate d(Value: I nteger); | |
| 2701 | begin | |
| 2702 | if (Valu e <> FCVRe lated) the n | |
| 2703 | begin | |
| 2704 | FCVRel ated := Va lue; | |
| 2705 | FSCCha nged := Tr ue; | |
| 2706 | end; | |
| 2707 | end; | |
| 2708 | ||
| 2709 | procedure TPCEData.S etSHADRela ted(Value: Integer); | |
| 2710 | begin | |
| 2711 | if (Valu e <> FSHAD Related) t hen | |
| 2712 | begin | |
| 2713 | FSHADR elated := Value; | |
| 2714 | FSCCha nged := True; | |
| 2715 | end; | |
| 2716 | end; | |
| 2717 | ||
| 2718 | procedure TPCEData.S etCLRelate d(Value: I nteger); | |
| 2719 | begin | |
| 2720 | if (Valu e <> FCLRe lated) the n | |
| 2721 | begin | |
| 2722 | FCLRel ated := Va lue; | |
| 2723 | FSCCha nged := True; | |
| 2724 | end; | |
| 2725 | end; | |
| 2726 | ||
| 2727 | procedure TPCEData.S etEncUseCu rr(Value: Boolean); | |
| 2728 | begin | |
| 2729 | FEncUseC urr := Val ue; | |
| 2730 | if FEncU seCurr the n | |
| 2731 | begin | |
| 2732 | FEncDa teTime := Encounter .DateTime; | |
| 2733 | FEncLo cation := Encounter .Location; | |
| 2734 | //need to add to full list of provid ers | |
| 2735 | FEncSv cCat := Encounter .VisitCate gory; | |
| 2736 | FStand Alone := Encounter .StandAlon e; | |
| 2737 | FStand AloneLoade d := TRUE; | |
| 2738 | FEncIn patient := Encounter .Inpatient ; | |
| 2739 | ||
| 2740 | end else | |
| 2741 | begin | |
| 2742 | FEncDa teTime := 0; | |
| 2743 | FEncLo cation := 0; | |
| 2744 | FStand Alone := F ALSE; | |
| 2745 | FStand AloneLoade d := FALSE ; | |
| 2746 | FProvi ders.Prima ryIdx := - 1; | |
| 2747 | FEncSv cCat := 'A'; | |
| 2748 | FEncIn patient := False; | |
| 2749 | end; | |
| 2750 | // | |
| 2751 | SetRPCEn cLocation( FEncLocati on); | |
| 2752 | end; | |
| 2753 | ||
| 2754 | function T PCEData.St rDiagnoses : string; | |
| 2755 | { returns the list o f diagnose s for this encounter as a sing le comma d elimited s tring } | |
| 2756 | var | |
| 2757 | i: Integ er; | |
| 2758 | begin | |
| 2759 | Result : = ''; | |
| 2760 | with FDi agnoses do for i := 0 to Count - 1 do wi th TPCEDia g(Items[i] ) do | |
| 2761 | if not FDelete t hen | |
| 2762 | Resu lt := Resu lt + GetPC EDataText( pdcDiag, C ode, Categ ory, Narra tive, Prim ary) + CRL F; | |
| 2763 | if Lengt h(Result) > 0 then R esult := P CEDataCatT ext[pdcDia g] + CRLF + Copy(Res ult, 1, Le ngth(Resul t) - 2) + CRLF; | |
| 2764 | end; | |
| 2765 | ||
| 2766 | function T PCEData.St rProcedure s: string; | |
| 2767 | { returns the list o f procedur es for thi s encounte r as a sin gle comma delimited string } | |
| 2768 | var | |
| 2769 | i: Integ er; | |
| 2770 | begin | |
| 2771 | Result : = ''; | |
| 2772 | with FPr ocedures d o for i := 0 to Coun t - 1 do w ith TPCEPr oc(Items[i ]) do | |
| 2773 | if not FDelete t hen | |
| 2774 | Resu lt := Resu lt + GetPC EDataText( pdcProc, C ode, Categ ory, Narra tive, FALS E, Quantit y) + | |
| 2775 | ModTe xt + CRLF; | |
| 2776 | if Lengt h(Result) > 0 then R esult := P CEDataCatT ext[pdcPro c] + CRLF + Copy(Res ult, 1, Le ngth(Resul t) - 2) + CRLF; | |
| 2777 | end; | |
| 2778 | ||
| 2779 | function T PCEData.St rImmunizat ions: stri ng; | |
| 2780 | { returns the list o f Immuniza tions for this encou nter as a single com ma delimit ed string } | |
| 2781 | var | |
| 2782 | i: Integ er; | |
| 2783 | begin | |
| 2784 | Result : = ''; | |
| 2785 | with FIm munization s do for i := 0 to C ount - 1 d o with TPC EImm(Items [i]) do | |
| 2786 | if not FDelete t hen | |
| 2787 | Resu lt := Resu lt + GetPC EDataText( pdcImm, Co de, Catego ry, Narrat ive) + CRL F; | |
| 2788 | if Lengt h(Result) > 0 then R esult := P CEDataCatT ext[pdcImm ] + CRLF + Copy(Resu lt, 1, Len gth(Result ) - 2) + C RLF; | |
| 2789 | end; | |
| 2790 | ||
| 2791 | ||
| 2792 | function T PCEData.St rSkinTests : string; | |
| 2793 | { returns the list o f Immuniza tions for this encou nter as a single com ma delimit ed string } | |
| 2794 | var | |
| 2795 | i: Integ er; | |
| 2796 | begin | |
| 2797 | Result : = ''; | |
| 2798 | with FSk inTests do for i := 0 to Count - 1 do wi th TPCESki n(Items[i] ) do | |
| 2799 | if not FDelete t hen | |
| 2800 | Resu lt := Resu lt + GetPC EDataText( pdcSkin, C ode, Categ ory, Narra tive) + CR LF; | |
| 2801 | if Lengt h(Result) > 0 then R esult := P CEDataCatT ext[pdcSki n] + CRLF + Copy(Res ult, 1, Le ngth(Resul t) - 2) + CRLF; | |
| 2802 | end; | |
| 2803 | ||
| 2804 | function T PCEData.St rPatientEd s: string; | |
| 2805 | var | |
| 2806 | i: Integ er; | |
| 2807 | begin | |
| 2808 | Result : = ''; | |
| 2809 | with FPa tientEds d o for i := 0 to Coun t - 1 do w ith TPCEPa t(Items[i] ) do | |
| 2810 | if not FDelete t hen | |
| 2811 | Resu lt := Resu lt + GetPC EDataText( pdcPED, Co de, Catego ry, Narrat ive) + CRL F; | |
| 2812 | if Lengt h(Result) > 0 then R esult := P CEDataCatT ext[pdcPED ] + CRLF + Copy(Resu lt, 1, Len gth(Result ) - 2) + C RLF; | |
| 2813 | end; | |
| 2814 | ||
| 2815 | function T PCEData.St rHealthFac tors: stri ng; | |
| 2816 | var | |
| 2817 | i: Integ er; | |
| 2818 | begin | |
| 2819 | Result : = ''; | |
| 2820 | with FHe althFactor s do for i := 0 to C ount - 1 d o with TPC EHealth(It ems[i]) do | |
| 2821 | if not FDelete t hen | |
| 2822 | Resu lt := Resu lt + GetPC EDataText( pdcHF, Cod e, Categor y, Narrati ve) + CRLF ; | |
| 2823 | if Lengt h(Result) > 0 then R esult := P CEDataCatT ext[pdcHF] + CRLF + Copy(Resul t, 1, Leng th(Result) - 2) + CR LF; | |
| 2824 | end; | |
| 2825 | ||
| 2826 | function T PCEData.St rExams: st ring; | |
| 2827 | var | |
| 2828 | i: Integ er; | |
| 2829 | begin | |
| 2830 | Result : = ''; | |
| 2831 | with FEx ams do for i := 0 to Count - 1 do with T PCEExams(I tems[i]) d o | |
| 2832 | if not FDelete t hen | |
| 2833 | Resu lt := Resu lt + GetPC EDataText( pdcExam, C ode, Categ ory, Narra tive) + CR LF; | |
| 2834 | if Lengt h(Result) > 0 then R esult := P CEDataCatT ext[pdcExa m] + CRLF + Copy(Res ult, 1, Le ngth(Resul t) - 2) + CRLF; | |
| 2835 | end; | |
| 2836 | ||
| 2837 | function T PCEData.St rVisitType (const ASC Related, A AORelated, AIRRelate d, | |
| 2838 | AECRelat ed, AMSTRe lated, AHN CRelated, ACVRelated , ASHADRel ated, ACLR elated: In teger): st ring; | |
| 2839 | { returns as a strin g the type of encoun ter (accor ding to CP T) & relat ed contiti ons treate d } | |
| 2840 | ||
| 2841 | procedur e AddTxt(t xt: string ); | |
| 2842 | begin | |
| 2843 | if(Res ult <> '') then | |
| 2844 | Resu lt := Resu lt + ','; | |
| 2845 | Result := Result + ' ' + t xt; | |
| 2846 | end; | |
| 2847 | ||
| 2848 | begin | |
| 2849 | Result : = ''; | |
| 2850 | if ASCRe lated = SC C_YES the n AddTxt(' Service Co nnected Co ndition'); | |
| 2851 | if AAORe lated = SC C_YES the n AddTxt(' Agent Oran ge Exposur e'); | |
| 2852 | if AIRRe lated = SC C_YES the n AddTxt(' Ionizing R adiation E xposure'); | |
| 2853 | if AECRe lated = SC C_YES the n AddTxt(' Environmen tal Contam inants'); | |
| 2854 | if AMSTR elated = S CC_YES the n AddTxt(' MST');//'M ilitary Se xual Traum a'; | |
| 2855 | // if HNC OK and (AH NCRelated = SCC_YES) then AddT xt('Head a nd/or Neck Cancer'); | |
| 2856 | if AHNCR elated = S CC_YES the n AddTxt(' Head and/o r Neck Can cer'); | |
| 2857 | if ACVRe lated = SC C_YES the n AddTxt(' Combat Vet eran Relat ed'); | |
| 2858 | if ACLRe lated = SC C_YES the n AddTxt(' Camp Lejeu ne'); //Ca mp Lejeune | |
| 2859 | if Lengt h(Result) > 0 then R esult := ' related t o: ' + Res ult; | |
| 2860 | // Result := Trim(R esult); | |
| 2861 | end; | |
| 2862 | ||
| 2863 | function T PCEData.St rVisitType : string; | |
| 2864 | { returns as a strin g the type of encoun ter (accor ding to CP T) & relat ed contiti ons treate d } | |
| 2865 | begin | |
| 2866 | Result : = ''; | |
| 2867 | with FVi sitType do | |
| 2868 | begin | |
| 2869 | Resu lt := GetP CEDataText (pdcVisit, Code, Cat egory, Nar rative); | |
| 2870 | if L ength(ModT ext) > 0 t hen Result := Result + ModText + ', '; | |
| 2871 | end; | |
| 2872 | Result : = Trim(Res ult + StrV isitType(F SCRelated, FAORelate d, FIRRela ted, | |
| 2873 | F ECRelated, FMSTRelat ed, FHNCRe lated, FCV Related, F SHADRelate d, FCLRela ted)); | |
| 2874 | end; | |
| 2875 | ||
| 2876 | function T PCEData.St andAlone: boolean; | |
| 2877 | var | |
| 2878 | Sts: int eger; | |
| 2879 | ||
| 2880 | begin | |
| 2881 | if(not F StandAlone Loaded) an d ((FNoteI EN > 0) or ((FEncLoc ation > 0) and (FEnc DateTime > 0))) then | |
| 2882 | begin | |
| 2883 | Sts := HasVisit( FNoteIEN, FEncLocati on, FEncDa teTime); | |
| 2884 | FStand Alone := ( Sts <> 1); | |
| 2885 | if(Sts >= 0) the n | |
| 2886 | FSta ndAloneLoa ded := TRU E; | |
| 2887 | end; | |
| 2888 | Result : = FStandAl one; | |
| 2889 | end; | |
| 2890 | ||
| 2891 | function T PCEData.ge tDocCount: Integer; | |
| 2892 | begin | |
| 2893 | rESULT : = 1; | |
| 2894 | // result := DocCou nt(vISIT); | |
| 2895 | end; | |
| 2896 | ||
| 2897 | {function TPCEItem.M atchProvid er(AnItem: TPCEItem) : Boolean; | |
| 2898 | begin | |
| 2899 | Result : = False; | |
| 2900 | if (Prov ider = AnI tem.Provid er) then R esult := T rue; | |
| 2901 | end; | |
| 2902 | } | |
| 2903 | function T PCEItem.Ma tchPOV(AnI tem: TPCEI tem): Bool ean; | |
| 2904 | begin | |
| 2905 | Result : = False; | |
| 2906 | if (Code = AnItem. Code) and (Category = AnItem.C ategory) | |
| 2907 | then R esult := T rue; | |
| 2908 | end; | |
| 2909 | ||
| 2910 | function T PCEItem.Ma tchProvide r(AnItem: TPCEItem): Boolean; | |
| 2911 | begin | |
| 2912 | Result : = False; | |
| 2913 | if (Prov ider = AnI tem.Provid er) then R esult := T rue; | |
| 2914 | end; | |
| 2915 | ||
| 2916 | function T PCEData.Ge tHasData: Boolean; | |
| 2917 | begin | |
| 2918 | result : = True; | |
| 2919 | if ((FDi agnoses.co unt = 0) | |
| 2920 | and ( FProcedure s.count = 0) | |
| 2921 | and ( FImmunizat ions.count = 0) | |
| 2922 | and ( FSkinTests .count = 0 ) | |
| 2923 | and ( FPatientEd s.count = 0) | |
| 2924 | and ( FHealthFac tors.count = 0) | |
| 2925 | and ( fExams.cou nt = 0) an d | |
| 2926 | (Fvis itType.Qua ntity = 0) )then | |
| 2927 | resu lt := Fals e; | |
| 2928 | end; | |
| 2929 | ||
| 2930 | procedure TPCEData.C opyPCEData (Dest: TPC EData); | |
| 2931 | begin | |
| 2932 | Dest.Cle ar; | |
| 2933 | Dest.FEn cDateTime := FEncDa teTime; | |
| 2934 | Dest.FNo teDateTime := FNoteD ateTime; | |
| 2935 | Dest.FEn cLocation := FEncLo cation; | |
| 2936 | Dest.FEn cSvcCat := FEncSv cCat; | |
| 2937 | Dest.FEn cInpatient := FEncIn patient; | |
| 2938 | Dest.FSt andAlone := FStand Alone; | |
| 2939 | Dest.FSt andAloneLo aded := FS tandAloneL oaded; | |
| 2940 | Dest.FEn cUseCurr := FEncUs eCurr; | |
| 2941 | Dest.FSC Changed := FSCCha nged; | |
| 2942 | Dest.FSC Related := FSCRel ated; | |
| 2943 | Dest.FAO Related := FAORel ated; | |
| 2944 | Dest.FIR Related := FIRRel ated; | |
| 2945 | Dest.FEC Related := FECRel ated; | |
| 2946 | Dest.FMS TRelated := FMSTRe lated; | |
| 2947 | Dest.FHN CRelated := FHNCRe lated; | |
| 2948 | Dest.FCV Related := FCVRel ated; | |
| 2949 | Dest.FSH ADRelated := FSHADR elated; | |
| 2950 | if IsLej euneActive then | |
| 2951 | Dest.fC LRelated := FCLRe lated; //C amp Lejeun e | |
| 2952 | FVisitTy pe.CopyPro c(Dest.Vis itType); | |
| 2953 | Dest.FPr oviders.As sign(FProv iders); | |
| 2954 | ||
| 2955 | CopyPCEI tems(FDiag noses, Dest.FDia gnoses, TPCEDiag ); | |
| 2956 | CopyPCEI tems(FProc edures, Dest.FPro cedures, TPCEProc ); | |
| 2957 | CopyPCEI tems(FImmu nizations, Dest.FImm unizations , TPCEImm) ; | |
| 2958 | CopyPCEI tems(FSkin Tests, Dest.FSki nTests, TPCESkin ); | |
| 2959 | CopyPCEI tems(FPati entEds, Dest.FPat ientEds, TPCEPat) ; | |
| 2960 | CopyPCEI tems(FHeal thFactors, Dest.FHea lthFactors , TPCEHeal th); | |
| 2961 | CopyPCEI tems(FExam s, Dest.FExa ms, TPCEExam s); | |
| 2962 | ||
| 2963 | Dest.FNo teTitle := FNoteTitl e; | |
| 2964 | Dest.FNo teIEN := F NoteIEN; | |
| 2965 | Dest.FPa rent := FP arent; | |
| 2966 | Dest.FHi storicalLo cation := FHistorica lLocation; | |
| 2967 | end; | |
| 2968 | ||
| 2969 | function T PCEData.Ne ededPCEDat a: tRequir edPCEDataT ypes; | |
| 2970 | var | |
| 2971 | EC: TSCC onditions; | |
| 2972 | NeedSC: boolean; | |
| 2973 | TmpLst: TStringLis t; | |
| 2974 | ||
| 2975 | begin | |
| 2976 | Result : = []; | |
| 2977 | if(not F utureEncou nter(Self) ) then | |
| 2978 | begin | |
| 2979 | if(Pro mptForWork load(FNote IEN, FNote Title, FEn cSvcCat, S tandAlone) ) then | |
| 2980 | begin | |
| 2981 | if(f diagnoses. count <= 0 ) then | |
| 2982 | In clude(Resu lt, ndDiag ); | |
| 2983 | if(( fprocedure s.count <= 0) and (f VisitType. Code = '') ) then | |
| 2984 | begi n | |
| 2985 | Tm pLst := TS tringList. Create; | |
| 2986 | tr y | |
| 2987 | GetHasCPTL ist(TmpLst ); | |
| 2988 | if(not Dat aHasCPTCod es(TmpLst) ) then | |
| 2989 | Include( Result, nd Proc); | |
| 2990 | fi nally | |
| 2991 | TmpLst.Fre e; | |
| 2992 | en d; | |
| 2993 | end; | |
| 2994 | if(R equireExpo sures(FNot eIEN, FNot eTitle)) t hen | |
| 2995 | begi n | |
| 2996 | Ne edSC := FA LSE; | |
| 2997 | EC := Eligb leConditio ns; | |
| 2998 | if (EC.SCAll ow and (SC Related = SCC_NA)) t hen | |
| 2999 | NeedSC := TRUE | |
| 3000 | el se if(SC Related <> SCC_YES) then //if screlated = yes, th e others a re not ask ed. | |
| 3001 | be gin | |
| 3002 | if(EC .AOAllow a nd (AORela ted = SCC_ NA)) then NeedSC := TRUE | |
| 3003 | else if(EC .IRAllow a nd (IRRela ted = SCC_ NA)) then NeedSC := TRUE | |
| 3004 | else if(EC .ECAllow a nd (ECRela ted = SCC_ NA)) then NeedSC := TRUE | |
| 3005 | en d; | |
| 3006 | if (EC.MSTAll ow and (MS TRelated = SCC_NA)) then NeedS C := TRUE; | |
| 3007 | // if HNCOK a nd (EC.HNC Allow and (HNCRelate d = SCC_NA )) then Ne edSC := TR UE; | |
| 3008 | if (EC.HNCAll ow and (HN CRelated = SCC_NA)) then NeedS C := TRUE; | |
| 3009 | if (EC.CVAllo w and (CVR elated = S CC_NA) and (SHADRela ted = SCC_ NA)) then NeedSC := TRUE; | |
| 3010 | if (NeedSC) t hen | |
| 3011 | Include(Re sult, ndSC ); | |
| 3012 | end; | |
| 3013 | (* if (Result = []) and (F NoteIEN > 0) then // **** b lock remov ed in v19. 1 {RV} ** ** | |
| 3014 | Cl earCPTRequ ired(FNote IEN);*) | |
| 3015 | end; | |
| 3016 | end; | |
| 3017 | end; | |
| 3018 | ||
| 3019 | ||
| 3020 | function T PCEData.OK 2SignNote: boolean; | |
| 3021 | var | |
| 3022 | Req: tRe quiredPCED ataTypes; | |
| 3023 | msg: str ing; | |
| 3024 | Asked, D oAsk, Prim ary, Neede d: boolean ; | |
| 3025 | Outpatie nt, First, DoSave, N eedSave, D one: boole an; | |
| 3026 | Ans: int eger; | |
| 3027 | Flags: w ord; | |
| 3028 | Ask: TAs kPCE; | |
| 3029 | ||
| 3030 | procedur e Add(Typ: tRequired PCEDataTyp e; txt: st ring); | |
| 3031 | begin | |
| 3032 | if(Typ in Req) t hen | |
| 3033 | msg := msg + t xt + CRLF; | |
| 3034 | end; | |
| 3035 | ||
| 3036 | begin | |
| 3037 | if not C anEditPCE( Self) then | |
| 3038 | begin | |
| 3039 | Result := TRUE; | |
| 3040 | exit; | |
| 3041 | end; | |
| 3042 | if IsNon CountClini c(FEncLoca tion) then | |
| 3043 | begin | |
| 3044 | Result := TRUE; | |
| 3045 | exit; | |
| 3046 | end; | |
| 3047 | if IsCan celOrNoSho w(NoteIEN) then | |
| 3048 | begin | |
| 3049 | Result := TRUE; | |
| 3050 | exit; | |
| 3051 | end; | |
| 3052 | Ask := G etAskPCE(F EncLocatio n); | |
| 3053 | if(Ask = apNever) or (Ask = apDisable) then | |
| 3054 | Result := TRUE | |
| 3055 | else | |
| 3056 | begin | |
| 3057 | DoSave := FALSE; | |
| 3058 | try | |
| 3059 | Aske d := FALSE ; | |
| 3060 | Firs t := TRUE; | |
| 3061 | Outp atient := ((FEncSvcC at = 'A') or (FEncSv cCat = 'I' ) or (FEnc SvcCat = ' T')); | |
| 3062 | repe at | |
| 3063 | Re sult := TR UE; | |
| 3064 | Do ne := TRUE ; | |
| 3065 | Re q := Neede dPCEData; | |
| 3066 | Ne eded := (R eq <> []); | |
| 3067 | if (First) th en | |
| 3068 | be gin | |
| 3069 | if Needed and (not O utpatient) then | |
| 3070 | OutPatie nt := TRUE ; | |
| 3071 | if((Ask = apPrimaryA lways) or Needed or | |
| 3072 | ((Ask = apPrimary Outpatient ) and Outp atient)) t hen | |
| 3073 | begin | |
| 3074 | if(Provi ders.Prima ryIdx < 0) then | |
| 3075 | begin | |
| 3076 | NoPrim aryPCEProv ider(FProv iders, Sel f); | |
| 3077 | if(not DoSave) t hen | |
| 3078 | DoSa ve := (Pro viders.Pri maryIdx >= 0); | |
| 3079 | if(DoS ave and (F Providers. PendingIEN (FALSE) <> 0) and | |
| 3080 | (FPr oviders.In dexOfProvi der(IntToS tr(FProvid ers.Pendin gIEN(FALSE ))) < 0)) then | |
| 3081 | FPro viders.Add Provider(I ntToStr(FP roviders.P endingIEN( FALSE)), F Providers. PendingNam e(FALSE), FALSE); | |
| 3082 | end; | |
| 3083 | end; | |
| 3084 | First := F ALSE; | |
| 3085 | en d; | |
| 3086 | Pr imary := ( Providers. PrimaryIEN = User.DU Z); | |
| 3087 | ca se Ask of | |
| 3088 | apPrimaryO utpatient: DoAsk := (Primary a nd Outpati ent); | |
| 3089 | apPrimaryA lways: DoAsk := Primary; | |
| 3090 | apNeeded: DoAsk := Needed; | |
| 3091 | apOutpatie nt: DoAsk := Outpatient ; | |
| 3092 | apAlways: DoAsk := TRUE; | |
| 3093 | else | |
| 3094 | { apPrimaryN eeded } DoAsk := (Primary a nd Needed) ; | |
| 3095 | en d; | |
| 3096 | if (DoAsk) th en | |
| 3097 | be gin | |
| 3098 | if(Asked a nd ((not N eeded) or (not Prima ry))) then | |
| 3099 | exit; | |
| 3100 | if(Needed) then | |
| 3101 | begin | |
| 3102 | msg := T X_NEED1; | |
| 3103 | Add(ndDi ag, TX_NEE D_DIAG); | |
| 3104 | Add(ndPr oc, TX_NEE D_PROC); | |
| 3105 | Add(ndSC , TX_NEE D_SC); | |
| 3106 | if(Prima ry and For cePCEEntry (FEncLocat ion)) then | |
| 3107 | begin | |
| 3108 | Flags := MB_OKCA NCEL; | |
| 3109 | msg := msg + CR LF + TX_NE ED3; | |
| 3110 | end | |
| 3111 | else | |
| 3112 | begin | |
| 3113 | if(Pri mary) then | |
| 3114 | Flag s := MB_YE SNOCANCEL | |
| 3115 | else | |
| 3116 | Flag s := MB_YE SNO; | |
| 3117 | msg := msg + CR LF + TX_NE ED2; | |
| 3118 | end; | |
| 3119 | Flags := Flags + M B_ICONWARN ING; | |
| 3120 | end | |
| 3121 | else | |
| 3122 | begin | |
| 3123 | Flags := MB_YESNO + MB_ICONQ UESTION; | |
| 3124 | msg := TX_NEED2; | |
| 3125 | end; | |
| 3126 | Ans := Inf oBox(msg, TX_NEED_T, Flags); | |
| 3127 | if(Ans = I D_CANCEL) then | |
| 3128 | begin | |
| 3129 | Result : = FALSE; | |
| 3130 | InfoBox( TX_NEEDABO RT, TX_NEE D_T, MB_OK ); | |
| 3131 | exit; | |
| 3132 | end; | |
| 3133 | Result := (Ans = ID_ NO); | |
| 3134 | if(not Res ult) then | |
| 3135 | begin | |
| 3136 | if(not M issingProv iderInfo(S elf)) then | |
| 3137 | begin | |
| 3138 | NeedSa ve := Upda tePCE(Self , FALSE); | |
| 3139 | if(not DoSave) t hen | |
| 3140 | DoSa ve := Need Save; | |
| 3141 | FUpdat ed := TRUE ; | |
| 3142 | end; | |
| 3143 | Done := frmFrame.C losing; | |
| 3144 | Asked := TRUE; | |
| 3145 | end; | |
| 3146 | en d; | |
| 3147 | unti l(Done); | |
| 3148 | finall y | |
| 3149 | if(D oSave) the n | |
| 3150 | Sa ve; | |
| 3151 | end; | |
| 3152 | end; | |
| 3153 | end; | |
| 3154 | ||
| 3155 | procedure TPCEData.A ddStrData( List: TStr ings); | |
| 3156 | ||
| 3157 | procedur e Add(Txt: string); | |
| 3158 | begin | |
| 3159 | if(len gth(Txt) > 0) then L ist.Add(Tx t); | |
| 3160 | end; | |
| 3161 | ||
| 3162 | begin | |
| 3163 | Add(StrV isitType); | |
| 3164 | Add(StrD iagnoses); | |
| 3165 | Add(StrP rocedures) ; | |
| 3166 | Add(StrI mmunizatio ns); | |
| 3167 | Add(StrS kinTests); | |
| 3168 | Add(StrP atientEds) ; | |
| 3169 | Add(StrH ealthFacto rs); | |
| 3170 | Add(StrE xams); | |
| 3171 | end; | |
| 3172 | ||
| 3173 | procedure TPCEData.A ddVitalDat a(Data, Li st: TStrin gs); | |
| 3174 | var | |
| 3175 | i: integ er; | |
| 3176 | ||
| 3177 | begin | |
| 3178 | for i := 0 to Data .Count-1 d o | |
| 3179 | List.A dd(FormatV italForNot e(Data[i]) ); | |
| 3180 | end; | |
| 3181 | ||
| 3182 | function T PCEData.Pe rsonClassD ate: TFMDa teTime; | |
| 3183 | begin | |
| 3184 | if(FEncS vcCat = 'H ') then | |
| 3185 | Result := FMToda y | |
| 3186 | else | |
| 3187 | Result := FEncDa teTime; // Encounter. DateTime; | |
| 3188 | end; | |
| 3189 | ||
| 3190 | function T PCEData.Vi sitDateTim e: TFMDate Time; | |
| 3191 | begin | |
| 3192 | if(IsSec ondaryVisi t) then | |
| 3193 | Result := FNoteD ateTime | |
| 3194 | else | |
| 3195 | Result := FEncDa teTime; | |
| 3196 | end; | |
| 3197 | ||
| 3198 | function T PCEData.Is SecondaryV isit: bool ean; | |
| 3199 | begin | |
| 3200 | Result : = ((FEncSv cCat = 'H' ) and (FNo teDateTime > 0) and (FEncInpat ient)); | |
| 3201 | end; | |
| 3202 | ||
| 3203 | function T PCEData.Ne edProvider Info: bool ean; | |
| 3204 | var | |
| 3205 | i: integ er; | |
| 3206 | TmpLst: TStringLis t; | |
| 3207 | ||
| 3208 | begin | |
| 3209 | if(FProv iders.Prim aryIdx < 0 ) then | |
| 3210 | begin | |
| 3211 | Result := AutoCh eckout(FEn cLocation) ; | |
| 3212 | if not Result th en | |
| 3213 | begin | |
| 3214 | for i := 0 to FDiagnoses .Count - 1 do | |
| 3215 | begi n | |
| 3216 | if not TPCED iag(FDiagn oses[i]).F Delete the n | |
| 3217 | be gin | |
| 3218 | Result := TRUE; | |
| 3219 | break; | |
| 3220 | en d; | |
| 3221 | end; | |
| 3222 | end; | |
| 3223 | if not Result th en | |
| 3224 | begin | |
| 3225 | for i := 0 to FProcedure s.Count - 1 do | |
| 3226 | begi n | |
| 3227 | if not TPCEP roc(FProce dures[i]). FDelete th en | |
| 3228 | be gin | |
| 3229 | Result := TRUE; | |
| 3230 | break; | |
| 3231 | en d; | |
| 3232 | end; | |
| 3233 | end; | |
| 3234 | if not Result th en | |
| 3235 | begin | |
| 3236 | for i := 0 to FProviders .Count - 1 do | |
| 3237 | begi n | |
| 3238 | if not FProv iders[i].D elete then | |
| 3239 | be gin | |
| 3240 | Result := TRUE; | |
| 3241 | break; | |
| 3242 | en d; | |
| 3243 | end; | |
| 3244 | end; | |
| 3245 | if not Result th en | |
| 3246 | begin | |
| 3247 | TmpL st := TStr ingList.Cr eate; | |
| 3248 | try | |
| 3249 | Ge tHasCPTLis t(TmpLst); | |
| 3250 | if (DataHasCP TCodes(Tmp Lst)) then | |
| 3251 | Result := TRUE; | |
| 3252 | fina lly | |
| 3253 | Tm pLst.Free; | |
| 3254 | end; | |
| 3255 | end; | |
| 3256 | end | |
| 3257 | else | |
| 3258 | Result := FALSE; | |
| 3259 | end; | |
| 3260 | ||
| 3261 | procedure TPCEData.G etHasCPTLi st(AList: TStrings); | |
| 3262 | ||
| 3263 | procedur e AddList( List: TLis t); | |
| 3264 | var | |
| 3265 | i: int eger; | |
| 3266 | tmp: s tring; | |
| 3267 | ||
| 3268 | begin | |
| 3269 | for i := 0 to Li st.Count-1 do | |
| 3270 | begin | |
| 3271 | tmp := TPCEIte m(List[i]) .HasCPTStr ; | |
| 3272 | if(t mp <> '') then | |
| 3273 | AL ist.Add(tm p); | |
| 3274 | end; | |
| 3275 | end; | |
| 3276 | ||
| 3277 | begin | |
| 3278 | AddList( FImmunizat ions); | |
| 3279 | AddList( FSkinTests ); | |
| 3280 | AddList( FPatientEd s); | |
| 3281 | AddList( FHealthFac tors); | |
| 3282 | AddList( FExams); | |
| 3283 | end; | |
| 3284 | ||
| 3285 | procedure TPCEData.C opyPCEItem s(Src: TLi st; Dest: TObject; I temClass: TPCEItemCl ass); | |
| 3286 | Type | |
| 3287 | fDestType = (CopyCa ptionList, CopyStrin gs, CopyLi st); | |
| 3288 | var | |
| 3289 | AItem: T PCEItem; | |
| 3290 | i: Integ er; | |
| 3291 | DestType : fDestTyp e; | |
| 3292 | begin | |
| 3293 | if (Dest is TCapti onListView ) then | |
| 3294 | DestTyp e := CopyC aptionList | |
| 3295 | else if( Dest is TS trings) th en | |
| 3296 | DestT ype := Cop yStrings | |
| 3297 | else | |
| 3298 | if(Dest is TList) then | |
| 3299 | DestT ype := Cop yList | |
| 3300 | else | |
| 3301 | exit; | |
| 3302 | ||
| 3303 | for i := 0 to Src. Count - 1 do | |
| 3304 | begin | |
| 3305 | if(not TPCEItem( Src[i]).FD elete) the n | |
| 3306 | begin | |
| 3307 | AIte m := ItemC lass.Creat e; | |
| 3308 | AIte m.Assign(T PCEItem(Sr c[i])); | |
| 3309 | case DestType of | |
| 3310 | Cop yCaptionLi st: TCapti onListView (Dest).Add Object(AIt em.ItemStr , AItem); | |
| 3311 | Cop yStrings: TStrings(D est).AddOb ject(AItem .ItemStr, AItem); | |
| 3312 | Cop yList: TLi st(Dest).A dd(AItem); | |
| 3313 | end; | |
| 3314 | ||
| 3315 | end; | |
| 3316 | end; | |
| 3317 | end; | |
| 3318 | ||
| 3319 | function T PCEData.Em pty: boole an; | |
| 3320 | begin | |
| 3321 | Result : = (FProvid ers.Count = 0); | |
| 3322 | if(Resul t) then Re sult := (F SCRelated = SCC_NA) ; | |
| 3323 | if(Resul t) then Re sult := (F AORelated = SCC_NA) ; | |
| 3324 | if(Resul t) then Re sult := (F IRRelated = SCC_NA) ; | |
| 3325 | if(Resul t) then Re sult := (F ECRelated = SCC_NA) ; | |
| 3326 | if(Resul t) then Re sult := (F MSTRelated = SCC_NA) ; | |
| 3327 | // if(Res ult) and H NCOK then Result := (FHNCRelat ed = SCC_N A); | |
| 3328 | if(Resul t) then Re sult := (F HNCRelated = SCC_NA) ; | |
| 3329 | if(Resul t) then Re sult := (F CVRelated = SCC_NA); | |
| 3330 | if(Resul t) then Re sult := (F SHADRelate d = SCC_NA ); | |
| 3331 | if(Resul t) then Re sult := (F CLRelated = SCC_NA); //Camp Le jeune | |
| 3332 | if(Resul t) then Re sult := (F Diagnoses. Count = 0) ; | |
| 3333 | if(Resul t) then Re sult := (F Procedures .Count = 0 ); | |
| 3334 | if(Resul t) then Re sult := (F Immunizati ons.Count = 0); | |
| 3335 | if(Resul t) then Re sult := (F SkinTests. Count = 0) ; | |
| 3336 | if(Resul t) then Re sult := (F PatientEds .Count = 0 ); | |
| 3337 | if(Resul t) then Re sult := (F HealthFact ors.Count = 0); | |
| 3338 | if(Resul t) then Re sult := (f Exams.Coun t = 0); | |
| 3339 | if(Resul t) then Re sult := (F VisitType. Empty); | |
| 3340 | end; | |
| 3341 | ||
| 3342 | ||
| 3343 | { TPCEProv iderList } | |
| 3344 | ||
| 3345 | function T PCEProvide rList.Add( const S: s tring): In teger; | |
| 3346 | var | |
| 3347 | SIEN: st ring; | |
| 3348 | LastPrim ary: integ er; | |
| 3349 | ||
| 3350 | begin | |
| 3351 | SIEN := IntToStr(S trToInt64D ef(Piece(S , U, pnumP rvdrIEN), 0)); | |
| 3352 | if(SIEN = '0') the n | |
| 3353 | Result := -1 | |
| 3354 | else | |
| 3355 | begin | |
| 3356 | LastPr imary := P rimaryIdx; | |
| 3357 | Result := IndexO fProvider( SIEN); | |
| 3358 | if(Res ult < 0) t hen | |
| 3359 | Resu lt := inhe rited Add( S) | |
| 3360 | else | |
| 3361 | Stri ngs[Result ] := S; | |
| 3362 | if(Pie ce(S, U, p numPrvdrPr imary) = ' 1') then | |
| 3363 | begin | |
| 3364 | FNoU pdate := T RUE; | |
| 3365 | try | |
| 3366 | Se tPrimaryId x(Result); | |
| 3367 | fina lly | |
| 3368 | FN oUpdate := FALSE; | |
| 3369 | end; | |
| 3370 | if(a ssigned(FO nPrimaryCh anged) and (LastPrim ary <> Pri maryIdx)) then | |
| 3371 | FO nPrimaryCh anged(Self ); | |
| 3372 | end; | |
| 3373 | end; | |
| 3374 | end; | |
| 3375 | ||
| 3376 | function T PCEProvide rList.AddP rovider(AI EN, AName: string; A Primary: b oolean): i nteger; | |
| 3377 | var | |
| 3378 | tmp: str ing; | |
| 3379 | ||
| 3380 | begin | |
| 3381 | tmp := ' PRV' + U + AIEN + U + U + U + AName + U; | |
| 3382 | if(APrim ary) then tmp := tmp + '1'; | |
| 3383 | Result : = Add(tmp) ; | |
| 3384 | end; | |
| 3385 | ||
| 3386 | procedure TPCEProvid erList.Cle ar; | |
| 3387 | var | |
| 3388 | DoNotify : boolean; | |
| 3389 | ||
| 3390 | begin | |
| 3391 | DoNotify := (assig ned(FOnPri maryChange d) and (Ge tPrimaryId x >= 0)); | |
| 3392 | FPending Default := ''; | |
| 3393 | FPending User := '' ; | |
| 3394 | FPCEProv iderIEN := 0; | |
| 3395 | FPCEProv iderName : = ''; | |
| 3396 | inherite d; | |
| 3397 | if(DoNot ify) then | |
| 3398 | FOnPri maryChange d(Self); | |
| 3399 | end; | |
| 3400 | ||
| 3401 | procedure TPCEProvid erList.Del ete(Index: Integer); | |
| 3402 | var | |
| 3403 | DoNotify : boolean; | |
| 3404 | ||
| 3405 | begin | |
| 3406 | DoNotify := (assig ned(FOnPri maryChange d) and (Pi ece(String s[Index], U, pnumPrv drPrimary) = '1')); | |
| 3407 | inherite d Delete(I ndex); | |
| 3408 | if(DoNot ify) then | |
| 3409 | FOnPri maryChange d(Self); | |
| 3410 | end; | |
| 3411 | ||
| 3412 | function T PCEProvide rList.PCEP rovider: I nt64; | |
| 3413 | ||
| 3414 | function Check(AIE N: Int64): Int64; | |
| 3415 | begin | |
| 3416 | if(AIE N = 0) or (IndexOfPr ovider(Int ToStr(AIEN )) < 0) th en | |
| 3417 | Resu lt := 0 | |
| 3418 | else | |
| 3419 | Resu lt := AIEN ; | |
| 3420 | end; | |
| 3421 | ||
| 3422 | begin | |
| 3423 | Result : = Check(En counter.Pr ovider); | |
| 3424 | if(Resul t = 0) the n Result : = Check(Us er.DUZ); | |
| 3425 | if(Resul t = 0) the n Result : = PrimaryI EN; | |
| 3426 | end; | |
| 3427 | ||
| 3428 | function T PCEProvide rList.PCEP roviderNam e: string; | |
| 3429 | var | |
| 3430 | NewProv: Int64; | |
| 3431 | ||
| 3432 | begin | |
| 3433 | NewProv := PCEProv ider; | |
| 3434 | if(FPCEP roviderIEN <> NewPro v) then | |
| 3435 | begin | |
| 3436 | FPCEPr oviderIEN := NewProv ; | |
| 3437 | FPCEPr oviderName := Extern alName(PCE Provider, FN_NEW_PER SON); | |
| 3438 | end; | |
| 3439 | Result : = FPCEProv iderName; | |
| 3440 | end; | |
| 3441 | ||
| 3442 | function T PCEProvide rList.GetP rimaryIdx: integer; | |
| 3443 | begin | |
| 3444 | Result : = IndexOfP iece('1', U, pnumPrv drPrimary) ; | |
| 3445 | end; | |
| 3446 | ||
| 3447 | function T PCEProvide rList.GetP roviderDat a(Index: i nteger): T PCEProvide rRec; | |
| 3448 | var | |
| 3449 | X: strin g; | |
| 3450 | ||
| 3451 | begin | |
| 3452 | X := Str ings[Index ]; | |
| 3453 | Result.I EN := StrToInt64 Def(Piece( X, U, pnum PrvdrIEN), 0); | |
| 3454 | Result.N ame := Piece(X, U , pnumPrvd rName); | |
| 3455 | Result.P rimary := (Piece(X, U, pnumPrv drPrimary) = '1'); | |
| 3456 | Result.D elete := (Piece(X, U, 1) = 'P RV-'); | |
| 3457 | end; | |
| 3458 | ||
| 3459 | function T PCEProvide rList.Inde xOfProvide r(AIEN: st ring): int eger; | |
| 3460 | begin | |
| 3461 | Result : = IndexOfP iece(AIEN, U, pnumPr vdrIEN); | |
| 3462 | end; | |
| 3463 | ||
| 3464 | procedure TPCEProvid erList.Mer ge(AList: TPCEProvid erList); | |
| 3465 | var | |
| 3466 | i, idx: integer; | |
| 3467 | tmp: str ing; | |
| 3468 | ||
| 3469 | begin | |
| 3470 | for i := 0 to Coun t-1 do | |
| 3471 | begin | |
| 3472 | tmp := Strings[i ]; | |
| 3473 | idx := AList.Ind exOfProvid er(Piece(t mp, U, pnu mPrvdrIEN) ); | |
| 3474 | if(idx < 0) then | |
| 3475 | begin | |
| 3476 | SetP iece(tmp, U, 1, 'PRV -'); | |
| 3477 | Stri ngs[i] := tmp; | |
| 3478 | end; | |
| 3479 | end; | |
| 3480 | for i := 0 to ALis t.Count-1 do | |
| 3481 | Add(AL ist.String s[i]); // Add alread y filters out duplic ates | |
| 3482 | end; | |
| 3483 | ||
| 3484 | function T PCEProvide rList.Pend ingIEN(ADe fault: boo lean): Int 64; | |
| 3485 | begin | |
| 3486 | if(ADefa ult) then | |
| 3487 | Result := StrToI nt64Def(Pi ece(FPendi ngDefault, U, 1), 0) | |
| 3488 | else | |
| 3489 | Result := StrToI nt64Def(Pi ece(FPendi ngUser, U, 1), 0); | |
| 3490 | end; | |
| 3491 | ||
| 3492 | function T PCEProvide rList.Pend ingName(AD efault: bo olean): st ring; | |
| 3493 | begin | |
| 3494 | if(ADefa ult) then | |
| 3495 | Result := Piece( FPendingDe fault, U, 2) | |
| 3496 | else | |
| 3497 | Result := Piece( FPendingUs er, U, 2); | |
| 3498 | end; | |
| 3499 | ||
| 3500 | function T PCEProvide rList.Prim aryIEN: in t64; | |
| 3501 | var | |
| 3502 | idx: int eger; | |
| 3503 | ||
| 3504 | begin | |
| 3505 | idx := G etPrimaryI dx; | |
| 3506 | if(idx < 0) then | |
| 3507 | Result := 0 | |
| 3508 | else | |
| 3509 | Result := StrToI nt64Def(Pi ece(String s[idx], U, pnumPrvdr IEN), 0); | |
| 3510 | end; | |
| 3511 | ||
| 3512 | function T PCEProvide rList.Prim aryName: s tring; | |
| 3513 | var | |
| 3514 | idx: int eger; | |
| 3515 | ||
| 3516 | begin | |
| 3517 | idx := G etPrimaryI dx; | |
| 3518 | if(idx < 0) then | |
| 3519 | Result := '' | |
| 3520 | else | |
| 3521 | Result := Piece( Strings[id x], U, pnu mPrvdrName ); | |
| 3522 | end; | |
| 3523 | ||
| 3524 | procedure TPCEProvid erList.Set Primary(in dex: integ er; Primar y: boolean ); | |
| 3525 | var | |
| 3526 | tmp, x: string; | |
| 3527 | ||
| 3528 | begin | |
| 3529 | tmp := S trings[ind ex]; | |
| 3530 | if(Prima ry) then | |
| 3531 | x := ' 1' | |
| 3532 | else | |
| 3533 | x := ' '; | |
| 3534 | SetPiece (tmp, U, p numPrvdrPr imary, x); | |
| 3535 | Strings[ Index] := tmp; | |
| 3536 | end; | |
| 3537 | ||
| 3538 | procedure TPCEProvid erList.Set PrimaryIdx (const Val ue: intege r); | |
| 3539 | var | |
| 3540 | LastPrim ary, idx: integer; | |
| 3541 | Found: b oolean; | |
| 3542 | ||
| 3543 | begin | |
| 3544 | LastPrim ary := Get PrimaryIdx ; | |
| 3545 | idx := - 1; | |
| 3546 | Found := FALSE; | |
| 3547 | repeat | |
| 3548 | idx := IndexOfPi ece('1', U , pnumPrvd rPrimary, idx); | |
| 3549 | if(idx >= 0) the n | |
| 3550 | begin | |
| 3551 | if(i dx = Value ) then | |
| 3552 | Fo und := TRU E | |
| 3553 | else | |
| 3554 | Se tPrimary(i dx, FALSE) ; | |
| 3555 | end; | |
| 3556 | until(id x < 0); | |
| 3557 | if(not F ound) and (Value >= 0) and (Va lue < Coun t) then | |
| 3558 | SetPri mary(Value , TRUE); | |
| 3559 | if((not FNoUpdate) and assig ned(FOnPri maryChange d) and (La stPrimary <> Value)) then | |
| 3560 | FOnPri maryChange d(Self); | |
| 3561 | end; | |
| 3562 | ||
| 3563 | procedure TPCEProvid erList.Set ProviderDa ta(Index: integer; | |
| 3564 | const Va lue: TPCEP roviderRec ); | |
| 3565 | var | |
| 3566 | tmp, SIE N: string; | |
| 3567 | ||
| 3568 | begin | |
| 3569 | if(Value .IEN = 0) or (index < 0) or (i ndex >= Co unt) then exit; | |
| 3570 | SIEN := IntToStr(V alue.IEN); | |
| 3571 | if(Index OfPiece(SI EN, U, pnu mPrvdrIEN) = index) then | |
| 3572 | begin | |
| 3573 | tmp := 'PRV'; | |
| 3574 | if(Val ue.Delete) then tmp := tmp + ' -'; | |
| 3575 | tmp := tmp + U + SIEN + U + U + U + Value.Name + U; | |
| 3576 | String s[index] : = tmp; | |
| 3577 | if Val ue.Primary then | |
| 3578 | SetP rimaryIdx( Index); | |
| 3579 | end; | |
| 3580 | end; | |
| 3581 | ||
| 3582 | procedure TPCEProvid erList.Ass ign(Source : TPersist ent); | |
| 3583 | var | |
| 3584 | Src: TPC EProviderL ist; | |
| 3585 | ||
| 3586 | begin | |
| 3587 | inherite d Assign(S ource); | |
| 3588 | if(Sourc e is TPCEP roviderLis t) then | |
| 3589 | begin | |
| 3590 | Src := TPCEProvi derList(So urce); | |
| 3591 | Src.FO nPrimaryCh anged := F OnPrimaryC hanged; | |
| 3592 | Src.FP endingDefa ult := FPe ndingDefau lt; | |
| 3593 | Src.FP endingUser := FPendi ngUser; | |
| 3594 | Src.FP CEProvider IEN := FPC EProviderI EN; | |
| 3595 | Src.FP CEProvider Name := FP CEProvider Name; | |
| 3596 | end; | |
| 3597 | end; | |
| 3598 | ||
| 3599 | initializa tion | |
| 3600 | ||
| 3601 | finalizati on | |
| 3602 | KillObj( @PCESetsOf Codes); | |
| 3603 | KillObj( @HistLocat ions); | |
| 3604 | ||
| 3605 | end. |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.