Ignore:
Timestamp:
May 7, 2015, 12:34:29 PM (9 years ago)
Author:
healthsevak
Message:

Updating the working copy to CPRS version 28

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/trunk/CPRS-Chart/fPtSel.pas

    r830 r1679  
    11unit fPtSel;
    22{ Allows patient selection using various pt lists.  Allows display & processing of alerts. }
    3  //vwpt enhancements included
    43
    54{$OPTIMIZATION OFF}                              // REMOVE AFTER UNIT IS DEBUGGED
     
    3837    lstvAlerts: TCaptionListView;
    3938    N1: TMenuItem;
    40     RadioGroup1: TRadioGroup ;
    41     //RadioGroup1: TRadioGroup;
    4239    cmdComments: TButton;
     40    txtCmdComments: TVA508StaticText;
     41    txtCmdRemove: TVA508StaticText;
     42    txtCmdForward: TVA508StaticText;
     43    txtCmdProcess: TVA508StaticText;
    4344    procedure cmdOKClick(Sender: TObject);
    4445    procedure cmdCancelClick(Sender: TObject);
     
    8081    procedure FormResize(Sender: TObject);
    8182    procedure cmdCommentsClick(Sender: TObject);
    82 
    83     //VWPT ENAHANCED PATIENT LOOKUP
    84     function IsOther(itemindex:Integer):Boolean;
    85    
    86     procedure onclick1(Sender: TObject);
    87 
     83    procedure lstvAlertsMouseUp(Sender: TObject; Button: TMouseButton;
     84      Shift: TShiftState; X, Y: Integer);
     85    procedure cboPatientKeyUp(Sender: TObject; var Key: Word;
     86      Shift: TShiftState);
    8887  private
    8988    FsortCol: integer;
     
    9493    FNotificationBtnsAdjusted: Boolean;
    9594    FAlertsNotReady: boolean;
     95    FMouseUpPos: TPoint;
    9696    procedure WMReadyAlert(var Message: TMessage); message UM_MISC;
    9797    procedure ReadyAlert;
     
    107107    procedure AdjustButtonSize(pButton:TButton);
    108108    procedure AdjustNotificationButtons;
     109    procedure SetupDemographicsForm;
     110    procedure ShowDisabledButtonTexts;
    109111
    110112  public
     
    121123  PtStrs: TStringList;
    122124
    123     //vwpt enhancement
    124   itimson : integer = 1;
    125   enhanceskip : integer = 0;
    126   radiogrp1index : integer = 0;
    127 
    128125
    129126implementation
     
    132129
    133130uses rCore, uCore, fDupPts, fPtSens, fPtSelDemog, fPtSelOptns, fPatientFlagMulti,
    134      uOrPtf, fAlertForward, rMisc, fFrame, fRptBox, VA508AccessibilityRouter;
    135 
    136 resourcestring
    137   StrFPtSel_lstvAlerts_Co = 'C'+U+'fPtSel.lstvAlerts.Cols';
     131     uOrPtf, fAlertForward, rMisc, fFrame, fRptBox, VA508AccessibilityRouter,
     132     VAUtils;
     133
     134var
     135  FDragging: Boolean = False;
    138136
    139137const
    140138  AliasString = ' -- ALIAS';
    141 
    142    //VWPT ENAHANCED PATIENT LOOKUP
    143 function TfrmPtSel.IsOther(itemindex:Integer):Boolean;
    144 var
    145    i:Integer  ;
    146 
    147 begin
    148          Result := True;
    149          if (RadioGroup1.ItemIndex = -1) or (RadioGroup1.ItemIndex = 0) or (itimson = 0) then Result := False;
    150 end;
    151139
    152140procedure SelectPatient(ShowNotif: Boolean; FontSize: Integer; var UserCancelled: boolean);
     
    191179var
    192180  Rect: TRect;
    193 //  TheFormHeight: integer;
    194181  SplitterTop, t1, t2, t3: integer;
    195182begin
     183  SetFormPosition(self);
    196184  ResizeAnchoredFormToFont(self);
    197 //  TheFormHeight := pnlPtSel.Height;
    198   // Make the form bigger (140%) to show notifications and show notification controls.
    199185  if ShowNotif then
    200186  begin
    201 //    TheFormHeight := Round(TheFormHeight * 2.4);
    202 //    pnlDivide.Height := lblNotifications.Height + 4;
    203187    pnlDivide.Visible := True;
    204188    lstvAlerts.Visible := True;
    205189    pnlNotifications.Visible := True;
    206190    pnlPtSel.BevelOuter := bvRaised;
    207 //    ClientHeight := TheFormHeight;
    208191  end
    209192  else
     
    212195    lstvAlerts.Visible := False;
    213196    pnlNotifications.Visible := False;
    214 //    ClientHeight := TheFormHeight;
    215 //    pnlPtSel.Anchors := [akLeft,akRight,akTop,akBottom];
    216   end;
    217 //  ClientHeight := TheFormHeight;
    218 //  VertScrollBar.Range := TheFormHeight;
    219 
    220   //After all of this calcualtion, we still use the saved preferences when possible
    221   SetFormPosition(self);
     197  end;
     198  //SetFormPosition(self);
    222199  Rect := BoundsRect;
    223200  ForceInsideWorkArea(Rect);
    224201  BoundsRect := Rect;
    225 
    226202  if frmFrame.EnduringPtSelSplitterPos <> 0 then
    227203    SplitterTop := frmFrame.EnduringPtSelSplitterPos
     
    270246    Items.Add(LLS_SPACE);
    271247    cboPatient.InitLongList('');
    272   //VWPT
    273   //cboPatient.LongList := True;
    274   //cboPateint.HintonItem := True;
    275   //end
    276248    RedrawActivate(cboPatient.Handle);
    277249  end;
     
    402374    end;
    403375
    404 var caption:string;
    405 index:integer;
    406 
    407    
    408376begin
    409377  with cboPatient do
    410     if IsOther(integer(1))and (IsRPL <> '1')and (enhanceskip=0) and (frmPtSelOptns.IsEnhanced(Text))and (not frmPtSelOptns.IsPatientName(Text)) then
    411       begin
    412         if (IsRPL = '1') then
    413           ///ListPtByRPLLast5(Items, Text)   Messagebox error
    414         else
    415          begin
    416              index := RadioGroup1.ItemIndex;
    417              caption := piece(RadioGroup1.Items[index],'&',2);
    418              //Application.MessageBox(pChar(caption), pChar('Message'),MB_OK);
    419              //caption := '' ; //derivative of integer(1) or other index of radio button selection
    420              ListPtByOther(Items, Text,caption); // one extra argument on radio button selection
    421              if Items.Count>0  then
    422              begin
    423                   //itimson :=0 ;//no check for timson change in cbopatient until after click event finished
    424              RadioGroup1.ItemIndex  := 0;
    425              RadioGroup1.SetFocus;
    426              RadioGroup1.Refresh;
    427              end;
    428              ShowMatchingPatients;
    429          end;
    430       end
    431     else if frmPtSelOptns.IsLast5(Text) then
     378    if frmPtSelOptns.IsLast5(Text) then
    432379      begin
    433380        if (IsRPL = '1') then
     
    443390        else
    444391           ListPtByFullSSN(Items, Text);
    445         ShowMatchingPatients
    446       end
    447     else if (not IsOther(integer(1))) and (IsRPL <> '1')and (enhanceskip=0) and (frmPtSelOptns.IsEnhanced(Text)) and (not frmPtSelOptns.IsPatientName(Text)) then
    448     begin
    449 
    450            ListPtByTimson(Items,Text) ;
    451            ShowMatchingPatients;
    452           //vwpt enhanced changes
    453           //check for change here if itimson flag =1 .no matter what however, even if 0,
    454          //set it back to 1
    455          //itimson :=1;
    456          //end vwpt enhanced
    457 
    458 
    459     end
    460     //enhanceskip := 0 ;
     392        ShowMatchingPatients;
     393      end;
    461394end;
    462395
     
    473406end;
    474407
     408procedure TfrmPtSel.cboPatientKeyUp(Sender: TObject; var Key: Word;
     409  Shift: TShiftState);
     410begin
     411  inherited;
     412  if (Key = VK_BACK) and (cboPatient.Text = '') then cboPatient.ItemIndex := -1;
     413end;
     414
    475415procedure TfrmPtSel.cboPatientMouseClick(Sender: TObject);
    476416begin
     
    487427procedure TfrmPtSel.cboPatientDblClick(Sender: TObject);
    488428begin
    489   // vwpt enhanced   on click or double clck set mode back to normal to a.) not allow change event
    490  //erroneously checked with false lookup, and b.0 immedicately put back into normal mode
    491  //without separate step needed.
    492   if (RadioGroup1.ItemIndex  > 0) then
    493   begin
    494   //itimson :=0 ;//no check for timson change in cbopatient until after click event finished
    495   RadioGroup1.ItemIndex  := 0;
    496   RadioGroup1.SetFocus;
    497   RadioGroup1.Refresh;
    498   end;
    499   //enhanceskip:=1 ;
    500 
    501 //end vwpt enhanced
    502429  if Length(cboPatient.ItemID) > 0 then cmdOKClick(Self);  //*DFN*
    503430end;
     
    573500  AccessStatus: integer;
    574501begin
    575 // vwpt enhanced   on click or double clck set mode back to normal to a.) not allow change event
    576 //erroneiusly checked with false lookup, and b.0 immedicately put back into normal mode
    577 //without separate step needed.
    578   if (RadioGroup1.ItemIndex  > 0 ) then
    579   begin
    580   //itimson :=0 ;//no check for timson change in cbopatient until after click event finished
    581   RadioGroup1.ItemIndex  := 0;
    582   RadioGroup1.SetFocus;
    583   RadioGroup1.Refresh;
    584   end;
    585 
    586 //end vwpt enhanced
    587502if not (Length(cboPatient.ItemID) > 0) then  //*DFN*
    588503  begin
     
    731646          ADFN := Piece(XQAID, ',', 2);  //*DFN*
    732647          AFollowUp := StrToIntDef(Piece(Piece(XQAID, ';', 1), ',', 3), 0);
    733           Notifications.Add(ADFN, AFollowUp, RecordID);
     648          Notifications.Add(ADFN, AFollowUp, RecordID, Items[i].SubItems[3]); //CB
    734649          enableclose := true;
    735650        end
     
    812727
    813728procedure TfrmPtSel.lstvAlertsDblClick(Sender: TObject);
     729var
     730  ScreenCurPos, ClientCurPos: TPoint;
    814731begin
    815732  cmdProcessClick(Self);
     733  ScreenCurPos.X := 0;
     734  ScreenCurPos.Y := 0;
     735  ClientCurPos.X := 0;
     736  ClientCurPos.Y := 0;
     737  if GetCursorPos(ScreenCurPos) then ClientCurPos := lstvAlerts.ScreenToClient(ScreenCurPos); //convert screen coord. to client coord.
     738  //fixes CQ 18657: double clicking on notification, does not go to pt. chart until mouse is moved. [v28.4 - TC]
     739  if (FMouseUpPos.X = ClientCurPos.X) and (FMouseUpPos.Y = ClientCurPos.Y) then
     740    begin
     741      lstvAlerts.BeginDrag(False,0);
     742      FDragging := True;
     743    end;
    816744end;
    817745
     
    866794
    867795procedure TfrmPtSel.FormDestroy(Sender: TObject);
     796var
     797  i: integer;
     798  AString: string;
    868799begin
    869800  SaveUserBounds(Self);
    870801  frmFrame.EnduringPtSelSplitterPos := pnlPtSel.Height;
     802  AString := '';
     803  for i := 0 to 6 do
     804  begin
     805    AString := AString + IntToStr(lstvAlerts.Column[i].Width);
     806    if i < 6 then AString:= AString + ',';
     807  end;
     808  frmFrame.EnduringPtSelColumns := AString;
    871809 end;
    872810
     
    888826begin
    889827  frmPtSelDemog.Left := cboPatient.Left + cboPatient.Width + 9;
    890   //  frmPtSelDemog.Width := frmPtSel.CmdCancel.Left - frmPtSelDemog.Left-2;// before vwpt enhancements pnlPtSel.Width - frmPtSelDemog.Left - 2;
     828  frmPtSelDemog.Width := pnlPtSel.Width - frmPtSelDemog.Left - 2;
    891829  frmPtSelOptns.Width := cboPatient.Left-8;
    892830end;
     
    895833begin
    896834  inherited;
    897 // This needs to be in Loaded rather than FormCreate or the TORAutoPanel resize logic breaks.
    898   //vwpt enhancements
    899   CmdOK.parent := pnlPtSel;
    900   CmdCancel.parent  :=  pnlPtSel;
    901   //end vwpt
    902   frmPtSelDemog := TfrmPtSelDemog.Create(Self);  // Was application - kcm
    903   with frmPtSelDemog do
    904   begin
    905     parent := pnlPtSel;
    906     Top := 4; //before vwpt change was 65
    907     Left := cboPatient.Left + cboPatient.Width + 9;
    908     //Width := pnlPtSel.Width - Left - 2; //before vwpt change
    909     Width := CmdCancel.Left - Left-2  ;
    910     TabOrder := cmdCancel.TabOrder + 1;  //Place after cancel button
    911     Show;
    912   end;
    913 
    914   with RadioGroup1 do
    915   begin
    916       parent := pnlPtSel;
    917       TabOrder  := cmdCancel.TabOrder + 2;
    918       Show;
    919   end;
    920   //end vwpt enhancements
     835  SetupDemographicsForm;
    921836
    922837  frmPtSelOptns := TfrmPtSelOptns.Create(Self);  // Was application - kcm
     
    940855end;
    941856
     857procedure TfrmPtSel.ShowDisabledButtonTexts;
     858begin
     859  if ScreenReaderActive then
     860  begin
     861    txtCmdProcess.Visible := not cmdProcess.Enabled;
     862    txtCmdRemove.Visible := not cmdRemove.Enabled;
     863    txtCmdForward.Visible := not cmdForward.Enabled;
     864    txtCmdComments.Visible := not cmdComments.Enabled;
     865  end;
     866end;
     867
     868procedure TfrmPtSel.SetupDemographicsForm;
     869begin
     870  // This needs to be in Loaded rather than FormCreate or the TORAutoPanel resize logic breaks.
     871  frmPtSelDemog := TfrmPtSelDemog.Create(Self);
     872  // Was application - kcm
     873  with frmPtSelDemog do
     874  begin
     875    parent := pnlPtSel;
     876    Top := cmdCancel.Top + cmdCancel.Height + 2;
     877    Left := cboPatient.Left + cboPatient.Width + 9;
     878    Width := pnlPtSel.Width - Left - 2;
     879    TabOrder := cmdCancel.TabOrder + 1;
     880    //Place after cancel button
     881    Show;
     882  end;
     883  if ScreenReaderActive then begin
     884    frmPtSelDemog.Memo.Show;
     885    frmPtSelDemog.Memo.BringToFront;
     886  end;
     887end;
     888
    942889procedure TfrmPtSel.RPLDisplay;
    943890begin
     
    950897
    951898procedure TfrmPtSel.FormClose(Sender: TObject; var Action: TCloseAction);
    952 var
    953   colSizes : String;
    954 begin
    955   colSizes := '';
    956   with lstvAlerts do begin
    957     colSizes := IntToStr(Columns[0].Width) + ',';  //Info                 Caption
    958     colSizes := colSizes + IntToStr(Columns[1].Width) + ',';  //Patient              SubItems[0]
    959     colSizes := colSizes + IntToStr(Columns[2].Width) + ',';  //Location             SubItems[1]
    960     colSizes := colSizes + IntToStr(Columns[3].Width) + ',';  //Urgency              SubItems[2]
    961     colSizes := colSizes + IntToStr(Columns[4].Width) + ',';  //Alert Date/Time      SubItems[3]
    962     colSizes := colSizes + IntToStr(Columns[5].Width) + ',';  //Message Text         SubItems[4]
    963     colSizes := colSizes + IntToStr(Columns[6].Width);  //Forwarded By/When    SubItems[5]
    964   end;
    965   SizeHolder.SetSize(StrFPtSel_lstvAlerts_Co,colSizes);
     899begin
     900if FDragging then
     901begin
     902  lstvAlerts.EndDrag(True); //terminate fake dragging operation from lstvAlertsDblClick.
     903  FDragging := False;
     904end;
    966905
    967906if (IsRPL = '1') then                          // Deal with restricted patient list users.
     
    975914  DefaultButton := cmdOK;
    976915  FAlertsNotReady := FALSE;
     916  ShowDisabledButtonTexts;
    977917end;
    978918
     
    10601000  NewItem: TListItem;
    10611001  I,J: Integer;
    1062   Comment,colSizes : String;
     1002  Comment: String;
    10631003begin
    10641004  // Load the items
    1065   colSizes := '';
    10661005  lstvAlerts.Items.Clear;
    10671006  List := TStringList.Create;
     
    10921031   with lstvAlerts do
    10931032     begin
    1094         colSizes := SizeHolder.GetSize(StrFPtSel_lstvAlerts_Co);
    1095         if colSizes = '' then begin
    1096           Columns[0].Width := 40;          //Info                 Caption
    1097           Columns[1].Width := 195;         //Patient              SubItems[0]
    1098           Columns[2].Width := 75;          //Location             SubItems[1]
    1099           Columns[3].Width := 95;          //Urgency              SubItems[2]
    1100           Columns[4].Width := 150;         //Alert Date/Time      SubItems[3]
    1101           Columns[5].Width := 310;         //Message Text         SubItems[4]
    1102           Columns[6].Width := 290;         //Forwarded By/When    SubItems[5]
    1103         end else begin
    1104           Columns[0].Width := StrToInt(piece(colSizes,',',1));          //Info                 Caption
    1105           Columns[1].Width := StrToInt(piece(colSizes,',',2));         //Patient              SubItems[0]
    1106           Columns[2].Width := StrToInt(piece(colSizes,',',3));          //Location             SubItems[1]
    1107           Columns[3].Width := StrToInt(piece(colSizes,',',4));          //Urgency              SubItems[2]
    1108           Columns[4].Width := StrToInt(piece(colSizes,',',5));         //Alert Date/Time      SubItems[3]
    1109           Columns[5].Width := StrToInt(piece(colSizes,',',6));         //Message Text         SubItems[4]
    1110           Columns[6].Width := StrToInt(piece(colSizes,',',7));         //Forwarded By/When    SubItems[5]
    1111         end;
    1112 
     1033        Columns[0].Width := StrToIntDef(Piece(frmFrame.EnduringPtSelColumns, ',', 1), 40);          //Info                 Caption
     1034        Columns[1].Width := StrToIntDef(Piece(frmFrame.EnduringPtSelColumns, ',', 2), 195);         //Patient              SubItems[0]
     1035        Columns[2].Width := StrToIntDef(Piece(frmFrame.EnduringPtSelColumns, ',', 3), 75);          //Location             SubItems[1]
     1036        Columns[3].Width := StrToIntDef(Piece(frmFrame.EnduringPtSelColumns, ',', 4), 95);          //Urgency              SubItems[2]
     1037        Columns[4].Width := StrToIntDef(Piece(frmFrame.EnduringPtSelColumns, ',', 5), 150);         //Alert Date/Time      SubItems[3]
     1038        Columns[5].Width := StrToIntDef(Piece(frmFrame.EnduringPtSelColumns, ',', 6), 310);         //Message Text         SubItems[4]
     1039        Columns[6].Width := StrToIntDef(Piece(frmFrame.EnduringPtSelColumns, ',', 7), 290);         //Forwarded By/When    SubItems[5]
    11131040     //Items not displayed in Columns:     XQAID                SubItems[6]
    11141041     //                                    Remove w/o process   SubItems[7]
    11151042     //                                    Forwarding comments  SubItems[8]
    11161043     end;
    1117   //with lstvAlerts do      ca comment out 12/24/03 to prevent default selection of first alert on list
    1118     //if (ItemIndex = -1) and (Items.Count > 0) then
    1119       //ItemIndex := 0;
    11201044end;
    11211045
     
    12541178  cmdForward.Enabled := ShowButts;
    12551179  cmdComments.Enabled := ShowButts and (lstvAlerts.SelCount = 1) and (lstvAlerts.Selected.SubItems[8] <> '');
     1180  ShowDisabledButtonTexts;
    12561181end;
    12571182
     
    12851210end;
    12861211
     1212procedure TfrmPtSel.lstvAlertsMouseUp(Sender: TObject; Button: TMouseButton;
     1213  Shift: TShiftState; X, Y: Integer);
     1214begin
     1215  inherited;
     1216  FMouseUpPos := Point(X,Y);
     1217end;
     1218
    12871219procedure TfrmPtSel.FormShow(Sender: TObject);
    12881220{
     
    12961228  sortResult := rCore.GetSortMethod;
    12971229  sortMethod := Piece(sortResult, U, 1);
     1230  if sortMethod = '' then
     1231     sortMethod := 'D';
    12981232  FsortDirection := Piece(sortResult, U, 2);
    12991233  if FsortDirection = 'F' then
     
    13851319end;
    13861320
    1387 //vwpt enhanced //
    1388 procedure TfrmPtSel.onclick1(Sender: TObject);  //click on RadioGroup1
    1389 var index :integer;
    1390 
    1391 begin
    1392 if RadioGroup1.ItemIndex >0 then
    1393  begin
    1394      itimson := 1  ;
    1395      cboPatient.Text := '' ;
    1396      if (frmPtSelOptns.radAll.Checked <> True)and (frmPtSelOptns.radDflt.Checked <> True) then
    1397      begin
    1398         radiogrp1index :=0  ;
    1399         RadioGroup1.ItemIndex  := 0;
    1400         RadioGroup1.SetFocus;
    1401         RadioGroup1.Refresh;
    1402      end
    1403      else
    1404      begin
    1405           index := RadioGroup1.ItemIndex;
    1406           radiogrp1index := index;
    1407           cboPatient.Hint  := 'Enter ' + piece(RadioGroup1.Items[index],'&',2);
    1408      end ;
    1409  end
    1410  else
    1411  begin
    1412        //itimson := 0;
    1413         cboPatient.Hint :=  'Enter name,Full SSN,Last4(x1234),''HRN'',DOB,or Phone#'  ;
    1414         radiogrp1index := 0;
    1415  end;
    1416 
    1417 end;
    1418  //end vwpt enhanced
    1419 
    14201321
    14211322end.
Note: See TracChangeset for help on using the changeset viewer.