comparison OrthancServer/ServerIndex.cpp @ 1676:f079f3efe33b db-changes

patient tags reported in studies
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 02 Oct 2015 17:09:18 +0200
parents de1413733c97
children a903d57d9f0c
comparison
equal deleted inserted replaced
1675:131136aeeaa7 1676:f079f3efe33b
879 int64_t resourceId, 879 int64_t resourceId,
880 ResourceType resourceType) 880 ResourceType resourceType)
881 { 881 {
882 DicomMap tags; 882 DicomMap tags;
883 db_.GetMainDicomTags(tags, resourceId); 883 db_.GetMainDicomTags(tags, resourceId);
884 target["MainDicomTags"] = Json::objectValue; 884
885 FromDcmtkBridge::ToJson(target["MainDicomTags"], tags, true); 885 if (resourceType == ResourceType_Study)
886 {
887 DicomMap t1, t2;
888 tags.ExtractStudyInformation(t1);
889 tags.ExtractPatientInformation(t2);
890
891 target["MainDicomTags"] = Json::objectValue;
892 FromDcmtkBridge::ToJson(target["MainDicomTags"], t1, true);
893
894 target["PatientMainDicomTags"] = Json::objectValue;
895 FromDcmtkBridge::ToJson(target["PatientMainDicomTags"], t2, true);
896
897 int64_t patient;
898 if (!db_.LookupParent(patient, resourceId))
899 {
900 throw OrthancException(ErrorCode_InternalError);
901 }
902
903 tags.Clear();
904 db_.GetMainDicomTags(tags, patient);
905
906 if (tags.HasTag(DICOM_TAG_PATIENT_ID))
907 {
908 target["PatientMainDicomTags"]["PatientID"] = tags.GetValue(DICOM_TAG_PATIENT_ID).AsString();
909 }
910 }
911 else
912 {
913 target["MainDicomTags"] = Json::objectValue;
914 FromDcmtkBridge::ToJson(target["MainDicomTags"], tags, true);
915 }
886 } 916 }
887 917
888 bool ServerIndex::LookupResource(Json::Value& result, 918 bool ServerIndex::LookupResource(Json::Value& result,
889 const std::string& publicId, 919 const std::string& publicId,
890 ResourceType expectedType) 920 ResourceType expectedType)