[456] | 1 | unit fPCELex;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 7 | fAutoSz, StdCtrls, ORFn, ORCtrls;
|
---|
| 8 |
|
---|
| 9 | type
|
---|
| 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 |
|
---|
| 33 | procedure LexiconLookup(var Code: string; LexApp: Integer; ADate: TFMDateTime = 0);
|
---|
| 34 |
|
---|
| 35 | implementation
|
---|
| 36 |
|
---|
| 37 | {$R *.DFM}
|
---|
| 38 |
|
---|
| 39 | uses rPCE,UBAGlobals;
|
---|
| 40 |
|
---|
| 41 | procedure LexiconLookup(var Code: string; LexApp: Integer; ADate: TFMDateTime = 0);
|
---|
| 42 | var
|
---|
| 43 | frmPCELex: TfrmPCELex;
|
---|
| 44 | begin
|
---|
| 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;
|
---|
| 55 | end;
|
---|
| 56 |
|
---|
| 57 | procedure TfrmPCELex.FormCreate(Sender: TObject);
|
---|
| 58 | begin
|
---|
| 59 | inherited;
|
---|
| 60 | FCode := '';
|
---|
| 61 | end;
|
---|
| 62 |
|
---|
| 63 | procedure TfrmPCELex.SetApp(LexApp: Integer);
|
---|
| 64 | begin
|
---|
| 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;
|
---|
| 76 | end;
|
---|
| 77 |
|
---|
| 78 | procedure TfrmPCELex.SetDate(ADate: TFMDateTime);
|
---|
| 79 | begin
|
---|
| 80 | FDate := ADate;
|
---|
| 81 | end;
|
---|
| 82 |
|
---|
| 83 | procedure TfrmPCELex.txtSearchChange(Sender: TObject);
|
---|
| 84 | begin
|
---|
| 85 | inherited;
|
---|
| 86 | cmdSearch.Default := True;
|
---|
| 87 | cmdOK.Default := False;
|
---|
| 88 | end;
|
---|
| 89 |
|
---|
| 90 | procedure TfrmPCELex.cmdSearchClick(Sender: TObject);
|
---|
| 91 | begin
|
---|
| 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('');
|
---|
| 110 | end;
|
---|
| 111 |
|
---|
| 112 | procedure TfrmPCELex.lstSelectClick(Sender: TObject);
|
---|
| 113 | begin
|
---|
| 114 | inherited;
|
---|
| 115 | if(lstSelect.ItemIndex > -1) and (lstSelect.ItemIEN > 0) then
|
---|
| 116 | begin
|
---|
| 117 | cmdSearch.Default := False;
|
---|
| 118 | cmdOK.Default := True;
|
---|
| 119 | end;
|
---|
| 120 | end;
|
---|
| 121 |
|
---|
| 122 | procedure TfrmPCELex.cmdOKClick(Sender: TObject);
|
---|
| 123 | begin
|
---|
| 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;
|
---|
| 134 | end;
|
---|
| 135 |
|
---|
| 136 | procedure TfrmPCELex.cmdCancelClick(Sender: TObject);
|
---|
| 137 | begin
|
---|
| 138 | inherited;
|
---|
| 139 | FCode := '';
|
---|
| 140 | Close;
|
---|
| 141 | end;
|
---|
| 142 |
|
---|
| 143 | procedure TfrmPCELex.lstSelectDblClick(Sender: TObject);
|
---|
| 144 | begin
|
---|
| 145 | inherited;
|
---|
| 146 | lstSelectClick(Sender);
|
---|
| 147 | cmdOKClick(Sender);
|
---|
| 148 | end;
|
---|
| 149 |
|
---|
| 150 | end.
|
---|
| 151 |
|
---|