5. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 11/2/2017 7:18:07 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

5.1 Files compared

# Location File Last Modified
1 CAPRI_CIF.zip\CAPRI_CIF\Source eCrud.pas Wed Nov 1 18:09:32 2017 UTC
2 CAPRI_CIF.zip\CAPRI_CIF\Source eCrud.pas Wed Nov 1 19:06:46 2017 UTC

5.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 2308
Changed 1 2
Inserted 0 0
Removed 0 0

5.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

5.4 Active regular expressions

No regular expressions were active.

5.5 Comparison detail

  1   unit eCrud ;
  2  
  3   interface
  4  
  5   uses Windo ws, Classe s, Dialogs , xmldom,  XMLIntf, m sxmldom, X MLDoc, Xsd EngineLite ,
  6     XmlConfi g, XsdComp lexType, X mlComponen tBindings,
  7     IdBaseCo mponent, I dComponent , IdTCPCon nection, I dTCPClient , IdHTTP
  8     , ExtCtr ls, SysUti ls, Varian ts
  9     , VlerDa sClient
  10     , VlerDa sIdHTTP
  11     , CCOWRP CBrokerCAP RI
  12     , SynCom mons, Unit DocumentMe thods
  13     , untMis cMthds
  14     ;
  15  
  16   //const  L MS not use d
  17   //  NS_GET nc = 'nc=" http://nie m.gov/niem /niem-core /2.0"';
  18  
  19   type
  20     PVLERAtt achNodeVal  = ^TVLERA ttachNodeV al;
  21     TVLERAtt achNodeVal  = record
  22       strncD ocumentFil eControlID : string;                                              //used a u nique id i n this Rec ord to be  search in  TList
  23       strncB inaryDescr iptionText : string;                                              //prefix o f attachme nt filenam e
  24       strncB inaryForma tStandardN ame: strin g;                                          //file typ e such as  image/jpeg
  25       strncB inaryLocat ionURI: st ring;                                                  //Is the l ocation wi thin the " fs" collec tion that  contains t he file.wh en query " fs" passin g this val ue the sto re file wi ll be retu rned.
  26       strncB inarySizeV alue: stri ng;                                                    //Is the s ize of the  file
  27       strncB inaryCateg oryText: s tring;                                                 //Category  group the  image per tains to.  (ex: X-Ray s)
  28     end;
  29  
  30     TeCRUD =  class(TCo mponent)
  31     private
  32       FeCRUD Version: s tring;
  33       FdbNam e: string;
  34       Fcolle ctionName:  string;
  35       FmaxRe cords: str ing;
  36       FSpeci fyResponse Fields: st ring;
  37       FSort:  string;
  38       FHTTPS erver: TId HTTPvler;
  39       FXMLDo cument: TX MLdocument ;
  40       FVLERA ttachNodeL ist: TList ;                                                      // rpk 9/1 1/2014
  41       FOpenD ocList: TO penDocList ;
  42       pVLERA ttachNodeV alue: PVLE RAttachNod eVal;                                       // rpk 9/1 1/2014
  43       functi on SelectN odes(xnRoo t: IXmlNod e; const n odePath: W ideString) : IXMLNode List;
  44   //    func tion NodeF ound(var a Node: IXml Node; aNod eName: str ing; var F oundNode:  IXmlNode):  boolean;
  45       functi on NodeFou nd(aNode:  IXmlNode;  aNodeName:  string; v ar FoundNo de: IXmlNo de): boole an;
  46     public
  47       constr uctor Crea te(AOwner:  TComponen t; ABroker : TCCOWRPC BrokerCAPR I); reintr oduce; ove rload; vir tual; // L MS - Corre cted decla ration
  48       destru ctor Destr oy; overri de;                                                    // LMS - C orrected d eclaration
  49       functi on getExam By(UserInp utType: st ring; Sear chParams:  TStringLis t; var aRe sultStrlst : TStringL ist): bool ean;
  50       proced ure getExa mAttachmen ts(aBinary LocURI: st ring; var  strURLQryA ttachment:  string);
  51   //    proc edure getE xamAttachm entList(va r aTList:  TList; pRe cord: PVLE RAttachNod eVal);
  52       proced ure setExa mAttachmen tList(inTL ist: TList );
  53       proced ure setOpe nDocumentL ist(inDocL ist: TOpen DocList);
  54       proced ure OpenDo cumentFrom XMLNode(an cBinaryLoc ationURI:  string;
  55         aFil ename: str ing; aFile Type: stri ng; Attach mentSQL: s tring; Bin arySzValue : integer) ;
  56       proced ure CloseO penAttachm ents();
  57       functi on getExam ReviewDocu ments(URLa ndQuery: s tring; var  aResult:  TStringLis t; include Text: Bool ean): Bool ean;
  58       //func tion GetTe mpDirector y: String;   // CodeC R496 - LMS  - 2014-07 -14
  59   //    func tion FreeT List(var a TList: TLi st): Boole an;
  60  
  61     publishe d
  62   //    prop erty HTTPS erver: TId HTTP read  FHTTPServe r write FH TTPServer;   // DONE:  LMS Needs  a setter  method to  free exist ing object .
  63       proper ty HTTPSer ver: TIdHT TPVler rea d FHTTPSer ver;                             // IdHTTPV ler object  used by T eCRUD clas s to conne ct to the  server (pr oxy or dir ect to VLE R).
  64       proper ty XMLDocu ment: TXML Document r ead FXMLDo cument wri te FXMLDoc ument;     // TODO: L MS - maybe  - Needs a  setter me thod to fr ee existin g object.
  65  
  66       proper ty eCRUDVe rsion: str ing read F eCRUDVersi on write F eCRUDVersi on;
  67          //i nterface v ersion num ber
  68       proper ty dbName:  string re ad FdbName  write Fdb Name;
  69          //t he VLER Da ta Store ( VDS) Mongo DB databas e name whe re the dat a for this  operation  is to
  70          //b e read
  71       proper ty collect ionName: s tring read  Fcollecti onName wri te Fcollec tionName;
  72          //f or MongoDB  read requ ests: this  is the VD S, MongoDB  collectio n name, fo r GridFS p artition,
  73          //  this will  always hav e the valu e of “fs”.
  74       //prop erty query String : s tring read  FqueryStr ing write  FqueryStri ng;
  75          //t he optiona l “query=”  request p arameter,  accepts a  {queryStri ng} which  is a key-v alue
  76          //  pair of th e selectio n criteria  in a JSON  format.
  77       proper ty maxReco rds: strin g read Fma xRecords w rite FmaxR ecords;
  78          //-  the optio nal “limit =” request  integer p arameter,  accepts a  {maxRecord s}
  79          //  value whic h sets the  maximum n umber of r esults tha t can be s ent back i n the resp onse.
  80          //  When not s pecified:  will defau lt to 100  max record s, when ze ro: implie s no limit s and all  records wi ll be retu rned and w hen negati ve: the ab solute val ue will be  considere d.
  81       proper ty Specify ResponseFi elds: stri ng read FS pecifyResp onseFields  write FSp ecifyRespo nseFields;
  82          //t he optiona l “fields= ” request  parameter,  accepts a  {columnPr ojections}  value whi ch
  83          //  sets the f ields that  can be in cluded/not  included  in the res ponse. Whe n not spec ified
  84          //  will retur n all fiel ds in the  document
  85       proper ty Sort: s tring read  FSort wri te FSort;
  86  
  87     end;
  88  
  89   //var
  90   //  FVLERA ttachNodeL ist: TList ;
  91   //  pVLERA ttachNodeV alue: PVLE RAttachNod eVal;
  92   //  aOpenD ocList: TO penDocList ;
  93  
  94   implementa tion
  95   uses
  96     Main,
  97     dialogsc apri;
  98   { TeCRUD }
  99  
  100   procedure  TeCRUD.Clo seOpenAtta chments;
  101   begin
  102     if Assig ned(FOpenD ocList) th en
  103       FOpenD ocList.Clo seMyDocume nts;
  104   end;
  105  
  106   constructo r TeCRUD.C reate(AOwn er: TCompo nent; ABro ker: TCCOW RPCBrokerC APRI);
  107   begin
  108     inherite d Create(A Owner);
  109     FHTTPSer ver := TId HTTPvler.C reate(self , ABroker) ;
  110  
  111     //Header  from http ://www.sit epoint.com /web-found ations/mim e-types-co mplete-lis t/
  112     {FHTTPSe rver.Reque st.CustomH eaders.Add ('Accept :  applicati on/msword' );
  113     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  applicatio n/mswrite' );
  114     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  applicatio n/pdf');
  115     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  applicatio n/rtf');
  116     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  applicatio n/X-rtf');
  117     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  image/jpeg ');
  118     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  image/pjpe g');
  119     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  image/BMP' );
  120     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  image/gif' );
  121     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  image/tiff ');
  122     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  image/x-ti ff');
  123     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  image/vnd. dwg');
  124     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  image/x-dw g');
  125     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  image/png' );
  126     FHTTPSer ver.Reques t.CustomHe aders.Add( 'Accept :  text/richt ext');
  127      }
  128  
  129     // Make  sure there 's no memo ry leak
  130     // FXMLD ocument:=  XMLDOM;
  131     eCRUDVer sion := 'v 1';
  132     dbName : = 'core';
  133     collecti onName :=  'disabilit yBenefitsQ uestionnai res';
  134     maxRecor ds := '100 ';
  135   //  FOpenD ocList :=  nil;
  136   end;
  137  
  138   destructor  TeCRUD.De stroy;
  139   begin
  140   //  FreeTL ist(FVLERA ttachNodeL ist);
  141   //  if ass igned(aOpe nDocList)  then
  142   //    aOpe nDocList.F ree;
  143   //  if ass igned(FOpe nDocList)  then
  144   //    FOpe nDocList.F ree;
  145     inherite d Destroy;
  146   end;
  147  
  148   { function  TeCRUD.Fr eeTList(va r aTList:  TList): Bo olean;
  149   var
  150     I: Integ er;
  151   begin
  152     result : = true;
  153     if assig ned(aTList ) then beg in
  154       try
  155         try
  156           fo r I := 0 t o aTList.C ount - 1 d o
  157         // a TList[i] =  new(pVLER AttachNode Value)
  158              dispose(PV LERAttachN odeVal(aTL ist[i]));
  159           aT list.Clear ;
  160   //    aTli st.Free;
  161         exce pt
  162           on  E: Except ion do
  163              result :=  False;
  164         end;
  165       finall y
  166   //    aTli st.Clear;
  167         Free AndNil(aTL ist);
  168       end;
  169     end; //  if assigne d
  170   end; }
  171  
  172   (*
  173   procedure  TeCRUD.Est ablishHTTP ServerSett ings;
  174   begin
  175     theHTTPS erver.Requ est.Clear;
  176     theHTTPS erver.Requ est.Accept  := FHTTPA cceptHeade rXML; //'a pplication /xml' - DE FAULT is J ASON
  177     theHTTPS erver.Requ est.Conten tType := F HTTPConten tType;
  178     theHTTPS erver.Requ est.Conten tEncoding  := FHTTPCo ntentEncod ing;
  179     theHTTPS erver.Requ est.Custom Headers.Cl ear;
  180     theHTTPS erver.Requ est.Custom Headers.Ad d('authTok en:' + FVl erDasToken ); //CodeC R540 JRL
  181   end;
  182   *)
  183  
  184  
  185  
  186  
  187   //procedur e TeCRUD.g etExamAtta chmentList (var aTLis t: TList;  pRecord: P VLERAttach NodeVal);
  188  
  189   procedure  TeCRUD.set ExamAttach mentList(i nTList: TL ist);
  190   begin
  191   //  aTList  := FVLERA ttachNodeL ist;
  192   //  pRecor d := pVLER AttachNode Value;
  193     FVLERAtt achNodeLis t := inTLi st;
  194   end;
  195  
  196   procedure  TeCRUD.set OpenDocume ntList(inD ocList: TO penDocList );
  197   begin
  198     FOpenDoc List := in DocList;
  199   end;
  200  
  201   procedure  TeCRUD.get ExamAttach ments(aBin aryLocURI:  string; v ar strURLQ ryAttachme nt: string );
  202   begin
  203      //Creat e GET URL  with query
  204     strURLQr yAttachmen t := TIdHT TPVler.Get VlerDasURL () + '/' +  'ecrud' +  '/' + FeC RUDVersion  + '/' +
  205       FdbNam e + '/' +  Fcollectio nName + '/ ' + aBinar yLocURI;
  206  
  207      // Esta blishHTTPS erverSetti ngs();
  208   end;
  209  
  210   function T eCRUD.getE xamBy(User InputType:  string; S earchParam s: TString List; var  aResultStr lst: TStri ngList): b oolean;
  211   var
  212     strURLQR Y: string;
  213     MiddleNa me: string ;
  214     includeT ext: Boole an;
  215        (**** ********** ********** ********** ********** ********** **********
  216         !!!s udo code e xample of  implementi ng monogoD B FIND $el emMatch !! !!
  217          cld :Claim.cld :CommonDat a.nc:Perso n.nc:Perso nName.nc:P ersonName:  {
  218              { field: {  $regex: / acme.*corp /i}
  219           }
  220        ***** ********** ********** ********** ********** ********** ********** **)
  221   begin
  222     includeT ext := Tru e;                                                                // all get ExamBy cal ls include  text file s.
  223  
  224      //Creat e GET URL  with query
  225     strURLQR Y := TIdHT TPVler.Get VlerDasURL ()
  226       + '/'  + 'ecrud'
  227       + '/'  + FeCRUDVe rsion
  228       + '/'  + FdbName
  229       + '/'  + Fcollect ionName;
  230  
  231      //assig n query ba sed on use r input on  frmVlerGe tExam
  232     if UserI nputType =  'SSN' the n                                                      //search b y SSN
  233     begin
  234       strURL QRY := str URLQRY +
  235         '?qu ery=%7b%22 cld:Claim. cld:Common Data.nc:Pe rson.nc:Pe rsonSSNIde ntificatio n.nc:Ident ificationI D%22:%22'  +
  236         Sear chParams.S trings[0]  + '%22,' +
  237  
  238         // f ilter Docu ment Statu s = Comple ted or Rej ected
  239       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentStatus .nc:Status Text": { " $in": ["Co mpleted",  "Rejected" ] },' +
  240  
  241       '%22cl d:Claim.cl d:CommonDa ta.nc:Docu ment.nc:Do cumentCrea tionDate.n c:DateTime %22:%7b%22 $gte%22:%2 2$Date(' +  SearchPar ams.String s[1] +
  242         ')%2 2,' + '%22 $lte%22:%2 2$Date(' +  SearchPar ams.String s[2] + ')% 22%7d%7d';
  243     end
  244     else if  UserInputT ype = 'FAC ILITY' the n                                           //search b y facility
  245     begin
  246       strURL QRY := str URLQRY +
  247         '?qu ery=%7b%22 cld:Claim. cld:Common Data.nc:Fa cility.nc: FacilityId entificati on.nc:Iden tification ID%22:%22'  +
  248         Sear chParams.S trings[0]  + '%22,' +
  249  
  250         // f ilter Docu ment Statu s = Comple ted or Rej ected
  251       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentStatus .nc:Status Text": { " $in": ["Co mpleted",  "Rejected" ] },' +
  252  
  253       '%22cl d:Claim.cl d:CommonDa ta.nc:Docu ment.nc:Do cumentCrea tionDate.n c:DateTime %22:%7b%22 $gte%22:%2 2$Date(' +  SearchPar ams.String s[1] +
  254         ')%2 2,' + '%22 $lte%22:%2 2$Date(' +  SearchPar ams.String s[2] + ')% 22%7d%7d';
  255     end
  256     else if  UserInputT ype = 'SSN _FACILITY'  then                                       //search b y SNN and  facility
  257     begin
  258        //SSN  qry
  259       strURL QRY := str URLQRY +
  260         '?qu ery=%7b%22 cld:Claim. cld:Common Data.nc:Pe rson.nc:Pe rsonSSNIde ntificatio n.nc:Ident ificationI D%22:%22'  +
  261         Sear chParams.S trings[0]  + '%22,' +
  262  
  263        //Fac ility qry
  264       '%22cl d:Claim.cl d:CommonDa ta.nc:Faci lity.nc:Fa cilityIden tification .nc:Identi ficationID %22:%22' +
  265         Sear chParams.S trings[1]  + '%22,' +
  266  
  267         // f ilter Docu ment Statu s = Comple ted or Rej ected
  268       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentStatus .nc:Status Text": { " $in": ["Co mpleted",  "Rejected" ] },' +
  269  
  270        //Dat e Range
  271       '%22cl d:Claim.cl d:CommonDa ta.nc:Docu ment.nc:Do cumentCrea tionDate.n c:DateTime %22:%7b%22 $gte%22:%2 2$Date(' +  SearchPar ams.String s[2] +
  272         ')%2 2,' + '%22 $lte%22:%2 2$Date(' +  SearchPar ams.String s[3] + ')% 22%7d%7d';
  273     end
  274     else if  UserInputT ype = 'PHY SICIAN' th en                                          //search b y physicia n
  275     begin
  276       if Sea rchParams. Strings[1]  = '' then                                             // Don't s end middle  name if i t doesn't  exist, it  causes que ry issues
  277         Midd leName :=  ''
  278       else
  279         Midd leName :=
  280           '" nc:PersonN ame.nc:Per sonMiddleN ame":{"$re gex":"^' +
  281           Se archParams .Strings[1 ] + '","$o ptions":"i "},';
  282       strURL QRY := str URLQRY +
  283         // p hysician n ame
  284       '?quer y={"cld:Cl aim.cld:Co mmonData.n c:Person": {"$elemMat ch":{"-s:i d":"two",'  +
  285         '"nc :PersonNam e.nc:Perso nGivenName ":{"$regex ":"^' +
  286         Sear chParams.S trings[0]  + '","$opt ions":"i"} ,' +
  287         Midd leName +
  288         '"nc :PersonNam e.nc:Perso nSurName": {"$regex": "^' +
  289         Sear chParams.S trings[2]  + '","$opt ions":"i"} }},' +
  290  
  291         // f ilter Docu ment Statu s = Comple ted or Rej ected
  292       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentStatus .nc:Status Text": { " $in": ["Co mpleted",  "Rejected" ] },' +
  293  
  294         // d ate range
  295       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentCreati onDate.nc: DateTime": {"$gte":"$ Date(' +
  296         Sear chParams.S trings[3]  + ')",' +
  297         '"$l te":"$Date (' + Searc hParams.St rings[4] +  ')"}}';
  298  
  299     end
  300     else if  UserInputT ype = 'SSN _PHYSICIAN ' then                                      //search b y SSN and  PHYSICIAN
  301     begin
  302       if Sea rchParams. Strings[2]  = '' then                                             // Don't s end middle  name if i t doesn't  exist, it  causes que ry issues
  303         Midd leName :=  ''
  304       else
  305         Midd leName :=
  306   //      '" $options": "i"},"cld: Claim.cld: CommonData .nc:Person .nc:Person Name.nc:Pe rsonMiddle Name":{"$r egex":"^'  + SearchPa rams.Strin gs[2] + '" ,';
  307         '"nc :PersonNam e.nc:Perso nMiddleNam e":{"$rege x":"^' +
  308           Se archParams .Strings[2 ] + '","$o ptions":"i "},';
  309  
  310        //SSN  qry
  311       strURL QRY := str URLQRY +
  312         '?qu ery={"cld: Claim.cld: CommonData .nc:Person .nc:Person SSNIdentif ication.nc :Identific ationID":" ' +
  313         Sear chParams.S trings[0]  + '",' +
  314  
  315        //Phy sician qry
  316   //    '"cl d:Claim.cl d:CommonDa ta.nc:Pers on.nc:Pers onName.nc: PersonGive nName":{"$ regex":"^'  + SearchP arams.Stri ngs[1] + ' ",' +
  317       '"cld: Claim.cld: CommonData .nc:Person ":{"$elemM atch":{"-s :id":"two" ,' +
  318         '"nc :PersonNam e.nc:Perso nGivenName ":{"$regex ":"^' +
  319         Sear chParams.S trings[1]  + '","$opt ions":"i"} ,' +
  320         Midd leName +
  321         '"nc :PersonNam e.nc:Perso nSurName": {"$regex": "^' +
  322         Sear chParams.S trings[3]  + '","$opt ions":"i"} }},' +
  323  
  324         // f ilter Docu ment Statu s = Comple ted or Rej ected
  325       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentStatus .nc:Status Text": { " $in": ["Co mpleted",  "Rejected" ] },' +
  326  
  327        //Dat e Range
  328       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentCreati onDate.nc: DateTime": {"$gte":"$ Date(' + S earchParam s.Strings[ 4] +
  329         ')", ' + '"$lte ":"$Date('  + SearchP arams.Stri ngs[5] + ' )"}}';
  330  
  331     end
  332     else if  UserInputT ype = 'PHY SICIAN_FAC ILITY' the n                                //search b y Physicia n and Faci lity
  333     begin
  334       if Sea rchParams. Strings[1]  = '' then                                             // Don't s end middle  name if i t doesn't  exist, it  causes que ry issues
  335         Midd leName :=  ''
  336       else
  337         Midd leName :=  '"nc:Perso nName.nc:P ersonMiddl eName":{"$ regex":"^'  +
  338           Se archParams .Strings[1 ] + '","$o ptions":"i "},';
  339        //Fac ility qry
  340       strURL QRY := str URLQRY +
  341         '?qu ery={"cld: Claim.cld: CommonData .nc:Facili ty.nc:Faci lityIdenti fication.n c:Identifi cationID": "' +
  342         Sear chParams.S trings[3]  + '",' +
  343  
  344        //Phy sician qry
  345       '"cld: Claim.cld: CommonData .nc:Person ":{"$elemM atch":{"-s :id":"two" ,' +
  346         '"nc :PersonNam e.nc:Perso nGivenName ":{"$regex ":"^' + Se archParams .Strings[0 ] +
  347         '"," $options": "i"},' +
  348         Midd leName +
  349         '"nc :PersonNam e.nc:Perso nSurName": {"$regex": "^' +
  350         Sear chParams.S trings[2]  + '","$opt ions":"i"} }},' +
  351  
  352         // f ilter Docu ment Statu s = Comple ted or Rej ected
  353       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentStatus .nc:Status Text": { " $in": ["Co mpleted",  "Rejected" ] },' +
  354  
  355        //Dat e Range
  356       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentCreati onDate.nc: DateTime": {"$gte":"$ Date(' +
  357         Sear chParams.S trings[4]  + ')",' +
  358         '"$l te":"$Date (' + Searc hParams.St rings[5] +  ')"}}';
  359  
  360     end
  361     else if  UserInputT ype = 'EXA MSTATUS' t hen                                         //search b y ExamStat us
  362     begin
  363       strURL QRY := str URLQRY +
  364         '?qu ery={"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentStatus .nc:Status Text":"' +
  365         Sear chParams.S trings[0]  + '",' +
  366         '"cl d:Claim.cl d:CommonDa ta.nc:Docu ment.nc:Do cumentCrea tionDate.n c:DateTime ":{"$gte": "$Date(' +
  367         Sear chParams.S trings[1]  + ')",' +
  368         '"$l te":"$Date (' + Searc hParams.St rings[2] +  ')"}}';
  369  
  370     end
  371     else if  UserInputT ype = 'SSN _EXAMSTATU S' then                                     //search b y SSN and  ExamStatus
  372     begin
  373       //SSN  qry
  374       strURL QRY := str URLQRY +
  375         '?qu ery=%7b%22 cld:Claim. cld:Common Data.nc:Pe rson.nc:Pe rsonSSNIde ntificatio n.nc:Ident ificationI D%22:%22'  +
  376         Sear chParams.S trings[0]  + '%22,' +
  377  
  378       //Exam  status
  379       '%22cl d:Claim.cl d:CommonDa ta.nc:Docu ment.nc:Do cumentStat us.nc:Stat usText%22: %22' +
  380         Sear chParams.S trings[1]  + '%22,' +
  381  
  382        //Dat e Range
  383       '%22cl d:Claim.cl d:CommonDa ta.nc:Docu ment.nc:Do cumentCrea tionDate.n c:DateTime %22:%7b%22 $gte%22:%2 2$Date(' +  SearchPar ams.String s[2] +
  384         ')%2 2,' + '%22 $lte%22:%2 2$Date(' +  SearchPar ams.String s[3] + ')% 22%7d%7d';
  385     end
  386     else if  UserInputT ype = 'PHY SICIAN_EXA MSTATUS' t hen                              //search b y Physicia n and Exam Status
  387     begin
  388       if Sea rchParams. Strings[1]  = '' then                                             // Don't s end middle  name if i t doesn't  exist, it  causes que ry issues
  389         Midd leName :=  ''
  390       else
  391         Midd leName :=  '"nc:Perso nName.nc:P ersonMiddl eName":{"$ regex":"^'  +
  392           Se archParams .Strings[1 ] + '","$o ptions":"i "},';
  393        //Phy sician qry
  394       strURL QRY := str URLQRY +
  395         // p hysician n ame
  396       '?quer y={"cld:Cl aim.cld:Co mmonData.n c:Person": {"$elemMat ch":{"-s:i d":"two",'  +
  397         '"nc :PersonNam e.nc:Perso nGivenName ":{"$regex ":"^' +
  398         Sear chParams.S trings[0]  + '","$opt ions":"i"} ,' +
  399         Midd leName +
  400         '"nc :PersonNam e.nc:Perso nSurName": {"$regex": "^' +
  401         Sear chParams.S trings[2]  + '","$opt ions":"i"} }},' +
  402  
  403        //Exa m status
  404       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentStatus .nc:Status Text":"' +
  405         Sear chParams.S trings[3]  + '",' +
  406  
  407         // d ate range
  408       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentCreati onDate.nc: DateTime": {"$gte":"$ Date(' +
  409         Sear chParams.S trings[4]  + ')",' +
  410         '"$l te":"$Date (' + Searc hParams.St rings[5] +  ')"}}';
  411  
  412     end
  413     else if  UserInputT ype = 'SSN _PHYSICIAN _EXAMSTATU S' then                          //search b y SSN, PHY SICIAN and  EXAM STAT US
  414     begin
  415       if Sea rchParams. Strings[2]  = '' then                                             // Don't s end middle  name if i t doesn't  exist, it  causes que ry issues
  416         Midd leName :=  ''
  417       else
  418         Midd leName :=
  419   //      '" $options": "i"},"cld: Claim.cld: CommonData .nc:Person .nc:Person Name.nc:Pe rsonMiddle Name":{"$r egex":"^'  + SearchPa rams.Strin gs[2] + '" ,';
  420         '"nc :PersonNam e.nc:Perso nMiddleNam e":{"$rege x":"^' +
  421           Se archParams .Strings[2 ] + '","$o ptions":"i "},';
  422       //SSN  qry
  423       strURL QRY := str URLQRY +
  424         '?qu ery={"cld: Claim.cld: CommonData .nc:Person .nc:Person SSNIdentif ication.nc :Identific ationID":" ' +
  425         Sear chParams.S trings[0]  + '",' +
  426  
  427       //Phys ician qry
  428   //    '"cl d:Claim.cl d:CommonDa ta.nc:Pers on.nc:Pers onName.nc: PersonGive nName":{"$ regex":"^'  + SearchP arams.Stri ngs[1] + ' ",' +
  429       '"cld: Claim.cld: CommonData .nc:Person ":{"$elemM atch":{"-s :id":"two" ,' +
  430         '"nc :PersonNam e.nc:Perso nGivenName ":{"$regex ":"^' +
  431         Sear chParams.S trings[1]  + '","$opt ions":"i"} ,' +
  432         Midd leName +
  433         '"nc :PersonNam e.nc:Perso nSurName": {"$regex": "^' +
  434         Sear chParams.S trings[3]  + '","$opt ions":"i"} }},' +
  435  
  436       // Exa m Status
  437   //    '"cl d:Claim.cl d:CommonDa ta.nc:Docu ment.nc:Do cumentStat us.nc:Stat usText":"'  +
  438   //      Se archParams .Strings[4 ] + '",' +
  439       // Exa m status
  440       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentStatus .nc:Status Text":"' +
  441         Sear chParams.S trings[4]  + '",' +
  442  
  443        //Dat e Range
  444       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentCreati onDate.nc: DateTime": {"$gte":"$ Date(' +
  445         Sear chParams.S trings[5]  + ')",' +  '"$lte":"$ Date(' +
  446         Sear chParams.S trings[6]  + ')"}}';
  447  
  448     end
  449     else if  UserInputT ype = 'FAC ILITY_EXAM STATUS' th en                               //search b y Facility  and ExamS tatus
  450     begin
  451       strURL QRY := str URLQRY +
  452        //Fac ility
  453       '?quer y=%7b%22cl d:Claim.cl d:CommonDa ta.nc:Faci lity.nc:Fa cilityIden tification .nc:Identi ficationID %22:%22' +  SearchPar ams.String s[0] + '%2 2,' +
  454  
  455        //Exa m status
  456       '%22cl d:Claim.cl d:CommonDa ta.nc:Docu ment.nc:Do cumentStat us.nc:Stat usText%22: %22' + Sea rchParams. Strings[1]  +
  457  
  458        //Dat e
  459       '%22,'  + '%22cld :Claim.cld :CommonDat a.nc:Docum ent.nc:Doc umentCreat ionDate.nc :DateTime% 22:%7b%22$ gte%22:%22 $Date(' +  SearchPara ms.Strings [2] +
  460         ')%2 2,' + '%22 $lte%22:%2 2$Date(' +  SearchPar ams.String s[3] + ')% 22%7d%7d';
  461     end
  462     else if  UserInputT ype = 'FAC ILITY_PHYS ICIAN_EXAM STATUS' th en                    //Search b y Facility  and Physi cian and E xamStatus
  463     begin
  464       if Sea rchParams. Strings[2]  = '' then                                             // Don't s end middle  name if i t doesn't  exist, it  causes que ry issues
  465         Midd leName :=  ''
  466       else
  467         Midd leName :=  '"nc:Perso nName.nc:P ersonMiddl eName":{"$ regex":"^'  +
  468           Se archParams .Strings[2 ] + '","$o ptions":"i "},';
  469  
  470        //Fac ility qry
  471       strURL QRY := str URLQRY +
  472         '?qu ery={"cld: Claim.cld: CommonData .nc:Facili ty.nc:Faci lityIdenti fication.n c:Identifi cationID": "' +
  473         Sear chParams.S trings[0]  + '",' +
  474  
  475        //Phy sician qry
  476       '"cld: Claim.cld: CommonData .nc:Person ":{"$elemM atch":{"-s :id":"two" ,' +
  477         '"nc :PersonNam e.nc:Perso nGivenName ":{"$regex ":"^' + Se archParams .Strings[1 ] +
  478         '"," $options": "i"},' +
  479         Midd leName +
  480         '"nc :PersonNam e.nc:Perso nSurName": {"$regex": "^' +
  481         Sear chParams.S trings[3]  + '","$opt ions":"i"} }},' +
  482  
  483        //Exa m status
  484       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentStatus .nc:Status Text":"' +  SearchPar ams.String s[4] + '", ' +
  485  
  486         // d ate range
  487       '"cld: Claim.cld: CommonData .nc:Docume nt.nc:Docu mentCreati onDate.nc: DateTime": {"$gte":"$ Date(' +
  488         Sear chParams.S trings[5]  + ')",' +
  489         '"$l te":"$Date (' + Searc hParams.St rings[6] +  ')"}}';
  490  
  491     end
  492     else if  UserInputT ype = 'SSN _FACILITY_ PHYSICIAN'  then                            //Search b y SSN and  Facility a nd Physici an
  493     begin
  494       if Sea rchParams. Strings[3]  = '' then                                             // Don't s end middle  name if i t doesn't  exist, it  causes que ry issues
  495         Midd leName :=  ''
  496       else
  497         Midd leName :=  '"nc:Perso nName.nc:P ersonMiddl eName":{"$ regex":"^'  +
  498           Se archParams .Strings[3 ] + '","$o ptions":"i "},';
  499  
  500        //SSN  qry
  501       strURL QRY := str URLQRY +
  502         '?qu ery={"cld: Claim.cld: CommonData .nc:Person .nc:Person SSNIdentif ication.nc :Identific ationID":" ' + Search Params.Str ings[0] +  '",';
  503  
  504        //Fac ility qry
  505       strURL QRY := str URLQRY +
  506         '"cl d:Claim.cl d:CommonDa ta.nc:Faci lity.nc:Fa cilityIden tification .nc:Identi ficationID ":"' +
  507         Sear chParams.S trings[1]  + '",';
  508  
  509        //Phy sician qry
  510       strURL QRY := str URLQRY +
  511         '"cl d:Claim.cl d:CommonDa ta.nc:Pers on":{"$ele mMatch":{" -s:id":"tw o",' +
  512         '"nc :PersonNam e.nc:Perso nGivenName ":{"$regex ":"^' + Se archParams .Strings[2 ] +
  513         '"," $options": "i"},' +
  514         Midd leName +
  515         '"nc :PersonNam e.nc:Perso nSurName": {"$regex": "^' +
  516         Sear chParams.S trings[4]  + '","$opt ions":"i"} }},';
  517  
  518         // f ilter Docu ment Statu s = Comple ted or Rej ected
  519       strURL QRY := str URLQRY +
  520         '"cl d:Claim.cl d:CommonDa ta.nc:Docu ment.nc:Do cumentStat us.nc:Stat usText": {  "$in": [" Completed" , "Rejecte d"] },';
  521  
  522         // d ate range
  523       strURL QRY := str URLQRY +
  524         '"cl d:Claim.cl d:CommonDa ta.nc:Docu ment.nc:Do cumentCrea tionDate.n c:DateTime ":{"$gte": "$Date(' +
  525         Sear chParams.S trings[5]  + ')",' +
  526         '"$l te":"$Date (' + Searc hParams.St rings[6] +  ')"}}';
  527  
  528     end
  529     else if  UserInputT ype = 'SSN _FACILITY_ PHYSICIAN_ EXAMSTATUS ' then                //Search b y SSN and  Facility a nd Physici an and Exa mStatus
  530     begin
  531       if Sea rchParams. Strings[3]  = '' then                                             // Don't s end middle  name if i t doesn't  exist, it  causes que ry issues
  532         Midd leName :=  ''
  533       else
  534         Midd leName :=  '"nc:Perso nName.nc:P ersonMiddl eName":{"$ regex":"^'  +
  535           Se archParams .Strings[3 ] + '","$o ptions":"i "},';
  536  
  537        //SSN  qry
  538       strURL QRY := str URLQRY +
  539         '?qu ery={"cld: Claim.cld: CommonData .nc:Person .nc:Person SSNIdentif ication.nc :Identific ationID":" ' + Search Params.Str ings[0] +  '",';
  540  
  541        //Fac ility qry
  542       strURL QRY := str URLQRY +
  543         '"cl d:Claim.cl d:CommonDa ta.nc:Faci lity.nc:Fa cilityIden tification .nc:Identi ficationID ":"' +
  544         Sear chParams.S trings[1]  + '",';
  545  
  546        //Phy sician qry
  547       strURL QRY := str URLQRY +
  548         '"cl d:Claim.cl d:CommonDa ta.nc:Pers on":{"$ele mMatch":{" -s:id":"tw o",' +
  549         '"nc :PersonNam e.nc:Perso nGivenName ":{"$regex ":"^' + Se archParams .Strings[2 ] +
  550         '"," $options": "i"},' +
  551         Midd leName +
  552         '"nc :PersonNam e.nc:Perso nSurName": {"$regex": "^' +
  553         Sear chParams.S trings[4]  + '","$opt ions":"i"} }},';
  554  
  555        //Exa m status
  556       strURL QRY := str URLQRY +
  557         '"cl d:Claim.cl d:CommonDa ta.nc:Docu ment.nc:Do cumentStat us.nc:Stat usText":"'  + SearchP arams.Stri ngs[5] + ' ",';
  558  
  559         // d ate range
  560       strURL QRY := str URLQRY +
  561         '"cl d:Claim.cl d:CommonDa ta.nc:Docu ment.nc:Do cumentCrea tionDate.n c:DateTime ":{"$gte": "$Date(' +
  562         Sear chParams.S trings[6]  + ')",' +
  563         '"$l te":"$Date (' + Searc hParams.St rings[7] +  ')"}}';
  564  
  565     end;
  566  
  567      //Resul t Fields,  Sort condi tion, Limi t Number o f result
  568     //strURL QRY:=strUR LQRY + '&f ields='+FS pecifyResp onseFields +'&sort='+ FSort+'&li mit='+Fmax Records;
  569     strURLQR Y := strUR LQRY + '&l imit=' + F maxRecords ;
  570  
  571     //Exampl e of SSN U RL Query//
  572       //http:// DNS            .vaco. DNS     /ecrud/v1/ core/disab ilityBenef itsQuestio nnaires?qu ery={"cld: Claim.cld: CommonData .nc:Person .nc:Person SSNIdentif ication.nc :Identific ationID":" 500950188" }&fields={ "cld:Claim .cld:Commo nData.nc:D ocument":1 ,"cld:Clai m.cld:Comm onData.vle r:Client": 1,"cld:Cla im.cld:Com monData.nc :Person":1 }&sort={"c ld:Claim.c ld:CommonD ata.nc:Doc ument.nc:D ocumentCre ationDate. nc:DateTim e":-1}&lim it=100
  573     //port i s optional
  574     Result : = getExamR eviewDocum ents(strUR LQRY, aRes ultStrlst,  includeTe xt);       //Execute  RESTful GE T and Form at XML Res ponse for  Exam Revie w.
  575  
  576   end;
  577  
  578   function T eCRUD.getE xamReviewD ocuments(U RLandQuery : string;  var aResul t: TString List; incl udeText: B oolean): B oolean;
  579   var
  580     strXML:  string;
  581     DocFileC trlID, Doc CreateDT,  DocIDUUID,  ClaimID,  ClientID,  Person, Gi venNMclien t, MiddleN Mclient, S urNMclient : string;
  582     StatusOf ExamRslt,  DbqDocTitl eText, Giv enNMSrvPro v, MiddleN MSrvProv,  SurNMSrvPr ov, Facili tyNM, Pers onDOB, Per sonSSN: st ring;
  583     BinaryDe scriptionT ext, Binar yFormatSta ndardName,  BinaryLoc ationURI,  BinarySize Value, Bin aryCategor yText, Exa mID, ExamS tatusDT: s tring;
  584     i, x: in teger;
  585     xNode, a Node, docs Node, clsc laimNode,  cldCommonD ataNode, c lsclaimIDN ode, ncdoc Node,
  586       ncDocC reationDTN ode, ncDat eTimeNode,
  587       ncDocF ileControl ID, ncDate TimeNodeVa lue, ncDoc IDNode, nc IdntIDNode ,
  588       ncDocS tatusNode,  ncStatusT xtNode, nc DocTitleTe xtNode,
  589       Person ElementNod e, PersonS rvcProvNod e, PersonS rvProvNmNo de, Person ClientNmNo de,
  590       ncFaci lityNode,  ncFacility NmNode, Pe rsonClient Node, ncPe rsonDOBNod e, ncPerso nDOBncDate Node,
  591       ncPers onSSNIdent Node, ncId entIDSSNNo de,
  592       ncBina ryDescript ionTextNod e, ncBinar yFormatSta ndardNameN ode, ncBin aryLocatio nURINode,
  593       ncBina rySizeValu eNode, ncB inaryCateg oryTextNod e,
  594       cldAtt achmentsNo de, ncAtta chmentNode ,
  595       vlerEx amDetailNo de, vlerEx amIdNode,
  596       vlerSt atusDateNo de, vlerSt atusDateNo dencDateTi me,
  597       cldDoc umentTypeV ersion: IX MLNode;
  598     RstlTmp,  TmpStr: s tring;
  599     DestFile _pt: Syste m.Text;
  600     DocTypeV er: string ;
  601     FileNM:  string;
  602     MS: TMem oryStream;
  603   begin
  604     try
  605      //URLan dQuery - i s the form atted URL  and and Qu ery and is  execute R ESTful GET
  606       result  := True;
  607       strXML  := FHTTPS erver.Get( URLandQuer y);
  608  
  609       FXMLDo cument.Loa dFromXML(s trXml);
  610       FXMLDo cument.Act ive := Tru e;
  611       AddDoc umentsWrap perIfMissi ng(FXMLDoc ument);                                     // DONE: L MS - new g eneric cal l to add < documents>  container  for queri es that re turn singl e object
  612  
  613     //Diagno sitc Code
  614       if PAR AM_SAVE_XM L then
  615       begin
  616         File NM := GetT empDir;                                                           // LMS - 2 014-07-14  refactor i n unit unt MiscMthds
  617         File NM := File NM + 'XMLR eplyFromVl er.xml';
  618         MS : = TMemoryS tream.Crea te;
  619         FXML Document.S aveToStrea m(MS);
  620         MS.S aveToFile( FileNM);
  621         MS.F ree;
  622       end;
  623  
  624       if FXM LDocument. DocumentEl ement.HasC hildNodes  then
  625       begin
  626  
  627     //VLERAt tachNodeLi st := TVLE RAttachNod eList.Crea te; //Crea te a TList  of type R ecord to h old attach ment value s to
  628                                                             //  ret rieve Exam  document  attachment s.
  629  
  630           // Create dyn arry to ho ld attachm ent record s
  631           {  if assigne d(FVLERAtt achNodeLis t) = True  then
  632           be gin
  633              FreeTList( FVLERAttac hNodeList) ;
  634              FVLERAttac hNodeList  := TList.C reate;
  635           en d
  636           el se
  637              FVLERAttac hNodeList  := TList.C reate; }
  638  
  639   //         if assigne d(FVLERAtt achNodeLis t) then
  640   //           FreeTLis t(FVLERAtt achNodeLis t);
  641   //         FVLERAttac hNodeList  := TList.C reate;
  642  
  643         for  x := 0 to  FXMLDocume nt.Documen tElement.C hildNodes. Count - 1  do
  644         begi n
  645           Rs tlTmp := ' ';
  646           Do cFileCtrlI D := ' ';  DocCreateD T := ' ';  DocIDUUID  := ' ';
  647           Cl aimID := '  '; Client ID := ' ';  Person :=  ' '; Give nNMclient  := ' ';
  648           Mi ddleNMclie nt := ' ';  SurNMclie nt := ' ';  StatusOfE xamRslt :=  ' '; DbqD ocTitleTex t := ' ';
  649           Gi venNMSrvPr ov := ' ';  MiddleNMS rvProv :=  ' '; SurNM SrvProv :=  ' '; Faci lityNM :=  ' ';
  650           Pe rsonDOB :=  ' '; Pers onSSN := '  '; ExamID  := ' '; E xamStatusD T := ' ';
  651           Bi naryDescri ptionText  := ' '; Bi naryFormat StandardNa me := ' ';  BinaryLoc ationURI : = ' ';
  652           Bi narySizeVa lue := ' ' ; BinaryCa tegoryText  := ' ';
  653  
  654  
  655           do csNode :=  FXMLDocume nt.Documen tElement.C hildNodes. Get(x);
  656  
  657           Tm pStr := do csNode.Nod eName;
  658           if  NodeFound (docsNode,  'cld:Clai m', clscla imNode) th en
  659              if clsclai mNode <> n il then
  660                tmpstr : = clsclaim Node.NodeN ame;
  661           if  NodeFound (clsclaimN ode, 'cld: ClaimID',  clsclaimID Node) then
  662           be gin
  663              if clsclai mIDNode <>  nil then
  664              begin
  665                tmpstr : = clsclaim IDNode.Nod eName;
  666                if clscl aimIDNode. NodeValue  <> null th en
  667                begin
  668                  ClaimI D := clscl aimIDNode. NodeValue;                                  //Retrieve d ClaimID
  669                end;
  670              end;
  671  
  672              if NodeFou nd(clsclai mNode, 'cl d:Document TypeVersio n', cldDoc umentTypeV ersion) th en
  673              begin
  674                if cldDo cumentType Version <>  nil then
  675                begin
  676                  tmpstr  := cldDoc umentTypeV ersion.Nod eName;
  677                  if cld DocumentTy peVersion. NodeValue  <> null th en
  678                  begin
  679                    DocT ypeVer :=  cldDocumen tTypeVersi on.NodeVal ue;                   //Retrieve d ClaimID
  680                  end;
  681                end;
  682              end;
  683  
  684              ncdocnode  := nil;
  685              vlerExamDe tailNode : = nil;
  686              PersonClie ntNode :=  nil;
  687              PersonSrvc ProvNode : = nil;
  688              ncFacility Node := ni l;
  689              if NodeFou nd(clsclai mNode, 'cl d:CommonDa ta', cldCo mmonDataNo de) then
  690              begin
  691  
  692                //Nav to  cld:Commo nData then  nc:docume nt
  693                if NodeF ound(cldCo mmonDataNo de, 'nc:Do cument', n cdocNode)  then
  694                begin
  695                          //Get Cre ation Date
  696                  tmpstr  := ncdocN ode.NodeNa me;
  697                  if Nod eFound(ncd ocNode, 'n c:Document CreationDa te', ncDoc CreationDT Node) then
  698                  begin
  699                    tmps tr := intt ostr(ncDoc CreationDT Node.Child Nodes.coun t);
  700                    if n cDocCreati onDTNode < > nil then
  701                    begi n
  702                      tm pstr := in ttostr(ncD ocCreation DTNode.Chi ldNodes.co unt);
  703                      tm pstr := nc DocCreatio nDTNode.No deName;
  704                      if  NodeFound (ncDocCrea tionDTNode , 'nc:Date Time', ncD ateTimeNod e) then
  705                      be gin
  706                         tmpstr :=  ncDateTime Node.NodeN ame;
  707                         tmpstr :=  inttostr(n cDateTimeN ode.ChildN odes.count );
  708  
  709                         if ncDateT imeNode <>  nil then
  710                         begin
  711                           if ncDat eTimeNode. NodeValue  <> null th en
  712                           begin
  713                             DocCre ateDT := n cDateTimeN ode.NodeVa lue;                  //Retrieve d 'nc:Date Time'
  714                           end;
  715                         end;
  716                      en d;
  717                    end;
  718                  end;
  719  
  720                  if Nod eFound(ncd ocNode, 'n c:Document FileContro lID', ncDo cFileContr olID) then
  721                    if n cDocFileCo ntrolID <>  nil then
  722                    begi n
  723                      tm pstr := nc DocFileCon trolID.Nod eName;
  724                      if  ncDocFile ControlID. NodeValue  <> null th en
  725                         DocFileCtr lID := ncD ocFileCont rolID.Node Value;                //Retrived  nc:Docume ntFileCont rolID
  726                    end;
  727                  //Get  Document I D (UUID)
  728                  if Nod eFound(ncd ocNode, 'n c:Document Identifica tion', ncD ocIDNode)  then
  729                    if n cDocIDNode  <> nil th en
  730                    begi n
  731                      tm pstr := nc DocIDNode. NodeName;
  732                      if  NodeFound (ncDocIDNo de, 'nc:Id entificati onID', ncI dntIDNode)  then
  733                         if ncIdntI DNode.Node Value <> n ull then
  734                           DocIDUUI D := ncIdn tIDNode.No deValue;                         //Retrieve d nc:Ident ificationI D
  735                    end;
  736                  //Get  Status of  Exam Resul t
  737                  if Nod eFound(ncd ocNode, 'n c:Document Status', n cDocStatus Node) then
  738                    if n cDocStatus Node <> ni l then
  739                    begi n
  740                      tm pstr := nc DocStatusN ode.NodeNa me;
  741   //                    ncStatusTx tNode := n cDocStatus Node.Child Nodes['nc: StatusText '];
  742                      if  NodeFound (ncDocStat usNode, 'n c:StatusTe xt', ncSta tusTxtNode ) then
  743                         if ncStatu sTxtNode.N odeValue < > null the n
  744                           StatusOf ExamRslt : = ncStatus TxtNode.No deValue;              //Retrieve d nc:Statu sText
  745                    end;
  746                  //Get  DBQ Docume nt Type
  747                  if Nod eFound(ncd ocNode, 'n c:Document TitleText' , ncDocTit leTextNode ) then
  748                    if n cDocTitleT extNode <>  nil then
  749                    begi n
  750                      tm pstr := nc DocTitleTe xtNode.Nod eName;
  751                      if  ncDocTitl eTextNode. NodeValue  <> null th en
  752                         DbqDocTitl eText := n cDocTitleT extNode.No deValue;              //Retrived  nc:Docume ntTitleTex t
  753                    end;
  754                  //DONE  WITH nc:D ocument NO DE LEVEL
  755                end;                                                                       //end of g et values  from nc:do cument nod e level
  756  
  757                if NodeF ound(cldCo mmonDataNo de, 'vler: ExamDetail ', vlerExa mDetailNod e) then
  758                begin
  759                  tmpstr  := vlerEx amDetailNo de.NodeNam e;
  760                                 // vlerExamId Node:=vler ExamDetail Node.Child Nodes['vle r:ExamId'] ; //Retriv ed vler:Ex amId
  761                  if Nod eFound(vle rExamDetai lNode, 'vl er:ExamId' , vlerExam IdNode) th en
  762                    if v lerExamIdN ode <> nil  then
  763                    begi n
  764                      tm pstr := vl erExamIdNo de.NodeNam e;
  765                      if  vlerExamI dNode.Node Value <> n ull then
  766                         ExamID :=  vlerExamId Node.NodeV alue;
  767                    end;
  768                end;
  769  
  770                if vlerE xamDetailN ode <> nil  then
  771                begin
  772                  if Nod eFound(vle rExamDetai lNode, 'vl er:StatusD ate', vler StatusDate Node) then
  773                  begin
  774                    tmps tr := vler StatusDate Node.NodeN ame;
  775  
  776                    if N odeFound(v lerStatusD ateNode, ' nc:DateTim e', vlerSt atusDateNo dencDateTi me) then
  777                    begi n
  778                      tm pstr := vl erStatusDa teNodencDa teTime.Nod eName;
  779                      if  vlerStatu sDateNoden cDateTime. NodeValue  <> null th en
  780                         ExamStatus DT := vler StatusDate NodencDate Time.NodeV alue;
  781                    end;
  782                  end;
  783  
  784                end;
  785  
  786                // loop  through Co mmonDataNo de child n odes and m atch nc:Pe rson
  787                for I :=  0 to cldC ommonDataN ode.ChildN odes.Count  - 1 do be gin
  788                  xNode  := cldComm onDataNode .ChildNode s[I];
  789                  tmpstr  := xNode. NodeName;
  790                  // che ck s:id at tribute to  identify  person nod e
  791                  if xNo de.NodeNam e = 'nc:Pe rson' then  begin
  792                    aNod e := xNode .Attribute Nodes['s:i d'];
  793                    if a Node <> ni l then beg in
  794                      if  aNode.Tex t = 'one'  then
  795                         PersonClie ntNode :=  xNode
  796                      el se if aNod e.Text = ' two' then
  797                         PersonSrvc ProvNode : = xNode;
  798                    end;
  799                  end;
  800                end;                                                                       // for I
  801  
  802                if Perso nSrvcProvN ode <> nil  then
  803                begin
  804                  if Nod eFound(Per sonSrvcPro vNode, 'nc :PersonNam e', Person SrvProvNmN ode) then
  805                  begin
  806                    tmps tr := Pers onSrvProvN mNode.Node Name;
  807  
  808                    if N odeFound(P ersonSrvPr ovNmNode,  'nc:Person GivenName' , PersonEl ementNode)  then
  809                      if  PersonEle mentNode < > nil then
  810                      be gin
  811                         tmpstr :=  PersonElem entNode.No deName;
  812                         if PersonE lementNode .NodeValue  <> null t hen
  813                           GivenNMS rvProv :=  PersonElem entNode.No deValue;              //Retrived  nc:Person GivenName
  814                      en d;
  815                    if N odeFound(P ersonSrvPr ovNmNode,  'nc:Person MiddleName ', PersonE lementNode ) then
  816                      if  PersonEle mentNode < > nil then
  817                      be gin
  818                         tmpstr :=  PersonElem entNode.No deName;
  819                         if PersonE lementNode .NodeValue  <> null t hen
  820                           MiddleNM SrvProv :=  PersonEle mentNode.N odeValue;             //Retrived  nc:Person MiddleName
  821                      en d;
  822  
  823                    if N odeFound(P ersonSrvPr ovNmNode,  'nc:Person SurName',  PersonElem entNode) t hen
  824                      if  PersonEle mentNode < > nil then
  825                      be gin
  826                         tmpstr :=  PersonElem entNode.No deName;
  827                         if PersonE lementNode .NodeValue  <> null t hen
  828                           SurNMSrv Prov := Pe rsonElemen tNode.Node Value;                //Retrived  nc:Person SurName
  829                      en d;
  830                  end;                                                                     // end of  - if Perso nSrvcProvN ode <> nil  then
  831                end;                                                                       // PersonS rvcProvNod e
  832  
  833                //Get Cl ient/Patie nt Name
  834                if Perso nClientNod e <> nil t hen
  835                begin
  836                  tmpstr  := Person ClientNode .NodeName;
  837                  //DOB
  838                  if Nod eFound(Per sonClientN ode, 'nc:P ersonBirth Date', ncP ersonDOBNo de) then
  839                  begin
  840  
  841                    if n cPersonDOB Node <> ni l then
  842                    begi n
  843                      tm pstr := nc PersonDOBN ode.NodeNa me;
  844                      if  NodeFound (ncPersonD OBNode, 'n c:Date', n cPersonDOB ncDateNode ) then
  845                      be gin
  846                         tmpstr :=  ncPersonDO BNode.Node Name;
  847                         if ncPerso nDOBncDate Node.NodeV alue <> nu ll then
  848                           PersonDO B := ncPer sonDOBncDa teNode.Nod eValue;               //Retrieve d nc:Date
  849                      en d;
  850                    end;
  851                  end;
  852                  if Nod eFound(Per sonClientN ode, 'nc:P ersonName' , PersonCl ientNmNode ) then
  853                  begin
  854                    if P ersonClien tNmNode <>  nil then
  855                    begi n
  856                      tm pstr := Pe rsonClient NmNode.Nod eName;
  857                      if  NodeFound (PersonCli entNmNode,  'nc:Perso nGivenName ', PersonE lementNode ) then
  858                      be gin
  859                         tmpstr :=  PersonElem entNode.No deName;
  860                         if PersonE lementNode .NodeValue  <> null t hen
  861                           GivenNMc lient := P ersonEleme ntNode.Nod eValue;               //Retrieve d nc:Perso nGivenName
  862                      en d;
  863                    end;
  864  
  865                    if N odeFound(P ersonClien tNmNode, ' nc:PersonM iddleName' , PersonEl ementNode)  then
  866                      if  PersonEle mentNode < > nil then
  867                      be gin
  868                         tmpstr :=  PersonElem entNode.No deName;
  869                         if PersonE lementNode .NodeValue  <> null t hen
  870                           MiddleNM client :=  PersonElem entNode.No deValue;              //Retrived  nc:Person MiddleName
  871                      en d;
  872  
  873                    if N odeFound(P ersonClien tNmNode, ' nc:PersonS urName', P ersonEleme ntNode) th en
  874                      if  PersonEle mentNode < > nil then
  875                      be gin
  876                         tmpstr :=  PersonElem entNode.No deName;
  877                         if PersonE lementNode .NodeValue  <> null t hen
  878                           SurNMcli ent := Per sonElement Node.NodeV alue;                 //Retrived  nc:Person SurName
  879                      en d;
  880                  end;                                                                     // end of  - if Perso nClientNmN ode <> nil  then
  881                  //SSN
  882                  if Nod eFound(Per sonClientN ode, 'nc:P ersonSSNId entificati on', ncPer sonSSNIden tNode) the n
  883                  begin
  884                    if n cPersonSSN IdentNode  <> nil the n
  885                    begi n
  886                      tm pstr := nc PersonSSNI dentNode.N odeName;
  887                                     //ncIdent IDSSNNode: = ncPerson SSNIdentNo de.ChildNo des['nc:Id entificati onID'];
  888                      if  NodeFound (ncPersonS SNIdentNod e, 'nc:Ide ntificatio nID', ncId entIDSSNNo de) then
  889                         if ncIdent IDSSNNode  <> nil the n
  890                         begin
  891                           tmpstr : = ncIdentI DSSNNode.N odeName;
  892                           if ncIde ntIDSSNNod e.NodeValu e <> null  then
  893                             Person SSN := ncI dentIDSSNN ode.NodeVa lue;                  //Retrived  nc:Identi ficationID
  894                         end;
  895                    end;
  896                  end;
  897                end;                                                                       // end of  - if Perso nClientNod e <> nil t hen
  898  
  899                if NodeF ound(cldCo mmonDataNo de, 'nc:Fa cility', n cFacilityN ode) then  begin
  900                  if ncF acilityNod e <> nil t hen begin
  901                    tmps tr := ncFa cilityNode .NodeName;
  902                    if N odeFound(n cFacilityN ode, 'nc:F acilityNam e', ncFaci lityNmNode ) then
  903                      if  ncFacilit yNmNode <>  nil then  begin
  904                         tmpstr :=  ncFacility NmNode.Nod eName;
  905                         if ncFacil ityNmNode. NodeValue  <> null th en
  906                           Facility NM := ncFa cilityNmNo de.NodeVal ue;                   //Retrieve d nc:Facil ityName
  907                      en d;
  908                  end;
  909                end;
  910                //DONE W ITH cld:Co mmonData N ODE LEVEL
  911              end;                                                                         //end of g et values  from cld:C ommonData  node level
  912  
  913  
  914              //Get File  Attachmen t nodes
  915              cldAttachm entsNode : = clsclaim Node.Child Nodes['cld :Attachmen ts'];
  916              if cldAtta chmentsNod e.HasChild Nodes then
  917              begin
  918                tmpstr : = cldAttac hmentsNode .NodeName;
  919                //Loop a nd get all  attacheme nts
  920                for I :=  0 to cldA ttachments Node.Child Nodes.Coun t - 1 do
  921                begin
  922                  ncAtta chmentNode  := cldAtt achmentsNo de.ChildNo des[I];
  923                  if ncA ttachmentN ode <> nil  then
  924                  begin
  925                    tmps tr := ncAt tachmentNo de.NodeNam e;
  926  
  927                    if N odeFound(n cAttachmen tNode, 'nc :BinaryDes criptionTe xt', ncBin aryDescrip tionTextNo de) then
  928                      if  ncBinaryD escription TextNode.N odeValue < > null the n
  929                      be gin
  930                         BinaryDesc riptionTex t := ncBin aryDescrip tionTextNo de.NodeVal ue; //Retr ieved Bina ryDescript ionText
  931                      en d;
  932  
  933                    if N odeFound(n cAttachmen tNode, 'nc :BinaryFor matStandar dName', nc BinaryForm atStandard NameNode)  then
  934                      if  ncBinaryF ormatStand ardNameNod e.NodeValu e <> null  then
  935                      be gin
  936                         BinaryForm atStandard Name := nc BinaryForm atStandard NameNode.N odeValue;  //Retrived  BinaryFor matStandar dName
  937                      en d;
  938  
  939                    if N odeFound(n cAttachmen tNode, 'nc :BinaryLoc ationURI',  ncBinaryL ocationURI Node) then
  940                      if  ncBinaryL ocationURI Node.NodeV alue <> nu ll then
  941                      be gin
  942                         BinaryLoca tionURI :=  ncBinaryL ocationURI Node.NodeV alue;      //Retrived  BinaryLoc ationURI
  943                      en d;
  944  
  945                    if N odeFound(n cAttachmen tNode, 'nc :BinarySiz eValue', n cBinarySiz eValueNode ) then
  946                      if  ncBinaryS izeValueNo de.NodeVal ue <> null  then
  947                      be gin
  948                         BinarySize Value := n cBinarySiz eValueNode .NodeValue ;          //Retrived  BinarySiz eValue
  949                      en d;
  950  
  951                    if N odeFound(n cAttachmen tNode, 'nc :BinaryCat egoryText' , ncBinary CategoryTe xtNode) th en
  952                      if  ncBinaryC ategoryTex tNode.Node Value <> n ull then
  953                      be gin
  954                         BinaryCate goryText : = ncBinary CategoryTe xtNode.Nod eValue;    //Retrived  BinaryCat egoryText
  955                      en d;
  956  
  957  
  958                    if A ssigned(FV lerAttachN odeList) t hen
  959                      if  (includeT ext                                                    // include  everythin g in the l ist
  960                         or ((not i ncludeText ) and (pos ('text', l owercase(B inaryForma tStandardN ame)) = 0) )
  961                         )
  962                         then begin                                                        //Now assi gn to VLER AttachNode List
  963                                 // GetMem(pVL ERAttachNo deValue,si zeof(TVLER AttachNode Val));
  964                         new(pVLERA ttachNodeV alue);
  965                         pVLERAttac hNodeValue ^.strncDoc umentFileC ontrolID : = DocFileC trlID;
  966                         pVLERAttac hNodeValue ^.strncBin aryDescrip tionText : = BinaryDe scriptionT ext;
  967                         pVLERAttac hNodeValue ^.strncBin aryFormatS tandardNam e := Binar yFormatSta ndardName;
  968                         pVLERAttac hNodeValue ^.strncBin aryLocatio nURI := Bi naryLocati onURI;
  969                         pVLERAttac hNodeValue ^.strncBin arySizeVal ue := Bina rySizeValu e;
  970                         pVLERAttac hNodeValue ^.strncBin aryCategor yText := B inaryCateg oryText;
  971                         FVLERAttac hNodeList. Add(pVLERA ttachNodeV alue);
  972                      en d;
  973                  end;                                                                     // if ncAt tachmentNo de <> nil
  974                end;                                                                       //end of -  for I :=  0 to ncAtt achmentNod e.ChildNod es.Count -  1 do
  975              end;                                                                         // if cldA ttachments Node.HasCh ildNodes
  976  
  977              //DONE WIT H cld:Clai m NODE LEV EL
  978           en d;                                                                           //end of g et values  from cld:C laim node  level
  979  
  980           Rs tlTmp := ' "' + Given NMclient +  '"' + ','  + '"' + M iddleNMcli ent + '"'  + ',' + '" ' + SurNMc lient + '" ' + ',' +  '"' + Pers onDOB + '" ' + ',' +
  981              '"' + Pers onSSN + '" ' + ',' +  '"' + DocI DUUID + '" ' + ',' +  '"' + Exam ID + '"' +  ',' + '"'  + DbqDocT itleText +  '"' + ','  +
  982              '"' + DocC reateDT +  '"' + ','  + '"' + Ex amStatusDT  + '"' + ' ,' + '"' +  FacilityN M + '"' +  ',' +
  983              '"' + Give nNMSrvProv  + '"' + ' ,' + '"' +  MiddleNMS rvProv + ' "' + ',' +  '"' + Sur NMSrvProv  + '"' + ', ' +
  984              '"' + Stat usOfExamRs lt + '"' +  ',' + '"'  + DocFile CtrlID + ' "';
  985  
  986           aR esult.Add( RstlTmp);
  987         end;                                                                              // for x
  988       end                                                                                 // if FXML Document.D ocumentEle ment.HasCh ildNodes
  989       else
  990       begin
  991   //      Me ssageDlg(' No Records  Found!',  mtInformat ion, [mbOK ], -1);
  992         Show MessageCAP RI('No Rec ords Found !');                                        // rpk 10/ 16/2014
  993         Resu lt := Fals e;
  994       end;
  995  
  996     except
  997       on E:  Exception  do
  998       begin
  999   //      Sh owMessage( 'Error occ urred in e Crud: ' +  E.Message) ;
  1000         Show MessageCAP RI('Error  occurred i n eCrud: '  + E.Messa ge);                  // rpk 10/ 16/2014
  1001         Resu lt := Fals e;
  1002       end;
  1003     end;
  1004   end;                                                                                    // getExam ReviewDocu ment
  1005  
  1006  
  1007   // functio n TeCRUD.N odeFound(v ar aNode:  IXmlNode;  aNodeName:  string; v ar FoundNo de: IXmlNo de): boole an;
  1008  
  1009   function T eCRUD.Node Found(aNod e: IXmlNod e; aNodeNa me: string ; var Foun dNode: IXm lNode): bo olean;
  1010   var
  1011     I: Integ er;
  1012     xNode: I XmlNode;
  1013   begin
  1014     Result : = False;
  1015     FoundNod e := nil;
  1016  
  1017     if Assig ned(aNode)  then begi n
  1018       try
  1019         Foun dNode := a node.Child Nodes[anod eName];
  1020         resu lt := True ;
  1021       except
  1022         ;
  1023       end;
  1024       if not  Result th en begin
  1025         // i f ChildNod es fails,  loop throu gh child n odes by in dex and ma tch anodeN ame to Nod eName
  1026         for  I := 0 to  aNode.Chil dNodes.Cou nt - 1 do  begin
  1027           xN ode := aNo de.ChildNo des[I];
  1028           if  xNode.Nod eName = aN odeName th en begin
  1029              FoundNode  := xNode;
  1030              break;
  1031           en d;
  1032         end;
  1033       end;
  1034       Result  := FoundN ode <> nil ;
  1035     end;                                                                                  // if aNod e assigned  then
  1036   end;                                                                                    // NodeFou nd
  1037  
  1038   //******** ********** ********** ********** ********** ********** ********** ********** **********
  1039   // procedu re OpenDoc umentFromX MLNode sav e binary a ttachments  from "FS"  collectio n to a fil e
  1040   //then cal l OpenDocu ment(pass  filename)  to open th e document  based on  its type a nd handles
  1041   //destruct ion of ope n document s
  1042   //Paramate rs:
  1043   ////ncBina ryLocation URI: locat ion of fil e in fs co llection
  1044   //afilenam e: is used  to create  TFileStre am and pas s to OpenD ocument()
  1045   //aFileTyp e: is used  for defin ing XML He ader (ex:  Content-Ty pe: image/ jpeg)
  1046   //******** ********** ********** ********** ********** ********** ********** ********** ********** *
  1047  
  1048   procedure  TeCRUD.Ope nDocumentF romXMLNode (ancBinary LocationUR I, aFilena me,
  1049     aFileTyp e, Attachm entSQL: st ring; Bina rySzValue:  integer);
  1050   var
  1051    //fs: TFi leStream;
  1052     MS: TMem oryStream;
  1053     strFileE xt: string ;
  1054     strFileN amePath: s tring;
  1055     aAttachm entSQL: st ring;
  1056     DocOpen:  Boolean;
  1057     aTmpFile name: stri ng;
  1058   begin
  1059  
  1060     aAttachm entSQL :=  Attachment SQL;
  1061     //need a  HTTPserve r - aHTTPS erver
  1062     //URI nc :BinaryLoc ationURI l ocation of  file in f s collecti on
  1063     //need a filestream
  1064     //need a filename   nc:BinaryD escription Text + nc: BinaryCate goryText +  nc:Binary LocationUR I
  1065     //need t ype of fil e   nc:Bin aryFormatS tandardNam e ex: Acce pt: image/ jpeg.
  1066  
  1067      //Set p ath, filen ame and ex tention
  1068      //strFi leNamePath :='.\'+aFi lename+'.' +strFileEx t;
  1069     try
  1070      //Creat e file str eam create  a filestr eam to wri te binary  attachment
  1071      //fs :=  TFileStre am.Create( strFileNam ePath, fmC reate);
  1072       MS :=  TMemoryStr eam.Create ;
  1073       try
  1074        //HTT PServer Ge t executes  Attachmen t request  to "fs" co llection a nd result  to TBlobFi eld;
  1075         FHTT PServer.Ge t(aAttachm entSQL, MS );
  1076         aFil ename := F HTTPServer .ManagedId HTTP.Respo nse.RawHea ders.Value s['Content -Dispositi on'];
  1077         aFil ename := C opy(aFilen ame, (Pos( '=', aFile name) + 1) , (Length( aFilename)  - (Pos('= ', aFilena me))));
  1078         aTmp Filename : = aFilenam e;
  1079         aFil ename := C opy(aFilen ame, 1, (P os('.', aF ilename) -  1));
  1080         strF ileExt :=  Copy(aTmpF ilename, ( Pos('.', a TmpFilenam e)), (Leng th(aTmpFil ename) - ( Pos('.', a TmpFilenam e) - 1)));
  1081        //Set  path, fil ename
  1082         strF ileNamePat h := '.\'  + aFilenam e + Format DateTime(' mmddyyyhhm mss', Now)  + strFile Ext;
  1083         if a ssigned(MS ) then
  1084         begi n
  1085  
  1086           MS .SaveToFil e(strFileN amePath);
  1087   //         if assigne d(aOpenDoc List) = Fa lse then
  1088   //           aOpenDoc List := TO penDocList .Create;
  1089  
  1090   //         DocOpen :=  aOpenDocL ist.OpenDo cument(str FileNamePa th);
  1091           if  Assigned( FOpenDocLi st) then b egin
  1092              DocOpen :=  FOpenDocL ist.OpenDo cument(str FileNamePa th);
  1093   //         if DocOpen  <> True t hen
  1094              if not Doc Open then
  1095                MessageD lg('Attach ment ' + s trFileName Path + 'co uld not be  opened!',  mtWarning , [mbOK],  -1);
  1096           en d;
  1097         end
  1098       finall y
  1099        //fs. Free;
  1100         MS.F ree;
  1101       end;
  1102     except
  1103       on E:  Exception  do
  1104       begin
  1105   //      Sh owMessage( E.Message) ;
  1106         Show MessageCAP RI(E.Messa ge);                                                   // rpk 10/ 16/2014
  1107       end;
  1108     end
  1109   end;
  1110  
  1111   function T eCRUD.Sele ctNodes(xn Root: IXml Node; cons t nodePath : WideStri ng): IXMLN odeList;
  1112   var
  1113     intfSele ct: IDomNo deSelect;
  1114     intfAcce ss: IXmlNo deAccess;
  1115     dnlResul t: IDomNod eList;
  1116     intfDocA ccess: IXm lDocumentA ccess;
  1117     doc: TXm lDocument;
  1118     i: Integ er;
  1119     dn: IDom Node;
  1120   begin
  1121     Result : = nil;
  1122     if not A ssigned(xn Root)
  1123       or not  Supports( xnRoot, IX mlNodeAcce ss, intfAc cess)
  1124       or not  Supports( xnRoot.DOM Node, IDom NodeSelect , intfSele ct) then
  1125       Exit;
  1126  
  1127     dnlResul t := intfS elect.sele ctNodes(no dePath);
  1128     if Assig ned(dnlRes ult) then
  1129     begin
  1130       Result  := TXmlNo deList.Cre ate(intfAc cess.GetNo deObject,  '', nil);
  1131       if Sup ports(xnRo ot.OwnerDo cument, IX mlDocument Access, in tfDocAcces s) then
  1132         doc  := intfDoc Access.Doc umentObjec t
  1133       else
  1134         doc  := nil;
  1135  
  1136       for i  := 0 to dn lResult.le ngth - 1 d o
  1137       begin
  1138         dn : = dnlResul t.item[i];
  1139         Resu lt.Add(TXm lNode.Crea te(dn, nil , doc));
  1140       end;
  1141     end;
  1142   end;
  1143  
  1144   // CodeCR4 96 - LMS -  2014-07-1 4
  1145   {function  TeCRUD.Get TempDirect ory: Strin g;
  1146   var
  1147     tempFold er: array[ 0..MAX_PAT H] of Char ;
  1148   begin
  1149     GetTempP ath(MAX_PA TH, @tempF older);
  1150     result : = StrPas(t empFolder) ;
  1151   end;
  1152   }
  1153  
  1154   end.
  1155