Changeset 793 for cprs/branches/tmg-cprs/CPRS-Chart/fPtSel.pas
- Timestamp:
- Jun 10, 2010, 3:13:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/branches/tmg-cprs/CPRS-Chart/fPtSel.pas
r659 r793 11 11 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 12 12 StdCtrls, ORCtrls, ExtCtrls, ORFn, ORNet, ORDtTmRng, Gauges, Menus, ComCtrls, 13 UBAGlobals, UBACore, DKLang ;13 UBAGlobals, UBACore, DKLang, Buttons; 14 14 15 15 type … … 40 40 RadioGroup1: TRadioGroup; 41 41 TMGcmdAdd: TButton; 42 btnSearchPt: TBitBtn; 42 43 procedure cmdOKClick(Sender: TObject); 43 44 procedure cmdCancelClick(Sender: TObject); … … 80 81 procedure TMGcmdAddClick(Sender: TObject); 81 82 procedure FormCreate(Sender: TObject); 83 procedure btnSearchPtClick(Sender: TObject); 82 84 private 83 85 FsortCol: integer; … … 95 97 procedure AlertList; 96 98 procedure ReformatAlertDateTime; 99 procedure OpenPatient(NewSelectedPtIEN : string; InfoStr : string); //kt 6/3/10 97 100 public 98 101 procedure Loaded; override; … … 114 117 115 118 uses rCore, uCore, fDupPts, fPtSens, fPtSelDemog, fPtSelOptns, fPatientFlagMulti, 116 uOrPtf, fAlertForward, rMisc, fFrame, fPtAdd ;119 uOrPtf, fAlertForward, rMisc, fFrame, fPtAdd, fPtQuery; 117 120 118 121 const … … 467 470 procedure TfrmPtSel.cmdOKClick(Sender: TObject); 468 471 { Checks for restrictions on the selected patient and sets up the Patient object. } 472 var InfoStr : string; 473 begin 474 if cboPatient.ItemIndex > -1 then begin 475 InfoStr := cboPatient.Items[cboPatient.ItemIndex]; 476 end else begin 477 InfoStr := ''; 478 end; 479 with cboPatient do begin 480 OpenPatient(ItemID, InfoStr); 481 end; 482 483 (* 484 { Checks for restrictions on the selected patient and sets up the Patient object. } 469 485 const 470 486 DLG_CANCEL = False; … … 546 562 else if Patient.Inpatient then // Everything else: 547 563 begin 564 Encounter.Inpatient := True; 565 Encounter.Location := Patient.Location; 566 Encounter.DateTime := Patient.AdmitTime; 567 Encounter.VisitCategory := 'H'; 568 end; 569 if User.IsProvider then Encounter.Provider := User.DUZ; 570 571 GetBAStatus(Encounter.Provider,Patient.DFN); 572 //HDS00005025 573 if BILLING_AWARE then 574 if Assigned(UBAGLOBALS.BAOrderList) then UBAGLOBALS.BAOrderList.Clear; 575 FUserCancelled := FALSE; 576 Close; 577 end; 578 579 *) 580 end; 581 582 procedure TfrmPtSel.OpenPatient(NewSelectedPtIEN, InfoStr : string); 583 //kt This function used to be named cmdOKClick. I split into separate functions 584 // so that it can be called by AddNewPatient, and SearchForPatient functionality. 585 // However, after splitting the function, I see that many info pieces are needed 586 // from the cboPatient list, so substituting that is problematic. It may be optional. 587 // 6/3/10 588 { Checks for restrictions on the selected patient and sets up the Patient object. } 589 const 590 DLG_CANCEL = False; 591 DGSR_FAIL = -1; 592 DGSR_NONE = 0; 593 DGSR_SHOW = 1; 594 DGSR_ASK = 2; 595 DGSR_DENY = 3; 596 var 597 NewDFN, AMsg: string; //*DFN* 598 AccessStatus: Integer; 599 DateDied: TFMDateTime; 600 begin 601 if (NewSelectedPtIEN='') then begin //*DFN* 602 InfoBox('A patient has not been selected.', 'No Patient Selected', MB_OK); 603 Exit; 604 end; 605 NewDFN := NewSelectedPtIEN; //*DFN* 606 if FLastPt <> NewDFN then begin 607 HasActiveFlg(FlagList, HasFlag, NewDFN); 608 flastpt := NewDFN; 609 end; 610 611 If DupLastSSN(NewDFN) then begin // Check for, deal with duplicate patient data. 612 if (DupDFN = 'Cancel') then begin 613 Exit 614 end else begin 615 NewDFN := DupDFN; 616 end; 617 end; 618 CheckSensitiveRecordAccess(NewDFN, AccessStatus, AMsg); 619 case AccessStatus of 620 DGSR_FAIL: begin 621 InfoBox(TX_DGSR_ERR, TC_DGSR_ERR, MB_OK); 622 Exit; 623 end; 624 DGSR_NONE: { Nothing - allow access to the patient. }; 625 // DGSR_SHOW: InfoBox(AMsg, TC_DGSR_SHOW, MB_OK); 626 DGSR_SHOW: InfoBox(DKLangConstW('ptSelWarning'), DKLangConstW('fPatSel_Restricted'), MB_OK); 627 DGSR_ASK: if InfoBox(AMsg + TX_DGSR_YESNO, TC_DGSR_SHOW, MB_YESNO or MB_ICONWARNING or 628 MB_DEFBUTTON2) = IDYES then LogSensitiveRecordAccess(NewDFN) else Exit; 629 else begin 630 InfoBox(AMsg, TC_DGSR_DENY, MB_OK); 631 Exit; 632 end; 633 end; {case} 634 DateDied := DateOfDeath(NewDFN); 635 if (DateDied > 0) then begin 636 if InfoBox('This patient died ' + 637 FormatFMDateTime('mmm dd,yyyy hh:nn', DateDied) + CRLF + 638 'Do you wish to continue?', 'Deceased Patient', 639 MB_YESNO or MB_DEFBUTTON2) = ID_NO then begin 640 Exit; 641 end; 642 end; 643 // 9/23/2002: Code used to check for changed pt. DFN here, but since same patient could be 644 // selected twice in diff. Encounter locations, check was removed and following code runs 645 // no matter; in fFrame code then updates Encounter display if Encounter.Location has changed. 646 // NOTE: Some pieces in RPC returned arrays are modified/rearranged by ListPtByDflt call in rCore! 647 Patient.DFN := NewDFN; // The patient object in uCore must have been created already! 648 Encounter.Clear; 649 Changes.Clear; // An earlier call to ReviewChanges should have cleared this. 650 if (frmPtSelOptns.SrcType = TAG_SRC_CLIN) and (frmPtSelOptns.cboList.ItemIEN > 0) 651 and IsFMDateTime(Piece(InfoStr, U, 4)) then begin// Clinics, not by default. 652 Encounter.Location := frmPtSelOptns.cboList.ItemIEN; 653 Encounter.DateTime := MakeFMDateTime(Piece(InfoStr, U, 4)); 654 end else if (frmPtSelOptns.SrcType = TAG_SRC_DFLT) and (DfltPtListSrc = 'C') 655 and IsFMDateTime(Piece(InfoStr, U, 4)) 656 then begin // "Default" is a clinic. 657 Encounter.Location := StrToIntDef(Piece(InfoStr, U, 10), 0); // Piece 10 is ^SC( location IEN in this case. 658 Encounter.DateTime := MakeFMDateTime(Piece(InfoStr, U, 4)); 659 end else if ((frmPtSelOptns.SrcType = TAG_SRC_DFLT) and (FDfltSrc = 'Combination') 660 and (copy(Piece(InfoStr, U, 3), 1, 2) = 'Cl')) 661 and (IsFMDateTime(Piece(InfoStr, U, 8))) 662 then begin// "Default" combination, clinic pt. 663 Encounter.Location := StrToIntDef(Piece(InfoStr, U, 7), 0); // Piece 7 is ^SC( location IEN in this case. 664 Encounter.DateTime := MakeFMDateTime(Piece(InfoStr, U, 8)); 665 end else if Patient.Inpatient then begin// Everything else: 548 666 Encounter.Inpatient := True; 549 667 Encounter.Location := Patient.Location; … … 1211 1329 end; 1212 1330 1331 procedure TfrmPtSel.btnSearchPtClick(Sender: TObject); 1332 var InfoStr : string; 1333 IEN : int64; 1334 begin 1335 frmPtQuery.InitializeForm('PATIENT', 2); 1336 if frmPtQuery.ShowModal = mrOK then begin 1337 cboPatient.InitLongList(frmPtQuery.SelectedName); 1338 IEN := StrToInt64Def(frmPtQuery.SelectedIEN,0); 1339 if IEN < 1 then exit; 1340 cboPatient.SelectByIEN(IEN); 1341 if cboPatient.ItemID = frmPtQuery.SelectedIEN then begin 1342 InfoStr := cboPatient.Items[cboPatient.ItemIndex]; 1343 end else begin 1344 InfoStr := ''; 1345 end; 1346 OpenPatient(frmPtQuery.SelectedIEN, InfoStr); 1347 end; 1348 end; 1349 1213 1350 Initialization 1214 1351 SortViaKeyboard := false;
Note:
See TracChangeset
for help on using the changeset viewer.