source: cprs/trunk/CPRS-Chart/Encounter/fPCELex.pas@ 485

Last change on this file since 485 was 456, checked in by Kevin Toppenberg, 16 years ago

Initial Upload of Official WV CPRS 1.0.26.76

File size: 3.5 KB
Line 
1unit fPCELex;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 fAutoSz, StdCtrls, ORFn, ORCtrls;
8
9type
10 TfrmPCELex = class(TfrmAutoSz)
11 txtSearch: TCaptionEdit;
12 cmdSearch: TButton;
13 cmdOK: TButton;
14 cmdCancel: TButton;
15 lblSearch: TLabel;
16 lblSelect: TLabel;
17 lstSelect: TORListBox;
18 procedure cmdSearchClick(Sender: TObject);
19 procedure cmdCancelClick(Sender: TObject);
20 procedure FormCreate(Sender: TObject);
21 procedure cmdOKClick(Sender: TObject);
22 procedure lstSelectClick(Sender: TObject);
23 procedure txtSearchChange(Sender: TObject);
24 procedure lstSelectDblClick(Sender: TObject);
25 private
26 FLexApp: Integer;
27 FCode: string;
28 FDate: TFMDateTime;
29 procedure SetApp(LexApp: Integer);
30 procedure SetDate(ADate: TFMDateTime);
31 end;
32
33procedure LexiconLookup(var Code: string; LexApp: Integer; ADate: TFMDateTime = 0);
34
35implementation
36
37{$R *.DFM}
38
39uses rPCE,UBAGlobals;
40
41procedure LexiconLookup(var Code: string; LexApp: Integer; ADate: TFMDateTime = 0);
42var
43 frmPCELex: TfrmPCELex;
44begin
45 frmPCELex := TfrmPCELex.Create(Application);
46 try
47 ResizeFormToFont(TForm(frmPCELex));
48 frmPCELex.SetApp(LexApp);
49 frmPCELex.SetDate(ADate);
50 frmPCELex.ShowModal;
51 Code := frmPCELex.FCode;
52 finally
53 frmPCELex.Free;
54 end;
55end;
56
57procedure TfrmPCELex.FormCreate(Sender: TObject);
58begin
59 inherited;
60 FCode := '';
61end;
62
63procedure TfrmPCELex.SetApp(LexApp: Integer);
64begin
65 FLexApp := LexApp;
66 case LexApp of
67 LX_ICD: begin
68 Caption := 'Lookup Diagnosis';
69 lblSearch.Caption := 'Search for Diagnosis';
70 end;
71 LX_CPT: begin
72 Caption := 'Lookup Procedure';
73 lblSearch.Caption := 'Search for Procedure';
74 end;
75 end;
76end;
77
78procedure TfrmPCELex.SetDate(ADate: TFMDateTime);
79begin
80 FDate := ADate;
81end;
82
83procedure TfrmPCELex.txtSearchChange(Sender: TObject);
84begin
85 inherited;
86 cmdSearch.Default := True;
87 cmdOK.Default := False;
88end;
89
90procedure TfrmPCELex.cmdSearchClick(Sender: TObject);
91begin
92 inherited;
93 if Length(txtSearch.Text) = 0 then Exit;
94 StatusText('Searching clinical lexicon...');
95 ListLexicon(lstSelect.Items, txtSearch.Text, FLexApp, FDate);
96 if lstSelect.GetIEN(0) = -1 then
97 begin
98 lblSelect.Visible := False;
99 txtSearch.SetFocus;
100 txtSearch.SelectAll;
101 cmdOK.Default := False;
102 cmdSearch.Default := True;
103 end else
104 begin
105 lblSelect.Visible := True;
106 lstSelect.SetFocus;
107 cmdSearch.Default := False;
108 end;
109 StatusText('');
110end;
111
112procedure TfrmPCELex.lstSelectClick(Sender: TObject);
113begin
114 inherited;
115 if(lstSelect.ItemIndex > -1) and (lstSelect.ItemIEN > 0) then
116 begin
117 cmdSearch.Default := False;
118 cmdOK.Default := True;
119 end;
120end;
121
122procedure TfrmPCELex.cmdOKClick(Sender: TObject);
123begin
124 inherited;
125 if(lstSelect.ItemIndex = -1) or (lstSelect.ItemIEN <= 0) then Exit;
126 with lstSelect do
127 begin
128 if BAPersonalDX then
129 FCode := (LexiconToCode(ItemIEN, FLexApp, FDate) + U + DisplayText[ItemIndex] + U + IntToStr(ItemIEN) )
130 else
131 FCode := LexiconToCode(ItemIEN, FLexApp, FDate) + U + DisplayText[ItemIndex];
132 Close;
133 end;
134end;
135
136procedure TfrmPCELex.cmdCancelClick(Sender: TObject);
137begin
138 inherited;
139 FCode := '';
140 Close;
141end;
142
143procedure TfrmPCELex.lstSelectDblClick(Sender: TObject);
144begin
145 inherited;
146 lstSelectClick(Sender);
147 cmdOKClick(Sender);
148end;
149
150end.
151
Note: See TracBrowser for help on using the repository browser.