[456] | 1 | unit fEditConsult;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 7 | StdCtrls, ORCtrls, ExtCtrls, ComCtrls, ORfn, uConst, uConsults, Buttons,
|
---|
[829] | 8 | Menus, fBase508Form, VA508AccessibilityManager;
|
---|
[456] | 9 |
|
---|
| 10 | type
|
---|
[829] | 11 | TfrmEditCslt = class(TfrmBase508Form)
|
---|
[456] | 12 | cboService: TORComboBox;
|
---|
| 13 | cboUrgency: TORComboBox;
|
---|
| 14 | radInpatient: TRadioButton;
|
---|
| 15 | radOutpatient: TRadioButton;
|
---|
| 16 | cboPlace: TORComboBox;
|
---|
| 17 | txtProvDiag: TCaptionEdit;
|
---|
| 18 | txtAttn: TORComboBox;
|
---|
| 19 | lblReason: TLabel;
|
---|
| 20 | lblService: TLabel;
|
---|
| 21 | lblUrgency: TStaticText;
|
---|
| 22 | lblPlace: TStaticText;
|
---|
| 23 | lblAttn: TStaticText;
|
---|
| 24 | lblProvDiag: TStaticText;
|
---|
| 25 | cboCategory: TORComboBox;
|
---|
| 26 | pnlMessage: TPanel;
|
---|
| 27 | imgMessage: TImage;
|
---|
| 28 | memMessage: TRichEdit;
|
---|
| 29 | cmdAccept: TButton;
|
---|
| 30 | cmdQuit: TButton;
|
---|
| 31 | memComment: TRichEdit;
|
---|
| 32 | lblComment: TLabel;
|
---|
| 33 | lblComments: TLabel;
|
---|
| 34 | btnCmtCancel: TButton;
|
---|
| 35 | btnCmtOther: TButton;
|
---|
| 36 | mnuPopProvDx: TPopupMenu;
|
---|
| 37 | mnuPopProvDxDelete: TMenuItem;
|
---|
| 38 | cmdLexSearch: TButton;
|
---|
| 39 | lblInpOutp: TStaticText;
|
---|
| 40 | memReason: TRichEdit;
|
---|
| 41 | popReason: TPopupMenu;
|
---|
| 42 | popReasonCut: TMenuItem;
|
---|
| 43 | popReasonCopy: TMenuItem;
|
---|
| 44 | popReasonPaste: TMenuItem;
|
---|
| 45 | popReasonPaste2: TMenuItem;
|
---|
| 46 | popReasonReformat: TMenuItem;
|
---|
| 47 | procedure txtAttnNeedData(Sender: TObject; const StartFrom: String;
|
---|
| 48 | Direction, InsertAt: Integer);
|
---|
| 49 | procedure radInpatientClick(Sender: TObject);
|
---|
| 50 | procedure radOutpatientClick(Sender: TObject);
|
---|
| 51 | procedure ControlChange(Sender: TObject);
|
---|
| 52 | procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 53 | procedure cmdQuitClick(Sender: TObject);
|
---|
| 54 | procedure cmdAcceptClick(Sender: TObject);
|
---|
| 55 | procedure memReasonExit(Sender: TObject);
|
---|
| 56 | procedure OrderMessage(const AMessage: string);
|
---|
| 57 | procedure btnCmtCancelClick(Sender: TObject);
|
---|
| 58 | procedure btnCmtOtherClick(Sender: TObject);
|
---|
| 59 | procedure cmdLexSearchClick(Sender: TObject);
|
---|
| 60 | procedure mnuPopProvDxDeleteClick(Sender: TObject);
|
---|
| 61 | procedure popReasonCutClick(Sender: TObject);
|
---|
| 62 | procedure popReasonCopyClick(Sender: TObject);
|
---|
| 63 | procedure popReasonPasteClick(Sender: TObject);
|
---|
| 64 | procedure popReasonPopup(Sender: TObject);
|
---|
| 65 | procedure popReasonReformatClick(Sender: TObject);
|
---|
| 66 | procedure memCommentKeyUp(Sender: TObject; var Key: Word;
|
---|
| 67 | Shift: TShiftState);
|
---|
| 68 | procedure memCommentKeyDown(Sender: TObject; var Key: Word;
|
---|
| 69 | Shift: TShiftState);
|
---|
| 70 | procedure memCommentKeyPress(Sender: TObject; var Key: Char);
|
---|
| 71 | private
|
---|
| 72 | FLastServiceID: string;
|
---|
| 73 | FChanged: boolean;
|
---|
| 74 | FChanging: boolean;
|
---|
| 75 | FEditCtrl: TCustomEdit;
|
---|
| 76 | FNavigatingTab: boolean;
|
---|
| 77 | procedure SetProvDiagPromptingMode;
|
---|
| 78 | protected
|
---|
| 79 | procedure InitDialog;
|
---|
| 80 | procedure Validate(var AnErrMsg: string);
|
---|
| 81 | function ValidSave: Boolean;
|
---|
| 82 | end;
|
---|
| 83 |
|
---|
| 84 | function EditResubmitConsult(FontSize: Integer; ConsultIEN: integer): boolean;
|
---|
| 85 |
|
---|
| 86 | var
|
---|
| 87 | frmEditCslt: TfrmEditCslt;
|
---|
| 88 |
|
---|
| 89 | implementation
|
---|
| 90 |
|
---|
| 91 | {$R *.DFM}
|
---|
| 92 |
|
---|
| 93 | uses
|
---|
| 94 | rODBase, rConsults, uCore, rCore, fConsults, fRptBox, fPCELex, rPCE,
|
---|
| 95 | ORClasses, clipbrd, UBAGlobals, rOrders ;
|
---|
| 96 |
|
---|
| 97 | var
|
---|
| 98 | SvcList: TStrings ;
|
---|
| 99 | OldRec, NewRec: TEditResubmitRec;
|
---|
| 100 | Defaults: TStringList;
|
---|
| 101 | uMessageVisible: DWORD;
|
---|
| 102 | ProvDx: TProvisionalDiagnosis;
|
---|
| 103 | {Begin BillingAware}
|
---|
| 104 | BADxUpdated: boolean;
|
---|
| 105 | {End BillingAware}
|
---|
| 106 |
|
---|
| 107 | const
|
---|
| 108 | TX_NOTTHISSVC_TEXT = 'Consults cannot be ordered from this service' ;
|
---|
| 109 | TX_NO_SVC = 'A service must be specified.' ;
|
---|
| 110 | TX_NO_REASON = 'A reason for this consult must be entered.' ;
|
---|
| 111 | TX_SVC_ERROR = 'This service has not been defined in your Orderable Items file.' +
|
---|
| 112 | #13#10'Contact IRM for assistance.' ;
|
---|
| 113 | TX_NO_URGENCY = 'An urgency must be specified.';
|
---|
| 114 | TX_NO_PLACE = 'A place of consultation must be specified';
|
---|
| 115 | TX_NO_DIAG = 'A provisional diagnosis must be entered for consults to this service.';
|
---|
| 116 | TX_SELECT_DIAG = 'You must use the "Lexicon" button to select a diagnosis for consults to this service.';
|
---|
| 117 | TX_INACTIVE_CODE = 'The provisional diagnosis code is not active as of today''s date.' + #13#10 +
|
---|
| 118 | 'Another code must be selected';
|
---|
| 119 | TC_INACTIVE_CODE = 'Inactive ICD Code';
|
---|
| 120 |
|
---|
| 121 | function EditResubmitConsult(FontSize: Integer; ConsultIEN: integer): boolean;
|
---|
| 122 | begin
|
---|
| 123 | Result := False;
|
---|
| 124 | if ConsultIEN = 0 then exit;
|
---|
| 125 | FillChar(OldRec, SizeOf(OldRec), 0);
|
---|
| 126 | FillChar(NewRec, SizeOf(NewRec), 0);
|
---|
| 127 | FillChar(ProvDx, SizeOf(ProvDx), 0);
|
---|
| 128 | OldRec := LoadConsultForEdit(ConsultIEN);
|
---|
| 129 | NewRec.IEN := OldRec.IEN;
|
---|
| 130 | NewRec.RequestType := OldRec.RequestType;
|
---|
| 131 | with NewRec do
|
---|
| 132 | begin
|
---|
| 133 | RequestReason:= TStringList.Create ;
|
---|
| 134 | DenyComments:= TStringList.Create ;
|
---|
| 135 | OtherComments:= TStringList.Create ;
|
---|
| 136 | NewComments:= TStringList.Create ;
|
---|
| 137 | end;
|
---|
| 138 | StatusText('Loading Consult for Edit');
|
---|
| 139 | frmEditCslt := TfrmEditCslt.Create(Application);
|
---|
| 140 | SvcList := TStringList.Create ;
|
---|
| 141 | Defaults := TStringList.Create;
|
---|
| 142 | try
|
---|
| 143 | with frmEditCslt do
|
---|
| 144 | begin
|
---|
| 145 | ResizeAnchoredFormToFont(frmEditCslt);
|
---|
| 146 | FChanged := False;
|
---|
| 147 | InitDialog;
|
---|
| 148 | ShowModal ;
|
---|
| 149 | Result := FChanged ;
|
---|
| 150 | end ;
|
---|
| 151 | finally
|
---|
| 152 | OldRec.RequestReason.Free;
|
---|
| 153 | OldRec.DenyComments.Free;
|
---|
| 154 | OldRec.OtherComments.Free;
|
---|
| 155 | OldRec.NewComments.Free;
|
---|
| 156 | NewRec.RequestReason.Free;
|
---|
| 157 | NewRec.DenyComments.Free;
|
---|
| 158 | NewRec.OtherComments.Free;
|
---|
| 159 | NewRec.NewComments.Free;
|
---|
| 160 | SvcList.Free;
|
---|
| 161 | Defaults.Free;
|
---|
| 162 | frmEditCslt.Release;
|
---|
| 163 | end;
|
---|
| 164 | end;
|
---|
| 165 |
|
---|
| 166 | procedure TfrmEditCslt.InitDialog;
|
---|
| 167 | var
|
---|
| 168 | i:integer;
|
---|
| 169 | begin
|
---|
| 170 | FChanging := True;
|
---|
[829] | 171 | FastAssign(ODForConsults, Defaults);
|
---|
[456] | 172 | FLastServiceID := '';
|
---|
| 173 | cboService.Items.Clear;
|
---|
| 174 | if OldRec.InpOutp <> '' then
|
---|
| 175 | case OldRec.InpOutp[1] of
|
---|
| 176 | 'I': radInpatient.Checked := True; //INPATIENT CONSULT
|
---|
| 177 | 'O': radOutpatient.Checked := True; //OUTPATIENT CONSULT
|
---|
| 178 | end
|
---|
| 179 | else
|
---|
| 180 | begin
|
---|
| 181 | if Patient.Inpatient then
|
---|
| 182 | radInpatient.Checked := True
|
---|
| 183 | else
|
---|
| 184 | radOutpatient.Checked := True;
|
---|
| 185 | end;
|
---|
| 186 | StatusText('Initializing Long List');
|
---|
[829] | 187 | FastAssign(LoadServiceList(CN_SVC_LIST_ORD), SvcList) ;
|
---|
[456] | 188 | with cboService do
|
---|
| 189 | begin
|
---|
| 190 | for i := 0 to SvcList.Count - 1 do
|
---|
| 191 | if SelectByID(Piece(SvcList.Strings[i], U, 1)) = -1 then
|
---|
| 192 | Items.Add(SvcList.Strings[i]);
|
---|
| 193 | SelectByID(IntToStr(OldRec.ToService));
|
---|
| 194 | end;
|
---|
| 195 | cboPlace.SelectByID(OldRec.Place);
|
---|
| 196 | with cboUrgency do for i := 0 to Items.Count-1 do
|
---|
| 197 | if UpperCase(DisplayText[i]) = UpperCase(OldRec.UrgencyName) then ItemIndex := i;
|
---|
| 198 | txtProvDiag.Text := OldRec.ProvDiagnosis;
|
---|
| 199 | ProvDx.Code := OldRec.ProvDxCode;
|
---|
| 200 | if OldRec.ProvDxCodeInactive then
|
---|
| 201 | begin
|
---|
| 202 | InfoBox(TX_INACTIVE_CODE, TC_INACTIVE_CODE, MB_ICONWARNING or MB_OK);
|
---|
| 203 | ProvDx.CodeInactive := True;
|
---|
| 204 | end;
|
---|
[829] | 205 | QuickCopy(OldRec.RequestReason, memReason);
|
---|
[456] | 206 | memComment.Clear ;
|
---|
| 207 | btnCmtCancel.Enabled := (OldRec.DenyComments.Count > 0);
|
---|
| 208 | btnCmtOther.Enabled := (OldRec.OtherComments.Count > 0);
|
---|
| 209 | txtAttn.InitLongList(OldRec.AttnName) ;
|
---|
| 210 | if OldRec.Attention > 0 then
|
---|
| 211 | txtAttn.SelectByIEN(OldRec.Attention)
|
---|
| 212 | else
|
---|
| 213 | txtAttn.ItemIndex := -1;
|
---|
| 214 | SetProvDiagPromptingMode;
|
---|
| 215 | FChanging := False;
|
---|
| 216 | StatusText('');
|
---|
| 217 | end;
|
---|
| 218 |
|
---|
| 219 | procedure TfrmEditCslt.Validate(var AnErrMsg: string);
|
---|
| 220 |
|
---|
| 221 | procedure SetError(const x: string);
|
---|
| 222 | begin
|
---|
| 223 | if Length(AnErrMsg) > 0 then AnErrMsg := AnErrMsg + CRLF;
|
---|
| 224 | AnErrMsg := AnErrMsg + x;
|
---|
| 225 | end;
|
---|
| 226 |
|
---|
| 227 | begin
|
---|
| 228 | inherited;
|
---|
| 229 | if cboService.ItemIEN = 0 then SetError(TX_NO_SVC);
|
---|
| 230 | if cboUrgency.ItemIEN = 0 then SetError(TX_NO_URGENCY);
|
---|
| 231 | if cboPlace.ItemID = '' then SetError(TX_NO_PLACE);
|
---|
| 232 | if memReason.Lines.Count = 0 then SetError(TX_NO_REASON);
|
---|
| 233 | with cboService do
|
---|
| 234 | begin
|
---|
| 235 | if Piece(Items[ItemIndex], U, 5) = '1' then SetError(TX_NOTTHISSVC_TEXT);
|
---|
| 236 | if (Piece(Items[ItemIndex],U,5) <> '1')
|
---|
| 237 | and (Piece(Items[ItemIndex], U, 6) = '')
|
---|
| 238 | then SetError(TX_SVC_ERROR) ;
|
---|
| 239 | end;
|
---|
| 240 | if (ProvDx.Reqd = 'R') and (Length(txtProvDiag.Text) = 0) then
|
---|
| 241 | begin
|
---|
| 242 | if ProvDx.PromptMode = 'F' then
|
---|
| 243 | SetError(TX_NO_DIAG)
|
---|
| 244 | else
|
---|
| 245 | SetError(TX_SELECT_DIAG);
|
---|
| 246 | end;
|
---|
| 247 | if OldRec.ProvDxCodeInactive and ProvDx.CodeInactive then
|
---|
| 248 | SetError(TX_INACTIVE_CODE);
|
---|
| 249 | end;
|
---|
| 250 |
|
---|
| 251 | procedure TfrmEditCslt.txtAttnNeedData(Sender: TObject;
|
---|
| 252 | const StartFrom: string; Direction, InsertAt: Integer);
|
---|
| 253 | begin
|
---|
| 254 | inherited;
|
---|
| 255 | txtAttn.ForDataUse(SubSetOfPersons(StartFrom, Direction));
|
---|
| 256 | end;
|
---|
| 257 |
|
---|
| 258 | procedure TfrmEditCslt.radInpatientClick(Sender: TObject);
|
---|
| 259 | begin
|
---|
| 260 | inherited;
|
---|
| 261 | cboUrgency.Items.Clear;
|
---|
| 262 | cboPlace.Items.Clear;
|
---|
| 263 | cboCategory.Items.Clear;
|
---|
| 264 | cboCategory.Items.Add('I^Inpatient');
|
---|
| 265 | cboCategory.SelectById('I');
|
---|
| 266 | ExtractItems(cboPlace.Items, Defaults, 'Inpt Place');
|
---|
| 267 | ExtractItems(cboUrgency.Items, Defaults, 'Inpt Cslt Urgencies'); //S.GMRCR
|
---|
| 268 | ControlChange(Self);
|
---|
| 269 | end;
|
---|
| 270 |
|
---|
| 271 | procedure TfrmEditCslt.radOutpatientClick(Sender: TObject);
|
---|
| 272 | begin
|
---|
| 273 | inherited;
|
---|
| 274 | cboUrgency.Items.Clear;
|
---|
| 275 | cboPlace.Items.Clear;
|
---|
| 276 | cboCategory.Items.Clear;
|
---|
| 277 | cboCategory.Items.Add('O^Outpatient');
|
---|
| 278 | cboCategory.SelectById('O');
|
---|
| 279 | ExtractItems(cboPlace.Items, Defaults, 'Outpt Place');
|
---|
| 280 | ExtractItems(cboUrgency.Items, Defaults, 'Outpt Urgencies'); //S.GMRCO
|
---|
| 281 | ControlChange(Self);
|
---|
| 282 | end;
|
---|
| 283 |
|
---|
| 284 |
|
---|
| 285 | procedure TfrmEditCslt.ControlChange(Sender: TObject);
|
---|
| 286 | begin
|
---|
| 287 | if FChanging then exit;
|
---|
| 288 | with NewRec do
|
---|
| 289 | begin
|
---|
| 290 | with cboService do if ItemIEN > 0 then
|
---|
| 291 | if ItemIEN <> OldRec.ToService then
|
---|
| 292 | begin
|
---|
| 293 | ToService := ItemIEN;
|
---|
| 294 | ToServiceName := Text;
|
---|
| 295 | end
|
---|
| 296 | else
|
---|
| 297 | begin
|
---|
| 298 | ToService := 0;
|
---|
| 299 | ToServiceName := '';
|
---|
| 300 | end;
|
---|
| 301 |
|
---|
| 302 | with cboCategory do if Length(ItemID) > 0 then
|
---|
| 303 | if ItemID <> OldRec.InpOutP then
|
---|
| 304 | InpOutP := ItemID
|
---|
| 305 | else
|
---|
| 306 | InpOutP := '';
|
---|
| 307 |
|
---|
| 308 | with cboUrgency do if ItemIEN > 0 then
|
---|
| 309 | if StrToIntDef(Piece(Items[ItemIndex], U, 3), 0) <> OldRec.Urgency then
|
---|
| 310 | begin
|
---|
| 311 | Urgency := StrToIntDef(Piece(Items[ItemIndex], U, 3), 0);
|
---|
| 312 | UrgencyName := Text;
|
---|
| 313 | end
|
---|
| 314 | else
|
---|
| 315 | begin
|
---|
| 316 | Urgency := 0;
|
---|
| 317 | UrgencyName := '';
|
---|
| 318 | end;
|
---|
| 319 |
|
---|
| 320 | with cboPlace do if Length(ItemID) > 0 then
|
---|
| 321 | if ItemID <> OldRec.Place then
|
---|
| 322 | begin
|
---|
| 323 | Place := ItemID;
|
---|
| 324 | PlaceName := Text;
|
---|
| 325 | end
|
---|
| 326 | else
|
---|
| 327 | begin
|
---|
| 328 | Place := '';
|
---|
| 329 | PlaceName := '';
|
---|
| 330 | end;
|
---|
| 331 |
|
---|
| 332 | with txtAttn do
|
---|
| 333 | if ItemIEN > 0 then
|
---|
| 334 | begin
|
---|
| 335 | if ItemIEN <> OldRec.Attention then
|
---|
| 336 | begin
|
---|
| 337 | Attention := ItemIEN;
|
---|
| 338 | AttnName := Text;
|
---|
| 339 | end
|
---|
| 340 | else
|
---|
| 341 | begin
|
---|
| 342 | Attention := 0;
|
---|
| 343 | AttnName := '';
|
---|
| 344 | end;
|
---|
| 345 | end
|
---|
| 346 | else // blank
|
---|
| 347 | begin
|
---|
| 348 | if OldRec.Attention > 0 then
|
---|
| 349 | begin
|
---|
| 350 | Attention := -1;
|
---|
| 351 | AttnName := '';
|
---|
| 352 | end
|
---|
| 353 | else
|
---|
| 354 | begin
|
---|
| 355 | Attention := 0;
|
---|
| 356 | AttnName := '';
|
---|
| 357 | end;
|
---|
| 358 | end;
|
---|
| 359 |
|
---|
| 360 | with txtProvDiag do
|
---|
| 361 | if Length(Text) > 0 then
|
---|
| 362 | begin
|
---|
| 363 | if Text <> OldRec.ProvDiagnosis then
|
---|
| 364 | ProvDiagnosis := Text
|
---|
| 365 | else
|
---|
| 366 | ProvDiagnosis := '';
|
---|
| 367 |
|
---|
| 368 | if ProvDx.Code <> OldRec.ProvDxCode then
|
---|
| 369 | ProvDxCode := ProvDx.Code
|
---|
| 370 | else
|
---|
| 371 | ProvDxCode := '';
|
---|
| 372 |
|
---|
| 373 | if OldRec.ProvDxCodeInactive then
|
---|
| 374 | ProvDx.CodeInactive := (ProvDx.Code = OldRec.ProvDxCode);
|
---|
| 375 | end
|
---|
| 376 | else //blank
|
---|
| 377 | begin
|
---|
| 378 | ProvDx.Code := '';
|
---|
| 379 | ProvDx.CodeInactive := False;
|
---|
| 380 | if OldRec.ProvDiagnosis <> '' then
|
---|
| 381 | ProvDiagnosis := '@'
|
---|
| 382 | else
|
---|
| 383 | ProvDiagnosis := '';
|
---|
| 384 | end;
|
---|
| 385 |
|
---|
| 386 | with memReason do if Lines.Count > 0 then
|
---|
| 387 | if Lines.Equals(OldRec.RequestReason) then
|
---|
| 388 | RequestReason.Clear
|
---|
| 389 | else
|
---|
[829] | 390 | QuickCopy(memReason, RequestReason);
|
---|
[456] | 391 |
|
---|
| 392 | with memComment do
|
---|
| 393 | if GetTextLen > 0 then
|
---|
[829] | 394 | QuickCopy(memComment, NewComments)
|
---|
[456] | 395 | else
|
---|
| 396 | NewComments.Clear;
|
---|
| 397 | end;
|
---|
| 398 | end;
|
---|
| 399 |
|
---|
| 400 | procedure TfrmEditCslt.FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 401 | const
|
---|
| 402 | TX_ACCEPT = 'Resubmit this request?' + CRLF + CRLF;
|
---|
| 403 | TX_ACCEPT_CAP = 'Unsaved Changes';
|
---|
| 404 | begin
|
---|
| 405 | if FChanged then
|
---|
| 406 | if InfoBox(TX_ACCEPT, TX_ACCEPT_CAP, MB_YESNO) = ID_YES then
|
---|
| 407 | if not ValidSave then Action := caNone;
|
---|
| 408 | end;
|
---|
| 409 |
|
---|
| 410 | procedure TfrmEditCslt.cmdAcceptClick(Sender: TObject);
|
---|
| 411 | {Begin BillingAware}
|
---|
| 412 | var
|
---|
| 413 | BADiagnosis: string;
|
---|
| 414 | //newDxRec: TBADxRecord;
|
---|
| 415 | //AnOrder: TOrder;
|
---|
| 416 | {End BillingAware}
|
---|
| 417 | begin
|
---|
| 418 |
|
---|
| 419 | {Begin BillingAware}
|
---|
| 420 | if BILLING_AWARE then
|
---|
| 421 | begin
|
---|
| 422 | if BADxUpdated then
|
---|
| 423 | begin
|
---|
| 424 | BADiagnosis := ProvDx.Text + '^' + ProvDx.Code;
|
---|
| 425 | UBAGlobals.Dx1 := BADiagnosis; // add selected dx to BA Dx List.
|
---|
| 426 | UBAGlobals.SimpleAddTempDxList(UBAGlobals.BAOrderID);
|
---|
| 427 | end;
|
---|
| 428 | end;
|
---|
| 429 | {End BillingAware}
|
---|
| 430 |
|
---|
| 431 | if ValidSave then
|
---|
| 432 | begin
|
---|
| 433 | FChanged := (ResubmitConsult(NewRec) = '0');
|
---|
| 434 | Close;
|
---|
| 435 | end;
|
---|
| 436 | end;
|
---|
| 437 |
|
---|
| 438 | procedure TfrmEditCslt.memReasonExit(Sender: TObject);
|
---|
| 439 | var
|
---|
| 440 | AStringList: TStringList;
|
---|
| 441 | begin
|
---|
| 442 | inherited;
|
---|
| 443 | AStringList := TStringList.Create;
|
---|
| 444 | try
|
---|
[829] | 445 | //QuickCopy(memReason, AStringList);
|
---|
| 446 | AStringList.Text := memReason.Text;
|
---|
[456] | 447 | LimitStringLength(AStringList, 74);
|
---|
[829] | 448 | //QuickCopy(AstringList, memReason);
|
---|
| 449 | memReason.Text := AStringList.Text;
|
---|
[456] | 450 | ControlChange(Self);
|
---|
| 451 | finally
|
---|
| 452 | AStringList.Free;
|
---|
| 453 | end;
|
---|
| 454 | end;
|
---|
| 455 |
|
---|
| 456 | procedure TfrmEditCslt.cmdQuitClick(Sender: TObject);
|
---|
| 457 | begin
|
---|
| 458 | inherited;
|
---|
| 459 | FChanged := False;
|
---|
| 460 | Close;
|
---|
| 461 | end;
|
---|
| 462 |
|
---|
| 463 | function TfrmEditCslt.ValidSave: Boolean;
|
---|
| 464 | const
|
---|
| 465 | TX_NO_SAVE = 'This request cannot be saved for the following reason(s):' + CRLF + CRLF;
|
---|
| 466 | TX_NO_SAVE_CAP = 'Unable to Save Request';
|
---|
| 467 | TX_SAVE_ERR = 'Unexpected error - it was not possible to save this request.';
|
---|
| 468 | var
|
---|
| 469 | ErrMsg: string;
|
---|
| 470 | begin
|
---|
| 471 | Result := True;
|
---|
| 472 | Validate(ErrMsg);
|
---|
| 473 | if Length(ErrMsg) > 0 then
|
---|
| 474 | begin
|
---|
| 475 | InfoBox(TX_NO_SAVE + ErrMsg, TX_NO_SAVE_CAP, MB_OK);
|
---|
| 476 | Result := False;
|
---|
| 477 | end;
|
---|
| 478 | if (ProvDx.Reqd = 'R') and (Length(txtProvDiag.Text) = 0) and (ProvDx.PromptMode = 'L') then
|
---|
| 479 | cmdLexSearchClick(Self);
|
---|
| 480 | end;
|
---|
| 481 |
|
---|
| 482 |
|
---|
| 483 | procedure TfrmEditCslt.OrderMessage(const AMessage: string);
|
---|
| 484 | begin
|
---|
| 485 | memMessage.Lines.SetText(PChar(AMessage));
|
---|
| 486 | if ContainsVisibleChar(AMessage) then
|
---|
| 487 | begin
|
---|
| 488 | pnlMessage.Visible := True;
|
---|
| 489 | pnlMessage.BringToFront;
|
---|
| 490 | uMessageVisible := GetTickCount;
|
---|
| 491 | end
|
---|
| 492 | else pnlMessage.Visible := False;
|
---|
| 493 | end;
|
---|
| 494 |
|
---|
| 495 | procedure TfrmEditCslt.btnCmtCancelClick(Sender: TObject);
|
---|
| 496 | begin
|
---|
| 497 | ReportBox(OldRec.DenyComments, 'Cancellation Comments', False);
|
---|
| 498 | end;
|
---|
| 499 |
|
---|
| 500 | procedure TfrmEditCslt.btnCmtOtherClick(Sender: TObject);
|
---|
| 501 | begin
|
---|
| 502 | ReportBox(OldRec.OtherComments, 'Added Comments', False);
|
---|
| 503 | end;
|
---|
| 504 |
|
---|
| 505 | procedure TfrmEditCslt.cmdLexSearchClick(Sender: TObject);
|
---|
| 506 | var
|
---|
| 507 | Match: string;
|
---|
| 508 | i: integer;
|
---|
| 509 | begin
|
---|
| 510 | inherited;
|
---|
| 511 | {Begin BillingAware}
|
---|
| 512 | if BILLING_AWARE then BADxUpdated := FALSE;
|
---|
| 513 | {End BillingAware}
|
---|
| 514 | LexiconLookup(Match, LX_ICD);
|
---|
| 515 | if Match = '' then Exit;
|
---|
| 516 | ProvDx.Code := Piece(Match, U, 1);
|
---|
| 517 | ProvDx.Text := Piece(Match, U, 2);
|
---|
| 518 | i := Pos(' (ICD', ProvDx.Text);
|
---|
| 519 | if i = 0 then i := Length(ProvDx.Text) + 1;
|
---|
| 520 | if ProvDx.Text[i-1] = '*' then i := i - 2;
|
---|
| 521 | ProvDx.Text := Copy(ProvDx.Text, 1, i - 1);
|
---|
| 522 | txtProvDiag.Text := ProvDx.Text + ' (' + ProvDx.Code + ')';
|
---|
| 523 | {Begin BillingAware}
|
---|
| 524 | if BILLING_AWARE then BADxUpdated := TRUE;
|
---|
| 525 | {End BillingAware}
|
---|
| 526 | ProvDx.CodeInactive := False;
|
---|
| 527 | end;
|
---|
| 528 |
|
---|
| 529 | procedure TfrmEditCslt.SetProvDiagPromptingMode;
|
---|
| 530 | const
|
---|
| 531 | TX_USE_LEXICON = 'You must use the "Lexicon" button to select a provisional diagnosis for this service.';
|
---|
| 532 | TX_PROVDX_OPT = 'Provisional Diagnosis';
|
---|
| 533 | TX_PROVDX_REQD = 'Provisional Dx (REQUIRED)';
|
---|
| 534 | begin
|
---|
| 535 | cmdLexSearch.Enabled := False;
|
---|
| 536 | txtProvDiag.Enabled := False;
|
---|
| 537 | txtProvDiag.ReadOnly := True;
|
---|
| 538 | txtProvDiag.Color := clBtnFace;
|
---|
| 539 | txtProvDiag.Font.Color := clBtnText;
|
---|
| 540 | lblProvDiag.Enabled := False;
|
---|
| 541 | txtProvDiag.Hint := '';
|
---|
| 542 | if cboService.ItemIEN = 0 then Exit;
|
---|
| 543 | GetProvDxMode(ProvDx, cboService.ItemID + CSLT_PTR);
|
---|
| 544 | // Returns: string A^B
|
---|
| 545 | // A = O (optional), R (required) or S (suppress)
|
---|
| 546 | // B = F (free-text) or L (lexicon)
|
---|
| 547 | with ProvDx do if (Reqd = '') or (PromptMode = '') then Exit;
|
---|
| 548 | if ProvDx.Reqd = 'R' then
|
---|
| 549 | lblProvDiag.Caption := TX_PROVDX_REQD
|
---|
| 550 | else
|
---|
| 551 | lblProvDiag.Caption := TX_PROVDX_OPT;
|
---|
| 552 | if ProvDx.Reqd = 'S' then
|
---|
| 553 | begin
|
---|
| 554 | cmdLexSearch.Enabled := False;
|
---|
| 555 | txtProvDiag.Enabled := False;
|
---|
| 556 | txtProvDiag.ReadOnly := True;
|
---|
| 557 | txtProvDiag.Color := clBtnFace;
|
---|
| 558 | txtProvDiag.Font.Color := clBtnText;
|
---|
| 559 | lblProvDiag.Enabled := False;
|
---|
| 560 | end
|
---|
| 561 | else
|
---|
| 562 | case ProvDx.PromptMode[1] of
|
---|
| 563 | 'F': begin
|
---|
| 564 | cmdLexSearch.Enabled := False;
|
---|
| 565 | txtProvDiag.Enabled := True;
|
---|
| 566 | txtProvDiag.ReadOnly := False;
|
---|
| 567 | txtProvDiag.Color := clWindow;
|
---|
| 568 | txtProvDiag.Font.Color := clWindowText;
|
---|
| 569 | lblProvDiag.Enabled := True;
|
---|
| 570 | end;
|
---|
| 571 | 'L': begin
|
---|
| 572 | cmdLexSearch.Enabled := True;
|
---|
| 573 | txtProvDiag.Enabled := True;
|
---|
| 574 | txtProvDiag.ReadOnly := True;
|
---|
| 575 | txtProvDiag.Color := clInfoBk;
|
---|
| 576 | txtProvDiag.Font.Color := clInfoText;
|
---|
| 577 | lblProvDiag.Enabled := True;
|
---|
| 578 | txtProvDiag.Hint := TX_USE_LEXICON;
|
---|
| 579 | end;
|
---|
| 580 | end;
|
---|
| 581 | end;
|
---|
| 582 |
|
---|
| 583 | procedure TfrmEditCslt.mnuPopProvDxDeleteClick(Sender: TObject);
|
---|
| 584 | begin
|
---|
| 585 | inherited;
|
---|
| 586 | ProvDx.Text := '';
|
---|
| 587 | ProvDx.Code := '';
|
---|
| 588 | ProvDx.CodeInactive := False;
|
---|
| 589 | txtProvDiag.Text := '';
|
---|
| 590 | ControlChange(Self);
|
---|
| 591 | end;
|
---|
| 592 |
|
---|
| 593 | procedure TfrmEditCslt.popReasonPopup(Sender: TObject);
|
---|
| 594 | begin
|
---|
| 595 | inherited;
|
---|
| 596 | if PopupComponent(Sender, popReason) is TCustomEdit
|
---|
| 597 | then FEditCtrl := TCustomEdit(PopupComponent(Sender, popReason))
|
---|
| 598 | else FEditCtrl := nil;
|
---|
| 599 | if FEditCtrl <> nil then
|
---|
| 600 | begin
|
---|
| 601 | popReasonCut.Enabled := FEditCtrl.SelLength > 0;
|
---|
| 602 | popReasonCopy.Enabled := popReasonCut.Enabled;
|
---|
| 603 | popReasonPaste.Enabled := (not TORExposedCustomEdit(FEditCtrl).ReadOnly) and
|
---|
| 604 | Clipboard.HasFormat(CF_TEXT);
|
---|
| 605 | end else
|
---|
| 606 | begin
|
---|
| 607 | popReasonCut.Enabled := False;
|
---|
| 608 | popReasonCopy.Enabled := False;
|
---|
| 609 | popReasonPaste.Enabled := False;
|
---|
| 610 | end;
|
---|
| 611 | popReasonReformat.Enabled := True;
|
---|
| 612 | end;
|
---|
| 613 |
|
---|
| 614 | procedure TfrmEditCslt.popReasonCutClick(Sender: TObject);
|
---|
| 615 | begin
|
---|
| 616 | inherited;
|
---|
| 617 | FEditCtrl.CutToClipboard;
|
---|
| 618 | end;
|
---|
| 619 |
|
---|
| 620 | procedure TfrmEditCslt.popReasonCopyClick(Sender: TObject);
|
---|
| 621 | begin
|
---|
| 622 | inherited;
|
---|
| 623 | FEditCtrl.CopyToClipboard;
|
---|
| 624 | end;
|
---|
| 625 |
|
---|
| 626 | procedure TfrmEditCslt.popReasonPasteClick(Sender: TObject);
|
---|
| 627 | begin
|
---|
| 628 | inherited;
|
---|
| 629 | FEditCtrl.SelText := Clipboard.AsText;
|
---|
| 630 | end;
|
---|
| 631 |
|
---|
| 632 | procedure TfrmEditCslt.popReasonReformatClick(Sender: TObject);
|
---|
| 633 | begin
|
---|
| 634 | inherited;
|
---|
| 635 | if (Screen.ActiveControl <> memReason) and
|
---|
| 636 | (Screen.ActiveControl <> memComment)then Exit;
|
---|
| 637 | ReformatMemoParagraph(TCustomMemo(FEditCtrl));
|
---|
| 638 | end;
|
---|
| 639 |
|
---|
| 640 | procedure TfrmEditCslt.memCommentKeyUp(Sender: TObject; var Key: Word;
|
---|
| 641 | Shift: TShiftState);
|
---|
| 642 | begin
|
---|
| 643 | if FNavigatingTab then
|
---|
| 644 | begin
|
---|
| 645 | if ssShift in Shift then
|
---|
| 646 | FindNextControl(Sender as TWinControl, False, True, False).SetFocus //previous control
|
---|
| 647 | else if ssCtrl in Shift then
|
---|
| 648 | FindNextControl(Sender as TWinControl, True, True, False).SetFocus; //next control
|
---|
| 649 | FNavigatingTab := False;
|
---|
| 650 | end;
|
---|
| 651 | if (key = VK_ESCAPE) then begin
|
---|
| 652 | FindNextControl(Sender as TWinControl, False, True, False).SetFocus; //previous control
|
---|
| 653 | key := 0;
|
---|
| 654 | end;
|
---|
| 655 | end;
|
---|
| 656 |
|
---|
| 657 | procedure TfrmEditCslt.memCommentKeyDown(Sender: TObject; var Key: Word;
|
---|
| 658 | Shift: TShiftState);
|
---|
| 659 | begin
|
---|
| 660 | //The navigating tab controls were inadvertantently adding tab characters
|
---|
| 661 | //This should fix it
|
---|
| 662 | FNavigatingTab := (Key = VK_TAB) and ([ssShift,ssCtrl] * Shift <> []);
|
---|
| 663 | if FNavigatingTab then
|
---|
| 664 | Key := 0;
|
---|
| 665 | end;
|
---|
| 666 |
|
---|
| 667 | procedure TfrmEditCslt.memCommentKeyPress(Sender: TObject; var Key: Char);
|
---|
| 668 | begin
|
---|
| 669 | if FNavigatingTab then
|
---|
| 670 | Key := #0; //Disable shift-tab processin
|
---|
| 671 | end;
|
---|
| 672 |
|
---|
| 673 | end.
|
---|