comparison OrthancServer/ServerIndex.cpp @ 1727:1ae29c5e52fb db-changes

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 20 Oct 2015 14:50:10 +0200
parents a7c05bbfaf6a
children 4941494b5dd8
comparison
equal deleted inserted replaced
1725:a7c05bbfaf6a 1727:1ae29c5e52fb
1887 } 1887 }
1888 1888
1889 1889
1890 1890
1891 void ServerIndex::LookupIdentifier(std::list<std::string>& result, 1891 void ServerIndex::LookupIdentifier(std::list<std::string>& result,
1892 ResourceType level,
1892 const DicomTag& tag, 1893 const DicomTag& tag,
1893 const std::string& value, 1894 const std::string& value)
1894 ResourceType type) 1895 {
1895 { 1896 assert((level == ResourceType_Patient && tag == DICOM_TAG_PATIENT_ID) ||
1896 assert(tag == DICOM_TAG_PATIENT_ID || 1897 (level == ResourceType_Study && tag == DICOM_TAG_STUDY_INSTANCE_UID) ||
1897 tag == DICOM_TAG_STUDY_INSTANCE_UID || 1898 (level == ResourceType_Study && tag == DICOM_TAG_ACCESSION_NUMBER) ||
1898 tag == DICOM_TAG_SERIES_INSTANCE_UID || 1899 (level == ResourceType_Series && tag == DICOM_TAG_SERIES_INSTANCE_UID) ||
1899 tag == DICOM_TAG_SOP_INSTANCE_UID || 1900 (level == ResourceType_Instance && tag == DICOM_TAG_SOP_INSTANCE_UID));
1900 tag == DICOM_TAG_ACCESSION_NUMBER);
1901 1901
1902 result.clear(); 1902 result.clear();
1903 1903
1904 boost::mutex::scoped_lock lock(mutex_); 1904 boost::mutex::scoped_lock lock(mutex_);
1905 1905
1906 std::list<int64_t> id; 1906 std::list<int64_t> id;
1907 db_.LookupIdentifier(id, tag, value); 1907 db_.LookupIdentifier(id, level, tag, value);
1908 1908
1909 for (std::list<int64_t>::const_iterator 1909 for (std::list<int64_t>::const_iterator
1910 it = id.begin(); it != id.end(); ++it) 1910 it = id.begin(); it != id.end(); ++it)
1911 { 1911 {
1912 if (db_.GetResourceType(*it) == type) 1912 result.push_back(db_.GetPublicId(*it));
1913 {
1914 result.push_back(db_.GetPublicId(*it));
1915 }
1916 } 1913 }
1917 } 1914 }
1918 1915
1919 1916
1920 StoreStatus ServerIndex::AddAttachment(const FileInfo& attachment, 1917 StoreStatus ServerIndex::AddAttachment(const FileInfo& attachment,