Procedure

GetConsultRec

Module

rConsults

Last Modified

7/15/2014 3:26:36 PM

Comments

Returns zero node from file 123, plus a list of all related TIU documents, if any
           1    2    3     4     5     6    7    8   9    10   11  12   13     14    15
{Pieces: EntDt^Pat^OrIFN^PtLoc^ToSvc^From^ReqDt^Typ^Urg^Place^Attn^Sts^LstAct^SndPrv^Rslt^
    16      17     18    19     20     21      22
 ^EntMode^ReqTyp^InOut^SigFnd^TIUPtr^OrdFac^FrgnCslt

Scope

Interfaced

Declaration

procedure GetConsultRec(IEN: integer) ;

Called-By Hierarchy


                                                                   GetConsultRec
                                                 TfrmConsults.lstConsultsClick┘ 
                                               TfrmConsults.tvConsultsChange┘   
                                TfrmConsults.mnuActDetachFromIDParentClick┤     
                                                  TfrmConsults.NotifyOrder┤     
                                                    TfrmFrame.UMNewOrder┘ │     
                                    TfrmConsults.mnuActDisplayDetailsClick┤     
                               TfrmConsults.mnuActIdentifyAddlSignersClick┤     
                                   TfrmConsults.popNoteMemoAddlSignClick┘ │     
                                         TfrmConsults.ProcessNotifications┤     
                                                TfrmConsults.DisplayPage┘ │     
                                                 TfrmConsults.LoadConsults┤     
                                                 TfrmConsults.UpdateList┤ │     
                                             TfrmConsults.mnuViewClick┤ │ │     
                                         TfrmConsults.SetViewContext┘ │ │ │     
                                          TfrmConsults.DisplayPage┤   │ │ │     
                          TfrmConsults.mnuViewReturntoDefaultClick┘   │ │ │     
                                    TfrmConsults.mnuActNoteDeleteClick┤ │ │     
                                      TfrmConsults.SaveEditedConsult┘ │ │ │     
                                      TfrmConsults.SaveCurrentNote┘   │ │ │     
                                 TfrmConsults.AllowContextChange┤     │ │ │     
                               TfrmFrame.AllowContextChangeAll┘ │     │ │ │     
                                    TfrmFrame.FormCloseQuery┤   │     │ │ │     
                                  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.ctxContextorPending┤   │     │ │ │     
                              TfrmFrame.StartCCOWContextor┘ │   │     │ │ │     
                                    TfrmFrame.FormCreate┘   │   │     │ │ │     
                             TfrmFrame.ctxContextorCommitted┤   │     │ │ │     
                           TfrmFrame.StartCCOWContextor...┘ │   │     │ │ │     
                      TfrmFrame.mnuFileResumeContextGetClick┤   │     │ │ │     
                      TfrmFrame.mnuFileResumeContextSetClick┘   │     │ │ │     
                                  TfrmConsults.SetViewContext...┤     │ │ │     
                                    TfrmConsults.mnuViewClick...┤     │ │ │     
                      TfrmConsults.mnuActDetachFromIDParentClick┤     │ │ │     
                           TfrmConsults.mnuActNoteDeleteClick...┤     │ │ │     
                           TfrmConsults.mnuActSignatureSaveClick┤     │ │ │     
                           TfrmConsults.mnuActSignatureSignClick┤     │ │ │     
                                       TfrmConsults.SaveSignItem┤     │ │ │     
                                         TfrmReview.cmdOKClick┘ │     │ │ │     
                                               ReviewChanges┘   │     │ │ │     
                        TfrmFrame.AllowContextChangeAll...┤     │     │ │ │     
                                  TfrmFrame.FormCloseQuery┤     │     │ │ │     
                              TfrmFrame.mnuFileReviewClick┤     │     │ │ │     
                                           UpdateEncounter┘     │     │ │ │     
                         TfrmFrame.mnuFileEncounterClick┤       │     │ │ │     
                                 TfrmFrame.ViewInfo...┤ │       │     │ │ │     
                    TfrmODMedIV.SetValuesFromResponses┤ │       │     │ │ │     
                             TfrmODMedIV.SetupDialog┤ │ │       │     │ │ │     
                   TfrmODMedIV.cboSolutionMouseClick┘ │ │       │     │ │ │     
                       TfrmODMedIV.cboSolutionExit┘   │ │       │     │ │ │     
                  TfrmODMedIV.cboSolutionMouseClick...┤ │       │     │ │ │     
                     TfrmODMedIV.cboAdditiveMouseClick┤ │       │     │ │ │     
                         TfrmODMedIV.cboAdditiveExit┘ │ │       │     │ │ │     
                                TfrmODAuto.SetupDialog┤ │       │     │ │ │     
                                   ActivateOrderDialog┤ │       │     │ │ │     
                           TfrmRemDlg.btnFinishClick┤ │ │       │     │ │ │     
           TfrmConsults.mnuActNewConsultRequestClick┤ │ │       │     │ │ │     
                   TfrmConsults.cmdNewConsultClick┘ │ │ │       │     │ │ │     
                TfrmConsults.mnuActNewProcedureClick┤ │ │       │     │ │ │     
                      TfrmConsults.cmdNewProcClick┘ │ │ │       │     │ │ │     
                                        ChangeOrders┤ │ │       │     │ │ │     
                      TfrmOrders.mnuActChangeClick┤ │ │ │       │     │ │ │     
                        TfrmMeds.mnuActChangeClick┘ │ │ │       │     │ │ │     
                                     ChangeOrdersEvt┤ │ │       │     │ │ │     
                                          CopyOrders┤ │ │       │     │ │ │     
                        TfrmOrders.mnuActCopyClick┤ │ │ │       │     │ │ │     
                          TfrmMeds.mnuActCopyClick┤ │ │ │       │     │ │ │     
                           TfrmODActive.btnOKClick┘ │ │ │       │     │ │ │     
                                      TransferOrders┤ │ │       │     │ │ │     
                        TfrmOrders.mnuActCopyClick┤ │ │ │       │     │ │ │     
                          TfrmMeds.mnuActCopyClick┤ │ │ │       │     │ │ │     
                           TfrmODActive.btnOKClick┘ │ │ │       │     │ │ │     
                            TfrmOrders.lstWriteClick┤ │ │       │     │ │ │     
               TfrmOrders.PlaceOrderForDefaultDialog┤ │ │       │     │ │ │     
                  TfrmOrders.DisplayDefaultDlgList┤ │ │ │       │     │ │ │     
                       TfrmOrders.ResetOrderPage┘ │ │ │ │       │     │ │ │     
               TfrmOrders.btnDelayedOrderClick┘   │ │ │ │       │     │ │ │     
                                 DisplayEvntDialog┤ │ │ │       │     │ │ │     
                             SetDelayEventForMed┘ │ │ │ │       │     │ │ │     
                      TfrmMeds.mnuActCopyClick┘   │ │ │ │       │     │ │ │     
                                 DisplayEvntDialog┤ │ │ │       │     │ │ │     
                                  SetViewForCopy┘ │ │ │ │       │     │ │ │     
                    TfrmOrders.mnuActCopyClick┘   │ │ │ │       │     │ │ │     
                                 DisplayEvntDialog┘ │ │ │       │     │ │ │     
                                ExecuteChangeEvt┘   │ │ │       │     │ │ │     
                 TfrmOrders.mnuActChgEvntClick┘     │ │ │       │     │ │ │     
                             TfrmMeds.mnuActNewClick┤ │ │       │     │ │ │     
                           TfrmOMNavA.ActivateDialog┤ │ │       │     │ │ │     
                         TfrmOMNavA.grdMenuKeyDown┤ │ │ │       │     │ │ │     
                         TfrmOMNavA.grdMenuMouseUp┘ │ │ │       │     │ │ │     
                                TfrmOMSet.DoNextItem┘ │ │       │     │ │ │     
                              TfrmOMSet.InsertList┤   │ │       │     │ │ │     
                               ActivateOrderList┘ │   │ │       │     │ │ │     
                     TfrmRemDlg.btnFinishClick┤   │   │ │       │     │ │ │     
                             ActivateOrderHTML┤   │   │ │       │     │ │ │     
                    TfrmOrders.lstWriteClick┤ │   │   │ │       │     │ │ │     
    TfrmOrders.PlaceOrderForDefaultDialog...┘ │   │   │ │       │     │ │ │     
                              ActivateOrderSet┤   │   │ │       │     │ │ │     
                   TfrmRemDlg.btnFinishClick┤ │   │   │ │       │     │ │ │     
TfrmConsults.mnuActNewConsultRequestClick...┤ │   │   │ │       │     │ │ │     
     TfrmConsults.mnuActNewProcedureClick...┤ │   │   │ │       │     │ │ │     
                    TfrmOrders.lstWriteClick┤ │   │   │ │       │     │ │ │     
    TfrmOrders.PlaceOrderForDefaultDialog...┤ │   │   │ │       │     │ │ │     
                     TfrmMeds.mnuActNewClick┤ │   │   │ │       │     │ │ │     
                TfrmOMNavA.ActivateDialog...┤ │   │   │ │       │     │ │ │     
                     TfrmOMSet.DoNextItem...┘ │   │   │ │       │     │ │ │     
                       TfrmOMNavA.DoSelectList┘   │   │ │       │     │ │ │     
                     TfrmOMNavA.grdMenuKeyUp┤     │   │ │       │     │ │ │     
                   TfrmOMNavA.grdMenuMouseUp┘     │   │ │       │     │ │ │     
                                        SkipToNext┤   │ │       │     │ │ │     
                         TfrmOMSet.DoNextItem...┘ │   │ │       │     │ │ │     
                            TfrmOMSet.UMDelayEvent┘   │ │       │     │ │ │     
                               TfrmOMSet.InsertList...┤ │       │     │ │ │     
                                TfrmODMeds.SetupDialog┤ │       │     │ │ │     
                             TfrmODMeds.btnSelectClick┤ │       │     │ │ │     
                             TfrmODMeds.UMDelayClick┘ │ │       │     │ │ │     
                                    ExecuteRenewOrders┘ │       │     │ │ │     
                         TfrmOrders.mnuActRenewClick┤   │       │     │ │ │     
                           TfrmMeds.mnuActRenewClick┘   │       │     │ │ │     
                                        EncounterPresent┤       │     │ │ │     
                                      ReadyForNewOrder┤ │       │     │ │ │     
                           TfrmRemDlg.btnFinishClick┤ │ │       │     │ │ │     
        TfrmConsults.mnuActNewConsultRequestClick...┤ │ │       │     │ │ │     
             TfrmConsults.mnuActNewProcedureClick...┤ │ │       │     │ │ │     
                                     ChangeOrders...┤ │ │       │     │ │ │     
                                     ChangeOrdersEvt┤ │ │       │     │ │ │     
                                       CopyOrders...┤ │ │       │     │ │ │     
                                   TransferOrders...┤ │ │       │     │ │ │     
                            TfrmOrders.lstWriteClick┤ │ │       │     │ │ │     
                             TfrmMeds.mnuActNewClick┘ │ │       │     │ │ │     
                                     ReadyForNewOrder1┤ │       │     │ │ │     
            TfrmOrders.PlaceOrderForDefaultDialog...┘ │ │       │     │ │ │     
                              TfrmOrders.mnuActDCClick┤ │       │     │ │ │     
                             TfrmOrders.mnuActRelClick┤ │       │     │ │ │     
                            TfrmOrders.mnuActHoldClick┤ │       │     │ │ │     
                          TfrmOrders.mnuActUnholdClick┤ │       │     │ │ │     
                           TfrmOrders.mnuActRenewClick┤ │       │     │ │ │     
                         TfrmOrders.mnuActReleaseClick┤ │       │     │ │ │     
                         TfrmOrders.mnuActOnChartClick┤ │       │     │ │ │     
                            TfrmOrders.mnuActSignClick┤ │       │     │ │ │     
                                TfrmMeds.mnuActDCClick┤ │       │     │ │ │     
                              TfrmMeds.mnuActHoldClick┤ │       │     │ │ │     
                             TfrmMeds.mnuActRenewClick┤ │       │     │ │ │     
                            TfrmMeds.mnuActUnholdClick┤ │       │     │ │ │     
                              TfrmMeds.mnuActCopyClick┤ │       │     │ │ │     
                            TfrmMeds.mnuActRefillClick┘ │       │     │ │ │     
                                     EncounterPresentEDO┤       │     │ │ │     
                                   ReadyForNewOrder...┤ │       │     │ │ │     
                         TfrmOrders.mnuActChgEvntClick┤ │       │     │ │ │     
                          TfrmOrders.mnuActChangeClick┤ │       │     │ │ │     
                            TfrmOrders.mnuActCopyClick┤ │       │     │ │ │     
                       TfrmOrders.btnDelayedOrderClick┤ │       │     │ │ │     
                            TfrmMeds.mnuActChangeClick┤ │       │     │ │ │     
                              TfrmMeds.mnuActCopyClick┘ │       │     │ │ │     
                                             UpdateVisit┤       │     │ │ │     
                                           EditPCEData┤ │       │     │ │ │     
                             TfrmSurgery.cmdPCEClick┤ │ │       │     │ │ │     
                                 UpdateEncounterInfo┘ │ │       │     │ │ │     
                             TfrmNotes.cmdPCEClick┘   │ │       │     │ │ │     
                        TfrmVitals.btnEnterVitalsClick┘ │       │     │ │ │     
                                             UpdateVisit┤       │     │ │ │     
                                        EncounterPresent┘       │     │ │ │     
                         TfrmProblems.lstProbActsClick┘         │     │ │ │     
                     TfrmProblems.wgProbDataDblClick┤           │     │ │ │     
                           TfrmProblems.lstViewClick┘           │     │ │ │     
                   TfrmProblems.HighlightDuplicate┘             │     │ │ │     
                         TfrmProblems.AddProblem┤               │     │ │ │     
              TfrmProblems.lstProbActsClick...┤ │               │     │ │ │     
                 TfrmProblems.lstProbPickClick┤ │               │     │ │ │     
              TfrmProblems.lstProbPickDblClick┤ │               │     │ │ │     
              TfrmProblems.edProbEntKeyPress┘ │ │               │     │ │ │     
                      TfrmProblems.UMPLLexicon┘ │               │     │ │ │     
                   TfrmdlgProb.bbChangeProbClick┘               │     │ │ │     
                                 TfrmConsults.mnuActConsultClick┤     │ │ │     
                                       TfrmConsults.RequestPrint┤     │ │ │     
                            TfrmConsults.mnuActPrintSF513Click┤ │     │ │ │     
                                   TfrmFrame.mnuFilePrintClick┘ │     │ │ │     
                          TfrmConsults.mnuActDisplayResultsClick┤     │ │ │     
                          TfrmConsults.ProcessNotifications...┘ │     │ │ │     
                            TfrmConsults.mnuActDisplaySF513Click┤     │ │ │     
                              TfrmConsults.mnuActPrintSF513Click┤     │ │ │     
                          TfrmConsults.mnuActDisplayDetailsClick┤     │ │ │     
                                          TfrmConsults.FormClose┤     │ │ │     
                  TfrmConsults.mnuActIdentifyAddlSignersClick...┤     │ │ │     
                            TfrmConsults.ProcessNotifications...┤     │ │ │     
                               TfrmConsults.mnuActNotePrintClick┤     │ │ │     
                            TfrmConsults.popNoteMemoPrintClick┘ │     │ │ │     
                                       TfrmConsults.StartNewEdit┤     │ │ │     
                              TfrmConsults.mnuActCompleteClick┤ │     │ │ │     
                            TfrmConsults.mnuActAddIDEntryClick┤ │     │ │ │     
                          TfrmConsults.mnuActMakeAddendumClick┤ │     │ │ │     
                              TfrmConsults.mnuActNoteEditClick┘ │     │ │ │     
                            TfrmConsults.mnuActCompleteClick┘   │     │ │ │     
                                TfrmConsults.tvCsltNotesDragDrop┤     │ │ │     
                               TfrmConsults.tvCsltNotesStartDrag┤     │ │ │     
                        TfrmConsults.mnuActAttachtoIDParentClick┤     │ │ │     
                                 TfrmConsults.LstConsultsToPrint┘     │ │ │     
                      TfrmFrame.mnuFilePrintSelectedItemsClick┘       │ │ │     
                                 TfrmConsults.mnuActSignatureSaveClick┤ │ │     
                                 TfrmConsults.mnuActSignatureSignClick┤ │ │     
                                          TfrmConsults.SaveSignItem...┤ │ │     
                                       TfrmConsults.mnuActConsultClick┤ │ │     
                                           TfrmConsults.NotifyOrder...┤ │ │     
                                               TfrmConsults.UMNewOrder┤ │ │     
                                        TfrmConsults.ProcessMedResults┘ │ │     
                                   TfrmConsults.mnuActAttachMedClick┤   │ │     
                                   TfrmConsults.mnuActRemoveMedClick┘   │ │     
                                    TfrmConsults.mnuActEditResubmitClick┤ │     
                                     TfrmConsults.cmdEditResubmitClick┘ │ │     
                                      TfrmConsults.LstConsultsToPrint...┘ │     
                                              TfrmConsults.tvConsultsClick┤     
                                            TfrmConsults.mnuViewClick...┤ │     
                              TfrmConsults.mnuActDetachFromIDParentClick┤ │     
                                   TfrmConsults.mnuActNoteDeleteClick...┤ │     
                                   TfrmConsults.mnuActSignatureSaveClick┤ │     
                                   TfrmConsults.mnuActSignatureSignClick┤ │     
                                            TfrmConsults.SaveSignItem...┤ │     
                                         TfrmConsults.mnuActConsultClick┤ │     
                                 TfrmConsults.mnuActEditResubmitClick...┤ │     
                                            TfrmConsults.StartNewEdit...┤ │     
                                       TfrmConsults.ProcessMedResults...┤ │     
                                TfrmConsults.mnuActAttachtoIDParentClick┘ │     
                                              TfrmConsults.DoAttachIDChild┤     
                                        TfrmConsults.tvCsltNotesDragDrop┤ │     
                                TfrmConsults.mnuActAttachtoIDParentClick┘ │     
                                              TfrmConsults.tvConsultsKeyUp┘     

Called-By

Name Declaration Comments
TfrmConsults.lstConsultsClick procedure lstConsultsClick(Sender: TObject); -


Source

312   procedure GetConsultRec(IEN: integer);
313   {returns zero node from file 123, plus a list of all related TIU documents, if any}
314   const
315     SHOW_ADDENDA = True;
316   var
317      alist: TStrings;
318      x: string ;
319      i: integer;
320   {           1    2    3     4     5     6    7    8   9    10   11  12   13     14    15
321   { Pieces: EntDt^Pat^OrIFN^PtLoc^ToSvc^From^ReqDt^Typ^Urg^Place^Attn^Sts^LstAct^SndPrv^Rslt^
322       16      17     18    19     20     21      22
323    ^EntMode^ReqTyp^InOut^SigFnd^TIUPtr^OrdFac^FrgnCslt}
324   begin
325     FillChar(ConsultRec, SizeOf(ConsultRec), 0);
326     CallV('ORQQCN GET CONSULT', [IEN, SHOW_ADDENDA]);
327     ConsultRec.IEN := IEN ;
328     alist := TStringList.Create ;
329    try
330     FastAssign(RPCBrokerV.Results, aList);
331     x := alist[0] ;
332     if Piece(x,u,1) <> '-1' then
333       with ConsultRec do
334        begin
335         EntryDate             := MakeFMDateTime(Piece(x, U, 1));
336         ORFileNumber          := StrToIntDef(Piece(x, U, 3),0);
337         PatientLocation       := StrToIntDef(Piece(x, U, 4),0);
338         OrderingFacility      := StrToIntDef(Piece(x, U, 21),0);
339         ForeignConsultFileNum := StrToIntDef(Piece(x, U, 22),0);
340         ToService             := StrToIntDef(Piece(x, U, 5),0);
341         From                  := StrToIntDef(Piece(x, U, 6),0);
342         RequestDate           := MakeFMDateTime(Piece(x, U, 7));
343         ConsultProcedure      := Piece(x, U, 8)  ;
344         Urgency               := StrToIntDef(Piece(x, U, 9),0);
345         PlaceOfConsult        := StrToIntDef(Piece(x, U, 10),0);
346         Attention             := StrToInt64Def(Piece(x, U, 11),0);
347         ORStatus              := StrToIntDef(Piece(x, U, 12),0);
348         LastAction            := StrToIntDef(Piece(x, U, 13),0);
349         SendingProvider       := StrToInt64Def(Piece(Piece(x, U, 14),';',1),0);
350         SendingProviderName   := Piece(Piece(x, U, 14),';',2)   ;
351         Result                := Piece(x, U, 15)  ;
352         ModeOfEntry           := Piece(x, U, 16)  ;
353         RequestType           := StrToIntDef(Piece(x, U, 17),0);
354         InOut                 := Piece(x, U, 18)  ;
355         Findings              := Piece(x, U, 19)  ;
356         TIUResultNarrative    := StrToIntDef(Piece(x, U, 20),0);
357         EarliestDate          := StrToFloatDef(Piece(x, U, 98), 0);
358         //LatestDate            := StrToFloatDef(Piece(x, U, 99), 0); //dropped requirement WAT
359         //ProvDiagnosis         := Piece(x, U, 23);  NO!!!!! Up to 180 Characters!!!!
360         alist.delete(0) ;
361         TIUDocuments := TStringList.Create ;
362         MedResults := TStringList.Create;
363         if alist.count > 0 then
364           begin
365             SortByPiece(TStringList(alist), U, 3);
366             for i := 0 to alist.Count - 1 do
367               if Copy(Piece(Piece(alist[i], U, 1), ';', 2), 1, 4) = 'MCAR' then
368                 MedResults.Add(alist[i])
369               else
370                 TIUDocuments.Add(alist[i]);
371           end;
372        end  {ConsultRec}
373     else
374      ConsultRec.EntryDate := -1 ;
375    finally
376      alist.free ;
377    end ;
378   end ;