1 | unit fPtDemoEdit;
|
---|
2 | //kt Added this entire unit for demographics editing at runtime.
|
---|
3 |
|
---|
4 | interface
|
---|
5 |
|
---|
6 | uses
|
---|
7 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
---|
8 | Dialogs, ComCtrls, StdCtrls, ExtCtrls, DKLang;
|
---|
9 |
|
---|
10 | type
|
---|
11 | BoolUC = (bucFalse, bucTrue, bucUnchanged);
|
---|
12 |
|
---|
13 | TPatientInfo = class(TObject)
|
---|
14 | public
|
---|
15 | LName: String;
|
---|
16 | FName: String;
|
---|
17 | MName: String;
|
---|
18 | CombinedName: String;
|
---|
19 | Prefix: String;
|
---|
20 | Suffix: String;
|
---|
21 | Degree: String;
|
---|
22 | DOB: String;
|
---|
23 | Sex: String;
|
---|
24 | SSNum: String;
|
---|
25 | EMail: String;
|
---|
26 | AliasInfo : TStringList; //format: s=IEN#, Object is ^tAlias
|
---|
27 | AddressLine1: String;
|
---|
28 | AddressLine2: String;
|
---|
29 | AddressLine3: String;
|
---|
30 | City: String;
|
---|
31 | State: String;
|
---|
32 | Zip4: String;
|
---|
33 | BadAddress: BoolUC;
|
---|
34 | PhoneNumResidence: String;
|
---|
35 | PhoneNumWork: String;
|
---|
36 | PhoneNumCell: String;
|
---|
37 | PhoneNumTemp: String;
|
---|
38 |
|
---|
39 | TempAddressLine1: String;
|
---|
40 | TempAddressLine2: String;
|
---|
41 | TempAddressLine3: String;
|
---|
42 | TempCity: String;
|
---|
43 | TempState: String;
|
---|
44 | TempZip4: String;
|
---|
45 | TempStartingDate : String;
|
---|
46 | TempEndingDate : String;
|
---|
47 | TempAddressActive: BoolUC;
|
---|
48 |
|
---|
49 | ConfidentalAddressLine1: String;
|
---|
50 | ConfidentalAddressLine2: String;
|
---|
51 | ConfidentalAddressLine3: String;
|
---|
52 | ConfidentalCity: String;
|
---|
53 | ConfidentalState: String;
|
---|
54 | ConfidentalZip: String;
|
---|
55 | ConfidentalStartingDate : String;
|
---|
56 | ConfidentalEndingDate : String;
|
---|
57 | ConfAddressActive : BoolUC;
|
---|
58 |
|
---|
59 | Modified : boolean;
|
---|
60 |
|
---|
61 | constructor Create;
|
---|
62 | destructor Destroy; override;
|
---|
63 | procedure ClearAliasInfo;
|
---|
64 | procedure Clear;
|
---|
65 | procedure Assign(Source : TPatientInfo);
|
---|
66 | procedure RemoveUnchanged(OldInfo : TPatientInfo);
|
---|
67 | end;
|
---|
68 |
|
---|
69 | TfrmPtDemoEdit = class(TForm)
|
---|
70 | OKBtn: TButton;
|
---|
71 | CancelBtn: TButton;
|
---|
72 | ApplyBtn: TButton;
|
---|
73 | PageControl: TPageControl;
|
---|
74 | DemoTabSheet: TTabSheet;
|
---|
75 | LNameLabel: TLabel;
|
---|
76 | FNameLabel: TLabel;
|
---|
77 | MNameLabel: TLabel;
|
---|
78 | CombinedNameLabel: TLabel;
|
---|
79 | PrefixLabel: TLabel;
|
---|
80 | SuffixLabel: TLabel;
|
---|
81 | DOBLabel: TLabel;
|
---|
82 | SSNumLabel: TLabel;
|
---|
83 | CombinedNameEdit: TEdit;
|
---|
84 | LNameEdit: TEdit;
|
---|
85 | FNameEdit: TEdit;
|
---|
86 | MNameEdit: TEdit;
|
---|
87 | PrefixEdit: TEdit;
|
---|
88 | SuffixEdit: TEdit;
|
---|
89 | DOBEdit: TEdit;
|
---|
90 | SSNumEdit: TEdit;
|
---|
91 | AliasGroupBox: TGroupBox;
|
---|
92 | AliasComboBox: TComboBox;
|
---|
93 | AliasNameLabel: TLabel;
|
---|
94 | AliasSSNumLabel: TLabel;
|
---|
95 | AliasNameEdit: TEdit;
|
---|
96 | AliasSSNEdit: TEdit;
|
---|
97 | AddressGroupBox: TGroupBox;
|
---|
98 | AddressRGrp: TRadioGroup;
|
---|
99 | AddressLine1Edit: TEdit;
|
---|
100 | AddressLine2Edit: TEdit;
|
---|
101 | AddressLine3Edit: TEdit;
|
---|
102 | CityLabel: TLabel;
|
---|
103 | CityEdit: TEdit;
|
---|
104 | StateComboBox: TComboBox;
|
---|
105 | Zip4Edit: TEdit;
|
---|
106 | Zip4Label: TLabel;
|
---|
107 | BadAddressCB: TCheckBox;
|
---|
108 | TempActiveCB: TCheckBox;
|
---|
109 | SexLabel: TLabel;
|
---|
110 | SexComboBox: TComboBox;
|
---|
111 | DelAliasBtn: TButton;
|
---|
112 | StartingDateEdit: TEdit;
|
---|
113 | StartingDateLabel: TLabel;
|
---|
114 | EndingDateLabel: TLabel;
|
---|
115 | EndingDateEdit: TEdit;
|
---|
116 | ConfActiveCB: TCheckBox;
|
---|
117 | DegreeEdit: TEdit;
|
---|
118 | DegreeLabel: TLabel;
|
---|
119 | AddAliasBtn: TButton;
|
---|
120 | DKLanguageController1: TDKLanguageController;
|
---|
121 | GroupBox1: TGroupBox;
|
---|
122 | PhoneNumGrp: TRadioGroup;
|
---|
123 | PhoneNumEdit: TEdit;
|
---|
124 | Label1: TLabel;
|
---|
125 | Label2: TLabel;
|
---|
126 | Label3: TLabel;
|
---|
127 | EMailEdit: TEdit;
|
---|
128 | procedure AliasComboBoxChange(Sender: TObject);
|
---|
129 | procedure FormCreate(Sender: TObject);
|
---|
130 | procedure AddressRGrpClick(Sender: TObject);
|
---|
131 | procedure PhoneNumGrpClick(Sender: TObject);
|
---|
132 | procedure DelAliasBtnClick(Sender: TObject);
|
---|
133 | procedure FormDestroy(Sender: TObject);
|
---|
134 | procedure FormShow(Sender: TObject);
|
---|
135 | procedure CombinedNameEditChange(Sender: TObject);
|
---|
136 | procedure LNameEditChange(Sender: TObject);
|
---|
137 | procedure FNameEditChange(Sender: TObject);
|
---|
138 | procedure MNameEditChange(Sender: TObject);
|
---|
139 | procedure PrefixEditChange(Sender: TObject);
|
---|
140 | procedure SuffixEditChange(Sender: TObject);
|
---|
141 | procedure SexComboBoxChange(Sender: TObject);
|
---|
142 | procedure AddressLine1EditChange(Sender: TObject);
|
---|
143 | procedure AddressLine2EditChange(Sender: TObject);
|
---|
144 | procedure AddressLine3EditChange(Sender: TObject);
|
---|
145 | procedure CityEditChange(Sender: TObject);
|
---|
146 | procedure Zip4EditChange(Sender: TObject);
|
---|
147 | procedure StateComboBoxChange(Sender: TObject);
|
---|
148 | procedure TempActiveCBClick(Sender: TObject);
|
---|
149 | procedure ConfActiveCBClick(Sender: TObject);
|
---|
150 | procedure BadAddressCBClick(Sender: TObject);
|
---|
151 | procedure DegreeEditChange(Sender: TObject);
|
---|
152 | procedure PhoneNumEditChange(Sender: TObject);
|
---|
153 | procedure StartingDateEditChange(Sender: TObject);
|
---|
154 | procedure EndingDateEditChange(Sender: TObject);
|
---|
155 | procedure AliasNameEditChange(Sender: TObject);
|
---|
156 | procedure AliasSSNEditChange(Sender: TObject);
|
---|
157 | procedure ApplyBtnClick(Sender: TObject);
|
---|
158 | procedure AddAliasBtnClick(Sender: TObject);
|
---|
159 | procedure OKBtnClick(Sender: TObject);
|
---|
160 | procedure CancelBtnClick(Sender: TObject);
|
---|
161 | procedure DOBEditChange(Sender: TObject);
|
---|
162 | procedure SSNumEditChange(Sender: TObject);
|
---|
163 | private
|
---|
164 | { Private declarations }
|
---|
165 | FCurPatientInfo : TPatientInfo;
|
---|
166 | FServerPatientInfo : TPatientInfo;
|
---|
167 | FCurAliasEdit : integer;
|
---|
168 | ProgAliasChangeOccuring : boolean;
|
---|
169 | ProgNameChangeOccuring : boolean;
|
---|
170 | ProgPhoneChangeOccuring : boolean;
|
---|
171 | ProgAddressChangeOccuring : boolean;
|
---|
172 | MaxAliasIEN : integer;
|
---|
173 | ChangesMade : boolean;
|
---|
174 | procedure GetPtInfo(PatientInfo : TPatientInfo);
|
---|
175 | procedure PostChangedInfo(PatientInfo : TPatientInfo);
|
---|
176 | procedure ShowAliasInfo(Patient : TPatientInfo);
|
---|
177 | procedure ShowPtInfo(Patient : TPatientInfo);
|
---|
178 | function CombinedName : string;
|
---|
179 | procedure NameParts(CombinedName: string; var LName, FName, MName : string);
|
---|
180 | procedure SetModified(value : boolean);
|
---|
181 | procedure SetAliasEnabled(value : boolean);
|
---|
182 | public
|
---|
183 | { Public declarations }
|
---|
184 | end;
|
---|
185 |
|
---|
186 | var
|
---|
187 | frmPtDemoEdit: TfrmPtDemoEdit;
|
---|
188 |
|
---|
189 | implementation
|
---|
190 |
|
---|
191 | {$R *.dfm}
|
---|
192 |
|
---|
193 | uses
|
---|
194 | IniFiles,Trpcb,ORNet,uCore, mfunstr, strutils;
|
---|
195 |
|
---|
196 | const
|
---|
197 | ADD_NEW_ALIAS = '<Add New Alias>';
|
---|
198 |
|
---|
199 | type
|
---|
200 | tAlias= class
|
---|
201 | Name : string;
|
---|
202 | SSN : string;
|
---|
203 | procedure Assign(Source: tAlias);
|
---|
204 | end;
|
---|
205 |
|
---|
206 | procedure tAlias.Assign(Source : tAlias);
|
---|
207 | begin
|
---|
208 | Name := Source.Name;
|
---|
209 | SSN := Source.SSN;
|
---|
210 | end;
|
---|
211 |
|
---|
212 | //=========================================================
|
---|
213 | //=========================================================
|
---|
214 | //=========================================================
|
---|
215 |
|
---|
216 | constructor TPatientInfo.Create;
|
---|
217 | begin
|
---|
218 | AliasInfo := TStringList.Create;
|
---|
219 | Clear;
|
---|
220 | end;
|
---|
221 |
|
---|
222 | destructor TPatientInfo.Destroy;
|
---|
223 | begin
|
---|
224 | ClearAliasInfo;
|
---|
225 | AliasInfo.Free;
|
---|
226 | inherited Destroy;
|
---|
227 | End;
|
---|
228 |
|
---|
229 | procedure TPatientInfo.ClearAliasInfo;
|
---|
230 | var i : integer;
|
---|
231 | pAlias : tAlias;
|
---|
232 | begin
|
---|
233 | for i := 0 to AliasInfo.Count-1 do begin
|
---|
234 | pAlias := tAlias(AliasInfo.Objects[i]);
|
---|
235 | pAlias.Free;
|
---|
236 | end;
|
---|
237 | AliasInfo.Clear
|
---|
238 | End;
|
---|
239 |
|
---|
240 | procedure TPatientInfo.Clear;
|
---|
241 | begin
|
---|
242 | LName:= '';
|
---|
243 | FName:= '';
|
---|
244 | MName:= '';
|
---|
245 | CombinedName:= '';
|
---|
246 | Prefix:= '';
|
---|
247 | Suffix:= '';
|
---|
248 | Degree:= '';
|
---|
249 | DOB:= '';
|
---|
250 | SSNum:= '';
|
---|
251 | ClearAliasInfo;
|
---|
252 | AddressLine1:= '';
|
---|
253 | AddressLine2:= '';
|
---|
254 | AddressLine3:= '';
|
---|
255 | City:= '';
|
---|
256 | State:= '';
|
---|
257 | Zip4:= '';
|
---|
258 | TempAddressLine1:= '';
|
---|
259 | TempAddressLine2:= '';
|
---|
260 | TempAddressLine3:= '';
|
---|
261 | TempCity:= '';
|
---|
262 | TempState:= '';
|
---|
263 | TempZip4:= '';
|
---|
264 | TempStartingDate := '';
|
---|
265 | TempEndingDate := '';
|
---|
266 | ConfidentalAddressLine1:= '';
|
---|
267 | ConfidentalAddressLine2:= '';
|
---|
268 | ConfidentalAddressLine3:= '';
|
---|
269 | ConfidentalCity:= '';
|
---|
270 | ConfidentalState:= '';
|
---|
271 | ConfidentalZip:= '';
|
---|
272 | ConfidentalStartingDate := '';
|
---|
273 | ConfidentalEndingDate := '';
|
---|
274 | BadAddress:= bucFalse;
|
---|
275 | TempAddressActive:= bucFalse;
|
---|
276 | ConfAddressActive := bucFalse;
|
---|
277 | Modified := false;
|
---|
278 |
|
---|
279 | PhoneNumResidence:= '';
|
---|
280 | PhoneNumWork:= '';
|
---|
281 | PhoneNumCell:= '';
|
---|
282 | PhoneNumTemp:= '';
|
---|
283 | Sex:= '';
|
---|
284 | end;
|
---|
285 |
|
---|
286 |
|
---|
287 | procedure TPatientInfo.Assign(Source : TPatientInfo);
|
---|
288 | var i : integer;
|
---|
289 | pAlias : tAlias;
|
---|
290 | OtherpAlias : tAlias;
|
---|
291 | begin
|
---|
292 | LName:=Source.LName;
|
---|
293 | FName:=Source.FName;
|
---|
294 | MName:=Source.MName;
|
---|
295 | CombinedName:=Source.CombinedName;
|
---|
296 | Prefix:=Source.Prefix;
|
---|
297 | Suffix:=Source.Suffix;
|
---|
298 | Degree:=Source.Degree;
|
---|
299 | DOB:=Source.DOB;
|
---|
300 | SSNum:=Source.SSNum;
|
---|
301 |
|
---|
302 | ClearAliasInfo;
|
---|
303 | //Copy pointed to tAlias entries, don't simply copy references
|
---|
304 | for i := 0 to Source.AliasInfo.Count-1 do begin
|
---|
305 | AliasInfo.Add(Source.AliasInfo.Strings[i]);
|
---|
306 | OtherpAlias := tAlias(Source.AliasInfo.Objects[i]);
|
---|
307 | if OtherpAlias<>nil then begin
|
---|
308 | pAlias := tAlias.Create;
|
---|
309 | pAlias.Name := OtherpAlias.Name;
|
---|
310 | pAlias.SSN := OtherpAlias.SSN;
|
---|
311 | AliasInfo.Objects[i]:=pAlias;
|
---|
312 | end;
|
---|
313 | end;
|
---|
314 | AddressLine1:=Source.AddressLine1;
|
---|
315 | AddressLine2:=Source.AddressLine2;
|
---|
316 | AddressLine3:=Source.AddressLine3;
|
---|
317 | City:=Source.City;
|
---|
318 | State:=Source.State;
|
---|
319 | Zip4:=Source.Zip4;
|
---|
320 | TempAddressLine1:=Source.TempAddressLine1;
|
---|
321 | TempAddressLine2:=Source.TempAddressLine2;
|
---|
322 | TempAddressLine3:=Source.TempAddressLine3;
|
---|
323 | TempCity:=Source.TempCity;
|
---|
324 | TempState:=Source.TempState;
|
---|
325 | TempZip4:=Source.TempZip4;
|
---|
326 | TempStartingDate :=Source.TempStartingDate ;
|
---|
327 | TempEndingDate :=Source.TempEndingDate ;
|
---|
328 | ConfidentalAddressLine1:=Source.ConfidentalAddressLine1;
|
---|
329 | ConfidentalAddressLine2:=Source.ConfidentalAddressLine2;
|
---|
330 | ConfidentalAddressLine3:=Source.ConfidentalAddressLine3;
|
---|
331 | ConfidentalCity:=Source.ConfidentalCity;
|
---|
332 | ConfidentalState:=Source.ConfidentalState;
|
---|
333 | ConfidentalZip:=Source.ConfidentalZip;
|
---|
334 | ConfidentalStartingDate :=Source.ConfidentalStartingDate ;
|
---|
335 | ConfidentalEndingDate :=Source.ConfidentalEndingDate ;
|
---|
336 | BadAddress:= Source.BadAddress;
|
---|
337 | TempAddressActive:= Source.TempAddressActive;
|
---|
338 | ConfAddressActive := Source.ConfAddressActive;
|
---|
339 | PhoneNumResidence:=Source.PhoneNumResidence;
|
---|
340 | PhoneNumWork:=Source.PhoneNumWork;
|
---|
341 | PhoneNumCell:=Source.PhoneNumCell;
|
---|
342 | PhoneNumTemp:=Source.PhoneNumTemp;
|
---|
343 | Sex:=Source.Sex;
|
---|
344 | end;
|
---|
345 |
|
---|
346 |
|
---|
347 | procedure TPatientInfo.RemoveUnchanged(OldInfo : TPatientInfo);
|
---|
348 | //Will remove entries that are unchanged from OldInfo
|
---|
349 | //ALSO, will change AliasInfo entries:
|
---|
350 | // Other code adds "IEN" numbers that don't have any corresponding
|
---|
351 | // true IEN on the server. This will convert these to +1,+2 etc.
|
---|
352 | // And, if there is an alias entry in the OldInfo that is not
|
---|
353 | // in this info, then a matching @ entry for that IEN will be generated.
|
---|
354 |
|
---|
355 | procedure CompStrs(var newS, oldS : string);
|
---|
356 | begin
|
---|
357 | if newS = oldS then begin
|
---|
358 | newS := ''; //no change,
|
---|
359 | end else begin
|
---|
360 | if (newS = '') and (oldS <> '') then newS := '@' //delete symbol
|
---|
361 | end;
|
---|
362 | end;
|
---|
363 |
|
---|
364 | procedure CompBoolUC(var newBN, oldBN : BoolUC);
|
---|
365 | begin
|
---|
366 | if newBN=oldBN then begin
|
---|
367 | newBN := bucUnchanged; //Mark unchanged
|
---|
368 | end;
|
---|
369 | end;
|
---|
370 |
|
---|
371 | const
|
---|
372 | BOOL_STR : array[false..true] of string =('TRUE','FALSE');
|
---|
373 | NO_CHANGE = 1;
|
---|
374 | NEW_RECORD = 2;
|
---|
375 | DELETED_RECORD = 3;
|
---|
376 | CHANGED_RECORD = 4;
|
---|
377 |
|
---|
378 | function CompAliasRec(curAlias,oldAlias : tAlias) : integer;
|
---|
379 | //Returns: NO_CHANGE = 1; NEW_RECORD = 2; DELETED_RECORD = 3; CHANGED_RECORD = 4;
|
---|
380 | begin
|
---|
381 | Result := NO_CHANGE;
|
---|
382 | if (curAlias <> nil) and (oldAlias <> nil) then begin
|
---|
383 | if curAlias.Name = '' then begin
|
---|
384 | if oldAlias.Name <> '' then Result := DELETED_RECORD;
|
---|
385 | end else if curAlias.Name <> oldAlias.Name then begin
|
---|
386 | Result := CHANGED_RECORD;
|
---|
387 | end;
|
---|
388 | if Result = NO_CHANGE then begin
|
---|
389 | if curAlias.SSN <> oldAlias.SSN then Result := CHANGED_RECORD;
|
---|
390 | end;
|
---|
391 | end;
|
---|
392 | end;
|
---|
393 |
|
---|
394 | function CompAlias(IEN : string; pAlias : tAlias; OldInfo : TPatientInfo) : integer;
|
---|
395 | //format: s=IEN#, Object is ^tAlias
|
---|
396 | //Returns: NO_CHANGE = 1; NEW_RECORD = 2; DELETED_RECORD = 3; CHANGED_RECORD = 4;
|
---|
397 | var i : integer;
|
---|
398 | oldPAlias : tAlias;
|
---|
399 | begin
|
---|
400 | Result := NEW_RECORD;
|
---|
401 | for i := 0 to OldInfo.AliasInfo.Count-1 do begin
|
---|
402 | if OldInfo.AliasInfo.Strings[i] = IEN then begin
|
---|
403 | oldPAlias := tAlias(OldInfo.AliasInfo.Objects[i]);
|
---|
404 | Result := CompAliasRec(pAlias,oldPAlias);
|
---|
405 | break;
|
---|
406 | end;
|
---|
407 | end;
|
---|
408 | end;
|
---|
409 |
|
---|
410 | var i,j,AddCt : integer;
|
---|
411 | pAlias, tempPAlias : tAlias;
|
---|
412 |
|
---|
413 | begin
|
---|
414 | {if OldInfo = This Info, then remove entries}
|
---|
415 | CompStrs(LName, OldInfo.LName);
|
---|
416 | CompStrs(FName, OldInfo.FName);
|
---|
417 | CompStrs(MName, OldInfo.MName);
|
---|
418 | CompStrs(CombinedName, OldInfo.CombinedName);
|
---|
419 | CompStrs(Prefix, OldInfo.Prefix);
|
---|
420 | CompStrs(Suffix, OldInfo.Suffix);
|
---|
421 | CompStrs(Degree, OldInfo.Degree);
|
---|
422 | CompStrs(DOB, OldInfo.DOB);
|
---|
423 | CompStrs(SSNum, OldInfo.SSNum);
|
---|
424 |
|
---|
425 | CompStrs(AddressLine1, OldInfo.AddressLine1);
|
---|
426 | CompStrs(AddressLine2, OldInfo.AddressLine2);
|
---|
427 | CompStrs(AddressLine3, OldInfo.AddressLine3);
|
---|
428 | CompStrs(City, OldInfo.City);
|
---|
429 | CompStrs(State, OldInfo.State);
|
---|
430 | CompStrs(Zip4, OldInfo.Zip4);
|
---|
431 | CompStrs(TempAddressLine1, OldInfo.TempAddressLine1);
|
---|
432 | CompStrs(TempAddressLine2, OldInfo.TempAddressLine2);
|
---|
433 | CompStrs(TempAddressLine3, OldInfo.TempAddressLine3);
|
---|
434 | CompStrs(TempCity, OldInfo.TempCity);
|
---|
435 | CompStrs(TempState, OldInfo.TempState);
|
---|
436 | CompStrs(TempZip4, OldInfo.TempZip4);
|
---|
437 | CompStrs(TempStartingDate , OldInfo.TempStartingDate );
|
---|
438 | CompStrs(TempEndingDate , OldInfo.TempEndingDate );
|
---|
439 | CompStrs(ConfidentalAddressLine1, OldInfo.ConfidentalAddressLine1);
|
---|
440 | CompStrs(ConfidentalAddressLine2, OldInfo.ConfidentalAddressLine2);
|
---|
441 | CompStrs(ConfidentalAddressLine3, OldInfo.ConfidentalAddressLine3);
|
---|
442 | CompStrs(ConfidentalCity, OldInfo.ConfidentalCity);
|
---|
443 | CompStrs(ConfidentalState, OldInfo.ConfidentalState);
|
---|
444 | CompStrs(ConfidentalZip, OldInfo.ConfidentalZip);
|
---|
445 | CompStrs(ConfidentalStartingDate , OldInfo.ConfidentalStartingDate );
|
---|
446 | CompStrs(ConfidentalEndingDate , OldInfo.ConfidentalEndingDate );
|
---|
447 |
|
---|
448 | CompBoolUC(BadAddress, OldInfo.BadAddress);
|
---|
449 | CompBoolUC(TempAddressActive, OldInfo.TempAddressActive);
|
---|
450 | CompBoolUC(ConfAddressActive, OldInfo.ConfAddressActive);
|
---|
451 |
|
---|
452 | CompStrs(PhoneNumResidence, OldInfo.PhoneNumResidence);
|
---|
453 | CompStrs(PhoneNumWork, OldInfo.PhoneNumWork);
|
---|
454 | CompStrs(PhoneNumCell, OldInfo.PhoneNumCell);
|
---|
455 | CompStrs(PhoneNumTemp, OldInfo.PhoneNumTemp);
|
---|
456 | CompStrs(Sex, OldInfo.Sex);
|
---|
457 |
|
---|
458 | //Compare Aliases
|
---|
459 | //format: s=IEN#, Object is ^tAlias
|
---|
460 |
|
---|
461 | //first, see which entries in OldInfo are deleted in CurInfo.
|
---|
462 | for i := 0 to OldInfo.AliasInfo.Count-1 do begin
|
---|
463 | pAlias := tAlias(OldInfo.AliasInfo.Objects[i]);
|
---|
464 | if CompAlias(OldInfo.AliasInfo.Strings[i], pAlias, self) = NEW_RECORD then begin
|
---|
465 | //here we have an entry in OldInfo, not in CurInfo, so must represent a Delete
|
---|
466 | //This needs to be posted to server with old IEN and @ symbol
|
---|
467 | tempPAlias := tAlias.Create;
|
---|
468 | tempPAlias.Name := '@';
|
---|
469 | AliasInfo.AddObject(OldInfo.AliasInfo.Strings[i],tempPAlias);
|
---|
470 | end;
|
---|
471 | end;
|
---|
472 |
|
---|
473 | AddCt := 0;
|
---|
474 | //First, see which entries in New PatientInfo are new, or unchanged.
|
---|
475 | for i := 0 to AliasInfo.Count-1 do begin
|
---|
476 | pAlias := tAlias(AliasInfo.Objects[i]);
|
---|
477 | if (pAlias=nil) then continue;
|
---|
478 | if pAlias.Name= '@' then continue; //skip those marked as deleted from OldInfo
|
---|
479 | case CompAlias(AliasInfo.Strings[i], pAlias, OldInfo) of
|
---|
480 | NO_CHANGE : begin //delete unchanged data (no need to repost to server)
|
---|
481 | pAlias.Destroy;
|
---|
482 | AliasInfo.Strings[i] :='<@>'; //mark for deletion below
|
---|
483 | end;
|
---|
484 | NEW_RECORD : begin //mark as +1, +2 etc IEN
|
---|
485 | AddCt := AddCt + 1;
|
---|
486 | AliasInfo.Strings[i] := '+' + IntToStr(AddCt);
|
---|
487 | end;
|
---|
488 | CHANGED_RECORD : begin end; // do nothing, leave changes in place
|
---|
489 | end; {case}
|
---|
490 | end;
|
---|
491 |
|
---|
492 | for i := AliasInfo.Count-1 downto 0 do begin
|
---|
493 | if AliasInfo.Strings[i] = '<@>' then AliasInfo.Delete(i);
|
---|
494 | end;
|
---|
495 |
|
---|
496 |
|
---|
497 | end;
|
---|
498 |
|
---|
499 |
|
---|
500 | //=========================================================
|
---|
501 | //=========================================================
|
---|
502 | //=========================================================
|
---|
503 |
|
---|
504 | procedure TfrmPtDemoEdit.GetPtInfo;
|
---|
505 | var tempINI : TMemINIFile; //I do this to make dealing with hash table read easier
|
---|
506 | i,index : integer;
|
---|
507 | IEN, Key,Value,s : string;
|
---|
508 | pAlias : tAlias;
|
---|
509 |
|
---|
510 | begin
|
---|
511 | FServerPatientInfo.Clear;
|
---|
512 | tempINI := TMemINIFile.Create('xxx.ini');
|
---|
513 |
|
---|
514 | RPCBrokerV.remoteprocedure := 'TMG GET PATIENT DEMOGRAPHICS';
|
---|
515 | RPCBrokerV.param[0].value := Patient.DFN; RPCBrokerV.param[0].ptype := literal;
|
---|
516 | RPCBrokerV.Call;
|
---|
517 |
|
---|
518 | with FServerPatientInfo do begin
|
---|
519 | //Store results in a hash table for easier random access
|
---|
520 | //Don't store Alias info in hash table, put directly into AliasInfo stringlist
|
---|
521 | for i := 0 to RPCBrokerV.Results.Count-1 do begin
|
---|
522 | s := RPCBrokerV.Results.Strings[i];
|
---|
523 | if Pos('ALIAS',s)=0 then begin
|
---|
524 | Key := piece(s,'=',1);
|
---|
525 | Value := piece(s,'=',2);
|
---|
526 | tempINI.WriteString('DATA',Key,Value);
|
---|
527 | end else begin
|
---|
528 | IEN := piece(s,' ',2);
|
---|
529 | if StrToInt(IEN)>MaxAliasIEN then MaxAliasIEN := StrToInt(IEN);
|
---|
530 | index := AliasInfo.IndexOf(IEN);
|
---|
531 | if index <0 then begin
|
---|
532 | pAlias := tAlias.Create; //AliasInfo will own these.
|
---|
533 | AliasInfo.AddObject(IEN,pAlias);
|
---|
534 | end else begin
|
---|
535 | pAlias := tAlias(AliasInfo.Objects[index]);
|
---|
536 | end;
|
---|
537 | if Pos('NAME=',s)>0 then begin
|
---|
538 | pAlias.Name := piece(s,'=',2);
|
---|
539 | end else if Pos('SSN=',s)>0 then begin
|
---|
540 | pAlias.SSN := piece(s,'=',2);
|
---|
541 | end;
|
---|
542 | end;
|
---|
543 | end;
|
---|
544 | LName:=tempINI.ReadString('DATA','LNAME','');
|
---|
545 | FName:=tempINI.ReadString('DATA','FNAME','');
|
---|
546 | MName:=tempINI.ReadString('DATA','MNAME','');
|
---|
547 | CombinedName:=tempINI.ReadString('DATA','COMBINED_NAME','');
|
---|
548 | Prefix:=tempINI.ReadString('DATA','PREFIX','');
|
---|
549 | Suffix:=tempINI.ReadString('DATA','SUFFIX','');
|
---|
550 | Degree:=tempINI.ReadString('DATA','DEGREE','');
|
---|
551 | DOB:= tempINI.ReadString('DATA','DOB','');
|
---|
552 | Sex:= tempINI.ReadString('DATA','SEX','');
|
---|
553 | SSNum:= tempINI.ReadString('DATA','SS_NUM','');
|
---|
554 | AddressLine1:= tempINI.ReadString('DATA','ADDRESS_LINE_1','');
|
---|
555 | AddressLine2:= tempINI.ReadString('DATA','ADDRESS_LINE_2','');
|
---|
556 | AddressLine3:= tempINI.ReadString('DATA','ADDRESS_LINE_3','');
|
---|
557 | City:= tempINI.ReadString('DATA','CITY','');
|
---|
558 | State:= tempINI.ReadString('DATA','STATE','');
|
---|
559 | Zip4:= tempINI.ReadString('DATA','ZIP4','');
|
---|
560 | BadAddress:= BoolUC(tempINI.ReadString('DATA','BAD_ADDRESS','')<>'');
|
---|
561 | TempAddressLine1:= tempINI.ReadString('DATA','TEMP_ADDRESS_LINE_1','');
|
---|
562 | TempAddressLine2:= tempINI.ReadString('DATA','TEMP_ADDRESS_LINE_2','');
|
---|
563 | TempAddressLine3:= tempINI.ReadString('DATA','TEMP_ADDRESS_LINE_3','');
|
---|
564 | TempCity:= tempINI.ReadString('DATA','TEMP_CITY','');
|
---|
565 | TempState:=tempINI.ReadString('DATA','TEMP_STATE','');
|
---|
566 | TempZip4:= tempINI.ReadString('DATA','TEMP_ZIP4','');
|
---|
567 | TempStartingDate :=tempINI.ReadString('DATA','TEMP_STARTING_DATE','');
|
---|
568 | TempEndingDate := tempINI.ReadString('DATA','TEMP_ENDING_DATE','');
|
---|
569 | TempAddressActive:= BoolUC(tempINI.ReadString('DATA','TEMP_ADDRESS_ACTIVE','')='YES');
|
---|
570 | ConfidentalAddressLine1:= tempINI.ReadString('DATA','CONF_ADDRESS_LINE_1','');
|
---|
571 | ConfidentalAddressLine2:= tempINI.ReadString('DATA','CONF_ADDRESS_LINE_2','');
|
---|
572 | ConfidentalAddressLine3:= tempINI.ReadString('DATA','CONF_ADDRESS_LINE_3','');
|
---|
573 | ConfidentalCity:= tempINI.ReadString('DATA','CONF_CITY','');
|
---|
574 | ConfidentalState:= tempINI.ReadString('DATA','CONF_STATE','');
|
---|
575 | ConfidentalZip:= tempINI.ReadString('DATA','CONF_ZIP','');
|
---|
576 | ConfidentalStartingDate := tempINI.ReadString('DATA','CONG_STARTING_DATE','');
|
---|
577 | ConfidentalEndingDate := tempINI.ReadString('DATA','CONF_ENDING_DATE','');
|
---|
578 | ConfAddressActive:= BoolUC(tempINI.ReadString('DATA','CONF_ADDRESS_ACTIVE','')='YES');
|
---|
579 | PhoneNumResidence:= tempINI.ReadString('DATA','PHONE_RESIDENCE','');
|
---|
580 | PhoneNumWork:= tempINI.ReadString('DATA','PHONE_WORK','');
|
---|
581 | PhoneNumCell:= tempINI.ReadString('DATA','PHONE_CELL','');
|
---|
582 | PhoneNumTemp:= tempINI.ReadString('DATA','PHONE_TEMP','');
|
---|
583 | end;
|
---|
584 | FCurPatientInfo.Assign(FServerPatientInfo);
|
---|
585 | tempINI.Free; //I don't write out, so should never end up on disk.
|
---|
586 | end;
|
---|
587 |
|
---|
588 | procedure TfrmPtDemoEdit.PostChangedInfo(PatientInfo : TPatientInfo);
|
---|
589 |
|
---|
590 | procedure CheckBUCPost(Title : string; Value : BoolUC);
|
---|
591 | begin
|
---|
592 | if Value <> bucUnchanged then begin
|
---|
593 | if Value = bucTrue then RPCBrokerV.Param[1].Mult['"'+Title+'"'] := 'YES';
|
---|
594 | if Value = bucFalse then RPCBrokerV.Param[1].Mult['"'+Title+'"'] := 'NO';
|
---|
595 | end;
|
---|
596 | end;
|
---|
597 |
|
---|
598 | procedure CheckPost(Title, Value : string);
|
---|
599 | begin
|
---|
600 | if Value <> '' then RPCBrokerV.Param[1].Mult['"'+Title+'"'] := Value;
|
---|
601 | end;
|
---|
602 |
|
---|
603 | var i : integer;
|
---|
604 | pAlias : tAlias;
|
---|
605 | begin
|
---|
606 | RPCBrokerV.remoteprocedure := 'TMG SET PATIENT DEMOGRAPHICS';
|
---|
607 | RPCBrokerV.param[0].value := Patient.DFN; RPCBrokerV.param[0].ptype := literal;
|
---|
608 |
|
---|
609 | RPCBrokerV.Param[1].PType := list;
|
---|
610 | with PatientInfo do begin
|
---|
611 | CheckPost('COMBINED_NAME',CombinedName);
|
---|
612 | //CheckPost('LNAME', LName); //Don't send because data is in COMBINED NAME
|
---|
613 | //CheckPost('FNAME',FName);
|
---|
614 | //CheckPost('MNAME',MName);
|
---|
615 | //CheckPost('PREFIX',Prefix);
|
---|
616 | //CheckPost('SUFFIX',Suffix);
|
---|
617 | //CheckPost('DEGREE',Degree);
|
---|
618 | CheckPost('DOB',DOB);
|
---|
619 | CheckPost('SEX',Sex);
|
---|
620 | CheckPost('SS_NUM',SSNum);
|
---|
621 | CheckPost('ADDRESS_LINE_1',AddressLine1);
|
---|
622 | CheckPost('ADDRESS_LINE_2',AddressLine2);
|
---|
623 | CheckPost('ADDRESS_LINE_3',AddressLine3);
|
---|
624 | CheckPost('CITY',City);
|
---|
625 | CheckPost('STATE',State);
|
---|
626 | CheckPost('ZIP4',Zip4);
|
---|
627 |
|
---|
628 | CheckPost('TEMP_ADDRESS_LINE_1',TempAddressLine1);
|
---|
629 | CheckPost('TEMP_ADDRESS_LINE_2',TempAddressLine2);
|
---|
630 | CheckPost('TEMP_ADDRESS_LINE_3',TempAddressLine3);
|
---|
631 | CheckPost('TEMP_CITY',TempCity);
|
---|
632 | CheckPost('TEMP_STATE',TempState);
|
---|
633 | CheckPost('TEMP_ZIP4',TempZip4);
|
---|
634 | CheckPost('TEMP_STARTING_DATE',TempStartingDate );
|
---|
635 | CheckPost('TEMP_ENDING_DATE',TempEndingDate );
|
---|
636 | CheckPost('CONF_ADDRESS_LINE_1',ConfidentalAddressLine1);
|
---|
637 | CheckPost('CONF_ADDRESS_LINE_2',ConfidentalAddressLine2);
|
---|
638 | CheckPost('CONF_ADDRESS_LINE_3',ConfidentalAddressLine3);
|
---|
639 | CheckPost('CONF_CITY',ConfidentalCity);
|
---|
640 | CheckPost('CONF_STATE',ConfidentalState);
|
---|
641 | CheckPost('CONF_ZIP',ConfidentalZip);
|
---|
642 | CheckPost('CONG_STARTING_DATE',ConfidentalStartingDate );
|
---|
643 | CheckPost('CONF_ENDING_DATE',ConfidentalEndingDate );
|
---|
644 | CheckPost('PHONE_RESIDENCE',PhoneNumResidence);
|
---|
645 | CheckPost('PHONE_WORK',PhoneNumWork);
|
---|
646 | CheckPost('PHONE_CELL',PhoneNumCell);
|
---|
647 | CheckPost('PHONE_TEMP',PhoneNumTemp);
|
---|
648 |
|
---|
649 | case BadAddress of
|
---|
650 | bucTrue: RPCBrokerV.Param[1].Mult['"BAD_ADDRESS"'] := 'UNDELIVERABLE';
|
---|
651 | bucFalse: RPCBrokerV.Param[1].Mult['"BAD_ADDRESS"'] := '@';
|
---|
652 | end; {case}
|
---|
653 | CheckBUCPost('TEMP_ADDRESS_ACTIVE', TempAddressActive);
|
---|
654 | CheckBUCPost('CONF_ADDRESS_ACTIVE', ConfAddressActive);
|
---|
655 |
|
---|
656 | for i := 0 to AliasInfo.Count-1 do begin
|
---|
657 | pAlias := tAlias(AliasInfo.Objects[i]);
|
---|
658 | if (pAlias=nil) then continue;
|
---|
659 | RPCBrokerV.Param[1].Mult['"ALIAS ' + AliasInfo.Strings[i] + ' NAME"'] := pAlias.Name;
|
---|
660 | if pAlias.Name <> '@' then begin
|
---|
661 | RPCBrokerV.Param[1].Mult['"ALIAS ' + AliasInfo.Strings[i] + ' SSN"'] := pAlias.SSN;
|
---|
662 | end;
|
---|
663 | end;
|
---|
664 |
|
---|
665 | RPCBrokerV.Call;
|
---|
666 | if RPCBrokerV.Results.Strings[0]<>'1' then begin
|
---|
667 | MessageDlg(RPCBrokerV.Results.Strings[0],mtError,[mbOK],0);
|
---|
668 | end else begin
|
---|
669 | ChangesMade := true;
|
---|
670 | end;
|
---|
671 | end;
|
---|
672 | end;
|
---|
673 |
|
---|
674 |
|
---|
675 | procedure TfrmPtDemoEdit.ShowPtInfo(Patient : TPatientInfo);
|
---|
676 | var i : integer;
|
---|
677 | pAlias : tAlias;
|
---|
678 | begin
|
---|
679 | ProgNameChangeOccuring := true;
|
---|
680 | With Patient do begin
|
---|
681 | LNameEdit.Text := LName;
|
---|
682 | FNameEdit.Text := FName;
|
---|
683 | MNameEdit.Text := MName;
|
---|
684 | CombinedNameEdit.Text := CombinedName;
|
---|
685 | PrefixEdit.Text := Prefix;
|
---|
686 | SuffixEdit.Text := Suffix;
|
---|
687 | DegreeEdit.Text := Degree;
|
---|
688 | DOBEdit.Text := DOB;
|
---|
689 | SSNumEdit.Text := SSNum;
|
---|
690 | if Sex='MALE' then SexComboBox.ItemIndex := 0 else SexComboBox.ItemIndex := 1;
|
---|
691 | AliasComboBox.Items.Clear;
|
---|
692 | for i := 0 to AliasInfo.Count-1 do begin
|
---|
693 | pAlias := tAlias(AliasInfo.Objects[i]);
|
---|
694 | if pAlias<>nil then begin
|
---|
695 | AliasComboBox.Items.AddObject(pAlias.Name,pAlias);
|
---|
696 | end;
|
---|
697 | end;
|
---|
698 | if AliasComboBox.Items.count>0 then begin
|
---|
699 | AliasComboBox.ItemIndex := 0;
|
---|
700 | SetAliasEnabled(true);
|
---|
701 | end;
|
---|
702 | ShowAliasInfo(Patient);
|
---|
703 |
|
---|
704 | PhoneNumGrp.ItemIndex := 0;
|
---|
705 | PhoneNumGrpClick(self);
|
---|
706 | end;
|
---|
707 |
|
---|
708 | BadAddressCB.Visible := false;
|
---|
709 | TempActiveCB.Visible := false;
|
---|
710 | ProgNameChangeOccuring := false;
|
---|
711 | end;
|
---|
712 |
|
---|
713 | procedure TfrmPtDemoEdit.ShowAliasInfo(Patient : TPatientInfo);
|
---|
714 | var i : integer;
|
---|
715 | pAlias : tAlias;
|
---|
716 | begin
|
---|
717 | i := AliasComboBox.ItemIndex;
|
---|
718 | if i > -1 then begin
|
---|
719 | if i < Patient.AliasInfo.Count then begin
|
---|
720 | pAlias := tAlias(Patient.AliasInfo.Objects[i]);
|
---|
721 | end else pAlias := nil;
|
---|
722 | ProgAliasChangeOccuring := true;
|
---|
723 | if pAlias<>nil then begin
|
---|
724 | AliasNameEdit.Text := pAlias.Name;
|
---|
725 | AliasSSNEdit.Text := pAlias.SSN;
|
---|
726 | end else begin
|
---|
727 | AliasNameEdit.Text := '';
|
---|
728 | AliasSSNEdit.Text := '';
|
---|
729 | end;
|
---|
730 | ProgAliasChangeOccuring := false;
|
---|
731 | end;
|
---|
732 | end;
|
---|
733 |
|
---|
734 |
|
---|
735 | procedure TfrmPtDemoEdit.AliasComboBoxChange(Sender: TObject);
|
---|
736 | var s : string;
|
---|
737 | i : integer;
|
---|
738 | begin
|
---|
739 | if ProgAliasChangeOccuring=false then begin
|
---|
740 | i := AliasCombobox.ItemIndex;
|
---|
741 | if i>-1 then begin
|
---|
742 | s := AliasCombobox.Items.Strings[i];
|
---|
743 | SetAliasEnabled(true);
|
---|
744 | end else begin
|
---|
745 | SetAliasEnabled(false);
|
---|
746 | end;
|
---|
747 | ShowAliasInfo(FCurPatientInfo);
|
---|
748 | end;
|
---|
749 | end;
|
---|
750 |
|
---|
751 | procedure TfrmPtDemoEdit.FormCreate(Sender: TObject);
|
---|
752 | begin
|
---|
753 | FCurAliasEdit := -1;
|
---|
754 | FCurPatientInfo := TPatientInfo.Create;
|
---|
755 | FServerPatientInfo := TPatientInfo.Create;
|
---|
756 | ProgAliasChangeOccuring := false;
|
---|
757 | ProgNameChangeOccuring := false;
|
---|
758 | ProgPhoneChangeOccuring := false;
|
---|
759 | ProgAddressChangeOccuring := false;
|
---|
760 | MaxAliasIEN := 0;
|
---|
761 | ChangesMade := false;
|
---|
762 | end;
|
---|
763 |
|
---|
764 | procedure TfrmPtDemoEdit.FormDestroy(Sender: TObject);
|
---|
765 | begin
|
---|
766 | FCurPatientInfo.Destroy;
|
---|
767 | FServerPatientInfo.Destroy;
|
---|
768 | end;
|
---|
769 |
|
---|
770 |
|
---|
771 | procedure TfrmPtDemoEdit.AddressRGrpClick(Sender: TObject);
|
---|
772 | begin
|
---|
773 | {fill in data for newly selected fields}
|
---|
774 | ProgAddressChangeOccuring := true;
|
---|
775 | TempActiveCB.Visible := false;
|
---|
776 | BadAddressCB.Visible := false;
|
---|
777 | ConfActiveCB.Visible := false;
|
---|
778 | StartingDateLabel.Visible := false;
|
---|
779 | StartingDateEdit.Visible := false;
|
---|
780 | EndingDateLabel.Visible := false;
|
---|
781 | EndingDateEdit.Visible := false;
|
---|
782 | case AddressRGrp.ItemIndex of
|
---|
783 | 0 : begin //Permanant
|
---|
784 | AddressLine1Edit.Text := FCurPatientInfo.AddressLine1;
|
---|
785 | AddressLine2Edit.Text := FCurPatientInfo.AddressLine2;
|
---|
786 | AddressLine3Edit.text := FCurPatientInfo.AddressLine3;
|
---|
787 | CityEdit.text := FCurPatientInfo.City;
|
---|
788 | StateComboBox.text := FCurPatientInfo.State;
|
---|
789 | Zip4Edit.text := FCurPatientInfo.Zip4;
|
---|
790 | BadAddressCB.Visible := true;
|
---|
791 | BadAddressCB.Checked := (FCurPatientInfo.BadAddress=bucTrue);
|
---|
792 | end;
|
---|
793 | 1 : begin //temp
|
---|
794 | AddressLine1Edit.Text := FCurPatientInfo.TempAddressLine1;
|
---|
795 | AddressLine2Edit.Text := FCurPatientInfo.TempAddressLine2;
|
---|
796 | AddressLine3Edit.Text := FCurPatientInfo.TempAddressLine3;
|
---|
797 | CityEdit.Text := FCurPatientInfo.TempCity;
|
---|
798 | StateComboBox.Text := FCurPatientInfo.TempState;
|
---|
799 | Zip4Edit.Text := FCurPatientInfo.TempZip4;
|
---|
800 | StartingDateEdit.Text := FCurPatientInfo.TempStartingDate ;
|
---|
801 | EndingDateEdit.Text := FCurPatientInfo.TempEndingDate ;
|
---|
802 | StartingDateLabel.Visible := true;
|
---|
803 | StartingDateEdit.Visible := true;
|
---|
804 | EndingDateLabel.Visible := true;
|
---|
805 | EndingDateEdit.Visible := true;
|
---|
806 | TempActiveCB.Visible := true;
|
---|
807 | TempActiveCB.Checked := (FCurPatientInfo.TempAddressActive=bucTrue);
|
---|
808 | end;
|
---|
809 | 2 : begin //confidental
|
---|
810 | AddressLine1Edit.Text := FCurPatientInfo.ConfidentalAddressLine1;
|
---|
811 | AddressLine2Edit.Text := FCurPatientInfo.ConfidentalAddressLine2;
|
---|
812 | AddressLine3Edit.Text := FCurPatientInfo.ConfidentalAddressLine3;
|
---|
813 | CityEdit.Text := FCurPatientInfo.ConfidentalCity;
|
---|
814 | StateComboBox.Text := FCurPatientInfo.ConfidentalState;
|
---|
815 | Zip4Edit.Text := FCurPatientInfo.ConfidentalZip;
|
---|
816 | StartingDateEdit.Text := FCurPatientInfo.ConfidentalStartingDate ;
|
---|
817 | EndingDateEdit.Text := FCurPatientInfo.ConfidentalEndingDate ;
|
---|
818 | StartingDateLabel.Visible := true;
|
---|
819 | StartingDateEdit.Visible := true;
|
---|
820 | EndingDateLabel.Visible := true;
|
---|
821 | EndingDateEdit.Visible := true;
|
---|
822 | ConfActiveCB.Visible := true;
|
---|
823 | ConfActiveCB.Checked := (FCurPatientInfo.ConfAddressActive=bucTrue);
|
---|
824 | end;
|
---|
825 | end; {case}
|
---|
826 | ProgAddressChangeOccuring := false;
|
---|
827 | end;
|
---|
828 |
|
---|
829 | procedure TfrmPtDemoEdit.PhoneNumGrpClick(Sender: TObject);
|
---|
830 | begin
|
---|
831 | ProgPhoneChangeOccuring := true;
|
---|
832 | case PhoneNumGrp.ItemIndex of
|
---|
833 | 0 : begin //Residence
|
---|
834 | PhoneNumEdit.Text := FCurPatientInfo.PhoneNumResidence;
|
---|
835 | end;
|
---|
836 | 1 : begin //work
|
---|
837 | PhoneNumEdit.Text := FCurPatientInfo.PhoneNumWork;
|
---|
838 | end;
|
---|
839 | 2 : begin //cell
|
---|
840 | PhoneNumEdit.Text := FCurPatientInfo.PhoneNumCell;
|
---|
841 | end;
|
---|
842 | 3 : begin //temp
|
---|
843 | PhoneNumEdit.Text := FCurPatientInfo.PhoneNumTemp;
|
---|
844 | end;
|
---|
845 | else begin
|
---|
846 | PhoneNumEdit.Text := '';
|
---|
847 | end;
|
---|
848 | end; {case}
|
---|
849 | ProgPhoneChangeOccuring := false;
|
---|
850 | end;
|
---|
851 |
|
---|
852 | procedure TfrmPtDemoEdit.DelAliasBtnClick(Sender: TObject);
|
---|
853 | var i, j : integer;
|
---|
854 | pAlias : tAlias;
|
---|
855 | begin
|
---|
856 | i := AliasComboBox.ItemIndex;
|
---|
857 | if i > -1 then begin
|
---|
858 | pAlias := tAlias(AliasComboBox.Items.Objects[i]);
|
---|
859 | if pAlias<>nil then begin
|
---|
860 | for j := 0 to FCurPatientInfo.AliasInfo.Count-1 do begin
|
---|
861 | if FCurPatientInfo.AliasInfo.Objects[j] = pAlias then begin
|
---|
862 | FCurPatientInfo.AliasInfo.Delete(j);
|
---|
863 | SetModified(true);
|
---|
864 | pAlias.Free;
|
---|
865 | AliasComboBox.Items.Delete(i);
|
---|
866 | //AliasComboBox.ItemIndex := 0;
|
---|
867 | //ShowAliasInfo(FCurPatientInfo);
|
---|
868 | ProgAliasChangeOccuring:= true;
|
---|
869 | AliasNameEdit.Text:='';
|
---|
870 | AliasSSNEdit.Text:='';
|
---|
871 | ProgAliasChangeOccuring:= false;
|
---|
872 | break;
|
---|
873 | end;
|
---|
874 | end;
|
---|
875 | end;
|
---|
876 | end;
|
---|
877 | if AliasCombobox.Items.Count=0 then begin
|
---|
878 | AliasNameEdit.Text:='';
|
---|
879 | AliasSSNEdit.Text:='';
|
---|
880 | SetAliasEnabled(false);
|
---|
881 | AliasCombobox.Text := '';
|
---|
882 | end;
|
---|
883 | end;
|
---|
884 |
|
---|
885 | procedure TfrmPtDemoEdit.FormShow(Sender: TObject);
|
---|
886 | begin
|
---|
887 | GetPtInfo(FServerPatientInfo);
|
---|
888 | FCurPatientInfo.Assign(FServerPatientInfo);
|
---|
889 | ShowPtInfo(FCurPatientInfo);
|
---|
890 | end;
|
---|
891 |
|
---|
892 | procedure TfrmPtDemoEdit.CombinedNameEditChange(Sender: TObject);
|
---|
893 | var LName,FName,MName : string;
|
---|
894 | begin
|
---|
895 | if ProgNameChangeOccuring = false then begin
|
---|
896 | FCurPatientInfo.CombinedName := CombinedNameEdit.Text;
|
---|
897 | SetModified(true);
|
---|
898 | if CombinedNameEdit.Text <> CombinedName then begin
|
---|
899 | ProgNameChangeOccuring := true;
|
---|
900 | NameParts(CombinedNameEdit.Text, LName, FName, MName);
|
---|
901 | LNameEdit.Text := LName;
|
---|
902 | FNameEdit.Text := FName;
|
---|
903 | MNameEdit.Text := MName;
|
---|
904 | ProgNameChangeOccuring := false;
|
---|
905 | end;
|
---|
906 | end;
|
---|
907 | end;
|
---|
908 |
|
---|
909 | procedure TfrmPtDemoEdit.LNameEditChange(Sender: TObject);
|
---|
910 | begin
|
---|
911 | if ProgNameChangeOccuring = false then begin
|
---|
912 | FCurPatientInfo.LName := LNameEdit.Text;
|
---|
913 | SetModified(true);
|
---|
914 | CombinedNameEdit.Text := CombinedName;
|
---|
915 | end;
|
---|
916 | end;
|
---|
917 |
|
---|
918 | procedure TfrmPtDemoEdit.FNameEditChange(Sender: TObject);
|
---|
919 | begin
|
---|
920 | if ProgNameChangeOccuring = false then begin
|
---|
921 | FCurPatientInfo.FName := FNameEdit.Text;
|
---|
922 | SetModified(true);
|
---|
923 | CombinedNameEdit.Text := CombinedName;
|
---|
924 | end
|
---|
925 | end;
|
---|
926 |
|
---|
927 | procedure TfrmPtDemoEdit.MNameEditChange(Sender: TObject);
|
---|
928 | begin
|
---|
929 | if ProgNameChangeOccuring = false then begin
|
---|
930 | FCurPatientInfo.MName := MNameEdit.Text;
|
---|
931 | SetModified(true);
|
---|
932 | CombinedNameEdit.Text := CombinedName;
|
---|
933 | end;
|
---|
934 | end;
|
---|
935 |
|
---|
936 | procedure TfrmPtDemoEdit.PrefixEditChange(Sender: TObject);
|
---|
937 | begin
|
---|
938 | if ProgNameChangeOccuring = false then begin
|
---|
939 | FCurPatientInfo.Prefix := PrefixEdit.Text;
|
---|
940 | SetModified(true);
|
---|
941 | end;
|
---|
942 | end;
|
---|
943 |
|
---|
944 | procedure TfrmPtDemoEdit.SuffixEditChange(Sender: TObject);
|
---|
945 | begin
|
---|
946 | if ProgNameChangeOccuring = false then begin
|
---|
947 | FCurPatientInfo.Suffix := SuffixEdit.Text;
|
---|
948 | SetModified(true);
|
---|
949 | CombinedNameEdit.Text := CombinedName;
|
---|
950 | end;
|
---|
951 | end;
|
---|
952 |
|
---|
953 | procedure TfrmPtDemoEdit.DOBEditChange(Sender: TObject);
|
---|
954 | begin
|
---|
955 | if ProgNameChangeOccuring = false then begin
|
---|
956 | FCurPatientInfo.DOB := DOBEdit.Text;
|
---|
957 | SetModified(true);
|
---|
958 | end;
|
---|
959 | end;
|
---|
960 |
|
---|
961 | procedure TfrmPtDemoEdit.SSNumEditChange(Sender: TObject);
|
---|
962 | begin
|
---|
963 | if ProgNameChangeOccuring = false then begin
|
---|
964 | FCurPatientInfo.SSNum := SSNumEdit.Text;
|
---|
965 | SetModified(true);
|
---|
966 | end;
|
---|
967 | end;
|
---|
968 |
|
---|
969 | procedure TfrmPtDemoEdit.SexComboBoxChange(Sender: TObject);
|
---|
970 | begin
|
---|
971 | if ProgNameChangeOccuring = false then begin
|
---|
972 | FCurPatientInfo.Sex := SexComboBox.Text;
|
---|
973 | SetModified(true);
|
---|
974 | end;
|
---|
975 | end;
|
---|
976 |
|
---|
977 | procedure TfrmPtDemoEdit.DegreeEditChange(Sender: TObject);
|
---|
978 | begin
|
---|
979 | if ProgNameChangeOccuring = false then begin
|
---|
980 | FCurPatientInfo.Degree := DegreeEdit.Text;
|
---|
981 | SetModified(true);
|
---|
982 | end;
|
---|
983 | end;
|
---|
984 |
|
---|
985 | procedure TfrmPtDemoEdit.AddressLine1EditChange(Sender: TObject);
|
---|
986 | begin
|
---|
987 | if ProgAddressChangeOccuring = false then SetModified(true);
|
---|
988 | Case AddressRGrp.ItemIndex of
|
---|
989 | 0 : FCurPatientInfo.AddressLine1 := AddressLine1Edit.Text;
|
---|
990 | 1 : FCurPatientInfo.TempAddressLine1 := AddressLine1Edit.Text;
|
---|
991 | 2 : FCurPatientInfo.ConfidentalAddressLine1 := AddressLine1Edit.Text;
|
---|
992 | end; {case}
|
---|
993 | end;
|
---|
994 |
|
---|
995 | procedure TfrmPtDemoEdit.AddressLine2EditChange(Sender: TObject);
|
---|
996 | begin
|
---|
997 | if ProgAddressChangeOccuring = false then SetModified(true);
|
---|
998 | Case AddressRGrp.ItemIndex of
|
---|
999 | 0 : FCurPatientInfo.AddressLine2 := AddressLine2Edit.Text;
|
---|
1000 | 1 : FCurPatientInfo.TempAddressLine2 := AddressLine2Edit.Text;
|
---|
1001 | 2 : FCurPatientInfo.ConfidentalAddressLine2 := AddressLine2Edit.Text;
|
---|
1002 | end; {case}
|
---|
1003 | end;
|
---|
1004 |
|
---|
1005 | procedure TfrmPtDemoEdit.AddressLine3EditChange(Sender: TObject);
|
---|
1006 | begin
|
---|
1007 | if ProgAddressChangeOccuring = false then SetModified(true);
|
---|
1008 | Case AddressRGrp.ItemIndex of
|
---|
1009 | 0 : FCurPatientInfo.AddressLine3 := AddressLine3Edit.Text;
|
---|
1010 | 1 : FCurPatientInfo.TempAddressLine3 := AddressLine3Edit.Text;
|
---|
1011 | 2 : FCurPatientInfo.ConfidentalAddressLine3 := AddressLine3Edit.Text;
|
---|
1012 | end; {case}
|
---|
1013 | end;
|
---|
1014 |
|
---|
1015 | procedure TfrmPtDemoEdit.CityEditChange(Sender: TObject);
|
---|
1016 | begin
|
---|
1017 | if ProgAddressChangeOccuring = false then SetModified(true);
|
---|
1018 | Case AddressRGrp.ItemIndex of
|
---|
1019 | 0 : FCurPatientInfo.City := CityEdit.Text;
|
---|
1020 | 1 : FCurPatientInfo.TempCity := CityEdit.Text;
|
---|
1021 | 2 : FCurPatientInfo.ConfidentalCity := CityEdit.Text;
|
---|
1022 | end; {case}
|
---|
1023 | end;
|
---|
1024 |
|
---|
1025 | procedure TfrmPtDemoEdit.Zip4EditChange(Sender: TObject);
|
---|
1026 | begin
|
---|
1027 | if ProgAddressChangeOccuring = false then SetModified(true);
|
---|
1028 | Case AddressRGrp.ItemIndex of
|
---|
1029 | 0 : FCurPatientInfo.Zip4 := Zip4Edit.Text;
|
---|
1030 | 1 : FCurPatientInfo.TempZip4 := Zip4Edit.Text;
|
---|
1031 | 2 : FCurPatientInfo.ConfidentalZip := leftstr(Zip4Edit.Text,5);
|
---|
1032 | end; {case}
|
---|
1033 | end;
|
---|
1034 |
|
---|
1035 | procedure TfrmPtDemoEdit.StateComboBoxChange(Sender: TObject);
|
---|
1036 | begin
|
---|
1037 | if ProgAddressChangeOccuring = false then SetModified(true);
|
---|
1038 | Case AddressRGrp.ItemIndex of
|
---|
1039 | 0 : FCurPatientInfo.State := StateComboBox.Text;
|
---|
1040 | 1 : FCurPatientInfo.TempState := StateComboBox.Text;
|
---|
1041 | 2 : FCurPatientInfo.ConfidentalState := StateComboBox.Text;
|
---|
1042 | end; {case}
|
---|
1043 | end;
|
---|
1044 |
|
---|
1045 | procedure TfrmPtDemoEdit.TempActiveCBClick(Sender: TObject);
|
---|
1046 | begin
|
---|
1047 | FCurPatientInfo.TempAddressActive := BoolUC(TempActiveCB.Checked);
|
---|
1048 | if ProgAddressChangeOccuring = false then SetModified(true);
|
---|
1049 | end;
|
---|
1050 |
|
---|
1051 | procedure TfrmPtDemoEdit.ConfActiveCBClick(Sender: TObject);
|
---|
1052 | begin
|
---|
1053 | FCurPatientInfo.ConfAddressActive := BoolUC(ConfActiveCB.Checked);
|
---|
1054 | if ProgAddressChangeOccuring = false then SetModified(true);
|
---|
1055 | end;
|
---|
1056 |
|
---|
1057 | procedure TfrmPtDemoEdit.BadAddressCBClick(Sender: TObject);
|
---|
1058 | begin
|
---|
1059 | FCurPatientInfo.BadAddress := BoolUC(BadAddressCB.Checked);
|
---|
1060 | if ProgAddressChangeOccuring = false then SetModified(true);
|
---|
1061 | end;
|
---|
1062 |
|
---|
1063 | procedure TfrmPtDemoEdit.PhoneNumEditChange(Sender: TObject);
|
---|
1064 | begin
|
---|
1065 | if ProgPhoneChangeOccuring = false then SetModified(true);
|
---|
1066 | Case PhoneNumGrp.ItemIndex of
|
---|
1067 | 0 : FCurPatientInfo.PhoneNumResidence := PhoneNumEdit.Text;
|
---|
1068 | 1 : FCurPatientInfo.PhoneNumWork := PhoneNumEdit.Text;
|
---|
1069 | 2 : FCurPatientInfo.PhoneNumCell := PhoneNumEdit.Text;
|
---|
1070 | 3 : FCurPatientInfo.PhoneNumTemp := PhoneNumEdit.Text;
|
---|
1071 | end; {case}
|
---|
1072 |
|
---|
1073 | end;
|
---|
1074 |
|
---|
1075 | procedure TfrmPtDemoEdit.StartingDateEditChange(Sender: TObject);
|
---|
1076 | begin
|
---|
1077 | if ProgAddressChangeOccuring = false then SetModified(true);
|
---|
1078 | Case AddressRGrp.ItemIndex of
|
---|
1079 | 1 : FCurPatientInfo.TempStartingDate := StartingDateEdit.Text;
|
---|
1080 | 2 : FCurPatientInfo.ConfidentalStartingDate := StartingDateEdit.Text;
|
---|
1081 | end; {case}
|
---|
1082 | end;
|
---|
1083 |
|
---|
1084 | procedure TfrmPtDemoEdit.EndingDateEditChange(Sender: TObject);
|
---|
1085 | begin
|
---|
1086 | if ProgAddressChangeOccuring = false then SetModified(true);
|
---|
1087 | Case AddressRGrp.ItemIndex of
|
---|
1088 | 1 : FCurPatientInfo.TempEndingDate := EndingDateEdit.Text;
|
---|
1089 | 2 : FCurPatientInfo.ConfidentalEndingDate := EndingDateEdit.Text;
|
---|
1090 | end; {case}
|
---|
1091 | end;
|
---|
1092 |
|
---|
1093 | procedure TfrmPtDemoEdit.AliasNameEditChange(Sender: TObject);
|
---|
1094 | var i : integer;
|
---|
1095 | pAlias : tAlias;
|
---|
1096 | tempB : boolean;
|
---|
1097 | begin
|
---|
1098 | if ProgAliasChangeOccuring=false then begin
|
---|
1099 | i := AliasComboBox.ItemIndex;
|
---|
1100 | if i > -1 then begin
|
---|
1101 | pAlias := tAlias(AliasComboBox.Items.Objects[i]);
|
---|
1102 | if pAlias<>nil then begin
|
---|
1103 | pAlias.Name := AliasNameEdit.Text;
|
---|
1104 | AliasComboBox.Items.Strings[i]:= AliasNameEdit.Text;
|
---|
1105 | AliasComboBox.Text := AliasNameEdit.Text;
|
---|
1106 | tempB := ProgAliasChangeOccuring;
|
---|
1107 | ProgAliasChangeOccuring:=true;
|
---|
1108 | AliasComboBox.ItemIndex := i;
|
---|
1109 | ProgAliasChangeOccuring:=tempB;
|
---|
1110 | SetModified(true);
|
---|
1111 | end;
|
---|
1112 | end;
|
---|
1113 | end;
|
---|
1114 | end;
|
---|
1115 |
|
---|
1116 |
|
---|
1117 | procedure TfrmPtDemoEdit.AliasSSNEditChange(Sender: TObject);
|
---|
1118 | var i : integer;
|
---|
1119 | pAlias : tAlias;
|
---|
1120 | begin
|
---|
1121 | if ProgAliasChangeOccuring=false then begin
|
---|
1122 | i := AliasComboBox.ItemIndex;
|
---|
1123 | if i > -1 then begin
|
---|
1124 | pAlias := tAlias(AliasComboBox.Items.Objects[i]);
|
---|
1125 | if pAlias<>nil then begin
|
---|
1126 | pAlias.SSN := AliasSSNEdit.Text;
|
---|
1127 | SetModified(true);
|
---|
1128 | end;
|
---|
1129 | end;
|
---|
1130 | end;
|
---|
1131 | end;
|
---|
1132 |
|
---|
1133 | procedure TfrmPtDemoEdit.SetAliasEnabled(value : boolean);
|
---|
1134 | begin
|
---|
1135 | AliasNameEdit.Enabled := value;
|
---|
1136 | AliasSSNEdit.Enabled := value;
|
---|
1137 | if value=true then begin
|
---|
1138 | AliasNameEdit.Color := clWindow;
|
---|
1139 | AliasSSNEdit.Color := clWindow;
|
---|
1140 | end else begin
|
---|
1141 | AliasNameEdit.Color := clInactiveBorder;
|
---|
1142 | AliasSSNEdit.Color := clInactiveBorder;
|
---|
1143 | end;
|
---|
1144 | end;
|
---|
1145 |
|
---|
1146 |
|
---|
1147 | function TfrmPtDemoEdit.CombinedName : string;
|
---|
1148 | begin
|
---|
1149 | Result := '';
|
---|
1150 | Result := FNameEdit.Text;
|
---|
1151 | if MNameEdit.Text <> '' then Result := Result + ' ' + MNameEdit.Text;
|
---|
1152 | if SuffixEdit.Text <> '' then Result := Result + ' ' + SuffixEdit.Text;
|
---|
1153 | if Result <> '' then Result := ',' + Result;
|
---|
1154 | Result := LNameEdit.Text + Result;
|
---|
1155 | end;
|
---|
1156 |
|
---|
1157 | procedure TfrmPtDemoEdit.NameParts(CombinedName: string; var LName, FName, MName : string);
|
---|
1158 | var tempS : string;
|
---|
1159 | begin
|
---|
1160 | LName := piece(CombinedName,',',1);
|
---|
1161 | tempS := piece(CombinedName,',',2);
|
---|
1162 | FName := piece(tempS,' ',1);
|
---|
1163 | MName := piece(tempS,' ',2,16);
|
---|
1164 | end;
|
---|
1165 |
|
---|
1166 |
|
---|
1167 | procedure TfrmPtDemoEdit.ApplyBtnClick(Sender: TObject);
|
---|
1168 | var TempPatientInfo : tPatientInfo;
|
---|
1169 | begin
|
---|
1170 | TempPatientInfo := tPatientInfo.Create;
|
---|
1171 | TempPatientInfo.Assign(FCurPatientInfo);
|
---|
1172 | TempPatientInfo.RemoveUnchanged(FServerPatientInfo);
|
---|
1173 | PostChangedInfo(TempPatientInfo);
|
---|
1174 | TempPatientInfo.Destroy;
|
---|
1175 | SetModified(false);
|
---|
1176 | end;
|
---|
1177 |
|
---|
1178 | procedure TfrmPtDemoEdit.SetModified(value : boolean);
|
---|
1179 | begin
|
---|
1180 | FCurPatientInfo.Modified := value;
|
---|
1181 | ApplyBtn.Enabled := FCurPatientInfo.Modified;
|
---|
1182 | end;
|
---|
1183 |
|
---|
1184 | procedure TfrmPtDemoEdit.AddAliasBtnClick(Sender: TObject);
|
---|
1185 | var pAlias : tAlias;
|
---|
1186 | IEN : string;
|
---|
1187 | begin
|
---|
1188 | pAlias := tAlias.Create;
|
---|
1189 | if FCurPatientInfo.AliasInfo.count>0 then begin
|
---|
1190 | IEN := FCurPatientInfo.AliasInfo.Strings[FCurPatientInfo.AliasInfo.count-1];
|
---|
1191 | end else begin
|
---|
1192 | IEN := IntToStr(MaxAliasIEN);
|
---|
1193 | end;
|
---|
1194 | MaxAliasIEN := StrToInt(IEN)+1;
|
---|
1195 | IEN := IntToStr(MaxAliasIEN);
|
---|
1196 | FCurPatientInfo.AliasInfo.AddObject(IEN,pAlias);
|
---|
1197 | SetModified(true);
|
---|
1198 | AliasCombobox.Items.AddObject('<Edit New Alias>',pAlias);
|
---|
1199 | //pAlias.Name := '<Edit New Alias>';
|
---|
1200 | //AliasCombobox.Items.Add(ADD_NEW_ALIAS);
|
---|
1201 | AliasCombobox.ItemIndex := AliasCombobox.Items.Count-1;
|
---|
1202 | SetAliasEnabled(true);
|
---|
1203 | ShowAliasInfo(FCurPatientInfo);
|
---|
1204 | end;
|
---|
1205 |
|
---|
1206 | procedure TfrmPtDemoEdit.OKBtnClick(Sender: TObject);
|
---|
1207 | begin
|
---|
1208 | if FCurPatientInfo.Modified = true then begin
|
---|
1209 | case MessageDlg('Apply Changes?',mtConfirmation,mbYesNoCancel,0) of
|
---|
1210 | mrYes : begin
|
---|
1211 | ApplyBtnClick(Sender);
|
---|
1212 | frmPtDemoEdit.ModalResult := mrOK; //closes form
|
---|
1213 | end;
|
---|
1214 | mrNo : begin
|
---|
1215 | if ChangesMade = false then frmPtDemoEdit.ModalResult := mrCancel // closes form, signal no need for refresh
|
---|
1216 | else frmPtDemoEdit.ModalResult := mrOK; // closes form.
|
---|
1217 | end;
|
---|
1218 | mrCancel : frmPtDemoEdit.ModalResult := mrNone; //do nothing
|
---|
1219 | end; {case}
|
---|
1220 | end else begin
|
---|
1221 | if ChangesMade = false then frmPtDemoEdit.ModalResult := mrCancel // closes form, signal no need for refresh
|
---|
1222 | else frmPtDemoEdit.ModalResult := mrOK; // closes form.
|
---|
1223 | end;
|
---|
1224 | end;
|
---|
1225 |
|
---|
1226 | procedure TfrmPtDemoEdit.CancelBtnClick(Sender: TObject);
|
---|
1227 | begin
|
---|
1228 | if FCurPatientInfo.Modified = true then begin
|
---|
1229 | case MessageDlg('Cancel Changes?',mtConfirmation,mbYesNoCancel,0) of
|
---|
1230 | mrYes : frmPtDemoEdit.ModalResult := mrCancel; //closes form
|
---|
1231 | mrNo : frmPtDemoEdit.ModalResult := mrNone; //do nothing
|
---|
1232 | mrCancel : frmPtDemoEdit.ModalResult := mrNone; //do nothing
|
---|
1233 | end; {case}
|
---|
1234 | end else begin
|
---|
1235 | frmPtDemoEdit.ModalResult := mrCancel; // closes form.
|
---|
1236 | end;
|
---|
1237 |
|
---|
1238 | end;
|
---|
1239 |
|
---|
1240 |
|
---|
1241 |
|
---|
1242 | end.
|
---|