Enable the worklist to retrieve more results based on different combinations of Patient ID and accession number.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "json/jsonobject.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDate>
|
||||
|
||||
WorkListManager::WorkListManager()
|
||||
{
|
||||
@@ -14,7 +15,7 @@ WorkListManager::~WorkListManager()
|
||||
{
|
||||
}
|
||||
|
||||
PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString& aAccessionNum, const QString& aPatientId)
|
||||
QList<PatientInformationPointer> WorkListManager::getPatientFromWorkList(const QString& aAccessionNum, const QString& aPatientId)
|
||||
{
|
||||
DcmSCU scu;
|
||||
OFString temp_str;
|
||||
@@ -27,6 +28,7 @@ PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString&
|
||||
overrideKeys.push_back("0010,0010");
|
||||
overrideKeys.push_back("0010,0030");
|
||||
overrideKeys.push_back("0010,0040");
|
||||
overrideKeys.push_back("0040,0002");
|
||||
if (!dcmDataDict.isDictionaryLoaded())
|
||||
{
|
||||
qDebug()<<"dcmdatadict error";
|
||||
@@ -38,7 +40,7 @@ PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString&
|
||||
scu.setACSETimeout(30);
|
||||
scu.setDIMSEBlockingMode(DIMSE_BLOCKING);
|
||||
scu.setDIMSETimeout(0);
|
||||
scu.setAETitle("USCT");
|
||||
scu.setAETitle(serverInfo.name.toLatin1().data());
|
||||
scu.setPeerHostName(ip.data());
|
||||
scu.setPeerPort(OFstatic_cast(Uint16, serverInfo.port.toInt()));
|
||||
scu.setPeerAETitle(aeTitle.data());
|
||||
@@ -50,14 +52,14 @@ PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString&
|
||||
{
|
||||
qDebug()<<cond.code() <<cond.text();
|
||||
qDebug()<<"worklist initNetwork failed";
|
||||
return PatientInformationPointer();
|
||||
return QList<PatientInformationPointer>();
|
||||
}
|
||||
cond = scu.negotiateAssociation();
|
||||
if(cond.bad())
|
||||
{
|
||||
qDebug()<<cond.code();//<< "----"<<cond.text();
|
||||
qDebug()<<"worklist connect failed";
|
||||
return PatientInformationPointer();
|
||||
return QList<PatientInformationPointer>();
|
||||
}
|
||||
|
||||
cond = EC_Normal;
|
||||
@@ -65,7 +67,7 @@ PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString&
|
||||
if (pcid == 0)
|
||||
{
|
||||
qDebug()<<"worklist pcid bad";
|
||||
return PatientInformationPointer();
|
||||
return QList<PatientInformationPointer>();
|
||||
}
|
||||
|
||||
DcmFileFormat dcmff;
|
||||
@@ -79,42 +81,41 @@ PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString&
|
||||
{
|
||||
proc.applyPathWithValue(dset, item);
|
||||
}
|
||||
|
||||
|
||||
PatientInformationPointer result = PatientInformationPointer(new PatientInformation());
|
||||
QList<PatientInformationPointer> result;
|
||||
cond = scu.sendFINDRequest(pcid, dset, &responses);
|
||||
if (!responses.empty())
|
||||
if (responses.size() > 1)
|
||||
{
|
||||
auto item = *responses.begin();
|
||||
if (item->m_dataset)
|
||||
for(auto item = responses.begin(); item != responses.end(); ++item)
|
||||
{
|
||||
OFString ID;
|
||||
OFString Name;
|
||||
OFString BirthDate;
|
||||
OFString Sex;
|
||||
OFString AccessionNumber;
|
||||
item->m_dataset->findAndGetOFString(DCM_PatientID, ID);
|
||||
if (ID.empty())
|
||||
if ((*item)->m_dataset)
|
||||
{
|
||||
return PatientInformationPointer();
|
||||
PatientInformationPointer patient = PatientInformationPointer(new PatientInformation());
|
||||
OFString ID;
|
||||
OFString Name;
|
||||
OFString BirthDate;
|
||||
OFString Sex;
|
||||
OFString AccessionNumber;
|
||||
OFString scheduledStartDateStr;
|
||||
(*item)->m_dataset->findAndGetOFString(DCM_PatientID, ID);
|
||||
|
||||
if (ID.empty())
|
||||
{
|
||||
return QList<PatientInformationPointer>();
|
||||
}
|
||||
(*item)->m_dataset->findAndGetOFString(DCM_PatientName, Name);
|
||||
(*item)->m_dataset->findAndGetOFString(DCM_PatientBirthDate, BirthDate);
|
||||
(*item)->m_dataset->findAndGetOFString(DCM_PatientSex, Sex);
|
||||
(*item)->m_dataset->findAndGetOFString(DCM_AccessionNumber, AccessionNumber);
|
||||
(*item)->m_dataset->findAndGetOFString(DCM_ScheduledProcedureStepStartDate, scheduledStartDateStr);
|
||||
//(*item)->m_dataset->print(std::cerr);
|
||||
patient->ID = QString(ID.c_str());
|
||||
patient->Name = QString(Name.c_str());
|
||||
patient->BirthDate = QString(BirthDate.c_str()).insert(4,"-").insert(7,"-");
|
||||
patient->Sex = QString(Sex.c_str());
|
||||
patient->AccessionNumber = QString(AccessionNumber.c_str());
|
||||
patient->ScheduledStartDate = QString(scheduledStartDateStr.c_str());
|
||||
result.push_back(patient);
|
||||
}
|
||||
item->m_dataset->findAndGetOFString(DCM_PatientName, Name);
|
||||
item->m_dataset->findAndGetOFString(DCM_PatientBirthDate, BirthDate);
|
||||
item->m_dataset->findAndGetOFString(DCM_PatientSex, Sex);
|
||||
item->m_dataset->findAndGetOFString(DCM_AccessionNumber, AccessionNumber);
|
||||
result->ID = QString(ID.c_str());
|
||||
result->Name = QString(Name.c_str());
|
||||
result->BirthDate = QString(BirthDate.c_str()).insert(4,"-").insert(7,"-");
|
||||
result->Sex = QString(Sex.c_str());
|
||||
result->AccessionNumber = QString(AccessionNumber.c_str());
|
||||
//if (patientName.bad())
|
||||
//{
|
||||
// std::cout << patientName.text() << std::endl;
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
return PatientInformationPointer();
|
||||
}
|
||||
|
||||
OFListIterator(QRResponse*) iter = responses.begin();
|
||||
@@ -127,7 +128,7 @@ PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString&
|
||||
}
|
||||
else
|
||||
{
|
||||
return PatientInformationPointer();
|
||||
return QList<PatientInformationPointer>();
|
||||
}
|
||||
|
||||
if (cond == EC_Normal)
|
||||
|
||||
Reference in New Issue
Block a user