[459] | 1 | unit fODConsult;
|
---|
| 2 |
|
---|
| 3 | {$O-}
|
---|
| 4 |
|
---|
| 5 | interface
|
---|
| 6 |
|
---|
| 7 | uses
|
---|
| 8 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 9 | fODBase, StdCtrls, ORCtrls, ExtCtrls, ComCtrls, ORfn, uConst, Buttons,
|
---|
| 10 | Menus, UBAGlobals, rOrders, fBALocalDiagnoses, UBAConst, UBACore, ORNet ;
|
---|
| 11 |
|
---|
| 12 | type
|
---|
| 13 | TfrmODCslt = class(TfrmODBase)
|
---|
| 14 | cboService: TORComboBox;
|
---|
| 15 | cboUrgency: TORComboBox;
|
---|
| 16 | cboPlace: TORComboBox;
|
---|
| 17 | txtProvDiag: TCaptionEdit;
|
---|
| 18 | txtAttn: TORComboBox;
|
---|
| 19 | lblService: TLabel;
|
---|
| 20 | lblUrgency: TStaticText;
|
---|
| 21 | lblPlace: TStaticText;
|
---|
| 22 | lblAttn: TStaticText;
|
---|
| 23 | lblProvDiag: TStaticText;
|
---|
| 24 | treService: TORTreeView;
|
---|
| 25 | cboCategory: TORComboBox;
|
---|
| 26 | pnlServiceTreeButton: TKeyClickPanel;
|
---|
| 27 | btnServiceTree: TSpeedButton;
|
---|
| 28 | mnuPopProvDx: TPopupMenu;
|
---|
| 29 | mnuPopProvDxDelete: TMenuItem;
|
---|
| 30 | cmdLexSearch: TButton;
|
---|
| 31 | popReason: TPopupMenu;
|
---|
| 32 | popReasonCut: TMenuItem;
|
---|
| 33 | popReasonCopy: TMenuItem;
|
---|
| 34 | popReasonPaste: TMenuItem;
|
---|
| 35 | popReasonPaste2: TMenuItem;
|
---|
| 36 | popReasonReformat: TMenuItem;
|
---|
| 37 | gbInptOpt: TGroupBox;
|
---|
| 38 | radInpatient: TRadioButton;
|
---|
| 39 | radOutpatient: TRadioButton;
|
---|
| 40 | pnlReason: TPanel;
|
---|
| 41 | lblReason: TLabel;
|
---|
| 42 | memReason: TRichEdit;
|
---|
| 43 | btnDiagnosis: TButton;
|
---|
| 44 | procedure FormCreate(Sender: TObject);
|
---|
| 45 | procedure txtAttnNeedData(Sender: TObject; const StartFrom: String;
|
---|
| 46 | Direction, InsertAt: Integer);
|
---|
| 47 | procedure radInpatientClick(Sender: TObject);
|
---|
| 48 | procedure radOutpatientClick(Sender: TObject);
|
---|
| 49 | procedure treServiceChange(Sender: TObject; Node: TTreeNode);
|
---|
| 50 | procedure ControlChange(Sender: TObject);
|
---|
| 51 | procedure treServiceExit(Sender: TObject);
|
---|
| 52 | procedure cmdAcceptClick(Sender: TObject);
|
---|
| 53 | procedure memReasonExit(Sender: TObject);
|
---|
| 54 | procedure cboServiceSelect(Sender: TObject);
|
---|
| 55 | procedure FormDestroy(Sender: TObject);
|
---|
| 56 | procedure btnServiceTreeClick(Sender: TObject);
|
---|
| 57 | procedure treServiceCollapsing(Sender: TObject; Node: TTreeNode;
|
---|
| 58 | var AllowCollapse: Boolean);
|
---|
| 59 | procedure treServiceMouseDown(Sender: TObject; Button: TMouseButton;
|
---|
| 60 | Shift: TShiftState; X, Y: Integer);
|
---|
| 61 | procedure cmdLexSearchClick(Sender: TObject);
|
---|
| 62 | procedure mnuPopProvDxDeleteClick(Sender: TObject);
|
---|
| 63 | procedure txtProvDiagChange(Sender: TObject);
|
---|
| 64 | procedure cboServiceExit(Sender: TObject);
|
---|
| 65 | procedure popReasonCutClick(Sender: TObject);
|
---|
| 66 | procedure popReasonCopyClick(Sender: TObject);
|
---|
| 67 | procedure popReasonPasteClick(Sender: TObject);
|
---|
| 68 | procedure popReasonPopup(Sender: TObject);
|
---|
| 69 | procedure popReasonReformatClick(Sender: TObject);
|
---|
| 70 | procedure pnlServiceTreeButtonEnter(Sender: TObject);
|
---|
| 71 | procedure pnlServiceTreeButtonExit(Sender: TObject);
|
---|
| 72 | procedure treServiceKeyDown(Sender: TObject; var Key: Word;
|
---|
| 73 | Shift: TShiftState);
|
---|
| 74 | procedure treServiceKeyUp(Sender: TObject; var Key: Word;
|
---|
| 75 | Shift: TShiftState);
|
---|
| 76 | procedure memReasonKeyUp(Sender: TObject; var Key: Word;
|
---|
| 77 | Shift: TShiftState);
|
---|
| 78 | procedure memReasonKeyDown(Sender: TObject; var Key: Word;
|
---|
| 79 | Shift: TShiftState);
|
---|
| 80 | procedure memReasonKeyPress(Sender: TObject; var Key: Char);
|
---|
| 81 | procedure cboServiceKeyDown(Sender: TObject; var Key: Word;
|
---|
| 82 | Shift: TShiftState);
|
---|
| 83 | procedure cboServiceKeyUp(Sender: TObject; var Key: Word;
|
---|
| 84 | Shift: TShiftState);
|
---|
| 85 | procedure btnDiagnosisClick(Sender: TObject);
|
---|
| 86 | procedure cmdQuitClick(Sender: TObject);
|
---|
| 87 |
|
---|
| 88 | private
|
---|
| 89 | FcboServiceKeyDownStopClick : boolean;
|
---|
| 90 | FKeyBoarding: boolean;
|
---|
| 91 | FLastServiceID: string;
|
---|
| 92 | FEditCtrl: TCustomEdit;
|
---|
| 93 | FNavigatingTab: boolean;
|
---|
| 94 | procedure BuildQuickTree(QuickList: TStrings; const Parent: string; Node: TTreeNode);
|
---|
| 95 | procedure ReadServerVariables;
|
---|
| 96 | procedure SetProvDiagPromptingMode;
|
---|
| 97 | procedure SetupReasonForRequest(OrderAction: integer);
|
---|
| 98 | procedure GetProvDxandValidateCode(AResponses: TResponses);
|
---|
| 99 | function ShowPrerequisites: boolean;
|
---|
| 100 | procedure DoSetFontSize(FontSize: integer);
|
---|
| 101 | procedure SetUpQuickOrderDX;
|
---|
| 102 | procedure SaveConsultDxForNurse(pDiagnosis: string); // save the dx entered by nurese if Master BA switch is ON
|
---|
| 103 | procedure SetUpCopyConsultDiagnoses(pOrderID:string);
|
---|
| 104 | protected
|
---|
| 105 | procedure InitDialog; override;
|
---|
| 106 | procedure Validate(var AnErrMsg: string); override;
|
---|
| 107 | function DefaultReasonForRequest(Service: string; Resolve: Boolean): TStrings;
|
---|
| 108 | public
|
---|
| 109 | procedure SetupDialog(OrderAction: Integer; const ID: string); override;
|
---|
| 110 | procedure SetFontSize(FontSize: integer); override;
|
---|
| 111 | end;
|
---|
| 112 |
|
---|
| 113 | var
|
---|
| 114 | LastNode: integer ;
|
---|
| 115 | displayDXCode: string;
|
---|
| 116 | consultQuickOrder: boolean;
|
---|
| 117 |
|
---|
| 118 |
|
---|
| 119 | implementation
|
---|
| 120 |
|
---|
| 121 | {$R *.DFM}
|
---|
| 122 |
|
---|
| 123 | uses
|
---|
| 124 | rODBase, rConsults, uCore, uConsults, rCore, fConsults, fPCELex, rPCE, fPreReq,
|
---|
| 125 | ORClasses, clipbrd, uTemplates;
|
---|
| 126 |
|
---|
| 127 | var
|
---|
| 128 | SvcList, QuickList, Defaults: TStrings ;
|
---|
| 129 | ProvDx: TProvisionalDiagnosis;
|
---|
| 130 | GMRCREAF: string;
|
---|
| 131 | BADxUpdated: boolean;
|
---|
| 132 | quickCode: string;
|
---|
| 133 |
|
---|
| 134 |
|
---|
| 135 |
|
---|
| 136 |
|
---|
| 137 | const
|
---|
| 138 | TX_NOTTHISSVC_TEXT = 'Consults cannot be ordered from this service' ;
|
---|
| 139 | TX_NO_SVC = 'A service must be specified.' ;
|
---|
| 140 | TX_NO_REASON = 'A reason for this consult must be entered.' ;
|
---|
| 141 | TX_SVC_ERROR = 'This service has not been defined in your Orderable Items file.' +
|
---|
| 142 | #13#10'Contact IRM for assistance.' ;
|
---|
| 143 | TX_NO_URGENCY = 'An urgency must be specified.';
|
---|
| 144 | TX_NO_PLACE = 'A place of consultation must be specified';
|
---|
| 145 | TX_NO_DIAG = 'A provisional diagnosis must be entered for consults to this service.';
|
---|
| 146 | TX_SELECT_DIAG = 'You must select a diagnosis for consults to this service.';
|
---|
| 147 | TX_GROUPER = 'This is not an orderable service. Please select a subspecialty';
|
---|
| 148 | TC_INACTIVE_CODE = 'Inactive ICD Code';
|
---|
| 149 | TX_INACTIVE_CODE1 = 'The provisional diagnosis code is not active as of today''s date.' + #13#10;
|
---|
| 150 | TX_INACTIVE_CODE_REQD = 'Another code must be selected before the order can be saved.';
|
---|
| 151 | TX_INACTIVE_CODE_OPTIONAL = 'If another code is not selected, no code will be saved.';
|
---|
| 152 |
|
---|
| 153 | procedure TfrmODCslt.FormCreate(Sender: TObject);
|
---|
| 154 | begin
|
---|
| 155 | AutoSizeDisabled := True;
|
---|
| 156 | inherited;
|
---|
| 157 | if BILLING_AWARE then
|
---|
| 158 | begin
|
---|
| 159 | btnDiagnosis.Visible := True;
|
---|
| 160 | cmdLexSearch.Visible := False;
|
---|
| 161 | end
|
---|
| 162 | else
|
---|
| 163 | begin
|
---|
| 164 | btnDiagnosis.Visible := False;
|
---|
| 165 | cmdLexSearch.Visible := True;
|
---|
| 166 | end;
|
---|
| 167 | Defaults := TStringList.Create ;
|
---|
| 168 | SvcList := TStringList.Create ;
|
---|
| 169 | QuickList := TStringList.Create ;
|
---|
| 170 | AllowQuickOrder := True;
|
---|
| 171 | LastNode := 0;
|
---|
| 172 | FLastServiceID := '' ;
|
---|
| 173 | GMRCREAF := '';
|
---|
| 174 | FillChar(ProvDx, SizeOf(ProvDx), 0);
|
---|
| 175 | FillerID := 'GMRC'; // does 'on Display' order check **KCM**
|
---|
| 176 | StatusText('Loading Dialog Definition');
|
---|
| 177 | Responses.Dialog := 'GMRCOR CONSULT'; // loads formatting info
|
---|
| 178 | StatusText('Loading Default Values');
|
---|
| 179 | Defaults.Assign(ODForConsults); // ODForConsults returns TStrings with defaults
|
---|
| 180 | CtrlInits.LoadDefaults(Defaults);
|
---|
| 181 | txtAttn.InitLongList('') ;
|
---|
| 182 | PreserveControl(txtAttn);
|
---|
| 183 | InitDialog;
|
---|
| 184 | //Calling virtual SetFontSize in constructor is a bad idea!
|
---|
| 185 | DoSetFontSize( MainFontSize);
|
---|
| 186 | FcboServiceKeyDownStopClick := false;
|
---|
| 187 | consultQuickOrder := false;
|
---|
| 188 |
|
---|
| 189 |
|
---|
| 190 | end;
|
---|
| 191 |
|
---|
| 192 | procedure TfrmODCslt.InitDialog;
|
---|
| 193 | begin
|
---|
| 194 | inherited;
|
---|
| 195 | Changing := True;
|
---|
| 196 | FLastServiceID := '';
|
---|
| 197 | QuickList.Clear;
|
---|
| 198 | with CtrlInits do
|
---|
| 199 | begin
|
---|
| 200 | ExtractItems(QuickList, Defaults, 'ShortList');
|
---|
| 201 | if OrderForInpatient then //INPATIENT CONSULT
|
---|
| 202 | begin
|
---|
| 203 | radInpatient.Checked := True;
|
---|
| 204 | cboCategory.Items.Clear;
|
---|
| 205 | cboCategory.Items.Add('I^Inpatient');
|
---|
| 206 | cboCategory.SelectById('I');
|
---|
| 207 | SetControl(cboPlace, 'Inpt Place');
|
---|
| 208 | SetControl(cboUrgency, 'Inpt Cslt Urgencies'); //S.GMRCT
|
---|
| 209 | end
|
---|
| 210 | else
|
---|
| 211 | begin
|
---|
| 212 | radOutpatient.Checked := True; //OUTPATIENT CONSULT
|
---|
| 213 | cboCategory.Items.Clear;
|
---|
| 214 | cboCategory.Items.Add('O^Outpatient');
|
---|
| 215 | cboCategory.SelectById('O');
|
---|
| 216 | SetControl(cboPlace, 'Outpt Place');
|
---|
| 217 | SetControl(cboUrgency, 'Outpt Urgencies'); //S.GMRCO
|
---|
| 218 | end ;
|
---|
| 219 | end ;
|
---|
| 220 | StatusText('Initializing Long List');
|
---|
| 221 | memOrder.Clear ;
|
---|
| 222 | memReason.Clear;
|
---|
| 223 | cboService.Enabled := True;
|
---|
| 224 | cboService.Font.Color := clWindowText;
|
---|
| 225 | btnServiceTree.Enabled := True;
|
---|
| 226 | ActiveControl := cboService;
|
---|
| 227 | SetProvDiagPromptingMode;
|
---|
| 228 | Changing := False;
|
---|
| 229 | StatusText('');
|
---|
| 230 | end;
|
---|
| 231 |
|
---|
| 232 | procedure TfrmODCslt.SetupDialog(OrderAction: Integer; const ID: string);
|
---|
| 233 | const
|
---|
| 234 | TX_INACTIVE_SVC = 'This consult service is currently inactive and not receiving requests.' + CRLF +
|
---|
| 235 | 'Please contact your Clinical Coordinator/IRM staff to fix this order.';
|
---|
| 236 | TX_INACTIVE_SVC_CAP = 'Inactive Service';
|
---|
| 237 | var
|
---|
| 238 | i:integer;
|
---|
| 239 | AList: TStringList;
|
---|
| 240 | tmpResp: TResponse;
|
---|
| 241 | SvcIEN: string;
|
---|
| 242 | begin
|
---|
| 243 | inherited;
|
---|
| 244 | ReadServerVariables;
|
---|
| 245 | AList := TStringList.Create;
|
---|
| 246 | try
|
---|
| 247 | if OrderAction in [ORDER_COPY, ORDER_EDIT, ORDER_QUICK] then with Responses do
|
---|
| 248 | begin
|
---|
| 249 | Changing := True;
|
---|
| 250 | tmpResp := TResponse(FindResponseByName('ORDERABLE',1));
|
---|
| 251 | SvcIEN := GetServiceIEN(tmpResp.IValue);
|
---|
| 252 | if SvcIEN = '-1' then
|
---|
| 253 | begin
|
---|
| 254 | InfoBox(TX_INACTIVE_SVC, TX_INACTIVE_SVC_CAP, MB_OK);
|
---|
| 255 | AbortOrder := True;
|
---|
| 256 | Close;
|
---|
| 257 | Exit;
|
---|
| 258 | end;
|
---|
| 259 | cboService.Items.Add(SvcIEN + U + tmpResp.EValue + '^^^^' + tmpResp.IValue);
|
---|
| 260 | cboService.SelectByID(SvcIEN);
|
---|
| 261 | tmpResp := TResponse(FindResponseByName('CLASS',1));
|
---|
| 262 | cboCategory.SelectByID(tmpResp.IValue);
|
---|
| 263 | if tmpResp.IValue = 'I' then
|
---|
| 264 | radInpatient.Checked := True
|
---|
| 265 | else
|
---|
| 266 | radOutpatient.Checked := True ;
|
---|
| 267 | SetControl(cboUrgency, 'URGENCY', 1);
|
---|
| 268 | SetControl(cboPlace, 'PLACE', 1);
|
---|
| 269 | SetControl(txtAttn, 'PROVIDER', 1);
|
---|
| 270 | cboService.Enabled := False;
|
---|
| 271 | cboService.Font.Color := clGrayText;
|
---|
| 272 | btnServiceTree.Enabled := False;
|
---|
| 273 | if (OrderAction in [ORDER_COPY, ORDER_QUICK]) and (not ShowPrerequisites) then
|
---|
| 274 | begin
|
---|
| 275 | Close;
|
---|
| 276 | Exit;
|
---|
| 277 | end;
|
---|
| 278 | SetProvDiagPromptingMode;
|
---|
| 279 | GetProvDxandValidateCode(Responses);
|
---|
| 280 | SetControl(memReason, 'COMMENT', 1);
|
---|
| 281 | SetupReasonForRequest(OrderAction);
|
---|
| 282 | Changing := False;
|
---|
| 283 | ControlChange(Self);
|
---|
| 284 | end
|
---|
| 285 | else
|
---|
| 286 | begin
|
---|
| 287 | if QuickList.Count > 0 then BuildQuickTree(QuickList, '0', nil) ;
|
---|
| 288 | //SvcList.Assign(LoadServiceList(CN_SVC_LIST_ORD)) ;
|
---|
| 289 | SvcList.Assign(LoadServiceListWithSynonyms(CN_SVC_LIST_ORD)); {RV}
|
---|
| 290 | AList.Assign(SvcList);
|
---|
| 291 | SortByPiece(AList, U, 2);
|
---|
| 292 | BuildServiceTree(treService, SvcList, '0', nil) ;
|
---|
| 293 | with treService do
|
---|
| 294 | begin
|
---|
| 295 | for i:=0 to Items.Count-1 do
|
---|
| 296 | if Items[i].Level > 0 then Items[i].Expanded := False else Items[i].Expanded := True;
|
---|
| 297 | TopItem := Items[LastNode] ;
|
---|
| 298 | Changing := True;
|
---|
| 299 | Selected := Items[LastNode] ;
|
---|
| 300 | Changing := False;
|
---|
| 301 | SendMessage(Handle, WM_HSCROLL, SB_THUMBTRACK, 0);
|
---|
| 302 | end ;
|
---|
| 303 | if QuickList.Count > 0 then with cboService do
|
---|
| 304 | begin
|
---|
| 305 | Items.Assign(QuickList);
|
---|
| 306 | Items.Add(LLS_LINE);
|
---|
| 307 | Items.Add(LLS_SPACE);
|
---|
| 308 | end;
|
---|
| 309 | Changing := True;
|
---|
| 310 | for i := 0 to AList.Count - 1 do
|
---|
| 311 | if (cboService.Items.IndexOf(Trim(Piece(AList.Strings[i], U, 2))) = -1) and {RV}
|
---|
| 312 | //if (cboService.SelectByID(Piece(AList.Strings[i], U, 1)) = -1) and
|
---|
| 313 | (Piece(AList.Strings[i], U, 5) <> '1') then
|
---|
| 314 | cboService.Items.Add(AList.Strings[i]);
|
---|
| 315 | cboService.ItemIndex := 0;
|
---|
| 316 | Changing := False;
|
---|
| 317 | if treService.Selected <> nil then
|
---|
| 318 | begin
|
---|
| 319 | if (TORTreeNode(treService.Selected).StringData <> '') and
|
---|
| 320 | (Piece(TORTreeNode(treService.Selected).StringData, U, 5) <> '1') then
|
---|
| 321 | cboService.ItemIndex := cboService.Items.IndexOf(Trim(Piece(TORTreeNode(treService.Selected).StringData, U, 2)))
|
---|
| 322 | //cboService.SelectByID(Piece(string(treService.Selected.Data), U, 1))
|
---|
| 323 | else
|
---|
| 324 | cboService.ItemIndex := -1;
|
---|
| 325 | end
|
---|
| 326 | else
|
---|
| 327 | cboService.ItemIndex := -1;
|
---|
| 328 | if cboService.ItemIEN > 0 then
|
---|
| 329 | begin
|
---|
| 330 | if not ShowPrerequisites then
|
---|
| 331 | begin
|
---|
| 332 | Close;
|
---|
| 333 | Exit;
|
---|
| 334 | end;
|
---|
| 335 | memReason.Lines.Assign(DefaultReasonForRequest(cboService.ItemID, True));
|
---|
| 336 | end;
|
---|
| 337 | PreserveControl(treService);
|
---|
| 338 | PreserveControl(cboService);
|
---|
| 339 | end;
|
---|
| 340 | finally
|
---|
| 341 | AList.Free;
|
---|
| 342 | end;
|
---|
| 343 | end;
|
---|
| 344 |
|
---|
| 345 | procedure TfrmODCslt.Validate(var AnErrMsg: string);
|
---|
| 346 |
|
---|
| 347 | procedure SetError(const x: string);
|
---|
| 348 | begin
|
---|
| 349 | if Length(AnErrMsg) > 0 then AnErrMsg := AnErrMsg + CRLF;
|
---|
| 350 | AnErrMsg := AnErrMsg + x;
|
---|
| 351 | end;
|
---|
| 352 |
|
---|
| 353 | begin
|
---|
| 354 | inherited;
|
---|
| 355 | if (not ContainsVisibleChar(memReason.Text)) then SetError(TX_NO_REASON);
|
---|
| 356 | if cboUrgency.ItemIEN = 0 then SetError(TX_NO_URGENCY);
|
---|
| 357 | if cboPlace.ItemID = '' then SetError(TX_NO_PLACE);
|
---|
| 358 | if cboService.ItemIEN = 0 then
|
---|
| 359 | SetError(TX_NO_SVC)
|
---|
| 360 | else
|
---|
| 361 | begin
|
---|
| 362 | if Piece(cboService.Items[cboService.ItemIndex],U,5) = '1' then SetError(TX_NOTTHISSVC_TEXT);
|
---|
| 363 | if (Piece(cboService.Items[cboService.ItemIndex],U,5) <> '1')
|
---|
| 364 | and (Piece(cboService.Items[cboService.ItemIndex],U,6) = '')
|
---|
| 365 | then SetError(TX_SVC_ERROR) ;
|
---|
| 366 | end;
|
---|
| 367 | if (ProvDx.Reqd = 'R') and (not ContainsVisibleChar(txtProvDiag.Text)) then
|
---|
| 368 | begin
|
---|
| 369 | if ProvDx.PromptMode = 'F' then
|
---|
| 370 | SetError(TX_NO_DIAG)
|
---|
| 371 | else
|
---|
| 372 | SetError(TX_SELECT_DIAG);
|
---|
| 373 | end;
|
---|
| 374 | end;
|
---|
| 375 |
|
---|
| 376 | procedure TfrmODCslt.txtAttnNeedData(Sender: TObject;
|
---|
| 377 | const StartFrom: string; Direction, InsertAt: Integer);
|
---|
| 378 | begin
|
---|
| 379 | inherited;
|
---|
| 380 | txtAttn.ForDataUse(SubSetOfPersons(StartFrom, Direction));
|
---|
| 381 | end;
|
---|
| 382 |
|
---|
| 383 | procedure TfrmODCslt.radInpatientClick(Sender: TObject);
|
---|
| 384 | begin
|
---|
| 385 | inherited;
|
---|
| 386 | with CtrlInits do
|
---|
| 387 | begin
|
---|
| 388 | SetControl(cboPlace, 'Inpt Place');
|
---|
| 389 | SetControl(cboUrgency, 'Inpt Cslt Urgencies');
|
---|
| 390 | cboCategory.Items.Clear;
|
---|
| 391 | cboCategory.Items.Add('I^Inpatient') ;
|
---|
| 392 | cboCategory.SelectById('I');
|
---|
| 393 | end ;
|
---|
| 394 | ControlChange(Self);
|
---|
| 395 | end;
|
---|
| 396 |
|
---|
| 397 | procedure TfrmODCslt.radOutpatientClick(Sender: TObject);
|
---|
| 398 | begin
|
---|
| 399 | inherited;
|
---|
| 400 | with CtrlInits do
|
---|
| 401 | begin
|
---|
| 402 | SetControl(cboPlace, 'Outpt Place');
|
---|
| 403 | SetControl(cboUrgency, 'Outpt Urgencies');
|
---|
| 404 | cboCategory.Items.Clear;
|
---|
| 405 | cboCategory.Items.Add('O^Outpatient');
|
---|
| 406 | cboCategory.SelectById('O');
|
---|
| 407 | end ;
|
---|
| 408 | ControlChange(Self);
|
---|
| 409 | end;
|
---|
| 410 |
|
---|
| 411 | procedure TfrmODCslt.BuildQuickTree(QuickList: TStrings; const Parent: string; Node: TTreeNode);
|
---|
| 412 | var
|
---|
| 413 | i: Integer;
|
---|
| 414 | QuickInfo, Name: string ;
|
---|
| 415 | ANode: TTreeNode;
|
---|
| 416 | begin
|
---|
| 417 | with QuickList do
|
---|
| 418 | begin
|
---|
| 419 | Node := treService.Items.AddChildObject(Node, 'Quick Orders', nil);
|
---|
| 420 | for i := 0 to Count - 1 do
|
---|
| 421 | begin
|
---|
| 422 | Name := Piece(Strings[i], U, 2);
|
---|
| 423 | QuickInfo := Strings[i];
|
---|
| 424 | ANode := treService.Items.AddChildObject(Node, Name, Pointer(QuickInfo));
|
---|
| 425 | TORTreeNode(ANode).StringData := QuickInfo;
|
---|
| 426 | end;
|
---|
| 427 | end;
|
---|
| 428 | end;
|
---|
| 429 |
|
---|
| 430 | procedure TfrmODCslt.treServiceChange(Sender: TObject; Node: TTreeNode);
|
---|
| 431 | var
|
---|
| 432 | i: integer;
|
---|
| 433 | tmpSvc: string;
|
---|
| 434 | begin
|
---|
| 435 | inherited;
|
---|
| 436 | pnlMessage.Visible := False;
|
---|
| 437 | if Changing or (treService.Selected = nil)
|
---|
| 438 | or FKeyBoarding or FcboServiceKeyDownStopClick then exit;
|
---|
| 439 | Changing := True;
|
---|
| 440 | with cboService do
|
---|
| 441 | begin
|
---|
| 442 | if treService.Selected <> nil then
|
---|
| 443 | begin
|
---|
| 444 | if (TORTreeNode(treService.Selected).StringData <> '') and
|
---|
| 445 | (Piece(TORTreeNode(treService.Selected).StringData, U, 5) <> '1') then
|
---|
| 446 | cboService.ItemIndex := cboService.Items.IndexOf(Trim(Piece(TORTreeNode(treService.Selected).StringData, U, 2)))
|
---|
| 447 | //cboService.SelectByID(Piece(string(treService.Selected.Data), U, 1))
|
---|
| 448 | else
|
---|
| 449 | begin
|
---|
| 450 | pnlMessage.TabOrder := treService.TabOrder + 1;
|
---|
| 451 | OrderMessage(TX_GROUPER);
|
---|
| 452 | cboService.ItemIndex := -1;
|
---|
| 453 | Changing := False;
|
---|
| 454 | Exit;
|
---|
| 455 | end;
|
---|
| 456 | end
|
---|
| 457 | else
|
---|
| 458 | ItemIndex := -1;
|
---|
| 459 | (* if (treService.Selected.Data <> nil) then
|
---|
| 460 | SelectByID(Piece(string(treService.Selected.Data), U, 1))
|
---|
| 461 | else
|
---|
| 462 | ItemIndex := -1;*)
|
---|
| 463 | Changing := False;
|
---|
| 464 | if ItemIndex < 0 then exit;
|
---|
| 465 | if Piece(Items[ItemIndex],U,5) = '1' then
|
---|
| 466 | begin
|
---|
| 467 | Responses.Update('ORDERABLE', 1, '', '');
|
---|
| 468 | memOrder.Clear;
|
---|
| 469 | cboService.ItemIndex := -1;
|
---|
| 470 | FLastServiceID := '';
|
---|
| 471 | Changing := True;
|
---|
| 472 | treService.Selected := nil;
|
---|
| 473 | Changing := False;
|
---|
| 474 | pnlMessage.TabOrder := treService.TabOrder + 1;
|
---|
| 475 | OrderMessage(TX_GROUPER);
|
---|
| 476 | Exit;
|
---|
| 477 | end;
|
---|
| 478 | treService.Visible := False;
|
---|
| 479 | memReason.Clear;
|
---|
| 480 | if ItemID <> FLastServiceID then FLastServiceID := ItemID else Exit;
|
---|
| 481 | Changing := True;
|
---|
| 482 | if Sender <> Self then
|
---|
| 483 | Responses.Clear; // Sender=Self when called from SetupDialog
|
---|
| 484 | Changing := False;
|
---|
| 485 | if CharAt(ItemID, 1) = 'Q' then
|
---|
| 486 | begin
|
---|
| 487 | Changing := True;
|
---|
| 488 | consultQuickOrder := True;
|
---|
| 489 | Responses.QuickOrder := ExtractInteger(ItemID);
|
---|
| 490 | tmpSvc := TResponse(Responses.FindResponseByName('ORDERABLE',1)).IValue;
|
---|
| 491 | with treService do for i := 0 to Items.Count-1 do
|
---|
| 492 | begin
|
---|
| 493 | if Piece(TORTreeNode(Items[i]).StringData, U, 6) = tmpSvc then
|
---|
| 494 | begin
|
---|
| 495 | Selected := Items[i];
|
---|
| 496 | break;
|
---|
| 497 | end;
|
---|
| 498 | end;
|
---|
| 499 | if treService.Selected <> nil then
|
---|
| 500 | begin
|
---|
| 501 | if (TORTreeNode(treService.Selected).StringData <> '') and
|
---|
| 502 | (Piece(TORTreeNode(treService.Selected).StringData, U, 5) <> '1') then
|
---|
| 503 | cboService.ItemIndex := cboService.Items.IndexOf(Trim(Piece(TORTreeNode(treService.Selected).StringData, U, 2)))
|
---|
| 504 | //cboService.SelectByID(Piece(string(treService.Selected.Data), U, 1))
|
---|
| 505 | else
|
---|
| 506 | cboService.ItemIndex := -1;
|
---|
| 507 | end
|
---|
| 508 | else
|
---|
| 509 | cboService.ItemIndex := -1;
|
---|
| 510 | FLastServiceID := ItemID;
|
---|
| 511 | cboService.Enabled := False;
|
---|
| 512 | cboService.Font.Color := clGrayText;
|
---|
| 513 | btnServiceTree.Enabled := False;
|
---|
| 514 | Changing := False;
|
---|
| 515 | end;
|
---|
| 516 | end;
|
---|
| 517 | with Responses do if QuickOrder > 0 then
|
---|
| 518 | begin
|
---|
| 519 | tmpSvc := TResponse(Responses.FindResponseByName('ORDERABLE',1)).IValue;
|
---|
| 520 | with treService do for i := 0 to Items.Count-1 do
|
---|
| 521 | begin
|
---|
| 522 | if Piece(TORTreeNode(Items[i]).StringData, U, 6) = tmpSvc then
|
---|
| 523 | begin
|
---|
| 524 | Selected := Items[i];
|
---|
| 525 | break;
|
---|
| 526 | end;
|
---|
| 527 | end;
|
---|
| 528 | if treService.Selected <> nil then
|
---|
| 529 | begin
|
---|
| 530 | if (TORTreeNode(treService.Selected).StringData <> '') and
|
---|
| 531 | (Piece(TORTreeNode(treService.Selected).StringData, U, 5) <> '1') then
|
---|
| 532 | cboService.ItemIndex := cboService.Items.IndexOf(Trim(Piece(TORTreeNode(treService.Selected).StringData, U, 2)))
|
---|
| 533 | //cboService.SelectByID(Piece(string(treService.Selected.Data), U, 1))
|
---|
| 534 | else
|
---|
| 535 | cboService.ItemIndex := -1;
|
---|
| 536 | end
|
---|
| 537 | else
|
---|
| 538 | cboService.ItemIndex := -1;
|
---|
| 539 | Changing := True;
|
---|
| 540 | if not ShowPrerequisites then
|
---|
| 541 | begin
|
---|
| 542 | Close;
|
---|
| 543 | Exit;
|
---|
| 544 | end;
|
---|
| 545 | SetControl(cboCategory, 'CLASS', 1);
|
---|
| 546 | if cboCategory.ItemID = 'I' then radInpatient.Checked := True
|
---|
| 547 | else radOutpatient.Checked := True ;
|
---|
| 548 | SetControl(cboUrgency, 'URGENCY', 1);
|
---|
| 549 | SetControl(cboPlace, 'PLACE', 1);
|
---|
| 550 | SetControl(txtAttn, 'PROVIDER', 1);
|
---|
| 551 | SetControl(memReason, 'COMMENT', 1);
|
---|
| 552 | if ((cboService.ItemIEN > 0) and (Length(memReason.Text) = 0)) then
|
---|
| 553 | memReason.Lines.Assign(DefaultReasonForRequest(cboService.ItemID, True));
|
---|
| 554 | SetupReasonForRequest(ORDER_QUICK);
|
---|
| 555 | GetProvDxandValidateCode(Responses);
|
---|
| 556 | Changing := False;
|
---|
| 557 | end
|
---|
| 558 | else
|
---|
| 559 | begin
|
---|
| 560 | if cboService.ItemIEN > 0 then
|
---|
| 561 | begin
|
---|
| 562 | if not ShowPrerequisites then
|
---|
| 563 | begin
|
---|
| 564 | Close;
|
---|
| 565 | Exit;
|
---|
| 566 | end;
|
---|
| 567 | memReason.Lines.Assign(DefaultReasonForRequest(cboService.ItemID, True));
|
---|
| 568 | SetupReasonForRequest(ORDER_NEW);
|
---|
| 569 | end;
|
---|
| 570 | end;
|
---|
| 571 | SetProvDiagPromptingMode;
|
---|
| 572 | tmpSvc := Piece(cboService.Items[cboService.ItemIndex], U, 6);
|
---|
| 573 | pnlMessage.TabOrder := treService.TabOrder + 1;
|
---|
| 574 | OrderMessage(ConsultMessage(StrToIntDef(tmpSvc, 0)));
|
---|
| 575 | //OrderMessage(ConsultMessage(cboService.ItemIEN));
|
---|
| 576 | ControlChange(Self) ;
|
---|
| 577 | end;
|
---|
| 578 |
|
---|
| 579 | procedure TfrmODCslt.ControlChange(Sender: TObject);
|
---|
| 580 | var
|
---|
| 581 | x: string;
|
---|
| 582 | i: integer;
|
---|
| 583 | begin
|
---|
| 584 | inherited;
|
---|
| 585 | if Changing or (cboService.ItemIEN = 0) then Exit;
|
---|
| 586 | with cboService do
|
---|
| 587 | begin
|
---|
| 588 | if (ItemIEN > 0) and (Piece(Items[ItemIndex], U, 5) <> '1') then
|
---|
| 589 | begin
|
---|
| 590 | i := Pos('<', Text);
|
---|
| 591 | if i > 0 then
|
---|
| 592 | begin
|
---|
| 593 | x := Piece(Copy(Text, i + 1, 99), '>', 1);
|
---|
| 594 | x := UpperCase(Copy(x, 1, 1)) + Copy(x, 2, 99);
|
---|
| 595 | end
|
---|
| 596 | else
|
---|
| 597 | x := Text;
|
---|
| 598 | Responses.Update('ORDERABLE', 1, Piece(Items[ItemIndex], U, 6), x);
|
---|
| 599 | end
|
---|
| 600 | else Responses.Update('ORDERABLE', 1, '', '');
|
---|
| 601 | end;
|
---|
| 602 | with memReason do if GetTextLen > 0 then Responses.Update('COMMENT', 1, TX_WPTYPE, Text);
|
---|
| 603 | with cboCategory do if ItemID <> '' then Responses.Update('CLASS', 1, ItemID, Text);
|
---|
| 604 | with cboUrgency do if ItemIEN > 0 then Responses.Update('URGENCY', 1, ItemID, Text);
|
---|
| 605 | with cboPlace do if ItemID <> '' then Responses.Update('PLACE', 1, ItemID, Text);
|
---|
| 606 | with txtAttn do if ItemIEN > 0 then Responses.Update('PROVIDER', 1, ItemID, Text);
|
---|
| 607 | //with txtProvDiag do if Length(Text) > 0 then Responses.Update('MISC', 1, Text, Text);
|
---|
| 608 | if Length(ProvDx.Text) > 0 then Responses.Update('MISC', 1, ProvDx.Text, ProvDx.Text)
|
---|
| 609 | else Responses.Update('MISC', 1, '', '');
|
---|
| 610 | if Length(ProvDx.Code) > 0 then Responses.Update('CODE', 1, ProvDx.Code, ProvDx.Code)
|
---|
| 611 | else Responses.Update('CODE', 1, '', '');
|
---|
| 612 |
|
---|
| 613 | memOrder.Text := Responses.OrderText;
|
---|
| 614 | end;
|
---|
| 615 |
|
---|
| 616 | procedure TfrmODCslt.treServiceExit(Sender: TObject);
|
---|
| 617 | begin
|
---|
| 618 | inherited;
|
---|
| 619 | with cboService do
|
---|
| 620 | begin
|
---|
| 621 | if ItemIEN > 0 then
|
---|
| 622 | begin
|
---|
| 623 | pnlMessage.TabOrder := treService.TabOrder + 1;
|
---|
| 624 | OrderMessage(ConsultMessage(StrToInt(Piece(Items[ItemIndex],U,6))));
|
---|
| 625 | end;
|
---|
| 626 | end;
|
---|
| 627 | end;
|
---|
| 628 |
|
---|
| 629 | procedure TfrmODCslt.SetUpQuickOrderDX;
|
---|
| 630 | // this procedure is called if the user selects a quick code from the list
|
---|
| 631 | // and accepts the order without entering or selection the diagnoses button.
|
---|
| 632 | begin
|
---|
| 633 | quickCode := ProvDx.Code;
|
---|
| 634 | if UBACore.IsICD9CodeActive(quickCode,'ICD',0) then
|
---|
| 635 | begin
|
---|
| 636 | uBAGlobals.BAConsultDxList.Clear;
|
---|
| 637 | uBAGlobals.BAConsultDxList.Add(UBAConst.PRIMARY_DX + U + ProvDx.Text + ':' + quickCode);
|
---|
| 638 | end;
|
---|
| 639 |
|
---|
| 640 | end;
|
---|
| 641 |
|
---|
| 642 | procedure TfrmODCslt.cmdAcceptClick(Sender: TObject);
|
---|
| 643 | var
|
---|
| 644 | BADiagnosis: string;
|
---|
| 645 | begin
|
---|
| 646 | inherited;
|
---|
| 647 |
|
---|
| 648 | //if NOT BILLING_AWARE then
|
---|
| 649 | if treService.Selected <> nil then
|
---|
| 650 | LastNode := treService.Selected.AbsoluteIndex;
|
---|
| 651 |
|
---|
| 652 | if BILLING_AWARE and CIDCOkToSave then
|
---|
| 653 | begin
|
---|
| 654 | if btnDiagnosis.Enabled then
|
---|
| 655 | if consultQuickOrder then SetUpQuickOrderDX;
|
---|
| 656 | if UBAGlobals.BAConsultDxList.Count > 0 then
|
---|
| 657 | begin
|
---|
| 658 | uBACore.CompleteConsultOrderRec(uBAGlobals.BAOrderID,UBAGlobals.BAConsultDxList);
|
---|
| 659 | // if ProvDx.Reqd = 'R' then UBAGlobals.BAConsultOrdersRequireDx.Add(uBAGlobals.BAOrderID); //allow special handling of non cidc consults that require dx .
|
---|
| 660 | uBAGlobals.BAConsultDxList.Clear;
|
---|
| 661 | end;
|
---|
| 662 | BADiagnosis := ProvDx.Text + '^' + ProvDx.Code;
|
---|
| 663 | end;
|
---|
| 664 |
|
---|
| 665 | if NOT BILLING_AWARE then
|
---|
| 666 | begin
|
---|
| 667 | // this will save a dx entered by a nurse to be reviewed by a provided.
|
---|
| 668 | // this is active if CIDC MASTER SWITCH is ON.
|
---|
| 669 | if rpcGetBAMasterSwStatus then // BA master sw is on.
|
---|
| 670 | if (uCore.User.OrderRole = OR_NURSE) then // user is a nurse
|
---|
| 671 | begin
|
---|
| 672 | if ProvDx.Text <> '' then // consult dx has been selected
|
---|
| 673 | begin
|
---|
| 674 | SaveConsultDxForNurse(ProvDx.Text + ProvDx.Code); // save selected dx, will be displayed to Provider
|
---|
| 675 | end;
|
---|
| 676 | end;
|
---|
| 677 | end;
|
---|
| 678 | end;
|
---|
| 679 |
|
---|
| 680 | procedure TfrmODCslt.memReasonExit(Sender: TObject);
|
---|
| 681 | var
|
---|
| 682 | AStringList: TStringList;
|
---|
| 683 | begin
|
---|
| 684 | inherited;
|
---|
| 685 | AStringList := TStringList.Create;
|
---|
| 686 | try
|
---|
| 687 | AStringList.Assign(memReason.Lines);
|
---|
| 688 | LimitStringLength(AStringList, 74);
|
---|
| 689 | memReason.Lines.Assign(AstringList);
|
---|
| 690 | ControlChange(Self);
|
---|
| 691 | finally
|
---|
| 692 | AStringList.Free;
|
---|
| 693 | end;
|
---|
| 694 | end;
|
---|
| 695 |
|
---|
| 696 | procedure TfrmODCslt.cboServiceSelect(Sender: TObject);
|
---|
| 697 | var
|
---|
| 698 | tmpSvc: string;
|
---|
| 699 | begin
|
---|
| 700 | if FcboServiceKeyDownStopClick then
|
---|
| 701 | begin
|
---|
| 702 | Exit; //This fixes clearquest: HDS00001418
|
---|
| 703 | FcboServiceKeyDownStopClick := false;
|
---|
| 704 | end;
|
---|
| 705 | memReason.Clear;
|
---|
| 706 | with cboService do
|
---|
| 707 | begin
|
---|
| 708 | if (ItemIndex < 0) or (ItemID = '') then
|
---|
| 709 | begin
|
---|
| 710 | Responses.Update('ORDERABLE', 1, '', '');
|
---|
| 711 | memOrder.Clear;
|
---|
| 712 | FLastServiceID := '';
|
---|
| 713 | exit;
|
---|
| 714 | end;
|
---|
| 715 | if Piece(Items[ItemIndex],U,5) = '1' then
|
---|
| 716 | begin
|
---|
| 717 | Responses.Update('ORDERABLE', 1, '', '');
|
---|
| 718 | memOrder.Clear;
|
---|
| 719 | FLastServiceID := '';
|
---|
| 720 | pnlMessage.TabOrder := cboService.TabOrder + 1;
|
---|
| 721 | OrderMessage(TX_GROUPER);
|
---|
| 722 | Exit;
|
---|
| 723 | end;
|
---|
| 724 | FLastServiceID := ItemID;
|
---|
| 725 | if CharAt(ItemID, 1) = 'Q' then
|
---|
| 726 | begin
|
---|
| 727 | Changing := True;
|
---|
| 728 | Responses.QuickOrder := ExtractInteger(ItemID);
|
---|
| 729 | consultQuickOrder := True;
|
---|
| 730 | tmpSvc := TResponse(Responses.FindResponseByName('ORDERABLE',1)).EValue;
|
---|
| 731 | ItemIndex := Items.IndexOf(Trim(tmpSvc));
|
---|
| 732 | (* tmpSvc := TResponse(Responses.FindResponseByName('ORDERABLE',1)).IValue;
|
---|
| 733 | for i := 0 to Items.Count-1 do
|
---|
| 734 | begin
|
---|
| 735 | if Piece(Items[i],U,6) = tmpSvc then
|
---|
| 736 | begin
|
---|
| 737 | ItemIndex := i;
|
---|
| 738 | break;
|
---|
| 739 | end;
|
---|
| 740 | end;*)
|
---|
| 741 | FLastServiceID := ItemID;
|
---|
| 742 | Enabled := False;
|
---|
| 743 | Font.Color := clGrayText;
|
---|
| 744 | btnServiceTree.Enabled := False;
|
---|
| 745 | Changing := False;
|
---|
| 746 | with Responses do if QuickOrder > 0 then
|
---|
| 747 | begin
|
---|
| 748 | Changing := True;
|
---|
| 749 | if not ShowPrerequisites then
|
---|
| 750 | begin
|
---|
| 751 | Close;
|
---|
| 752 | Exit;
|
---|
| 753 | end;
|
---|
| 754 | SetControl(cboCategory, 'CLASS', 1);
|
---|
| 755 | if cboCategory.ItemID = 'I' then radInpatient.Checked := True
|
---|
| 756 | else radOutpatient.Checked := True ;
|
---|
| 757 | SetControl(cboUrgency, 'URGENCY', 1);
|
---|
| 758 | SetControl(cboPlace, 'PLACE', 1);
|
---|
| 759 | SetControl(txtAttn, 'PROVIDER', 1);
|
---|
| 760 | SetControl(memReason, 'COMMENT', 1);
|
---|
| 761 | // if ((cboService.ItemIEN > 0) and (Length(memReason.Text) = 0)) then
|
---|
| 762 | // memReason.Lines.Assign(DefaultReasonForRequest(cboService.ItemID, True));
|
---|
| 763 | SetupReasonForRequest(ORDER_QUICK);
|
---|
| 764 | GetProvDxandValidateCode(Responses);
|
---|
| 765 | Changing := False;
|
---|
| 766 | end
|
---|
| 767 | else
|
---|
| 768 | begin
|
---|
| 769 | if cboService.ItemIEN > 0 then
|
---|
| 770 | begin
|
---|
| 771 | Changing := True;
|
---|
| 772 | if not ShowPrerequisites then
|
---|
| 773 | begin
|
---|
| 774 | Close;
|
---|
| 775 | Exit;
|
---|
| 776 | end;
|
---|
| 777 | memReason.Lines.Assign(DefaultReasonForRequest(cboService.ItemID, True));
|
---|
| 778 | SetupReasonForRequest(ORDER_NEW);
|
---|
| 779 | Changing := False;
|
---|
| 780 | end;
|
---|
| 781 | end;
|
---|
| 782 | end
|
---|
| 783 | else
|
---|
| 784 | begin
|
---|
| 785 | Changing := True;
|
---|
| 786 | if not ShowPrerequisites then
|
---|
| 787 | begin
|
---|
| 788 | Close;
|
---|
| 789 | Exit;
|
---|
| 790 | end;
|
---|
| 791 | QuickCopy(DefaultReasonForRequest(cboService.ItemID, True), memReason);
|
---|
| 792 | SetupReasonForRequest(ORDER_NEW);
|
---|
| 793 | Changing := False;
|
---|
| 794 | end;
|
---|
| 795 | end;
|
---|
| 796 | treService.Visible := False;
|
---|
| 797 | SetProvDiagPromptingMode;
|
---|
| 798 | tmpSvc := Piece(cboService.Items[cboService.ItemIndex], U, 6);
|
---|
| 799 | pnlMessage.TabOrder := cboService.TabOrder + 1;
|
---|
| 800 | OrderMessage(ConsultMessage(StrToIntDef(tmpSvc, 0)));
|
---|
| 801 | //OrderMessage(ConsultMessage(cboService.ItemIEN));
|
---|
| 802 | ControlChange(Self) ;
|
---|
| 803 | end;
|
---|
| 804 |
|
---|
| 805 | procedure TfrmODCslt.FormDestroy(Sender: TObject);
|
---|
| 806 | begin
|
---|
| 807 | Defaults.Free;
|
---|
| 808 | SvcList.Free ;
|
---|
| 809 | QuickList.Free;
|
---|
| 810 | inherited;
|
---|
| 811 | end;
|
---|
| 812 |
|
---|
| 813 | procedure TfrmODCslt.btnServiceTreeClick(Sender: TObject);
|
---|
| 814 | var
|
---|
| 815 | i: integer;
|
---|
| 816 | begin
|
---|
| 817 | inherited;
|
---|
| 818 | Changing := True;
|
---|
| 819 | treService.Visible := not treService.Visible;
|
---|
| 820 | if treService.Visible then
|
---|
| 821 | begin
|
---|
| 822 | treService.SetFocus;
|
---|
| 823 | with treService do for i := 0 to Items.Count-1 do
|
---|
| 824 | begin
|
---|
| 825 | if Piece(TORTreeNode(Items[i]).StringData, U, 1) = cboService.ItemID then
|
---|
| 826 | begin
|
---|
| 827 | Selected := Items[i];
|
---|
| 828 | if Piece(TORTreeNode(Items[i]).StringData, U, 5) = '1' then Selected.Expand(True);
|
---|
| 829 | break;
|
---|
| 830 | end;
|
---|
| 831 | end;
|
---|
| 832 | end;
|
---|
| 833 | Changing := False;
|
---|
| 834 | end;
|
---|
| 835 |
|
---|
| 836 | procedure TfrmODCslt.ReadServerVariables;
|
---|
| 837 | begin
|
---|
| 838 | if StrToIntDef(KeyVariable['GMRCNOAT'], 0) > 0 then
|
---|
| 839 | begin
|
---|
| 840 | txtAttn.Enabled := False;
|
---|
| 841 | txtAttn.Font.Color := clGrayText;
|
---|
| 842 | lblAttn.Enabled := False;
|
---|
| 843 | txtAttn.Color := clBtnFace;
|
---|
| 844 | end
|
---|
| 845 | else
|
---|
| 846 | begin
|
---|
| 847 | txtAttn.Enabled := True;
|
---|
| 848 | txtAttn.Font.Color := clWindowText;
|
---|
| 849 | lblAttn.Enabled := True;
|
---|
| 850 | txtAttn.Color := clWindow;
|
---|
| 851 | end;
|
---|
| 852 |
|
---|
| 853 | if StrToIntDef(KeyVariable['GMRCNOPD'], 0) > 0 then
|
---|
| 854 | begin
|
---|
| 855 | if BILLING_AWARE then
|
---|
| 856 | btnDiagnosis.Enabled := False //1.4.18
|
---|
| 857 | else
|
---|
| 858 | cmdLexSearch.Enabled := False;
|
---|
| 859 | txtProvDiag.Enabled := False;
|
---|
| 860 | txtProvDiag.Font.Color := clGrayText;
|
---|
| 861 | lblProvDiag.Enabled := False;
|
---|
| 862 | txtProvDiag.ReadOnly := True;
|
---|
| 863 | txtProvDiag.Color := clBtnFace;
|
---|
| 864 | end
|
---|
| 865 | else SetProvDiagPromptingMode;
|
---|
| 866 |
|
---|
| 867 | GMRCREAF := KeyVariable['GMRCREAF'];
|
---|
| 868 | end;
|
---|
| 869 |
|
---|
| 870 | procedure TfrmODCslt.treServiceCollapsing(Sender: TObject; Node: TTreeNode;
|
---|
| 871 | var AllowCollapse: Boolean);
|
---|
| 872 | begin
|
---|
| 873 | inherited;
|
---|
| 874 | Changing := True;
|
---|
| 875 | treService.Selected := nil;
|
---|
| 876 | Changing := False;
|
---|
| 877 | AllowCollapse := True;
|
---|
| 878 | end;
|
---|
| 879 |
|
---|
| 880 | procedure TfrmODCslt.treServiceMouseDown(Sender: TObject;
|
---|
| 881 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
---|
| 882 | var
|
---|
| 883 | tmpNode: TORTreeNode;
|
---|
| 884 | NodeRect: TRect;
|
---|
| 885 | begin
|
---|
| 886 | inherited;
|
---|
| 887 | if Button <> mbLeft then exit;
|
---|
| 888 | tmpNode := TORTreeNode(treService.GetNodeAt(X, Y));
|
---|
| 889 | if tmpNode = nil then exit;
|
---|
| 890 | NodeRect := tmpNode.DisplayRect(True);
|
---|
| 891 | if treService.Selected <> nil then
|
---|
| 892 | if (X >= NodeRect.Left) then // user clicked in the text of the item, not on the bitmap
|
---|
| 893 | begin
|
---|
| 894 | if tmpNode.StringData <> '' then
|
---|
| 895 | if (Piece(tmpNode.StringData, U, 5) <> '1') then
|
---|
| 896 | treService.Visible := False;
|
---|
| 897 | end;
|
---|
| 898 | end;
|
---|
| 899 |
|
---|
| 900 | procedure TfrmODCslt.cmdLexSearchClick(Sender: TObject);
|
---|
| 901 | var
|
---|
| 902 | Match: string;
|
---|
| 903 | i: integer;
|
---|
| 904 | begin
|
---|
| 905 | inherited;
|
---|
| 906 |
|
---|
| 907 | if BILLING_AWARE then BADxUpdated := FALSE;
|
---|
| 908 |
|
---|
| 909 | LexiconLookup(Match, LX_ICD);
|
---|
| 910 | if Match = '' then Exit;
|
---|
| 911 | ProvDx.Code := Piece(Match, U, 1);
|
---|
| 912 | ProvDx.Text := Piece(Match, U, 2);
|
---|
| 913 | i := Pos(' (ICD', ProvDx.Text);
|
---|
| 914 | if i = 0 then i := Length(ProvDx.Text) + 1;
|
---|
| 915 | if ProvDx.Text[i-1] = '*' then i := i - 2;
|
---|
| 916 | ProvDx.Text := Copy(ProvDx.Text, 1, i - 1);
|
---|
| 917 | txtProvDiag.Text := ProvDx.Text + ' (' + ProvDx.Code + ')';
|
---|
| 918 |
|
---|
| 919 | ProvDx.CodeInactive := False;
|
---|
| 920 | end;
|
---|
| 921 |
|
---|
| 922 | procedure TfrmODCslt.SetProvDiagPromptingMode;
|
---|
| 923 | const
|
---|
| 924 | TX_USE_LEXICON = 'You must use the "Lexicon" button to select a provisional diagnosis for this service.';
|
---|
| 925 | TX_USE_DIAGNOSIS = 'You must use the "Diagnosis" button to select a diagnosis for this service.';
|
---|
| 926 |
|
---|
| 927 | TX_PROVDX_OPT = 'Provisional Diagnosis';
|
---|
| 928 | TX_PROVDX_REQD = 'Provisional Dx (REQUIRED)';
|
---|
| 929 | begin
|
---|
| 930 | if BILLING_AWARE then
|
---|
| 931 | btnDiagnosis.Enabled := False //1.4.18
|
---|
| 932 | else
|
---|
| 933 | cmdLexSearch.Enabled := False;
|
---|
| 934 | txtProvDiag.Enabled := False;
|
---|
| 935 | txtProvDiag.ReadOnly := True;
|
---|
| 936 | txtProvDiag.Color := clBtnFace;
|
---|
| 937 | txtProvDiag.Font.Color := clBtnText;
|
---|
| 938 | lblProvDiag.Enabled := False;
|
---|
| 939 | txtProvDiag.Hint := '';
|
---|
| 940 | if cboService.ItemIEN = 0 then Exit;
|
---|
| 941 | GetProvDxMode(ProvDx, cboService.ItemID + CSLT_PTR);
|
---|
| 942 | // Returns: string A^B
|
---|
| 943 | // A = O (optional), R (required) or S (suppress)
|
---|
| 944 | // B = F (free-text) or L (lexicon)
|
---|
| 945 | with ProvDx do if (Reqd = '') or (PromptMode = '') then Exit;
|
---|
| 946 | if ProvDx.Reqd = 'R' then
|
---|
| 947 | lblProvDiag.Caption := TX_PROVDX_REQD
|
---|
| 948 | else
|
---|
| 949 | lblProvDiag.Caption := TX_PROVDX_OPT;
|
---|
| 950 | if ProvDx.Reqd = 'S' then
|
---|
| 951 | begin
|
---|
| 952 | cmdLexSearch.Enabled := False;
|
---|
| 953 | txtProvDiag.Enabled := False;
|
---|
| 954 | txtProvDiag.ReadOnly := True;
|
---|
| 955 | txtProvDiag.Color := clBtnFace;
|
---|
| 956 | txtProvDiag.Font.Color := clBtnText;
|
---|
| 957 | lblProvDiag.Enabled := False;
|
---|
| 958 | end
|
---|
| 959 | else
|
---|
| 960 | case ProvDx.PromptMode[1] of
|
---|
| 961 | 'F': begin
|
---|
| 962 | cmdLexSearch.Enabled := False;
|
---|
| 963 | txtProvDiag.Enabled := True;
|
---|
| 964 | txtProvDiag.ReadOnly := False;
|
---|
| 965 | txtProvDiag.Color := clWindow;
|
---|
| 966 | txtProvDiag.Font.Color := clWindowText;
|
---|
| 967 | lblProvDiag.Enabled := True;
|
---|
| 968 | end;
|
---|
| 969 | 'L': begin
|
---|
| 970 | if BILLING_AWARE then
|
---|
| 971 | begin
|
---|
| 972 | btnDiagnosis.Enabled := True; //1.4.18
|
---|
| 973 | txtProvDiag.Hint := TX_USE_DIAGNOSIS;
|
---|
| 974 | end
|
---|
| 975 | else
|
---|
| 976 | begin
|
---|
| 977 | cmdLexSearch.Enabled := True;
|
---|
| 978 | txtProvDiag.Hint := TX_USE_LEXICON;
|
---|
| 979 | end;
|
---|
| 980 | txtProvDiag.Enabled := True;
|
---|
| 981 | txtProvDiag.ReadOnly := True;
|
---|
| 982 | txtProvDiag.Color := clInfoBk;
|
---|
| 983 | txtProvDiag.Font.Color := clInfoText;
|
---|
| 984 | lblProvDiag.Enabled := True;
|
---|
| 985 | end;
|
---|
| 986 | end;
|
---|
| 987 | end;
|
---|
| 988 |
|
---|
| 989 |
|
---|
| 990 | procedure TfrmODCslt.mnuPopProvDxDeleteClick(Sender: TObject);
|
---|
| 991 | begin
|
---|
| 992 | inherited;
|
---|
| 993 | ProvDx.Text := '';
|
---|
| 994 | ProvDx.Code := '';
|
---|
| 995 | txtProvDiag.Text := '';
|
---|
| 996 | ControlChange(Self);
|
---|
| 997 | end;
|
---|
| 998 |
|
---|
| 999 | procedure TfrmODCslt.txtProvDiagChange(Sender: TObject);
|
---|
| 1000 | begin
|
---|
| 1001 | inherited;
|
---|
| 1002 | if ProvDx.PromptMode = 'F' then
|
---|
| 1003 | begin
|
---|
| 1004 | ProvDx.Text := txtProvDiag.Text;
|
---|
| 1005 | displayDxCode := ProvDx.Text;
|
---|
| 1006 | end;
|
---|
| 1007 | ControlChange(Self);
|
---|
| 1008 | end;
|
---|
| 1009 |
|
---|
| 1010 | procedure TfrmODCslt.SetupReasonForRequest(OrderAction: integer);
|
---|
| 1011 | var
|
---|
| 1012 | EditReason: string;
|
---|
| 1013 |
|
---|
| 1014 | procedure EnableReason;
|
---|
| 1015 | begin
|
---|
| 1016 | memReason.Color := clWindow;
|
---|
| 1017 | memReason.Font.Color := clWindowText;
|
---|
| 1018 | memReason.ReadOnly := False;
|
---|
| 1019 | lblReason.Caption := 'Reason for Request';
|
---|
| 1020 | end;
|
---|
| 1021 |
|
---|
| 1022 | procedure DisableReason;
|
---|
| 1023 | begin
|
---|
| 1024 | memReason.Color := clInfoBk;
|
---|
| 1025 | memReason.Font.Color := clInfoText;
|
---|
| 1026 | memReason.ReadOnly := True;
|
---|
| 1027 | lblReason.Caption := 'Reason for Request (not editable)';
|
---|
| 1028 | end;
|
---|
| 1029 |
|
---|
| 1030 | begin
|
---|
| 1031 | if ((OrderAction = ORDER_QUICK) and (cboService.ItemID <> '') and (Length(memReason.Text) = 0)) then
|
---|
| 1032 | memReason.Lines.Assign(DefaultReasonForRequest(cboService.ItemID, True));
|
---|
| 1033 | EditReason := GMRCREAF;
|
---|
| 1034 | if EditReason = '' then EditReason := ReasonForRequestEditable(cboService.ItemID + CSLT_PTR);
|
---|
| 1035 | case EditReason[1] of
|
---|
| 1036 | '0': EnableReason;
|
---|
| 1037 | '1': if OrderAction in [ORDER_COPY, ORDER_EDIT] then
|
---|
| 1038 | EnableReason
|
---|
| 1039 | else
|
---|
| 1040 | DisableReason;
|
---|
| 1041 | '2': DisableReason
|
---|
| 1042 | else
|
---|
| 1043 | EnableReason;
|
---|
| 1044 | end;
|
---|
| 1045 | end;
|
---|
| 1046 |
|
---|
| 1047 | function TfrmODCslt.ShowPrerequisites: boolean;
|
---|
| 1048 | var
|
---|
| 1049 | AList: TStringList;
|
---|
| 1050 | const
|
---|
| 1051 | TC_PREREQUISITES = 'Service Prerequisites - ';
|
---|
| 1052 | begin
|
---|
| 1053 | Result := True;
|
---|
| 1054 | AbortOrder := False;
|
---|
| 1055 | AList := TStringList.Create;
|
---|
| 1056 | try
|
---|
| 1057 | with cboService do
|
---|
| 1058 | if ItemIEN > 0 then
|
---|
| 1059 | begin
|
---|
| 1060 | Alist.Assign(GetServicePrerequisites(ItemID + CSLT_PTR));
|
---|
| 1061 | if AList.Count > 0 then
|
---|
| 1062 | begin
|
---|
| 1063 | if not DisplayPrerequisites(AList, TC_PREREQUISITES + DisplayText[ItemIndex]) then
|
---|
| 1064 | begin
|
---|
| 1065 | memOrder.Clear;
|
---|
| 1066 | Result := False;
|
---|
| 1067 | AbortOrder := True;
|
---|
| 1068 | //cmdQuitClick(Self);
|
---|
| 1069 | end
|
---|
| 1070 | else Result := True;
|
---|
| 1071 | end;
|
---|
| 1072 | end;
|
---|
| 1073 | finally
|
---|
| 1074 | AList.Free;
|
---|
| 1075 | end;
|
---|
| 1076 | end;
|
---|
| 1077 |
|
---|
| 1078 | ////////// NOTE THIS FUNCTION IS NO LONGER ASSIGNED TO OnExit EVENT
|
---|
| 1079 | ///////// Calling this with enter making a selection had serious errors
|
---|
| 1080 | ///////// No ill effect can be seen for not calling it.
|
---|
| 1081 | procedure TfrmODCslt.cboServiceExit(Sender: TObject);
|
---|
| 1082 | begin
|
---|
| 1083 | inherited;
|
---|
| 1084 | if Length(memOrder.Text) = 0 then Exit;
|
---|
| 1085 | if (Length(cboService.ItemID) = 0) or (cboService.ItemID = '0') then Exit;
|
---|
| 1086 | if cboService.ItemID = FLastServiceID then Exit;
|
---|
| 1087 | cboServiceSelect(cboService);
|
---|
| 1088 | cboService.SetFocus;
|
---|
| 1089 | PostMessage(Handle, WM_NEXTDLGCTL, 0, 0);
|
---|
| 1090 | end;
|
---|
| 1091 |
|
---|
| 1092 | procedure TfrmODCslt.popReasonPopup(Sender: TObject);
|
---|
| 1093 | begin
|
---|
| 1094 | inherited;
|
---|
| 1095 | if PopupComponent(Sender, popReason) is TCustomEdit
|
---|
| 1096 | then FEditCtrl := TCustomEdit(PopupComponent(Sender, popReason))
|
---|
| 1097 | else FEditCtrl := nil;
|
---|
| 1098 | if FEditCtrl <> nil then
|
---|
| 1099 | begin
|
---|
| 1100 | popReasonCut.Enabled := FEditCtrl.SelLength > 0;
|
---|
| 1101 | popReasonCopy.Enabled := popReasonCut.Enabled;
|
---|
| 1102 | popReasonPaste.Enabled := (not TORExposedCustomEdit(FEditCtrl).ReadOnly) and
|
---|
| 1103 | Clipboard.HasFormat(CF_TEXT);
|
---|
| 1104 | end else
|
---|
| 1105 | begin
|
---|
| 1106 | popReasonCut.Enabled := False;
|
---|
| 1107 | popReasonCopy.Enabled := False;
|
---|
| 1108 | popReasonPaste.Enabled := False;
|
---|
| 1109 | end;
|
---|
| 1110 | popReasonReformat.Enabled := True;
|
---|
| 1111 | end;
|
---|
| 1112 |
|
---|
| 1113 | procedure TfrmODCslt.popReasonCutClick(Sender: TObject);
|
---|
| 1114 | begin
|
---|
| 1115 | inherited;
|
---|
| 1116 | FEditCtrl.CutToClipboard;
|
---|
| 1117 | end;
|
---|
| 1118 |
|
---|
| 1119 | procedure TfrmODCslt.popReasonCopyClick(Sender: TObject);
|
---|
| 1120 | begin
|
---|
| 1121 | inherited;
|
---|
| 1122 | FEditCtrl.CopyToClipboard;
|
---|
| 1123 | end;
|
---|
| 1124 |
|
---|
| 1125 | procedure TfrmODCslt.popReasonPasteClick(Sender: TObject);
|
---|
| 1126 | begin
|
---|
| 1127 | inherited;
|
---|
| 1128 | FEditCtrl.SelText := Clipboard.AsText;
|
---|
| 1129 | end;
|
---|
| 1130 |
|
---|
| 1131 | procedure TfrmODCslt.popReasonReformatClick(Sender: TObject);
|
---|
| 1132 | begin
|
---|
| 1133 | inherited;
|
---|
| 1134 | if Screen.ActiveControl <> memReason then Exit;
|
---|
| 1135 | ReformatMemoParagraph(memReason);
|
---|
| 1136 | end;
|
---|
| 1137 |
|
---|
| 1138 | function TfrmODCslt.DefaultReasonForRequest(Service: string;
|
---|
| 1139 | Resolve: Boolean): TStrings;
|
---|
| 1140 | var
|
---|
| 1141 | TmpSL: TStringList;
|
---|
| 1142 | DocInfo: string;
|
---|
| 1143 |
|
---|
| 1144 | begin
|
---|
| 1145 | DocInfo := '';
|
---|
| 1146 | TmpSL := TStringList.Create;
|
---|
| 1147 | try
|
---|
| 1148 | Result := GetDefaultReasonForRequest(Service + CSLT_PTR, Resolve);
|
---|
| 1149 | TmpSL.Assign(Result);
|
---|
| 1150 | ExecuteTemplateOrBoilerPlate(TmpSL, cboService.ItemIEN , ltConsult, nil, 'Reason for Request: ' + cboService.DisplayText[cboService.ItemIndex], DocInfo);
|
---|
| 1151 | Result.Assign(TmpSL);
|
---|
| 1152 | finally
|
---|
| 1153 | TmpSL.Free;
|
---|
| 1154 | end;
|
---|
| 1155 | end;
|
---|
| 1156 |
|
---|
| 1157 | procedure TfrmODCslt.pnlServiceTreeButtonEnter(Sender: TObject);
|
---|
| 1158 | begin
|
---|
| 1159 | inherited;
|
---|
| 1160 | (Sender as TPanel).BevelOuter := bvRaised;
|
---|
| 1161 | end;
|
---|
| 1162 |
|
---|
| 1163 | procedure TfrmODCslt.pnlServiceTreeButtonExit(Sender: TObject);
|
---|
| 1164 | begin
|
---|
| 1165 | inherited;
|
---|
| 1166 | (Sender as TPanel).BevelOuter := bvNone;
|
---|
| 1167 | end;
|
---|
| 1168 |
|
---|
| 1169 | procedure TfrmODCslt.treServiceKeyDown(Sender: TObject; var Key: Word;
|
---|
| 1170 | Shift: TShiftState);
|
---|
| 1171 | begin
|
---|
| 1172 | inherited;
|
---|
| 1173 | case Key of
|
---|
| 1174 | VK_SPACE, VK_RETURN:
|
---|
| 1175 | begin
|
---|
| 1176 | Key := 0;
|
---|
| 1177 | FKeyBoarding := False;
|
---|
| 1178 | treServiceChange(Sender, treService.Selected);
|
---|
| 1179 | end;
|
---|
| 1180 | else
|
---|
| 1181 | FKeyBoarding := True;
|
---|
| 1182 | end;
|
---|
| 1183 | end;
|
---|
| 1184 |
|
---|
| 1185 | procedure TfrmODCslt.treServiceKeyUp(Sender: TObject; var Key: Word;
|
---|
| 1186 | Shift: TShiftState);
|
---|
| 1187 | begin
|
---|
| 1188 | inherited;
|
---|
| 1189 | FKeyBoarding := False;
|
---|
| 1190 | end;
|
---|
| 1191 |
|
---|
| 1192 | procedure TfrmODCslt.DoSetFontSize(FontSize: integer);
|
---|
| 1193 | begin
|
---|
| 1194 | memReason.DefAttributes.Size := FontSize;
|
---|
| 1195 | treService.Font.Size := FontSize * 7 div 8;
|
---|
| 1196 | end;
|
---|
| 1197 |
|
---|
| 1198 | procedure TfrmODCslt.SetFontSize(FontSize: integer);
|
---|
| 1199 | begin
|
---|
| 1200 | inherited SetFontSize(FontSize);
|
---|
| 1201 | DoSetFontSize(FontSize);
|
---|
| 1202 | end;
|
---|
| 1203 |
|
---|
| 1204 | procedure TfrmODCslt.memReasonKeyUp(Sender: TObject; var Key: Word;
|
---|
| 1205 | Shift: TShiftState);
|
---|
| 1206 | begin
|
---|
| 1207 | inherited;
|
---|
| 1208 | if FNavigatingTab then
|
---|
| 1209 | begin
|
---|
| 1210 | if ssShift in Shift then
|
---|
| 1211 | FindNextControl(Sender as TWinControl, False, True, False).SetFocus //previous control
|
---|
| 1212 | else if ssCtrl in Shift then
|
---|
| 1213 | FindNextControl(Sender as TWinControl, True, True, False).SetFocus; //next control
|
---|
| 1214 | FNavigatingTab := False;
|
---|
| 1215 | end;
|
---|
| 1216 | if (key = VK_ESCAPE) then begin
|
---|
| 1217 | FindNextControl(Sender as TWinControl, False, True, False).SetFocus; //previous control
|
---|
| 1218 | key := 0;
|
---|
| 1219 | end;
|
---|
| 1220 | end;
|
---|
| 1221 |
|
---|
| 1222 | procedure TfrmODCslt.GetProvDxandValidateCode(AResponses: TResponses);
|
---|
| 1223 | var
|
---|
| 1224 | tmpDx: TResponse;
|
---|
| 1225 |
|
---|
| 1226 | begin
|
---|
| 1227 | with AResponses do
|
---|
| 1228 | begin
|
---|
| 1229 | tmpDx := TResponse(FindResponseByName('MISC',1));
|
---|
| 1230 | if tmpDx <> nil then ProvDx.Text := tmpDx.Evalue;
|
---|
| 1231 | tmpDx := TResponse(FindResponseByName('CODE',1));
|
---|
| 1232 | sourceOrderID := Responses.CopyOrder;
|
---|
| 1233 | if (tmpDx <> nil) and (tmpDx.EValue <> '') then
|
---|
| 1234 | begin
|
---|
| 1235 | if IsActiveICDCode(tmpDx.EValue) then
|
---|
| 1236 | ProvDx.Code := tmpDx.Evalue
|
---|
| 1237 | else
|
---|
| 1238 | begin
|
---|
| 1239 | if ProvDx.Reqd = 'R' then
|
---|
| 1240 | InfoBox(TX_INACTIVE_CODE1 + TX_INACTIVE_CODE_REQD, TC_INACTIVE_CODE, MB_ICONWARNING or MB_OK)
|
---|
| 1241 | else
|
---|
| 1242 | InfoBox(TX_INACTIVE_CODE1 + TX_INACTIVE_CODE_OPTIONAL, TC_INACTIVE_CODE, MB_ICONWARNING or MB_OK);
|
---|
| 1243 | ProvDx.Code := '';
|
---|
| 1244 | ProvDx.Text := '';
|
---|
| 1245 | end;
|
---|
| 1246 | end;
|
---|
| 1247 | txtProvDiag.Text := ProvDx.Text;
|
---|
| 1248 | if ProvDx.Code <> '' then
|
---|
| 1249 | txtProvDiag.Text := (txtProvDiag.Text + ' (' + ProvDx.Code + ')' )
|
---|
| 1250 | else
|
---|
| 1251 | begin
|
---|
| 1252 | if BILLING_AWARE then
|
---|
| 1253 | if (sourceOrderID <> '') and (ProvDx.Code <> '') then // if sourceid exists then user is copying an order.
|
---|
| 1254 | SetUpCopyConsultDiagnoses(sourceOrderID);
|
---|
| 1255 |
|
---|
| 1256 | end;
|
---|
| 1257 |
|
---|
| 1258 | end;
|
---|
| 1259 | end;
|
---|
| 1260 |
|
---|
| 1261 | procedure TfrmODCslt.memReasonKeyDown(Sender: TObject; var Key: Word;
|
---|
| 1262 | Shift: TShiftState);
|
---|
| 1263 | begin
|
---|
| 1264 | inherited;
|
---|
| 1265 | //The navigating tab controls were inadvertantently adding tab characters
|
---|
| 1266 | //This should fix it
|
---|
| 1267 | FNavigatingTab := (Key = VK_TAB) and ([ssShift,ssCtrl] * Shift <> []);
|
---|
| 1268 | if FNavigatingTab then
|
---|
| 1269 | Key := 0;
|
---|
| 1270 | end;
|
---|
| 1271 |
|
---|
| 1272 | procedure TfrmODCslt.memReasonKeyPress(Sender: TObject; var Key: Char);
|
---|
| 1273 | begin
|
---|
| 1274 | inherited;
|
---|
| 1275 | if FNavigatingTab then
|
---|
| 1276 | Key := #0; //Disable shift-tab processing
|
---|
| 1277 | end;
|
---|
| 1278 |
|
---|
| 1279 | procedure TfrmODCslt.cboServiceKeyDown(Sender: TObject; var Key: Word;
|
---|
| 1280 | Shift: TShiftState);
|
---|
| 1281 | begin
|
---|
| 1282 | inherited;
|
---|
| 1283 | //This fixes clearquest: HDS00001418 Makes it so OnClick is not called
|
---|
| 1284 | //Except when Enter or Space is pressed. VK_LBUTTON activates OnClick in TORComboBoxes
|
---|
| 1285 | FcboServiceKeyDownStopClick := false;
|
---|
| 1286 | if (Key <> VK_RETURN) and (Key <> VK_SPACE) and (Key <> VK_LBUTTON) then
|
---|
| 1287 | FcboServiceKeyDownStopClick := True
|
---|
| 1288 | else
|
---|
| 1289 | Key := VK_LBUTTON;
|
---|
| 1290 | end;
|
---|
| 1291 |
|
---|
| 1292 | procedure TfrmODCslt.cboServiceKeyUp(Sender: TObject; var Key: Word;
|
---|
| 1293 | Shift: TShiftState);
|
---|
| 1294 | begin
|
---|
| 1295 | inherited;
|
---|
| 1296 | FcboServiceKeyDownStopClick := false;
|
---|
| 1297 | end;
|
---|
| 1298 |
|
---|
| 1299 |
|
---|
| 1300 | procedure TfrmODCslt.btnDiagnosisClick(Sender: TObject);
|
---|
| 1301 | var
|
---|
| 1302 | leftParan, rightParan: string;
|
---|
| 1303 | tmpOrderIDList: TStringList;
|
---|
| 1304 | begin
|
---|
| 1305 | inherited;
|
---|
| 1306 | tmpOrderIDList := TStringList.Create;
|
---|
| 1307 | tmpOrderIDList.Clear;
|
---|
| 1308 | leftParan := '(';
|
---|
| 1309 | rightParan := ')';
|
---|
| 1310 | UBAGlobals.BAtmpOrderList.Clear;
|
---|
| 1311 | UBAGlobals.BAtmpOrderList.Add(Responses.OrderText);
|
---|
| 1312 | quickCode := '';
|
---|
| 1313 | if consultQuickOrder then
|
---|
| 1314 | begin
|
---|
| 1315 | quickCode := Piece(txtProvDiag.text,'(',2);
|
---|
| 1316 | quickCode := Piece(quickCode,')',1);
|
---|
| 1317 | if UBACore.IsICD9CodeActive(quickCode,'ICD',0) then
|
---|
| 1318 | begin
|
---|
| 1319 | uBAGlobals.BAConsultDxList.Clear;
|
---|
| 1320 | uBAGlobals.BAConsultDxList.Add(UBAConst.PRIMARY_DX + U + Piece(txtProvDiag.text,'(',1) + ':' + quickCode);
|
---|
| 1321 | end;
|
---|
| 1322 |
|
---|
| 1323 | end;
|
---|
| 1324 | frmBALocalDiagnoses.Enter(UBAConst.F_CONSULTS, nil);
|
---|
| 1325 | if displayDxCode = '' then txtProvDiag.Text := ''
|
---|
| 1326 | else
|
---|
| 1327 | begin
|
---|
| 1328 | if displayDxCode <> 'DXCANCEL' then
|
---|
| 1329 | begin
|
---|
| 1330 | ProvDx.Code := Piece(displayDxCode,':', 2);
|
---|
| 1331 | ProvDx.Text := Piece(displayDxCode,':', 1);
|
---|
| 1332 | txtProvDiag.Text := ProvDx.Text + ' (' + ProvDx.Code + ')';
|
---|
| 1333 | end;
|
---|
| 1334 | end;
|
---|
| 1335 | ProvDx.CodeInactive := False;
|
---|
| 1336 | end;
|
---|
| 1337 |
|
---|
| 1338 | procedure TfrmODCslt.cmdQuitClick(Sender: TObject);
|
---|
| 1339 | begin
|
---|
| 1340 | inherited;
|
---|
| 1341 | if BILLING_AWARE then uBAGlobals.BAConsultDxList.Clear;
|
---|
| 1342 | end;
|
---|
| 1343 |
|
---|
| 1344 | procedure TfrmODCslt.SaveConsultDxForNurse(pDiagnosis: string);
|
---|
| 1345 | var
|
---|
| 1346 | s,tmpTFactors: string;
|
---|
| 1347 | tmpList: TStringList;
|
---|
| 1348 | begin
|
---|
| 1349 | tmpList := TStringList.Create;
|
---|
| 1350 | tmpList.Clear;
|
---|
| 1351 | s := '';
|
---|
| 1352 | tmpList.Add(uBAGlobals.BAOrderID);
|
---|
| 1353 | s := GetPatientTFactors(tmpList);
|
---|
| 1354 | tmpTFactors := ConvertPIMTreatmentFactors(s);
|
---|
| 1355 | BANurseConsultOrders.Add(uBAGlobals.BAOrderID + '1' + tmpTFactors + U + ProvDX.Code);
|
---|
| 1356 | end;
|
---|
| 1357 |
|
---|
| 1358 | procedure TfrmODCslt.SetUpCopyConsultDiagnoses(pOrderID:string);
|
---|
| 1359 | var
|
---|
| 1360 | sourceOrderID, primaryText,primaryCode: string;
|
---|
| 1361 | sourceOrderList: TStringList;
|
---|
| 1362 | thisOrderList: TStringList;
|
---|
| 1363 | begin
|
---|
| 1364 | //logic handles setting up diagnoses when copying an order.
|
---|
| 1365 | sourceOrderList := TStringList.Create;
|
---|
| 1366 | sourceOrderList.Clear;
|
---|
| 1367 | thisOrderList := TStringList.Create;
|
---|
| 1368 | thisOrderList.Clear;
|
---|
| 1369 | if IsOrderBillable(sourceOrderID) then
|
---|
| 1370 | begin
|
---|
| 1371 | thisOrderList.Add(sourceOrderID);
|
---|
| 1372 | sourceOrderList := rpcRetrieveSelectedOrderInfo(thisOrderList);
|
---|
| 1373 | primaryText := Piece(sourceOrderList.Strings[0],U,4);
|
---|
| 1374 | primaryCode := Piece(sourceOrderList.Strings[0],U,3);
|
---|
| 1375 | txtProvDiag.Text := primaryText + ' (' + primaryCode + ')';
|
---|
| 1376 | ProvDx.CodeInactive := False;
|
---|
| 1377 | // need to handle the rest of the dx's
|
---|
| 1378 | uBAGlobals.BAConsultDxList.Clear;
|
---|
| 1379 | uBAGlobals.BAConsultDxList.Add(UBAConst.PRIMARY_DX + U + Piece(txtProvDiag.text,'(',1) + ':' + primaryCode);
|
---|
| 1380 | if (Piece(sourceOrderList.Strings[0],U,5) <> '') then // dx2
|
---|
| 1381 | uBAGlobals.BAConsultDxList.Add(UBAConst.SECONDARY_DX + U + Piece(sourceOrderList.Strings[0],U,6) + ':' + Piece(sourceOrderList.Strings[0],U,5));
|
---|
| 1382 | if (Piece(sourceOrderList.Strings[0],U,7) <> '') then // dx3
|
---|
| 1383 | uBAGlobals.BAConsultDxList.Add(UBAConst.SECONDARY_DX + U + Piece(sourceOrderList.Strings[0],U,8) + ':' + Piece(sourceOrderList.Strings[0],U,7));
|
---|
| 1384 | if (Piece(sourceOrderList.Strings[0],U,9) <> '') then // dx4
|
---|
| 1385 | uBAGlobals.BAConsultDxList.Add(UBAConst.SECONDARY_DX + U + Piece(sourceOrderList.Strings[0],U,10) + ':' + Piece(sourceOrderList.Strings[0],U,9));
|
---|
| 1386 | end;
|
---|
| 1387 | end;
|
---|
| 1388 |
|
---|
| 1389 | end.
|
---|
| 1390 |
|
---|
| 1391 |
|
---|