示例#1
0
        public static void ModifyQCMappingList_DateTime <TC>(XCollection <TC> qcList, bool withBracket)
            where TC : QueryCriteriaItem, IDicomMappingItem, new()
        {
            if (qcList == null)
            {
                return;
            }
            bool found = true;

            while (found)
            {
                found = false;
                int count = qcList.Count;
                for (int index = 0; index < count; index++)
                {
                    TC item = qcList[index];

                    IDicomMappingItem dcmItem = item as IDicomMappingItem;
                    if (dcmItem == null)
                    {
                        continue;
                    }

                    if (dcmItem.DPath != null &&
                        dcmItem.DPath.Range == DRangeType.None &&
                        DHelper.IsDateTime(dcmItem.DPath.VR))
                    {
                        qcList.Remove(item);

                        QueryCriteriaItem itemB = dcmItem.Clone() as QueryCriteriaItem;
                        ((IDicomMappingItem)itemB).DPath.Range = DRangeType.Begin;
                        itemB.Operator    = QueryCriteriaOperator.EqualLargerThan;
                        itemB.SourceField = itemB.SourceField + "_BEGIN";

                        QueryCriteriaItem itemE = dcmItem.Clone() as QueryCriteriaItem;
                        ((IDicomMappingItem)itemE).DPath.Range = DRangeType.End;
                        itemE.Operator    = QueryCriteriaOperator.EqualSmallerThan;
                        itemE.SourceField = itemE.SourceField + "_END";

                        if (withBracket)    // for GetRule()
                        {
                            qcList.Insert(index, GetRightBracket <TC>());
                            qcList.Insert(index, GetRightBracket <TC>());

                            TC itemEE = GetFreeText <TC>("@" + itemE.SourceField + "=''");
                            itemEE.Type = QueryCriteriaType.And;
                            qcList.Insert(index, itemEE);

                            TC itemBB = GetFreeText <TC>("@" + itemB.SourceField + "=''");
                            itemBB.Type = QueryCriteriaType.None;
                            qcList.Insert(index, itemBB);

                            TC itemOr = GetLeftBracket <TC>();
                            itemOr.Type = QueryCriteriaType.Or;
                            qcList.Insert(index, itemOr);

                            qcList.Insert(index, GetRightBracket <TC>());

                            itemE.Type = QueryCriteriaType.And;
                            qcList.Insert(index, itemE);

                            itemB.Type = QueryCriteriaType.None;
                            qcList.Insert(index, itemB);

                            qcList.Insert(index, GetLeftBracket <TC>());

                            TC itemAnd = GetLeftBracket <TC>();
                            itemAnd.Type = QueryCriteriaType.And;
                            qcList.Insert(index, itemAnd);
                        }
                        else                // for NT Service to create QC DataSet
                        {
                            qcList.Insert(index, itemE);
                            qcList.Insert(index, itemB);
                        }

                        found = true;
                        break;
                    }
                }
            }
        }
示例#2
0
        public static void ModifyQCMappingList_CS <TC>(XCollection <TC> qcList, bool withBracket)
            where TC : QueryCriteriaItem, IDicomMappingItem, new()
        {
            if (qcList == null)
            {
                return;
            }
            bool found = true;

            while (found)
            {
                found = false;
                int count = qcList.Count;
                for (int index = 0; index < count; index++)
                {
                    TC item = qcList[index];

                    IDicomMappingItem dcmItem = item as IDicomMappingItem;
                    if (dcmItem == null)
                    {
                        continue;
                    }

                    if (dcmItem.DPath != null &&
                        dcmItem.DPath.VR == DVR.CS &&
                        dcmItem.DPath.Path == DicomMappingHelper.DataColumnName2DPath(item.SourceField))
                    {
                        qcList.Remove(item);

                        if (withBracket)    // for GetRule()
                        {
                            qcList.Insert(index, DicomMappingHelper.GetRightBracket <TC>());
                        }

                        for (int i = Program.ConfigMgt.Config.CSDivisionMAXCount - 1; i >= 0; i--)  // for GetRule() and for NT Service to create QC DataSet
                        {
                            QueryCriteriaItem itemSub = dcmItem.Clone() as QueryCriteriaItem;
                            itemSub.SourceField = itemSub.SourceField + "_" + i.ToString();
                            itemSub.Operator    = QueryCriteriaOperator.Like;
                            if (i == 0)
                            {
                                itemSub.Type = QueryCriteriaType.None;
                            }
                            else
                            {
                                itemSub.Type = QueryCriteriaType.Or;
                            }
                            qcList.Insert(index, itemSub);
                        }

                        if (withBracket)    // for GetRule()
                        {
                            TC itemAnd = DicomMappingHelper.GetLeftBracket <TC>();
                            itemAnd.Type = QueryCriteriaType.And;
                            qcList.Insert(index, itemAnd);
                        }

                        found = true;
                        break;
                    }
                }
            }
        }