diff OrthancServer/OrthancRestApi/OrthancRestArchive.cpp @ 1315:0c735fed8953

ZIP archives now display the accession number of the studies
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 12 Feb 2015 13:28:47 +0100
parents bba8a47922d1
children 02f5a3f5c0a0
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestArchive.cpp	Wed Feb 11 12:33:07 2015 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestArchive.cpp	Thu Feb 12 13:28:47 2015 +0100
@@ -56,27 +56,34 @@
                                                ResourceType resourceType)
   {
     std::string s;
+    const Json::Value& tags = resource["MainDicomTags"];
 
     switch (resourceType)
     {
       case ResourceType_Patient:
       {
-        std::string p = resource["MainDicomTags"]["PatientID"].asString();
-        std::string n = resource["MainDicomTags"]["PatientName"].asString();
+        std::string p = tags["PatientID"].asString();
+        std::string n = tags["PatientName"].asString();
         s = p + " " + n;
         break;
       }
 
       case ResourceType_Study:
       {
-        s = resource["MainDicomTags"]["StudyDescription"].asString();
+        std::string p;
+        if (tags.isMember("AccessionNumber"))
+        {
+          p = tags["AccessionNumber"].asString() + " ";
+        }
+
+        s = p + tags["StudyDescription"].asString();
         break;
       }
         
       case ResourceType_Series:
       {
-        std::string d = resource["MainDicomTags"]["SeriesDescription"].asString();
-        std::string m = resource["MainDicomTags"]["Modality"].asString();
+        std::string d = tags["SeriesDescription"].asString();
+        std::string m = tags["Modality"].asString();
         s = m + " " + d;
         break;
       }