Beispiel #1
0
static CONDITION
deleteInterpretationRecord(PRIVATE_HANDLE * h, FIS_DATA_TYPE criteriaType,
			   char *uid)
{
    CONDITION
    cond;
    TBL_CRITERIA
	criteria[2];

    if (criteriaType == FIS_K_RESULTS) {
	TBL_CRITERIA_LOAD_BYTE(criteria[0], "ResUID", uid, TBL_STRING,
			       TBL_EQUAL);
    } else if (criteriaType == FIS_K_INTERPRETATION) {
	TBL_CRITERIA_LOAD_BYTE(criteria[0], "IntUID", uid, TBL_STRING,
			       TBL_EQUAL);
    } else
	return COND_PushCondition(FIS_COND(FIS_ILLEGALDELETECRITERIA),
		       "interpretation", "(FIS)deleteInterpretationRecord");

    criteria[1].FieldName = NULL;

    cond = TBL_Delete(&h->interpretationHandle, criteria);
    if (cond != TBL_NORMAL)
	return FIS_DELETEFAILED;

    return FIS_NORMAL;
}
Beispiel #2
0
static CONDITION
deleteSCImageRecord(PRIVATE_HANDLE * h, FIS_DATA_TYPE criteriaType, char *uid)
{
    CONDITION
    cond;
    TBL_CRITERIA
	criteria[2];

    if (criteriaType == FIS_K_STUDYCOMPONENT) {
	TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuComUID", uid, TBL_STRING,
			       TBL_EQUAL);
    } else if (criteriaType == FIS_K_SCSERIES) {
	TBL_CRITERIA_LOAD_BYTE(criteria[0], "SerInsUID", uid, TBL_STRING,
			       TBL_EQUAL);
    } else if (criteriaType == FIS_K_SCIMAGE) {
	TBL_CRITERIA_LOAD_BYTE(criteria[0], "SOPInsUID", uid, TBL_STRING,
			       TBL_EQUAL);
    } else
	return COND_PushCondition(FIS_COND(FIS_ILLEGALDELETECRITERIA),
				  "study", "(FIS)deleteSCImageRecord");

    criteria[1].FieldName = NULL;

    cond = TBL_Delete(&h->studyComponentImageHandle, criteria);
    if (cond != TBL_NORMAL)
	return COND_PushCondition(FIS_COND(FIS_DELETEFAILED),
				  "(FIS)deleteSCImageRecord");

    return FIS_NORMAL;
}
Beispiel #3
0
static CONDITION
queryStorageControl(TBL_HANDLE ** handle,
		    DMAN_STORAGECONTROL * workRecord,
		    DMAN_STORAGECONTROL * criteriaRecord, LST_HEAD * head,
		    CONDITION(*callback) (), long *count, void *ctx)
{
    CONDITION
    cond;
    TBL_CRITERIA
	criteriaList[3];

    static TBL_FIELD
        fields[7];
    int
        i;
    CONTEXT
	context;

    i = 0;
    if (criteriaRecord->Flag & DMAN_K_STORAGECONTROL_REQUESTING) {
	TBL_CRITERIA_LOAD_BYTE(criteriaList[i], "RequestingTitle",
		    criteriaRecord->RequestingTitle, TBL_STRING, TBL_EQUAL);
	i++;
    }
    if (criteriaRecord->Flag & DMAN_K_STORAGECONTROL_RESPONDING) {
	TBL_CRITERIA_LOAD_BYTE(criteriaList[i], "RespondingTitle",
		    criteriaRecord->RespondingTitle, TBL_STRING, TBL_EQUAL);
	i++;
    }
    criteriaList[i].FieldName = NULL;

    i = 0;
    TBL_FIELD_DECLARE_STRING(fields[i], "RequestingTitle", workRecord->RequestingTitle,
			     sizeof(workRecord->RequestingTitle));
    i++;
    TBL_FIELD_DECLARE_STRING(fields[i], "RespondingTitle", workRecord->RespondingTitle,
			     sizeof(workRecord->RespondingTitle));
    i++;
    TBL_FIELD_DECLARE_STRING(fields[i], "Medium", workRecord->Medium,
			     sizeof(workRecord->Medium));
    i++;
    TBL_FIELD_DECLARE_STRING(fields[i], "Root", workRecord->Root,
			     sizeof(workRecord->Root));

    fields[++i].FieldName = NULL;

    context.lst = &head;
    context.record = (DMAN_GENERICRECORD *) workRecord;
    cond = TBL_Select(handle, criteriaList, fields, count,
		      callbackStorageControl, &context);
    if (cond == TBL_NORMAL)
	return DMAN_NORMAL;
    else
	return 0;
}
Beispiel #4
0
static CONDITION
getVisitRecord(PRIVATE_HANDLE * h,
   FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList,
	       FIS_VISITRECORD * r, long *count)
{
    CONDITION cond;
    TBL_CRITERIA criteria[2];
    FIS_VISITRECORD *p;

    static TBL_FIELD fields[] = {
	{TBL_FIELD_STRING("VisUID", visit.VisUID)},
	{TBL_FIELD_STRING("PatUID", visit.PatUID)},
	{TBL_FIELD_STRING("RefPhyNam", visit.RefPhyNam)},
	{NULL},
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    if (uid != NULL) {
	if (uid[0] != '\0') {
	    if (criteriaType == FIS_K_PATIENT) {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "PatUID", uid, TBL_STRING, TBL_EQUAL);
	    } else {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "VisUID", uid, TBL_STRING, TBL_EQUAL);
	    }
	}
    }
    memset(&visit, 0, sizeof(visit));
    visit.Type = FIS_K_VISIT;
    cond = TBL_Select(&h->visitHandle, criteria, fields, count, visitCallback,
		      getList);
    if (cond != TBL_NORMAL)
	return 0;

    if (r != NULL)
	*r = visit;

    if (listFlag & FIS_K_VISIT_STUDYLIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->StudyList = LST_Create();
	    cond = getStudyRecord(h, FIS_K_VISIT, p->VisUID, 0, p->StudyList, NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;
	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
    return FIS_NORMAL;
}
Beispiel #5
0
static CONDITION
getSCImageRecord(PRIVATE_HANDLE * h,
   FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList,
		 FIS_SCIMAGERECORD * r, long *count)
{
    CONDITION cond;
    TBL_CRITERIA criteria[2];
    FIS_SCIMAGERECORD *p;

    static TBL_FIELD fields[] = {
	{TBL_FIELD_STRING("SOPInsUID", scImage.SOPInsUID)},
	{TBL_FIELD_STRING("SerInsUID", scImage.SerInsUID)},
	{TBL_FIELD_STRING("StuComUID", scImage.StuComUID)},
	{TBL_FIELD_STRING("SOPClaUID", scImage.SOPClaUID)},
	{TBL_FIELD_STRING("RetAETit", scImage.RetAETit)},
	{TBL_FIELD_STRING("StoMedFilSetID", scImage.StoMedFilSetID)},
	{TBL_FIELD_STRING("StoMedFilSetUID", scImage.StoMedFilSetUID)},
	{NULL},
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    if (uid != NULL) {
	if (uid[0] != '\0') {
	    if (criteriaType == FIS_K_SCSERIES) {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "SerInsUID", uid, TBL_STRING, TBL_EQUAL);
	    } else if (criteriaType == FIS_K_STUDYCOMPONENT) {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuComUID", uid, TBL_STRING, TBL_EQUAL);
	    } else {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "SOPInsUID", uid, TBL_STRING, TBL_EQUAL);
	    }
	}
    }
    (void) memset(&scImage, 0, sizeof(scImage));
    scImage.Type = FIS_K_SCIMAGE;
    cond = TBL_Select(&h->studyComponentImageHandle, criteria, fields, count,
		      scImageCallback, getList);
    if (cond != TBL_NORMAL)
	return COND_PushCondition(FIS_COND(FIS_STUDYGETFAILED),
				  "(FIS)getSCImageRecord");

    if (r != NULL)
	*r = scImage;

    return FIS_NORMAL;
}
Beispiel #6
0
static CONDITION
getStorageCommitReq(PRIVATE_HANDLE * h,
   FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList,
		    FIS_STORAGECOMMITREQRECORD * r, long *count)
{
    CONDITION
    cond;
    TBL_CRITERIA
	criteria[2];

    static TBL_FIELD fields[] = {
	{"TraUID", TBL_STRING, sizeof(storageCommitRequest.TraUID),
	    sizeof(storageCommitRequest.TraUID), 0,
	(void *) &storageCommitRequest.TraUID[0]},
	{"ReqAE", TBL_STRING, sizeof(storageCommitRequest.ReqAE),
	    sizeof(storageCommitRequest.ReqAE), 0,
	(void *) &storageCommitRequest.ReqAE[0]},
	{"ResAE", TBL_STRING, sizeof(storageCommitRequest.ResAE),
	    sizeof(storageCommitRequest.TraUID), 0,
	(void *) &storageCommitRequest.ResAE[0]},
	{"ReqDat", TBL_SIGNED4, sizeof(commitRequestDate),
	    sizeof(commitRequestDate), 0,
	(void *) &commitRequestDate},
	{"ReqTim", TBL_FLOAT4, sizeof(commitRequestTime),
	    sizeof(commitRequestTime), 0,
	(void *) &commitRequestTime},
	{"ResDat", TBL_SIGNED4, sizeof(commitResponseDate),
	    sizeof(commitResponseDate), 0,
	(void *) &commitResponseDate},
	{"ResTim", TBL_FLOAT4, sizeof(commitResponseTime),
	    sizeof(commitResponseTime), 0,
	(void *) &commitResponseTime},

	{NULL}
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    if (uid != NULL && uid[0] != '\0') {
	if (criteriaType == FIS_K_STORAGECOMMITREQ) {
	    TBL_CRITERIA_LOAD_BYTE(criteria[0], "TraUID", uid, TBL_STRING, TBL_EQUAL);
	}
    }
    (void) memset(&storageCommitRequest, 0, sizeof(storageCommitRequest));
    commitRequestDate = commitResponseDate = 0;
    commitRequestTime = commitResponseTime = 0.;

    storageCommitRequest.Type = FIS_K_STORAGECOMMITREQ;
    cond = TBL_Select(&h->storageCommitReqHandle, criteria, fields, count,
		      storageCommitCallback, getList);
    if (cond != TBL_NORMAL)
	return FIS_GETFAILED;

    if (r != NULL)
	*r = storageCommitRequest;

    return FIS_NORMAL;
}
Beispiel #7
0
static CONDITION
getWorkQueueRecord(PRIVATE_HANDLE * h,
		   char *taskName, char *taskID,
		   long listFlag, LST_HEAD * getList,
		   FIS_WORKQUEUERECORD * r, long *count)
{
    CONDITION
    cond;
    TBL_CRITERIA
	criteria[3];
    int i = 0;

    static TBL_FIELD fields[] = {
	{"TasNam", TBL_STRING, sizeof(workQueue.TasNam),
	sizeof(workQueue.TasNam), 0, (void *) &workQueue.TasNam[0]},
	{"TasID", TBL_STRING, sizeof(workQueue.TasID),
	sizeof(workQueue.TasID), 0, (void *) &workQueue.TasID[0]},
	{NULL}
    };

    if (taskName != NULL && taskName[0] != '\0') {
	TBL_CRITERIA_LOAD_BYTE(criteria[i], "TasNam", taskName, TBL_STRING, TBL_EQUAL);
	i++;
    }
    if (taskID != NULL && taskID[0] != '\0') {
	TBL_CRITERIA_LOAD_BYTE(criteria[i], "TasID", taskID, TBL_STRING, TBL_EQUAL);
	i++;
    }
    criteria[i].FieldName = NULL;

    (void) memset(&workQueue, 0, sizeof(workQueue));
    workQueue.Type = FIS_K_WORKQUEUE;
    cond = TBL_Select(&h->workQueueHandle, criteria, fields, count,
		      workQueueCallback, getList);
    if (cond != TBL_NORMAL)
	return FIS_GETFAILED;

    if (r != NULL)
	*r = workQueue;

    return FIS_NORMAL;
}
Beispiel #8
0
CONDITION
FIS_DeleteWorkQueueRecord(FIS_HANDLE ** handle, char *taskID)
{
    CONDITION cond;
    TBL_CRITERIA criteria[2];
    PRIVATE_HANDLE *h;

    h = *(PRIVATE_HANDLE **) handle;

    TBL_CRITERIA_LOAD_BYTE(criteria[0], "TasID", taskID, TBL_STRING, TBL_EQUAL);
    criteria[1].FieldName = NULL;

    cond = TBL_Delete(&h->workQueueHandle, criteria);
    if (cond != TBL_NORMAL)
	return COND_PushCondition(FIS_COND(FIS_WORKQUEUERECORDDELETEFAILED),
				  "FIS_DeleteWorkQueueRecord");

    return FIS_NORMAL;
}
Beispiel #9
0
static CONDITION
getCommitSOPRecord(PRIVATE_HANDLE * h,
   FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList,
		   FIS_COMMITSOPREFRECORD * r, long *count)
{
    CONDITION
    cond;
    TBL_CRITERIA
	criteria[2];

    static TBL_FIELD fields[] = {
	{"TraUID", TBL_STRING, sizeof(commitSOPRef.TraUID),
	sizeof(commitSOPRef.TraUID), 0, (void *) &commitSOPRef.TraUID[0]},
	{"SOPClaUID", TBL_STRING, sizeof(commitSOPRef.SOPClaUID),
	sizeof(commitSOPRef.SOPClaUID), 0, (void *) &commitSOPRef.SOPClaUID[0]},
	{"SOPInsUID", TBL_STRING, sizeof(commitSOPRef.SOPInsUID),
	sizeof(commitSOPRef.SOPInsUID), 0, (void *) &commitSOPRef.SOPInsUID[0]},

	{NULL}
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    if (uid != NULL) {
	if (uid[0] != '\0') {
	    if (criteriaType == FIS_K_STORAGECOMMITREQ) {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "TraUID", uid, TBL_STRING, TBL_EQUAL);
	    }
	}
    }
    (void) memset(&commitSOPRef, 0, sizeof(commitSOPRef));
    commitSOPRef.Type = FIS_K_COMMITSOPREF;
    cond = TBL_Select(&h->commitSOPRefHandle, criteria, fields, count,
		      commitSOPRefCallback, getList);
    if (cond != TBL_NORMAL)
	return FIS_GETFAILED;

    if (r != NULL)
	*r = commitSOPRef;

    return FIS_NORMAL;
}
Beispiel #10
0
static CONDITION
deletePatientRecord(PRIVATE_HANDLE * h, FIS_DATA_TYPE criteriaType, char *uid)
{
    CONDITION
    cond;
    TBL_CRITERIA
	criteria[2];

    if (criteriaType == FIS_K_PATIENT) {
	TBL_CRITERIA_LOAD_BYTE(criteria[0], "PatUID", uid, TBL_STRING,
			       TBL_EQUAL);
    } else
	return COND_PushCondition(FIS_COND(FIS_ILLEGALDELETECRITERIA),
				  "patient", "(FIS)deletePatientRecord");

    criteria[1].FieldName = NULL;

    cond = TBL_Delete(&h->patientHandle, criteria);
    if (cond != TBL_NORMAL)
	return COND_PushCondition(FIS_COND(FIS_PATIENTDELETEFAILED),
				  "(FIS)deletePatientRecord");

    return FIS_NORMAL;
}
Beispiel #11
0
static CONDITION
getResultsRecord(PRIVATE_HANDLE * h,
   FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList,
		 FIS_RESULTSRECORD * r, long *count)
{
    CONDITION cond;
    TBL_CRITERIA criteria[2];
    FIS_RESULTSRECORD *p;

    static TBL_FIELD fields[] = {
	{"ResUID", TBL_STRING, sizeof(results.ResUID), sizeof(results.ResUID),
	0, (void *) &results.ResUID[0]},
	{"StuInsUID", TBL_STRING, sizeof(results.StuInsUID),
	sizeof(results.StuInsUID), 0, (void *) &results.StuInsUID[0]},
	{"ResID", TBL_STRING, sizeof(results.ResID), sizeof(results.ResID),
	0, (void *) &results.ResID[0]},
	{"Imp", TBL_TEXT, sizeof(results.Imp), sizeof(results.Imp),
	0, (void *) &results.Imp[0]},
	{"InsCreDat", TBL_STRING, sizeof(results.InsCreDat),
	sizeof(results.InsCreDat), 0, (void *) &results.InsCreDat[0]},
	{"InsCreTim", TBL_STRING, sizeof(results.InsCreTim),
	sizeof(results.InsCreTim), 0, (void *) &results.InsCreTim[0]},
	{"InsCreUID", TBL_STRING, sizeof(results.InsCreUID),
	sizeof(results.InsCreUID), 0, (void *) &results.InsCreUID},
	{NULL}
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    if (uid != NULL) {
	if (uid[0] != '\0') {
	    if (criteriaType == FIS_K_STUDY) {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuInsUID", uid, TBL_STRING, TBL_EQUAL);
	    } else {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "ResUID", uid, TBL_STRING, TBL_EQUAL);
	    }
	}
    }
    (void) memset(&results, 0, sizeof(results));
    results.Type = FIS_K_RESULTS;
    cond = TBL_Select(&h->resultsHandle, criteria, fields, count,
		      resultsCallback, getList);
    if (cond != TBL_NORMAL)
	return FIS_GETFAILED;

    if (r != NULL)
	*r = results;

    if (listFlag & FIS_K_RESULTS_INTERPRETATIONLIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->InterpretationList = LST_Create();
	    p->Flag |= FIS_K_RESULTS_INTERPRETATIONLIST;
	    cond = getInterpretationRecord(h, FIS_K_RESULTS, p->ResUID,
				      0, p->InterpretationList, NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;

	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
    return FIS_NORMAL;
}
Beispiel #12
0
static CONDITION
getSCSeriesRecord(PRIVATE_HANDLE * h,
   FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList,
		  FIS_SCSERIESRECORD * r, long *count)
{
    CONDITION cond;
    TBL_CRITERIA criteria[2];
    FIS_SCSERIESRECORD *p;

    static TBL_FIELD fields[] = {
	{TBL_FIELD_STRING("SerInsUID", scSeries.SerInsUID)},
	{TBL_FIELD_STRING("StuComUID", scSeries.StuComUID)},
	{TBL_FIELD_STRING("SerDat", scSeries.SerDat)},
	{TBL_FIELD_STRING("SerTim", scSeries.SerTim)},
	{TBL_FIELD_STRING("RetAETit", scSeries.RetAETit)},
	{TBL_FIELD_STRING("StoMedFilSetID", scSeries.StoMedFilSetID)},
	{TBL_FIELD_STRING("StoMedFilSetUID", scSeries.StoMedFilSetUID)},
	{NULL},
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    if (uid != NULL) {
	if (uid[0] != '\0') {
	    if (criteriaType == FIS_K_STUDYCOMPONENT) {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuComUID", uid, TBL_STRING, TBL_EQUAL);
	    } else {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "SerInsUID", uid, TBL_STRING, TBL_EQUAL);
	    }
	}
    }
    (void) memset(&scSeries, 0, sizeof(scSeries));
    scSeries.Type = FIS_K_SCSERIES;
    cond = TBL_Select(&h->studyComponentSeriesHandle, criteria, fields, count,
		      scSeriesCallback, getList);
    if (cond != TBL_NORMAL)
	return COND_PushCondition(FIS_COND(FIS_STUDYGETFAILED),
				  "(FIS)getSCSeriesRecord");

    if (r != NULL)
	*r = scSeries;


    if (listFlag & FIS_K_SCSERIES_IMAGELIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->ImageList = LST_Create();
	    cond = getSCImageRecord(h, FIS_K_SCSERIES, p->SerInsUID, 0,
				    p->ImageList, NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;
	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
    return FIS_NORMAL;
}
Beispiel #13
0
static CONDITION
getStudyComponentRecord(PRIVATE_HANDLE * h,
   FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList,
			FIS_STUDYCOMPONENTRECORD * r, long *count)
{
    CONDITION cond;
    TBL_CRITERIA criteria[2];
    FIS_STUDYCOMPONENTRECORD *p;

    static TBL_FIELD fields[] = {
	{TBL_FIELD_STRING("StuComUID", studyComponent.StuComUID)},
	{TBL_FIELD_STRING("StuInsUID", studyComponent.StuInsUID)},
	{TBL_FIELD_STRING("Mod", studyComponent.Mod)},
	{TBL_FIELD_STRING("StuDes", studyComponent.StuDes)},
	{TBL_FIELD_STRING("ProCodVal", studyComponent.ProCodVal)},
	{TBL_FIELD_STRING("ProCodSchDes", studyComponent.ProCodSchDes)},
	{TBL_FIELD_STRING("ProCodMea", studyComponent.ProCodMea)},
	{TBL_FIELD_STRING("StuComStaID", studyComponent.StuComStaID)},
	{TBL_FIELD_STRING("StuID", studyComponent.StuID)},
	{NULL},
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    if (uid != NULL) {
	if (uid[0] != '\0') {
	    if (criteriaType == FIS_K_STUDY) {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuInsUID", uid, TBL_STRING, TBL_EQUAL);
	    } else {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "StuComUID", uid, TBL_STRING, TBL_EQUAL);
	    }
	}
    }
    (void) memset(&studyComponent, 0, sizeof(studyComponent));
    studyComponent.Type = FIS_K_STUDYCOMPONENT;
    cond = TBL_Select(&h->studyComponentHandle, criteria, fields, count,
		      studyComponentCallback, getList);
    if (cond != TBL_NORMAL)
	return COND_PushCondition(FIS_COND(FIS_STUDYGETFAILED),
				  "(FIS)getStudyRecord");

    if (r != NULL)
	*r = studyComponent;

    if (listFlag & FIS_K_STUDYCOMP_SERIESLIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->SeriesList = LST_Create();
	    p->Flag |= FIS_K_STUDYCOMP_SERIESLIST;
	    cond = getSCSeriesRecord(h, FIS_K_STUDYCOMPONENT, p->StuComUID,
				     FIS_K_SCSERIES_IMAGELIST, p->SeriesList,
				     NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;
	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
    return FIS_NORMAL;
}
Beispiel #14
0
static CONDITION
selectStudyRecord(PRIVATE_HANDLE * h,
		  FIS_CRITERIA_TYPE criteriaType, const char *criteriaString,
		  long listFlag, LST_HEAD * getList,
		  FIS_STUDYRECORD * r, long *count)
{
    CONDITION cond = FIS_NORMAL;
    TBL_CRITERIA criteria[2];
    char localString[1024];
    FIS_STUDYRECORD *p;

    static TBL_FIELD fields[] = {
	{TBL_FIELD_STRING("PatUID", study.PatUID)},
	{TBL_FIELD_STRING("StuInsUID", study.StuInsUID)},
	{TBL_FIELD_STRING("VisUID", study.VisUID)},
	{TBL_FIELD_STRING("AccNum", study.AccNum)},
	{TBL_FIELD_STRING("StuID", study.StuID)},
	{"SchStuStaDat", TBL_SIGNED4, sizeof(studyDate), sizeof(studyDate),
	0, (void *) &studyDate},
	{"SchStuStaTim", TBL_FLOAT4, sizeof(studyTime), sizeof(studyTime),
	0, (void *) &studyTime},
	{TBL_FIELD_STRING("SchStuLoc", study.SchStuLoc)},
	{TBL_FIELD_STRING("ProDes", study.ProDes)},
	{TBL_FIELD_STRING("StuStaID", study.StuStaID)},
	{NULL},
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    strcpy(localString, criteriaString);
    switch (criteriaType) {
    case FIS_K_ACCESSION:
	TBL_CRITERIA_LOAD_BYTE(criteria[0], "AccNum", localString, TBL_STRING, TBL_EQUAL);
	break;
    default:
	cond = 0;		/* Repair */
    }

    if (cond != FIS_NORMAL)
	return cond;

    (void) memset(&study, 0, sizeof(study));
    study.Type = FIS_K_STUDY;
    cond = TBL_Select(&h->studyHandle, criteria, fields, count, studyCallback,
		      getList);
    if (cond != TBL_NORMAL)
	return COND_PushCondition(FIS_COND(FIS_STUDYGETFAILED),
				  "(FIS)getStudyRecord");

    if (r != NULL)
	*r = study;

    if (listFlag & FIS_K_STU_STUDYCOMPONENTLIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->StudyComponentList = LST_Create();
	    p->Flag |= FIS_K_STU_STUDYCOMPONENTLIST;
	    cond = getStudyComponentRecord(h, FIS_K_STUDY, p->StuInsUID,
				      0, p->StudyComponentList, NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;
	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
    if (listFlag & FIS_K_STU_RESULTSLIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->ResultsList = LST_Create();
	    p->Flag |= FIS_K_STU_RESULTSLIST;
	    cond = getResultsRecord(h, FIS_K_STUDY, p->StuInsUID, 0,
				    p->ResultsList, NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;
	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
    return FIS_NORMAL;
}
Beispiel #15
0
static CONDITION
getPatientRecord(PRIVATE_HANDLE * h,
   FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList,
		 FIS_PATIENTRECORD * r, long *count)
{
    CONDITION
    cond;
    TBL_CRITERIA
	criteria[2];
    FIS_PATIENTRECORD
	* p;

    static TBL_FIELD fields[] = {
	{"PatID", TBL_STRING, sizeof(patient.PatID), sizeof(patient.PatID),
	0, (void *) &patient.PatID[0]},
	{"PatUID", TBL_STRING, sizeof(patient.PatUID), sizeof(patient.PatUID),
	0, (void *) &patient.PatUID[0]},
	{"PatNam", TBL_STRING, sizeof(patient.PatNam), sizeof(patient.PatNam),
	0, (void *) &patient.PatNam[0]},
	{"PatSex", TBL_STRING, sizeof(patient.PatSex), sizeof(patient.PatSex),
	0, (void *) &patient.PatSex[0]},
	{"PatBirDat", TBL_SIGNED4, sizeof(patientBD), sizeof(patientBD),
	0, (void *) &patientBD},
	{NULL},
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    if (uid != NULL) {
	if (uid[0] != '\0') {
	    TBL_CRITERIA_LOAD_BYTE(criteria[0], "PatUID", uid, TBL_STRING, TBL_EQUAL);
	}
    }
    memset(&patient, 0, sizeof(patient));
    patient.Type = FIS_K_PATIENT;
    cond = TBL_Select(&h->patientHandle, criteria, fields, count, patientCallback,
		      getList);
    if (cond != TBL_NORMAL)
	return COND_PushCondition(FIS_COND(FIS_PATIENTGETFAILED),
				  "(FIS)getPatientRecord");

    if (r != NULL)
	*r = patient;

    if (listFlag & FIS_K_PAT_STUDYLIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->StudyList = LST_Create();
	    p->Flag |= FIS_K_PAT_STUDYLIST;
	    cond = getStudyRecord(h, FIS_K_PATIENT, p->PatUID, 0, p->StudyList, NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;
	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
/*
    if (listFlag & FIS_K_PAT_VISITLIST) {
	if (getList != NULL) {
	    p = LST_Head(&getList);
	    (void) LST_Position(&getList, p);
	} else
	    p = r;
	while (p != NULL) {
	    p->VisitList = LST_Create();
	    p->Flag |= FIS_K_PAT_VISITLIST;
	    cond = getVisitRecord(h, FIS_K_PATIENT, p->PatUID, 0, p->VisitList, NULL, NULL);
	    if (cond != FIS_NORMAL)
		return cond;
	    if (getList != NULL)
		p = LST_Next(&getList);
	    else
		p = NULL;
	}
    }
*/
    return FIS_NORMAL;
}
Beispiel #16
0
static CONDITION
getInterpretationRecord(PRIVATE_HANDLE * h,
   FIS_DATA_TYPE criteriaType, char *uid, long listFlag, LST_HEAD * getList,
			FIS_INTERPRETATIONRECORD * r, long *count)
{
    CONDITION
    cond;
    TBL_CRITERIA
	criteria[2];

    static TBL_FIELD fields[] = {
	{"IntUID", TBL_STRING, sizeof(interpretation.IntUID),
	sizeof(interpretation.IntUID), 0, (void *) &interpretation.IntUID[0]},
	{"ResUID", TBL_STRING, sizeof(interpretation.ResUID),
	sizeof(interpretation.ResUID), 0, (void *) &interpretation.ResUID[0]},
	{"IntID", TBL_STRING, sizeof(interpretation.IntID),
	sizeof(interpretation.IntID), 0, (void *) &interpretation.IntID[0]},
	{"IntTex", TBL_TEXT, sizeof(interpretation.IntTex),
	sizeof(interpretation.IntTex), 0, (void *) &interpretation.IntTex[0]},
	{"IntDiaDes", TBL_TEXT, sizeof(interpretation.IntDiaDes),
	    sizeof(interpretation.IntDiaDes), 0,
	(void *) &interpretation.IntDiaDes[0]},
	{"IntTypID", TBL_STRING, sizeof(interpretation.IntTypID),
	sizeof(interpretation.IntTypID), 0, (void *) &interpretation.IntTypID[0]},
	{"IntStaID", TBL_STRING, sizeof(interpretation.IntStaID),
	sizeof(interpretation.IntStaID), 0, (void *) &interpretation.IntStaID[0]},

	{"InsCreDat", TBL_STRING, sizeof(interpretation.InsCreDat),
	sizeof(interpretation.InsCreDat), 0, (void *) &interpretation.InsCreDat[0]},
	{"InsCreTim", TBL_STRING, sizeof(interpretation.InsCreTim),
	sizeof(interpretation.InsCreTim), 0, (void *) &interpretation.InsCreTim[0]},
	{"InsCreUID", TBL_STRING, sizeof(interpretation.InsCreUID),
	sizeof(interpretation.InsCreUID), 0, (void *) &interpretation.InsCreUID},

	{"PhyAppInt", TBL_STRING, sizeof(interpretation.PhyAppInt),
	sizeof(interpretation.PhyAppInt), 0, (void *) &interpretation.PhyAppInt},
	{"IntAppDat", TBL_STRING, sizeof(interpretation.IntAppDat),
	sizeof(interpretation.IntAppDat), 0, (void *) &interpretation.IntAppDat},
	{"IntAppTim", TBL_STRING, sizeof(interpretation.IntAppTim),
	sizeof(interpretation.IntAppTim), 0, (void *) &interpretation.IntAppTim},
	{NULL},
    };

    criteria[0].FieldName = criteria[1].FieldName = NULL;
    if (uid != NULL) {
	if (uid[0] != '\0') {
	    if (criteriaType == FIS_K_RESULTS) {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "ResUID", uid, TBL_STRING, TBL_EQUAL);
	    } else {
		TBL_CRITERIA_LOAD_BYTE(criteria[0], "IntUID", uid, TBL_STRING, TBL_EQUAL);
	    }
	}
    }
    (void) memset(&interpretation, 0, sizeof(interpretation));
    interpretation.Type = FIS_K_INTERPRETATION;
    cond = TBL_Select(&h->interpretationHandle, criteria, fields, count,
		      interpretationCallback, getList);
    if (cond != TBL_NORMAL)
	return FIS_GETFAILED;

    if (r != NULL)
	*r = interpretation;
    return FIS_NORMAL;
}