Procedure

CreateListItemsForCaseTree

Module

uCaseTree

Last Modified

7/15/2014 3:26:44 PM

Comments

Procedures for document treeviews/listviews
==============================================================
RPC [SURGERY CASES BY CONTEXT] returns
the following string '^' pieces:
===============================================================
CASE #^Operative Procedure^Date/Time of Operation^Surgeon^^^^^^^^^+^Context         ***NEEDS TO BE FIXED***
IEN NIR^TITLE^REF DATE/TIME^PT ID^AUTHOR^HOSP LOC^STATUS^Vis DT^Disch DT^CASE;SRF(^# Assoc Images^Subject^+ (if has addenda)^IEN of Parent Document
IEN AR^TITLE^REF DATE/TIME^PT ID^AUTHOR^HOSP LOC^STATUS^Vis DT^Disch DT^CASE;SRF(^# Assoc Images^Subject^+ (if has addenda)^IEN of Parent Document
IEN OS^TITLE^REF DATE/TIME^PT ID^AUTHOR^HOSP LOC^STATUS^Vis DT^Disch DT^CASE;SRF(^# Assoc Images^Subject^+ (if has addenda)^IEN of Parent Document
IEN Addendum^TITLE^REF DATE/TIME^PT ID^AUTHOR^HOSP LOC^STATUS^Vis DT^Disch DT^CASE;SRF(^# Assoc Images^Subject^^IEN of Parent Document*)

===============================================================

Scope

Interfaced

Declaration

procedure CreateListItemsForCaseTree(Dest, Source: TStrings; Context: integer; GroupBy: string;
          Ascending: boolean);

Called-By Hierarchy


                                                CreateListItemsForCaseTree
                                        TfrmSurgery.ProcessNotifications┤ 
                                               TfrmSurgery.DisplayPage┘ │ 
                                            TfrmSurgery.LoadSurgeryCases┘ 
                                              TfrmSurgery.mnuViewClick┤   
                                          TfrmSurgery.SetViewContext┘ │   
                                           TfrmSurgery.DisplayPage┤   │   
                           TfrmSurgery.mnuViewReturntoDefaultClick┘   │   
                                              TfrmSurgery.StartNewEdit┤   
                                          TfrmSurgery.mnuActNewClick┤ │   
                                       TfrmSurgery.cmdNewNoteClick┘ │ │   
                                       TfrmSurgery.mnuActAddendClick┤ │   
                                         TfrmSurgery.mnuActEditClick┘ │   
                                         TfrmSurgery.mnuActDeleteClick┤   
                                          TfrmSurgery.SaveEditedNote┘ │   
                                       TfrmSurgery.SaveCurrentNote┘   │   
                                  TfrmSurgery.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┘   │     │   
                                   TfrmSurgery.SetViewContext...┤     │   
                                        TfrmSurgery.RequestPrint┤     │   
                                   TfrmFrame.mnuFilePrintClick┘ │     │   
                                     TfrmSurgery.mnuViewClick...┤     │   
                                     TfrmSurgery.StartNewEdit...┤     │   
                                TfrmSurgery.mnuActDeleteClick...┤     │   
                                     TfrmSurgery.mnuActSaveClick┤     │   
                                     TfrmSurgery.mnuActSignClick┤     │   
                                        TfrmSurgery.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┘               │     │   
                                           TfrmSurgery.FormClose┤     │   
                      TfrmSurgery.mnuActIdentifyAddlSignersClick┤     │   
                          TfrmSurgery.popNoteMemoAddlSignClick┘ │     │   
                             TfrmSurgery.ProcessNotifications...┘     │   
                                           TfrmSurgery.mnuActSaveClick┤   
                                           TfrmSurgery.mnuActSignClick┤   
                                           TfrmSurgery.SaveSignItem...┤   
                         TfrmSurgery.mnuActIdentifyAddlSignersClick...┘   

Called-By

Name Declaration Comments
TfrmSurgery.LoadSurgeryCases procedure LoadSurgeryCases; -
TfrmSurgery.ProcessNotifications procedure ProcessNotifications; -


Source

68    procedure CreateListItemsForCaseTree(Dest, Source: TStrings; Context: integer; GroupBy: string;
69              Ascending: Boolean);
70    const
71      NO_MATCHES = '^No Surgery Cases Found^^^^^^^^^^^%^0';
72    var
73      i: Integer;
74      x, x1, x2, x3, MyParent, MyType: string;
75      AList, SrcList: TStringList;
76    begin
77      AList := TStringList.Create;
78      SrcList := TStringList.Create;
79      try
80        //ReportBox(Source, '', True);
81        FastAssign(Source, SrcList);
82        with SrcList do
83          begin
84            if (Count = 1) and (Piece(SrcList[0], U, 1) = '-1') then
85              begin
86                Dest.Insert(0, IntToStr(Context) + NO_MATCHES);
87                Exit;
88              end;
89            for i := 0 to Count - 1 do
90              begin
91                x := Strings[i];
92                if Piece(x, U, 10) <> '' then      // if item is a note, and is missing information
93                  begin
94                    if Piece(x, U, 2) = '' then
95                      SetPiece(x, U, 2, '** No title **');
96                    if Piece(x, U, 6) = '' then
97                      SetPiece(x, U, 6, '** No location **');
98                    if Piece(Piece(x, U, 5), ';', 3) = '' then
99                      SetPiece(x, U, 5, '0;** No Author **;** No Author **');
100                 end;
101               MyParent   := Piece(x, U, 14);
102               if GroupBy <> '' then case GroupBy[1] of
103                 'D':  begin
104                         x2 := Piece(x, U, 3);                          // Proc date (FM)
105                         if x2 = '' then
106                           begin
107                             x2 := '** No Date **';
108                             x1 := '** No Date **';
109                           end
110                         else
111                           x1 := FormatFMDateTime('mmm dd,yyyy', StrToFloat(x2));  // Proc date
112                         if MyParent = IntToStr(Context) then
113                           SetPiece(x, U, 14, MyParent + x2);
114                         x3 := x2 + U + MixedCase(x1) + U + IntToStr(Context);
115                         if (AList.IndexOf(x3) = -1) then AList.Add(x3);
116                       end;
117                 'P':  begin
118                         x1 := Piece(x, U, 2);
119                         if x1 = '' then x1 := '** No Procedure **';
120                         if MyParent = IntToStr(Context) then
121                           SetPiece(x, U, 14, MyParent + x1);
122                         x3 := x1 + U + MixedCase(x1) + U + IntToStr(Context);
123                         if (AList.IndexOf(x3) = -1) then AList.Add(x3);
124                       end;
125                 'S':  begin
126                         x1 := Piece(Piece(x, U, 4), ';', 2);
127                         if x1 = '' then x1 := '** No Surgeon **';
128                         if MyParent = IntToStr(Context) then
129                           SetPiece(x, U, 14, MyParent + x1);
130                         x3 := x1 + U + MixedCase(x1) + U + IntToStr(Context);
131                         if (AList.IndexOf(x3) = -1) then AList.Add(x3);
132                       end;
133                 'T':  begin
134                         if MyParent = IntToStr(Context) then
135                         begin
136                           if Piece(x, U, 6) = '1' then
137                             MyType := 'Non-OR Procedures'
138                           else
139                             MyType := 'Operations';
140                           SetPiece(x, U, 14, MyParent + MyType);
141                           x3 := MyType + U + MyType + U + IntToStr(Context);
142                           if (AList.IndexOf(x3) = -1) then AList.Add(x3);
143                         end;
144                       end;
145               end;
146               Dest.Add(x);
147             end; {for}
148           SortByPiece(TStringList(Dest), U, 3);
149           if not Ascending then InvertStringList(TStringList(Dest));
150           Dest.Insert(0, IntToStr(Context) + '^' + SG_TV_TEXT + '^^^^^^^^^^^%^0');
151           Alist.Sort;
152           if Ascending or (CharAt(GroupBy, 1) = 'T') then InvertStringList(AList);   // operations before non-OR procs
153           for i := 0 to AList.Count-1 do
154             Dest.Insert(0, IntToStr(Context) + Piece(AList[i], U, 1) + '^' + Piece(AList[i], U, 2) + '^^^^^^^^^^^%^' + Piece(AList[i], U, 3));
155         end;
156         //ReportBox(Dest, '', True);
157     finally
158       AList.Free;
159       SrcList.Free;
160     end;
161   end;