Procedure

PutNewNote

Module

rTIU

Last Modified

7/15/2014 3:26:44 PM

Comments

Create a new progress note with the data in NoteRec and return its internal entry number
  load broker directly since there isn't a good way to set up mutilple subscript arrays 

var
  i: Integer;

Scope

Interfaced

Declaration

procedure PutNewNote(var CreatedDoc: TCreatedDoc; const NoteRec: TNoteRec);

Calls Hierarchy


PutNewNote
 ├TEncounter.GetVisitStr
 │ └TEncounter.GetVisitCategory
 └SetText
   └InitParams

Called-By Hierarchy


                            PutNewNote
        TfrmConsults.CompleteConsult┤ 
  TfrmConsults.mnuActCompleteClick┤ │ 
TfrmConsults.mnuActAddIDEntryClick┘ │ 
           TfrmSurgery.InsertNewNote┤ 
        TfrmSurgery.mnuActNewClick┘ │ 
     TfrmSurgery.cmdNewNoteClick┘   │ 
             TfrmNotes.InsertNewNote┘ 
          TfrmNotes.mnuActNewClick┤   
       TfrmNotes.cmdNewNoteClick┘ │   
   TfrmNotes.mnuActAddIDEntryClick┘   

Calls

Name Declaration Comments
TEncounter.GetVisitStr function GetVisitStr: string; -
SetText procedure SetText(var ErrMsg: string; NoteText: TStrings; NoteIEN: Int64; Suppress: Integer); -

Called-By

Name Declaration Comments
TfrmConsults.CompleteConsult procedure CompleteConsult(IsIDChild: boolean; AnIDParent: integer; UseClinProcTitles: boolean); -
TfrmSurgery.InsertNewNote procedure InsertNewNote(IsIDChild: boolean; AnIDParent: integer); -
TfrmNotes.InsertNewNote procedure InsertNewNote(IsIDChild: boolean; AnIDParent: integer); -


Source

680   procedure PutNewNote(var CreatedDoc: TCreatedDoc; const NoteRec: TNoteRec);
681   { create a new progress note with the data in NoteRec and return its internal entry number
682     load broker directly since there isn't a good way to set up mutilple subscript arrays }
683   (*var
684     i: Integer;*)
685   var
686     ErrMsg: string;
687   begin
688     with RPCBrokerV do
689     begin
690       ClearParameters := True;
691       RemoteProcedure := 'TIU CREATE RECORD';
692       Param[0].PType := literal;
693       Param[0].Value := Patient.DFN;  //*DFN*
694       Param[1].PType := literal;
695       Param[1].Value := IntToStr(NoteRec.Title);
696       Param[2].PType := literal;
697       Param[2].Value := ''; //FloatToStr(Encounter.DateTime);
698       Param[3].PType := literal;
699       Param[3].Value := ''; //IntToStr(Encounter.Location);
700       Param[4].PType := literal;
701       Param[4].Value := '';
702       Param[5].PType := list;
703       with Param[5] do
704       begin
705         //Mult['.11'] := BOOLCHAR[NoteRec.NeedCPT];  //  **** removed in v19.1  {RV} ****
706         Mult['1202'] := IntToStr(NoteRec.Author);
707         Mult['1301'] := FloatToStr(NoteRec.DateTime);
708         Mult['1205'] := IntToStr(Encounter.Location);
709         if NoteRec.Cosigner > 0 then Mult['1208'] := IntToStr(NoteRec.Cosigner);
710         if NoteRec.PkgRef <> '' then Mult['1405'] := NoteRec.PkgRef;
711         Mult['1701'] := FilteredString(Copy(NoteRec.Subject, 1, 80));
712         if NoteRec.IDParent > 0 then Mult['2101'] := IntToStr(NoteRec.IDParent);
713   (*      if NoteRec.Lines <> nil then
714           for i := 0 to NoteRec.Lines.Count - 1 do
715             Mult['"TEXT",' + IntToStr(i+1) + ',0'] := FilteredString(NoteRec.Lines[i]);*)
716       end;
717       Param[6].PType := literal;
718       Param[6].Value := Encounter.VisitStr;
719       Param[7].PType := literal;
720       Param[7].Value := '1';  // suppress commit logic
721       CallBroker;
722       CreatedDoc.IEN := StrToIntDef(Piece(Results[0], U, 1), 0);
723       CreatedDoc.ErrorText := Piece(Results[0], U, 2);
724     end;
725     if ( NoteRec.Lines <> nil ) and ( CreatedDoc.IEN <> 0 ) then
726     begin
727       SetText(ErrMsg, NoteRec.Lines, CreatedDoc.IEN, 1);
728       if ErrMsg <> '' then
729       begin
730         CreatedDoc.IEN := 0;
731         CreatedDoc.ErrorText := ErrMsg;
732       end;
733     end;
734   end;