Procedure

TfrmLabs.GoRemote

Module

fLabs

Last Modified

7/15/2014 3:26:38 PM

Visibility

Private

Owner

TfrmLabs

Declaration

procedure GoRemote(Dest: TStringList; AItem: string; AQualifier, ARpc: string; AHSTag: string; AHDR: string; aFHIE: string);

Calls Hierarchy


TfrmLabs.GoRemote
 ├HDRActive
 ├StrToFMDateTime
 ├TRemoteSite.SetSelected
 ├TRemoteSite.ReportClear
 ├TfrmLabs.UpdateRemoteStatus
 ├TfrmLabs.LoadListView
 │ ├TLabRowObject.Add
 │ │ ├TCellObject.Create
 │ │ └TCellObject.Add
 │ └TUser.HasKey
 │   └HasSecurityKey
 ├GetRemoteData
 ├DirectQuery
 └RemoteQuery

Called-By Hierarchy


                                      TfrmLabs.GoRemote
                           TfrmLabs.lstQualifierClick┤ 
                            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.tvReportsClick...┘ 

Calls

Name Declaration Comments
DirectQuery procedure DirectQuery(Dest: TStrings; AReportType: string; AHSType, ADaysback, AExamID: string; Alpha, AOmega: Double; ASite, ARemoteRPC, AHSTag: String); -
GetRemoteData procedure GetRemoteData(Dest: TStrings; aHandle: string; aItem: PChar); -
HDRActive function HDRActive: String; -
TfrmLabs.LoadListView procedure LoadListView(aReportData: TStringList); -
RemoteQuery procedure RemoteQuery(Dest: TStrings; AReportType: string; AHSType, ADaysback, AExamID: string; Alpha, AOmega: Double; ASite, ARemoteRPC, AHSTag: String); -
TRemoteSite.ReportClear procedure ReportClear; -
TRemoteSite.SetSelected procedure SetSelected(Value: Boolean); -
StrToFMDateTime function StrToFMDateTime(const AString: string): TFMDateTime; -
TfrmLabs.UpdateRemoteStatus procedure UpdateRemoteStatus(aSiteID, aStatus: string); -

Called-By

Name Declaration Comments
TfrmLabs.lstQualifierClick procedure lstQualifierClick(Sender: TObject); -
TfrmLabs.tvReportsClick procedure tvReportsClick(Sender: TObject); -


Source

4194  procedure TfrmLabs.GoRemote(Dest: TStringList; AItem: string; AQualifier, ARpc: string; AHSTag: string; AHDR: string; aFHIE: string);
4195  var
4196    i, j: integer;
4197    LocalHandle, Query, Report, Seq: string;
4198    HSType, DaysBack, ExamID, MaxOcc: string;
4199    Alpha, Omega, Trans: double;
4200  begin
4201    HSType := '';
4202    DaysBack := '';
4203    ExamID := '';
4204    Alpha := 0;
4205    Omega := 0;
4206    Seq := '';
4207    if AHDR = '1' then
4208      begin
4209        if HDRActive = '0' then
4210          begin
4211            InfoBox('The HDR is currently inactive.' + CRLF + 'Unable to retrieve HDR data at this time.', 'HDR Error', MB_OK);
4212            Exit;
4213          end;
4214        InfoBox('You must use VistaWeb to view this report.', 'Use VistaWeb for HDR data', MB_OK);
4215        if (Piece(AItem, ':', 1) = 'OR_VWAL') or (Piece(AItem, ':', 1) = 'OR_VWRX') then
4216          AQualifier := 'T-50000;T+50000;99999';
4217        if (Piece(AItem, ':', 1) = 'OR_VWVS') and (CharAt(AQualifier, 1) = ';') then
4218          AQualifier := 'T-50000;T+50000;99999';
4219      end;
4220    if CharAt(AQualifier, 1) = 'd' then
4221      begin
4222        DaysBack := Copy(AQualifier, 2, Length(AQualifier));
4223        AQualifier := ('T-' + Piece(DaysBack,';',1) + ';T;' + Pieces(AQualifier,';',2,3));
4224        DaysBack := '';
4225      end;
4226    if CharAt(AQualifier, 1) = 'T' then
4227      begin
4228        if Piece(AQualifier,';',1) = 'T-0' then SetPiece(AQualifier,';',1,'T');
4229        if (Piece(Aqualifier,';',1) = 'T') and (Piece(Aqualifier,';',2) = 'T')
4230          then SetPiece(AQualifier,';',2,'T+1');
4231        Alpha := StrToFMDateTime(Piece(AQualifier,';',1));
4232        Omega := StrToFMDateTime(Piece(AQualifier,';',2));
4233        if Alpha > Omega then
4234          begin
4235            Trans := Omega;
4236            Omega := Alpha;
4237            Alpha := Trans;
4238          end;
4239        MaxOcc := Piece(AQualifier,';',3);
4240        SetPiece(AHSTag,';',4,MaxOcc);
4241      end;
4242    if CharAt(AQualifier, 1) = 'h' then HSType   := Copy(AQualifier, 2, Length(AQualifier));
4243    if CharAt(AQualifier, 1) = 'i' then ExamID   := Copy(AQualifier, 2, Length(AQualifier));
4244    with RemoteSites.SiteList do for i := 0 to Count - 1 do
4245      begin
4246      if (AHDR='1') and (LeftStr(TRemoteSite(Items[i]).SiteID, 5) = '200HD') then
4247        begin
4248          TRemoteSite(Items[i]).Selected := true;
4249          frmFrame.lstCIRNLocations.Checked[i+1] := true;
4250        end;
4251      if TRemoteSite(Items[i]).Selected then
4252        begin
4253          TRemoteSite(Items[i]).ReportClear;
4254          if (LeftStr(TRemoteSite(Items[i]).SiteID, 5) = '200HD') and not(AHDR = '1') then
4255            begin
4256              TRemoteSite(Items[i]).LabQueryStatus := '1^Not Included';
4257              UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'NOT INCLUDED');
4258              TRemoteSite(Items[i]).LabRemoteHandle := '';
4259              TRemoteSite(Items[i]).LabQueryStatus := '1^Done';
4260              if uQualifierType = 6 then seq := '1^';
4261              TRemoteSite(Items[i]).Data.Add(seq + TRemoteSite(Items[i]).SiteName);
4262              if uQualifierType = 6 then seq := '2^';
4263              TRemoteSite(Items[i]).Data.Add(seq + '<No HDR Data Included> - Use "HDR Reports" menu for HDR Data.');
4264              TabControl1.OnChange(nil);
4265              if (length(piece(uHState,';',2)) > 0) then
4266                LoadListView(TRemoteSite(Items[i]).Data);
4267              continue;
4268            end;
4269          if (AHDR = '1') and not(LeftStr(TRemoteSite(Items[i]).SiteID, 5) = '200HD') then
4270            begin
4271              TRemoteSite(Items[i]).LabQueryStatus := '1^Not Included';
4272              UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'NOT INCLUDED');
4273              TRemoteSite(Items[i]).LabRemoteHandle := '';
4274              TRemoteSite(Items[i]).LabQueryStatus := '1^Done';
4275              if uQualifierType = 6 then seq := '1^';
4276              TRemoteSite(Items[i]).Data.Add(seq + TRemoteSite(Items[i]).SiteName);
4277              if uQualifierType = 6 then seq := '2^';
4278              TRemoteSite(Items[i]).Data.Add(seq + '<No HDR Data> This site is not a source for HDR Data.');
4279              TabControl1.OnChange(nil);
4280              if (length(piece(uHState,';',2)) > 0) then
4281                LoadListView(TRemoteSite(Items[i]).Data);
4282              continue;
4283            end;
4284          if (LeftStr(TRemoteSite(Items[i]).SiteID, 5) = '200') and not(aFHIE = '1') then
4285            begin
4286              TRemoteSite(Items[i]).LabQueryStatus := '1^Not Included';
4287              UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'NOT INCLUDED');
4288              TRemoteSite(Items[i]).LabRemoteHandle := '';
4289              TRemoteSite(Items[i]).LabQueryStatus := '1^Done';
4290              if uQualifierType = 6 then seq := '1^';
4291              TRemoteSite(Items[i]).Data.Add(seq + TRemoteSite(Items[i]).SiteName);
4292              if uQualifierType = 6 then seq := '2^';
4293              TRemoteSite(Items[i]).Data.Add(seq + '<No DOD Data> - Use "Dept. of Defense Reports" Menu to retrieve data from DOD.');
4294              TabControl1.OnChange(nil);
4295              if (length(piece(uHState,';',2)) > 0) then
4296                LoadListView(TRemoteSite(Items[i]).Data);
4297              continue;
4298            end;
4299          TRemoteSite(Items[i]).CurrentReportQuery := 'Report' + Patient.DFN + ';'
4300            + Patient.ICN + '^' + AItem + '^^^' + ARpc + '^' + HSType +
4301            '^' + DaysBack + '^' + ExamID + '^' + FloatToStr(Alpha) + '^' +
4302            FloatToStr(Omega) + '^' + TRemoteSite(Items[i]).SiteID + '^' + AHSTag + '^' + AHDR;
4303          LocalHandle := '';
4304          Query := TRemoteSite(Items[i]).CurrentReportQuery;
4305          for j := 0 to RemoteReports.Count - 1 do
4306            begin
4307              Report := TRemoteReport(RemoteReports.ReportList.Items[j]).Report;
4308              if Report = Query then
4309                begin
4310                  LocalHandle := TRemoteReport(RemoteReports.ReportList.Items[j]).Handle;
4311                  break;
4312                end;
4313            end;
4314          if Length(LocalHandle) > 1 then
4315            with RemoteSites.SiteList do
4316              begin
4317                GetRemoteData(TRemoteSite(Items[i]).Data,LocalHandle,Items[i]);
4318                TRemoteSite(Items[i]).LabRemoteHandle := '';
4319                TRemoteSite(Items[i]).LabQueryStatus := '1^Done';
4320                UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'Done');
4321                TabControl1.OnChange(nil);
4322                if (length(piece(uHState,';',2)) > 0) then //and (chkText.Checked = false) then
4323                  LoadListView(TRemoteSite(Items[i]).Data);
4324              end
4325          else
4326            begin
4327              if uDirect = '1' then
4328                begin
4329                  StatusText('Retrieving reports from ' + TRemoteSite(Items[i]).SiteName + '...');
4330                  TRemoteSite(Items[i]).LabQueryStatus := '1^Direct Call';
4331                  UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'Direct Call');
4332                  DirectQuery(Dest, AItem, HSType, Daysback, ExamID, Alpha, Omega, TRemoteSite(Items[i]).SiteID, ARpc, AHSTag);
4333                  if Copy(Dest[0],1,2) = '-1' then
4334                    begin
4335                      TRemoteSite(Items[i]).LabQueryStatus := '-1^Communication error';
4336                      UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID,'Communication error');
4337                      if uQualifierType = 6 then seq := '1^';
4338                      TRemoteSite(Items[i]).Data.Add(seq + TRemoteSite(Items[i]).SiteName);
4339                      if uQualifierType = 6 then seq := '2^';
4340                      TRemoteSite(Items[i]).Data.Add(seq + '<ERROR>- Unable to communicate with Remote site');
4341                      TabControl1.OnChange(nil);
4342                      if (length(piece(uHState,';',2)) > 0) then
4343                        LoadListView(TRemoteSite(Items[i]).Data);
4344                    end
4345                  else
4346                    begin
4347                      QuickCopy(Dest,TRemoteSite(Items[i]).Data);
4348                      TRemoteSite(Items[i]).LabRemoteHandle := '';
4349                      TRemoteSite(Items[i]).LabQueryStatus := '1^Done';
4350                      UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'Done');
4351                      TabControl1.OnChange(nil);
4352                      if (length(piece(uHState,';',2)) > 0) then
4353                        LoadListView(TRemoteSite(Items[i]).Data);
4354                    end;
4355                  StatusText('');
4356                end
4357              else
4358                begin
4359                  RemoteQuery(Dest, AItem, HSType, Daysback, ExamID, Alpha, Omega, TRemoteSite(Items[i]).SiteID, ARpc, AHSTag);
4360                  if Dest[0] = '' then
4361                    begin
4362                      TRemoteSite(Items[i]).LabQueryStatus := '-1^Communication error';
4363                      UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID,'Communication error');
4364                      if uQualifierType = 6 then seq := '1^';
4365                      TRemoteSite(Items[i]).Data.Add(seq + TRemoteSite(Items[i]).SiteName);
4366                      if uQualifierType = 6 then seq := '2^';
4367                      TRemoteSite(Items[i]).Data.Add(seq + '<ERROR>- Unable to communicate with Remote site');
4368                      TabControl1.OnChange(nil);
4369                      if (length(piece(uHState,';',2)) > 0) then
4370                        LoadListView(TRemoteSite(Items[i]).Data);
4371                    end
4372                  else
4373                    begin
4374                      TRemoteSite(Items[i]).LabRemoteHandle := Dest[0];
4375                      TRemoteSite(Items[i]).LabQueryStatus := '0^initialization...';
4376                      UpdateRemoteStatus(TRemoteSite(Items[i]).SiteID, 'initialization');
4377                      Timer1.Enabled := True;
4378                      StatusText('Retrieving reports from ' + TRemoteSite(Items[i]).SiteName + '...');
4379                    end;
4380                end;
4381            end;
4382        end;
4383      end;
4384  end;