Procedure

TfrmLabs.GetInterimGrid

Module

fLabs

Last Modified

7/15/2014 3:26:38 PM

Visibility

Private

Owner

TfrmLabs

Declaration

procedure GetInterimGrid(adatetime: TFMDateTime; direction: integer);

Calls Hierarchy


TfrmLabs.GetInterimGrid
 ├GetNewestOldest
 ├InterimGrid
 ├LabPatchInstalled
 │ └ServerHasPatch
 ├TfrmLabs.FillGrid
 └TfrmLabs.FillComments

Called-By Hierarchy


                                TfrmLabs.GetInterimGrid
                                TfrmLabs.cmdNextClick┤ 
                                TfrmLabs.cmdPrevClick┤ 
                              TfrmLabs.cmdRecentClick┤ 
                            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┘       │ 
                  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┘         │ 
                                 TfrmLabs.cmdOldClick┘ 

Calls

Name Declaration Comments
TfrmLabs.FillComments procedure FillComments(amemo: TRichEdit; aitems:TStrings); -
TfrmLabs.FillGrid procedure FillGrid(agrid: TStringGrid; aitems: TStrings); -
GetNewestOldest procedure GetNewestOldest(const PatientDFN: string; var newest, oldest: string); -
InterimGrid function InterimGrid(const PatientDFN: string; ADate1: TFMDateTime; direction, format: integer): TStrings; -
LabPatchInstalled function LabPatchInstalled: boolean; -

Called-By

Name Declaration Comments
TfrmLabs.cmdNextClick procedure cmdNextClick(Sender: TObject); -
TfrmLabs.cmdOldClick procedure cmdOldClick(Sender: TObject); -
TfrmLabs.cmdPrevClick procedure cmdPrevClick(Sender: TObject); -
TfrmLabs.cmdRecentClick procedure cmdRecentClick(Sender: TObject); -


Source

2024  procedure TfrmLabs.GetInterimGrid(adatetime: TFMDateTime; direction: integer);
2025  var
2026    tmpList: TStringList;
2027    nexton, prevon: boolean;
2028    newest, oldest, DisplayDate, aCollection, aSpecimen, aX: string;
2029    i,ix: integer;
2030  begin
2031    tmpList := TStringList.Create;
2032    GetNewestOldest(Patient.DFN, newest, oldest);  //****** PATCH
2033    prevon := true;
2034    aCollection := '';
2035    aSpecimen := '';
2036    aX := '';
2037    lblSample.Caption := '';
2038    lblSample.Color := clBtnFace;
2039    try
2040      FastAssign(InterimGrid(Patient.DFN, adatetime, direction, uFormat), tmpList);
2041      if tmpList.Count > 0 then
2042      begin
2043        lblDateFloat.Caption := Piece(tmpList[0], '^', 3);
2044        uFormat := strtointdef(Piece(tmpList[0], '^', 9), 1);
2045        //------------------------------------------------------------------------------------------
2046        //v27.1 - RV - PSI-05-118 / Remedy HD0000000123277 - don't show "00:00" if no time present
2047        if LabPatchInstalled then        // Requires lab patch in const "PSI_05_118"
2048        begin
2049          DisplayDate := Piece(tmpList[0], '^', 3);
2050          if length(DisplayDate) > 7 then
2051            lblDate.Caption := FormatFMDateTime('MMM DD, YYYY hh:nn', strtofloat(DisplayDate))
2052          else if length(DisplayDate) > 0 then
2053            lblDate.Caption := FormatFMDateTime('MMM DD, YYYY', strtofloat(DisplayDate))
2054          else
2055            if length(lblDateFloat.Caption) > 0 then
2056              lblDate.Caption := FormatFMDateTime('MMM DD, YYYY hh:nn', strtofloat(lblDateFloat.Caption));
2057        end
2058        else                             // If no lab patch in const "PSI_05_118", continue as is
2059        begin
2060          if length(lblDateFloat.Caption) > 0 then
2061            lblDate.Caption := FormatFMDateTime('MMM DD, YYYY hh:nn', strtofloat(lblDateFloat.Caption));
2062        end;
2063        //------------------------------------------------------------------------------------------
2064        if length(lblDateFloat.Caption) < 1
2065        then
2066        begin
2067          lblDateFloat.Caption := FloatToStr(adatetime);
2068          nexton := false;
2069        end
2070        else
2071        begin
2072          nexton := lblDateFloat.Caption <> newest;
2073          prevon := lblDateFloat.Caption <> oldest;
2074        end;
2075        if (not nexton) and (uFormat = 3) then
2076          nexton := true;
2077        if (not prevon) and (uFormat = 2) then
2078          prevon := true;
2079        if Piece(tmpList[0], '^', 2) = 'CH' then
2080          begin
2081            lblSample.Caption := 'Specimen: ' + Piece(tmpList[0], '^', 5);
2082            lblSample.Color := clWindow;
2083          end;
2084        if Piece(tmpList[0], '^', 2) = 'MI' then
2085          begin
2086            for i  := 0 to tmpList.Count - 1 do
2087              begin
2088                if i > 5 then break;
2089                if ansiContainsStr(tmpList[i],'Collection sample:') then
2090                  begin
2091                    ix := 0;
2092                    if length(piece(tmpList[i], ':',2)) > 0 then
2093                      begin
2094                        ix := Length(piece(tmpList[i], ':',2));
2095                        if ix > 15 then ix := ix - 15;
2096                      end;
2097                    aCollection := '  Sample: ' + LeftStr(piece(tmpList[i], ':',2),ix);
2098                  end;
2099              end;
2100            for i  := 0 to tmpList.Count - 1 do
2101              begin
2102                if i > 5 then break;
2103                if ansiContainsStr(tmpList[i],'Site/Specimen:') then
2104                  begin
2105                    aSpecimen := 'Specimen: ' + piece(tmpList[i], ':', 2);
2106                  end;
2107              end;
2108            aX := aSpecimen + aCollection;
2109            if Length(aX) > 0 then
2110              begin
2111                lblSample.Caption := aX;
2112                lblSample.Color := clWindow;
2113              end;
2114          end;
2115      end
2116      else
2117      begin
2118        lblDateFloat.Caption := '';
2119        lblDate.Caption := '';
2120        nexton := false;
2121        prevon := false;
2122      end;
2123      cmdNext.Enabled := nexton;
2124      cmdRecent.Enabled := nexton;
2125      cmdPrev.Enabled := prevon;
2126      cmdOld.Enabled := prevon;
2127      if cmdOld.Enabled and cmdRecent.Enabled then
2128        lblMostRecent.Visible := false
2129      else
2130      begin
2131        lblMostRecent.Visible := true;
2132        if (not cmdOld.Enabled) and (not cmdRecent.Enabled) then
2133          lblMostRecent.Caption := 'No Lab Data'
2134        else if cmdOld.Enabled then
2135          lblMostRecent.Caption := 'Most Recent Lab Data'
2136        else
2137          lblMostRecent.Caption := 'Oldest Lab Data';
2138      end;
2139      if tmpList.Count > 0 then
2140      begin
2141        if Piece(tmpList[0], '^', 2) = 'CH' then
2142        begin
2143          FastAssign(tmpList, uMostRecent);
2144          FillGrid(grdLab, tmpList);
2145          FillComments(memLab, tmpList);
2146          pnlRightTop.Height := pnlRight.Height - (pnlRight.Height div 5);
2147          sptHorzRight.Top := pnlRightTop.Height;
2148          uScreenSplitLoc := sptHorzRight.Top;
2149          pnlRightBottom.Height := pnlLeft.Height div 5;
2150          memLab.Height := pnlLeft.Height div 5;
2151          memLab.Lines.Insert(0,' ');
2152          memLab.Lines.Delete(0);
2153          memLab.SelStart := 0;
2154          grdLab.Align := alClient;
2155          grdLab.Visible := true;
2156          memLab.Visible := true;
2157          pnlFooter.Height := lblHeading.Height + 5;
2158          pnlFooter.Top := pnlLeft.Height - pnlFooter.Height;
2159          lblFooter.Caption := '  KEY: "L" = Abnormal Low, "H" = Abnormal High, "*" = Critical Value';
2160          lblFooter.Align := alTop;
2161          pnlFooter.Visible := true;
2162          if (grdLab.VisibleRowCount + 1) < grdLab.RowCount then
2163            grdLab.ColWidths[4] := grdLab.ColWidths[4] - 18;
2164          memLab.Align := alClient;
2165          memLab.Repaint;
2166        end;
2167        if Piece(tmpList[0], '^', 2) = 'MI' then
2168        begin
2169          tmpList.Delete(0);
2170          QuickCopy(tmpList, memLab);
2171          memLab.SelStart := 0;
2172          grdLab.Visible := false;
2173          pnlFooter.Visible := false;
2174          sptHorzRight.Visible := true;
2175          TabControl1.Visible := false;
2176          pnlRightTop.Height := pnlHeader.Height;
2177          memLab.Height := pnlRight.Height - (lblHeading.Height + lblTitle.Height + pnlHeader.Height);
2178          pnlRightTop.Visible := true;
2179          memLab.Align := alClient;
2180          memLab.Repaint;
2181        end;
2182      end
2183      else
2184      begin
2185        grdLab.Visible := false;
2186        pnlFooter.Visible := false;
2187        memLab.Align := alClient;
2188      end;
2189    finally
2190      tmpList.Free;
2191    end;
2192  end;