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