Procedure

TfrmGraphs.SpecRefSet

Module

fGraphs

Last Modified

7/15/2014 3:26:36 PM

Comments

For mutiple spec ranges replace data and items

Visibility

Private

Owner

TfrmGraphs

Declaration

procedure SpecRefSet(aItemType, aItemName: string);

Calls Hierarchy


TfrmGraphs.SpecRefSet
 └MultiRef

Called-By Hierarchy


                                            TfrmGraphs.SpecRefSet
                                             TfrmGraphs.LabData┘ 
                                      TfrmGraphs.SaveTestData┤   
                                         TfrmGraphs.FastLab┘ │   
                                        TfrmGraphs.Switch┘   │   
                                 TfrmGraphs.InitialData┤     │   
                                TfrmGraphs.Initialize┘ │     │   
                             TfrmFrame.ClearPatient┤   │     │   
                           TfrmFrame.SetupPatient┘ │   │     │   
                      UpdatePatientInfoForAlert┤   │   │     │   
                   TfrmFrame.mnuFileNextClick┘ │   │   │     │   
                 TfrmFrame.mnuFileOpenClick┤   │   │   │     │   
                     TfrmFrame.UMInitiate┤ │   │   │   │     │   
            TfrmFrame.mnuFileNextClick...┤ │   │   │   │     │   
            TfrmFrame.mnuFileRefreshClick┤ │   │   │   │     │   
            TfrmOrders.CheckOrderStatus┤ │ │   │   │   │     │   
        TfrmOrders.mnuActChgEvntClick┤ │ │ │   │   │   │     │   
           TfrmOrders.mnuActHoldClick┤ │ │ │   │   │   │     │   
         TfrmOrders.mnuActUnholdClick┤ │ │ │   │   │   │     │   
          TfrmOrders.mnuActRenewClick┤ │ │ │   │   │   │     │   
         TfrmOrders.mnuActChangeClick┤ │ │ │   │   │   │     │   
           TfrmOrders.mnuActCopyClick┘ │ │ │   │   │   │     │   
                 TfrmMeds.mnuActDCClick┤ │ │   │   │   │     │   
                TfrmMeds.CheckMedStatus┘ │ │   │   │   │     │   
             TfrmMeds.mnuActHoldClick┤   │ │   │   │   │     │   
            TfrmMeds.mnuActRenewClick┤   │ │   │   │   │     │   
           TfrmMeds.mnuActUnholdClick┤   │ │   │   │   │     │   
           TfrmMeds.mnuActChangeClick┤   │ │   │   │   │     │   
             TfrmMeds.mnuActCopyClick┤   │ │   │   │   │     │   
           TfrmMeds.mnuActRefillClick┘   │ │   │   │   │     │   
                       TfrmFrame.ViewInfo┘ │   │   │   │     │   
                    TfrmDCSumm.ViewInfo┤   │   │   │   │     │   
                  TfrmConsults.ViewInfo┤   │   │   │   │     │   
          TfrmFrame.pnlRemindersMouseUp┤   │   │   │   │     │   
           TfrmFrame.RemindersChanged┘ │   │   │   │   │     │   
               TfrmFrame.FormCreate┘   │   │   │   │   │     │   
                 TfrmFrame.pnlCIRNClick┤   │   │   │   │     │   
           TfrmFrame.pnlVistaWebClick┤ │   │   │   │   │     │   
                TfrmFrame.FormKeyDown┘ │   │   │   │   │     │   
              TfrmFrame.pnlPatientClick┤   │   │   │   │     │   
                TfrmFrame.pnlVisitClick┤   │   │   │   │     │   
          TfrmFrame.pnlPrimaryCareClick┤   │   │   │   │     │   
            TfrmFrame.pnlRemindersClick┤   │   │   │   │     │   
             TfrmFrame.pnlPostingsClick┤   │   │   │   │     │   
                 TfrmFrame.pnlFlagClick┤   │   │   │   │     │   
                   TfrmFrame.laMHVClick┤   │   │   │   │     │   
                  TfrmFrame.laVAA2Click┤   │   │   │   │     │   
                    TfrmOrders.ViewInfo┤   │   │   │   │     │   
                      TfrmMeds.ViewInfo┤   │   │   │   │     │   
                   TfrmSurgery.ViewInfo┤   │   │   │   │     │   
                     TfrmNotes.ViewInfo┤   │   │   │   │     │   
                  TfrmProblems.ViewInfo┘   │   │   │   │     │   
          TfrmFrame.mnuFileNotifRemoveClick┤   │   │   │     │   
                  TfrmFrame.NextButtonClick┘   │   │   │     │   
                TfrmFrame.SetUpNextButton┘     │   │   │     │   
          TfrmFrame.mnuFileOpenClick...┤       │   │   │     │   
                   TfrmFrame.FormResize┘       │   │   │     │   
                 TfrmFrame.ChangeFont┘         │   │   │     │   
         TfrmFrame.LoadSizesForUser┤           │   │   │     │   
    TfrmFrame.LoadUserPreferences┘ │           │   │   │     │   
           TfrmFrame.UMInitiate┘   │           │   │   │     │   
         TfrmFrame.mnuFontSizeClick┘           │   │   │     │   
                  TfrmFrame.mnuFileOpenClick...┤   │   │     │   
               TfrmFrame.AllowCCOWContextChange┤   │   │     │   
                TfrmFrame.mnuFileNextClick...┤ │   │   │     │   
                TfrmFrame.mnuFileOpenClick...┤ │   │   │     │   
       TfrmFrame.mnuFileResumeContextSetClick┘ │   │   │     │   
                    TfrmFrame.UpdateCCOWContext┤   │   │     │   
                TfrmFrame.mnuFileOpenClick...┤ │   │   │     │   
              TfrmFrame.ctxContextorCommitted┤ │   │   │     │   
               TfrmFrame.StartCCOWContextor┘ │ │   │   │     │   
                     TfrmFrame.FormCreate┘   │ │   │   │     │   
       TfrmFrame.mnuFileResumeContextGetClick┘ │   │   │     │   
         TfrmFrame.mnuFileResumeContextSetClick┘   │   │     │   
                    TfrmFrame.mnuToolsGraphingClick┤   │     │   
                             TfrmLabs.grdLabClick┤ │   │     │   
                          TfrmLabs.tvReportsClick┤ │   │     │   
                           TfrmLabs.DisplayPage┤ │ │   │     │   
                          TfrmLabs.LoadTreeView┤ │ │   │     │   
                         TfrmLabs.DisplayPage┤ │ │ │   │     │   
       TfrmOptionsReportsCustom.btnApplyClick┘ │ │ │   │     │   
        TfrmOptionsReportsCustom.btnOKClick┘   │ │ │   │     │   
                    TfrmLabs.cmdOtherTestsClick┤ │ │   │     │   
                       TfrmLabs.chkMaxFreqClick┤ │ │   │     │   
                  TfrmLabs.ProcessNotifications┤ │ │   │     │   
                         TfrmLabs.DisplayPage┘ │ │ │   │     │   
                                      ..(rec)..┤ │ │   │     │   
                      TfrmLabs.tvReportsKeyDown┤ │ │   │     │   
                TfrmFrame.lstCIRNLocationsClick┘ │ │   │     │   
                          TfrmFrame.SetUpCIRN┘   │ │   │     │   
                  TfrmFrame.SetupPatient...┘     │ │   │     │   
                                        ..(rec)..┘ │   │     │   
                            TfrmReports.ClearPtData┤   │     │   
                        TfrmFrame.ClearPatient...┘ │   │     │   
                                  TfrmReports.Graph┘   │     │   
                       TfrmReports.tvReportsClick┘     │     │   
             TfrmFrame.lstCIRNLocationsClick...┤       │     │   
                        TfrmReports.DisplayPage┤       │     │   
                       TfrmReports.LoadTreeView┤       │     │   
                      TfrmReports.DisplayPage┤ │       │     │   
         TfrmOptionsReportsDefault.btnOKClick┤ │       │     │   
      TfrmOptionsReportsDefault.btnResetClick┤ │       │     │   
    TfrmOptionsReportsCustom.btnApplyClick...┘ │       │     │   
               TfrmReports.ProcessNotifications┤       │     │   
                      TfrmReports.DisplayPage┘ │       │     │   
                   TfrmReports.tvReportsKeyDown┤       │     │   
                TfrmReports.tvProceduresKeyDown┤       │     │   
                    TfrmReports.chkMaxFreqClick┤       │     │   
           TfrmOptionsReportsDefault.btnOKClick┤       │     │   
        TfrmOptionsReportsDefault.btnResetClick┤       │     │   
      TfrmOptionsReportsCustom.btnApplyClick...┘       │     │   
                         TfrmGraphs.lvwItemsBottomClick┤     │   
                             TfrmGraphs.Initialize...┤ │     │   
                              TfrmGraphs.CheckContext┤ │     │   
                                TfrmGraphs.FormShow┘ │ │     │   
                         TfrmGraphs.chkDualViewsClick┤ │     │   
                           TfrmGraphs.Initialize...┤ │ │     │   
                                TfrmGraphs.FormShow┤ │ │     │   
                                             Layout┤ │ │     │   
                               TfrmGraphs.GetSize┘ │ │ │     │   
                            TfrmGraphs.FormShow┘   │ │ │     │   
               TfrmGraphs.mnuPopGraphDualViewsClick┤ │ │     │   
                          TfrmGraphs.ViewSelections┘ │ │     │   
                    TfrmReports.tvReportsClick...┤   │ │     │   
               TfrmGraphs.btnGraphSelectionsClick┘   │ │     │   
            TfrmReports.btnGraphSelectionsClick┘     │ │     │   
                               TfrmGraphs.GraphSwitch┤ │     │   
                               TfrmGraphs.GraphSwap┘ │ │     │   
                  TfrmGraphs.mnuPopGraphSwapClick┘   │ │     │   
                                TfrmGraphs.SplitClick┤ │     │   
                   TfrmGraphs.mnuPopGraphSplitClick┘ │ │     │   
                     TfrmGraphs.mnuPopGraphClearClick┤ │     │   
                                TfrmGraphs.AutoSelect┤ │     │   
                             TfrmGraphs.ViewsChange┘ │ │     │   
                     TfrmGraphs.lstViewsTopChange┤   │ │     │   
                       TfrmGraphs.Initialize...┤ │   │ │     │   
                      TfrmGraphs.GraphSwitch...┤ │   │ │     │   
                  TfrmGraphs.cboDateRangeChange┤ │   │ │     │   
                TfrmReports.lstDateRangeClick┤ │ │   │ │     │   
                     TfrmReports.GraphPanel┘ │ │ │   │ │     │   
                     TfrmReports.Graph...┤   │ │ │   │ │     │   
            TfrmReports.tvReportsClick...┘   │ │ │   │ │     │   
                     TfrmGraphs.Initialize...┤ │ │   │ │     │   
                          TfrmGraphs.FormShow┤ │ │   │ │     │   
            TfrmGraphs.btnChangeSettingsClick┤ │ │   │ │     │   
             TfrmReports.btnChangeViewClick┘ │ │ │   │ │     │   
                 TfrmGraphs.CheckExpandedLabs┤ │ │   │ │     │   
                      TfrmGraphs.ItemsClick┘ │ │ │   │ │     │   
                   TfrmGraphs.DisplayData┤   │ │ │   │ │     │   
              TfrmFrame.ClearPatient...┤ │   │ │ │   │ │     │   
             TfrmReports.ClearPtData...┤ │   │ │ │   │ │     │   
                   TfrmReports.Graph...┤ │   │ │ │   │ │     │   
            TfrmGraphs.chkItemsTopClick┤ │   │ │ │   │ │     │   
         TfrmGraphs.chkItemsBottomClick┤ │   │ │ │   │ │     │   
     TfrmGraphs.mnuPopGraphIsolateClick┤ │   │ │ │   │ │     │   
       TfrmGraphs.cboDateRangeChange...┤ │   │ │ │   │ │     │   
               TfrmGraphs.ItemsClick...┤ │   │ │ │   │ │     │   
              TfrmGraphs.ViewsChange...┤ │   │ │ │   │ │     │   
      TfrmGraphs.mnuPopGraphRemoveClick┘ │   │ │ │   │ │     │   
        TfrmGraphs.lvwItemsBottomClick...┤   │ │ │   │ │     │   
              TfrmGraphs.lvwItemsTopClick┘   │ │ │   │ │     │   
               TfrmGraphs.Initialize...┤     │ │ │   │ │     │   
                    TfrmGraphs.FormShow┤     │ │ │   │ │     │   
        TfrmGraphs.chkDualViewsClick...┤     │ │ │   │ │     │   
              TfrmGraphs.GraphSwitch...┤     │ │ │   │ │     │   
               TfrmGraphs.SplitClick...┤     │ │ │   │ │     │   
       TfrmGraphs.mnuPopGraphClearClick┤     │ │ │   │ │     │   
               TfrmGraphs.AutoSelect...┤     │ │ │   │ │     │   
       TfrmGraphs.mnuPopGraphResetClick┤     │ │ │   │ │     │   
                  TfrmGraphs.FormShow┤ │     │ │ │   │ │     │   
TfrmGraphs.mnuPopGraphHorizontalClick┤ │     │ │ │   │ │     │   
  TfrmGraphs.mnuPopGraphVerticalClick┤ │     │ │ │   │ │     │   
    TfrmGraphs.mnuPopGraphRemoveClick┤ │     │ │ │   │ │     │   
  TfrmGraphs.mnuPopGraphZoomBackClick┘ │     │ │ │   │ │     │   
           TfrmGraphs.lvwItemsTopChange┘     │ │ │   │ │     │   
                    TfrmGraphs.ViewsChange...┤ │ │   │ │     │   
         TfrmGraphs.mnuPopGraphMergeLabsClick┘ │ │   │ │     │   
                   TfrmGraphs.ViewSelections...┘ │   │ │     │   
                  TfrmGraphs.lstViewsBottomChange┘   │ │     │   
                       TfrmGraphs.Initialize...┤     │ │     │   
                      TfrmGraphs.GraphSwitch...┤     │ │     │   
               TfrmGraphs.cboDateRangeChange...┤     │ │     │   
                   TfrmGraphs.ViewSelections...┘     │ │     │   
                      TfrmGraphs.lvwItemsBottomChange┘ │     │   
                         TfrmGraphs.lvwItemsTopClick...┘     │   
                                    TfrmGraphs.CheckToAddData┘   
                                     TfrmGraphs.AllTypeDate┤     
                                  TfrmGraphs.SeriesClicks┤ │     
                        TfrmGraphs.chartBaseClickSeries┘ │ │     
                                 TfrmGraphs.MakeChart┘   │ │     
                       TfrmGraphs.MakeSeparateItems┤     │ │     
                          TfrmGraphs.MakeSeparate┘ │     │ │     
                      TfrmGraphs.DisplayData...┤   │     │ │     
                   TfrmGraphs.MakeTogetherMaybe┘   │     │ │     
                    TfrmGraphs.DisplayData...┘     │     │ │     
                            TfrmGraphs.MakeTogether┘     │ │     
                  TfrmGraphs.MakeTogetherMaybe...┘       │ │     
                                   TfrmGraphs.LabelClicks┤ │     
                                 TfrmGraphs.MouseClicks┘ │ │     
                        TfrmGraphs.chartBaseMouseDown┘   │ │     
                        TfrmGraphs.chkItemsTopClick┤     │ │     
                     TfrmGraphs.chkItemsBottomClick┤     │ │     
                            TfrmGraphs.MakeChart...┘     │ │     
                       TfrmGraphs.mnuPopGraphDetailsClick┘ │     
                                TfrmGraphs.MakeChart...┤   │     
                              TfrmGraphs.LabelClicks...┘   │     
                                   TfrmGraphs.ItemsClick...┘     

Calls

Name Declaration Comments
MultiRef function MultiRef(aline: string): boolean; -

Called-By

Name Declaration Comments
TfrmGraphs.LabData procedure LabData(aItemType, aItemName, aSection: string; getdata: boolean); -


Source

5767  procedure TfrmGraphs.SpecRefSet(aItemType, aItemName: string);
5768  
5769  function MultiRef(aline: string): boolean;
5770  // check for multiple ref ranges on test/specimen
5771  var
5772    cnt, i: integer;
5773    checkspec, listline, testspec: string;
5774  begin
5775    Result := false;
5776    checkspec := Piece(aline, '^', 2);
5777    cnt := 0;
5778    for i := 0 to GtslSpec2.Count - 1 do
5779    begin
5780      listline := GtslSpec2[i];
5781      testspec := Piece(listline, '^', 2);
5782      if testspec = checkspec then cnt := cnt + 1;
5783      if cnt > 1 then
5784      begin
5785        Result := true;
5786        break;
5787      end;
5788    end;
5789  end;
5790  
5791  var
5792    cnt, i, lastnum: integer;
5793    listline, newline, newtest, newtsru, oldline, oldspec, oldtsru, refrange: string;
5794    range, specimen, specimens: string;
5795    multispec: boolean;
5796  begin
5797    lastnum := GtslSpec1.Count - 1;
5798    if lastnum < 0 then
5799      exit;
5800    GtslSpec2.Clear; GtslSpec3.Clear; GtslSpec4.Clear;
5801    GtslSpec1.Sort;
5802    oldtsru := ''; newtest := '';
5803    oldspec := Piece(GtslSpec1[0], '^', 2);
5804    multispec := false;
5805    cnt := 0;
5806    for i := GtslSpec1.Count - 1 downto 0 do  // backwards to assure most recent item
5807    begin
5808      listline := GtslSpec1[i];
5809      if Piece(listline, '^', 2) <> oldspec then multispec := true;
5810      newtsru := Pieces(listline, '^', 1 , 4);
5811      if newtsru <> oldtsru then
5812      begin
5813        cnt := cnt + 1;
5814        newtest := Piece(listline, '^', 6) + '.' + inttostr(cnt);
5815        SetPiece(listline, '^', 1, newtest);
5816        GtslSpec2.Add(listline);
5817        oldtsru := newtsru;
5818      end;
5819      newline := Pieces(listline, '^', 5, 15);
5820      SetPiece(newline, '^', 2, newtest);
5821      GtslSpec3.Add(newline);
5822    end;
5823    oldline := '';
5824    for i := 0 to GtslItems.Count - 1 do
5825    if aItemType = Pieces(GtslItems[i], '^', 1, 2) then
5826    begin
5827      oldline := GtslItems[i];
5828      GtslItems.Delete(i);
5829      break;
5830    end;
5831    specimen := ''; specimens := ''; range := '';
5832    for i := 0 to GtslSpec2.Count - 1 do
5833    begin
5834      listline := GtslSpec2[i];
5835      newtest := Piece(oldline, '^', 4);
5836      if multispec then
5837      begin
5838        specimen := LowerCase(Piece(listline, '^', 12));
5839        newtest := newtest + ' (' + specimen + ')';
5840        specimens := specimens + specimen + ', ';
5841      end;
5842      if MultiRef(listline) then
5843      begin
5844        refrange := Piece(listline, '^', 14);
5845        range := Piece(refrange, '!', 1) + '-' + Piece(refrange, '!', 2);
5846        newtest := newtest + ' [' + range + ']';
5847      end;
5848      newline := oldline;
5849      SetPiece(newline, '^', 2, Piece(listline, '^', 1));
5850      SetPiece(newline, '^', 4, newtest);
5851      SetPiece(newline, '^', 6, Piece(listline, '^', 7));
5852      SetPiece(newline, '^', 10, Piece(listline, '^', 14));
5853      SetPiece(newline, '^', 11, Piece(listline, '^', 15));
5854      GtslSpec4.Add(newline);
5855    end;
5856    newline := oldline;
5857    newtest := Piece(newline, '^', 2) + '.0';
5858    SetPiece(newline, '^', 2, newtest);
5859    newtest := Piece(newline, '^', 4) + '*';
5860    {if length(specimens) > 0 then        // add multi-specimens to name
5861    begin
5862      specimens := LeftStr(specimens, length(specimens) - 2);
5863      newtest := newtest + ' (' + specimens + ')';
5864    end;}
5865    SetPiece(newline, '^', 4, newtest);
5866    GtslSpec4.Add(newline);
5867    FastAddStrings(GtslSpec4, GtslItems);
5868    FastAddStrings(GtslSpec3, GtslData);
5869    FastAssign(GtslSpec4, GtslMultiSpec);
5870  end;