]> Creatis software - creaMiniTools.git/blobdiff - bbtk_package_creaMiniTools/src/bbcreaMiniToolsCreateReport01.cxx
3421 template_creaPatientsSystem
[creaMiniTools.git] / bbtk_package_creaMiniTools / src / bbcreaMiniToolsCreateReport01.cxx
index c5601579338753a662b7bbae52c6fdab55a4a636..385ac657bf7f76ee3efcbda47046db5228e6f096 100644 (file)
@@ -67,7 +67,7 @@ void CreateReport01::Process()
     for (iTitle2=0 ; iTitle2<sizeTitles2 ; iTitle2++ )
     {
         pLstOut[iTitle2]->push_back( lstTitles2[iTitle2]  );
-        pLstOut[iTitle2]->push_back( " "  );
+        pLstOut[iTitle2]->push_back( " " );
     } // for iTitle2
     
 
@@ -75,32 +75,99 @@ void CreateReport01::Process()
     int i,sizeLstPatientsID     = lstPatients.size();
     int j,sizeLstStepsPath      = lstStepsPath.size();
     int jj,sizeLstCommentsPath  = lstCommentsPath.size();
+    std::string stdPATIENT("<PATIENT>");
+    std::string pathFile;
+    FILE *ff;
+    char tmpTitle[255];
+    char tmpValue[255];
     for ( i=0 ;  i<sizeLstPatientsID ; i++ )
     {
-        printf("EED CreateReport01::Process Patient:%s\n", lstPatients[i].c_str() );
         pLstOut[0]->push_back( lstPatients[i] );
         pLstOut[0]->push_back( " " );
         pLstOut[0]->push_back( " " );
         pLstOut[0]->push_back( " " );
-        
+        pLstOut[0]->push_back( " " );
+
         for (j=0; j<sizeLstStepsPath;j++)
         {
             id=j+1;
-            pLstOut[id]->push_back( "Step:"+std::to_string(j) );
-            pLstOut[id]->push_back( "2021/11/12" );
-            pLstOut[id]->push_back( "16h56" );
-            pLstOut[id]->push_back( " " );
-            printf("EED CreateReport01::Process Step:%s\n", lstStepsPath[j].c_str() );
+            pathFile    = lstStepsPath[j];
+            size_t pos  = 0;
+            pos         = pathFile.find( stdPATIENT , pos);
+            pathFile.replace(pos, stdPATIENT.length(), lstPatients[i] );
+            printf("CreateReport01::Process %s \n", pathFile.c_str() );
+            ff=fopen(pathFile.c_str(), "r");
+            strcpy(tmpValue,"?EED?");
+            if (ff!=NULL)
+            {
+                fscanf(ff,"%s ",tmpTitle);                 // User
+                fscanf(ff,"%s ",tmpValue);                 //
+                pLstOut[id]->push_back( tmpValue );
+                fscanf(ff,"%s ",tmpTitle);                 // State
+                fscanf(ff,"%s ",tmpValue);                 //
+                pLstOut[id]->push_back( tmpValue );
+                fscanf(ff,"%s ",tmpTitle);                 // Date
+                fscanf(ff,"%s ",tmpValue);                 //
+                pLstOut[id]->push_back( tmpValue );
+                fscanf(ff,"%s ",tmpTitle);                 // Time
+                fscanf(ff,"%s ",tmpValue);                 //
+                pLstOut[id]->push_back( tmpValue );
+                pLstOut[id]->push_back( " " );
+                fclose(ff);
+            } else {
+                pLstOut[id]->push_back( " " );
+                pLstOut[id]->push_back( " " );
+                pLstOut[id]->push_back( " " );
+                pLstOut[id]->push_back( " " );
+                pLstOut[id]->push_back( " " );
+            }// if ff
         } // for j
 
         for ( jj=0; jj<sizeLstCommentsPath ; jj++ )
         {
             id=jj+1+sizeLstStepsPath;
-            pLstOut[id]->push_back( "Comment:"+std::to_string(jj) );
-            pLstOut[id]->push_back( "2021/11/12" );
-            pLstOut[id]->push_back( "16h56" );
-            pLstOut[id]->push_back( " " );
-            printf("EED CreateReport01::Process Comment:%s\n", lstCommentsPath[jj].c_str() );
+
+            pathFile    = lstCommentsPath[jj];
+            size_t pos  = 0;
+            pos         = pathFile.find( stdPATIENT , pos);
+            pathFile.replace(pos, stdPATIENT.length(), lstPatients[i] );
+            printf("CreateReport01::Process %s \n", pathFile.c_str() );
+            ff=fopen(pathFile.c_str(), "r");
+            strcpy(tmpValue,"?EED?");
+            if (ff!=NULL)
+            {
+                fgets(tmpValue,255,ff);
+                pLstOut[id]->push_back( tmpValue );
+                pLstOut[id]->push_back( " " );
+                pLstOut[id]->push_back( " " );
+                pLstOut[id]->push_back( " " );
+                pLstOut[id]->push_back( " " );
+
+                /*
+                fscanf(ff,"%s ",tmpTitle);                 // User
+                fscanf(ff,"%s ",tmpValue);                 //
+                pLstOut[id]->push_back( tmpValue );
+                fscanf(ff,"%s ",tmpTitle);                 // State
+                fscanf(ff,"%s ",tmpValue);                 //
+                pLstOut[id]->push_back( tmpValue );
+                fscanf(ff,"%s ",tmpTitle);                 // Date
+                fscanf(ff,"%s ",tmpValue);                 //
+                pLstOut[id]->push_back( tmpValue );
+                fscanf(ff,"%s ",tmpTitle);                 // Time
+                fscanf(ff,"%s ",tmpValue);                 //
+                pLstOut[id]->push_back( tmpValue );
+                pLstOut[id]->push_back( " " );
+                 
+                */
+                
+                fclose(ff);
+            } else {
+                pLstOut[id]->push_back( "Error file name" );
+                pLstOut[id]->push_back( " " );
+                pLstOut[id]->push_back( " " );
+                pLstOut[id]->push_back( " " );
+                pLstOut[id]->push_back( " " );
+            }// if ff
         } // for j
 
     } // for i