Exemplo n.º 1
0
        private int GetResultInfos(QueryArgs q, bool useIndex)
        {
            List <string> primIDs = new List <string>();

            _ResultDataSet = new DataSet("ResultDataSet");
            var       rdr         = _Connection.ExecuteQuery(q.TableName, q.Condition, useIndex);
            DataTable reportTable = CreateReportTable(rdr, "Report", _ResultDataSet);

            while (rdr.Read())
            {
                // 初始化数据记录
                DataRow row = reportTable.NewRow();
                for (int i = 0; i < rdr.FieldCount; i++)
                {
                    row[i] = rdr[i];
                }
                reportTable.Rows.Add(row);

                // 保存病人ID
                primIDs.Add((string)rdr["PrimID"]);

                // 创建曲线点信息
                if (OnAddCurve != null)
                {
                    string label = "Channel " + rdr["ChnlNum"].ToString();

                    AggRamCurve crv = new AggRamCurve(
                        label,
                        (int)rdr["InitialMax"], (int)rdr["InitialMin"],
                        (int)rdr["ScaleSet1Rd"], (int)rdr["MaxPCPoint"], (double)rdr["ScaleSetResult"],
                        (int)rdr["DataPoints"], (byte[])rdr["Data"]);
                    OnAddCurve(label, crv);
                    //OnAddCurve(label, CreateCurve((int)rdr["DataPoints"], (byte[])rdr["Data"]));
                }
            }

            _ResultDataSet.Tables.Add(CreatePatientsTable(primIDs));

            return(primIDs.Count);
        }
Exemplo n.º 2
0
        internal AggRamDbState GetSampleInfoByCrvSeqNum(int crvSeqNum)
        {
            var condition =
            new ParadoxCondition.LogicalAnd(
                new ParadoxCondition.Compare(
                    ParadoxCompareOperator.Greater, 0, 0, 0),
                new ParadoxCondition.Compare(
                    ParadoxCompareOperator.Equal, crvSeqNum, 3, 0));
            var sr = _Connection.ExecuteQuery("HRRuns", condition, false);
            if (sr.Read())
            {
                AggRamDbState result = new AggRamDbState();
                // 基本信息
                result.WrkLstNum = (int)sr["WrkLstNum"];
                result.ChnlNum = (short)((short)sr["ChnlNum"] + 1);
                result.CrvSeqNum = (int)sr["CrvSeqNum"];
                result.StartTime = ((DateTime)sr["StartTime"]).ToString("yyyy/MM/dd HH:mm:ss");

                // 创建曲线点信息
                int lblChnNum = (short)sr["ChnlNum"] + 1;
                string label = "Channel " + lblChnNum.ToString();
                AggRamCurve crv = new AggRamCurve(
                    label,
                    (int)sr["InitialMax"], (int)sr["InitialMin"],
                    (int)sr["ScaleSet1Rd"], (int)sr["MaxPCPoint"], (double)sr["ScaleSetResult"],
                    (int)sr["DataPoints"], (byte[])sr["Data"]);
                Curve c = new Curve();
                c.Label = crv.Label;
                c.InitialMin = (int)sr["InitialMin"];
                c.InitialMax = (int)sr["InitialMax"];
                c.ZeroODPoint = crv.ZeroODPoint;
                c.MaxPCPoint = crv.MaxPCPoint;
                c.PointUnit = crv.PointUnit;
                c.CurvePoints = crv.CurvePoints;
                c.Count = crv.Count;
                result.Curve = c;
                // Add Report Row
                ReportInfo reportRow = new ReportInfo();
                reportRow.ChnlNum = lblChnNum;
                reportRow.StartTime = (DateTime)sr["StartTime"];

                int selectedProcTag = (int)sr["ProcTag"];
                var procInfo = GetTestParams(selectedProcTag);
                if (procInfo != null)
                {
                    reportRow.ProcID = procInfo.ProcID;
                    reportRow.Abbrev = procInfo.Abbrev;
                }
                reportRow.Unit = (string)sr["Unit"];
                reportRow.Conc = (double)sr["Conc"];
                reportRow.PRP = FloatPS(crv.PRP, 3);
                reportRow.PPP = FloatPS(crv.PPP, 3);
                reportRow.MaxPercent = FloatPS(crv.MaxPercent * 100, 1);
                reportRow.MaxPCTime = FloatPS((int)sr["MaxPCTime"] / 1000.0, 0);
                reportRow.LagTime = FloatPS((int)sr["LagTime"] / 1000.0, 1);
                reportRow.Slope = FloatPS((double)sr["Slope"], 1);
                result.Report = reportRow;

                string selectedPrimID = (string)sr["PrimID"];

                result.Patient = GetPatientInfo(selectedPrimID);
                return result;
            }
            return null;
        }
Exemplo n.º 3
0
        private int GetResultInfos(QueryArgs q, bool useIndex)
        {
            List<string> primIDs = new List<string>();
            _ResultDataSet = new DataSet("ResultDataSet");
            var rdr = _Connection.ExecuteQuery(q.TableName, q.Condition, useIndex);
            DataTable reportTable = CreateReportTable(rdr, "Report", _ResultDataSet);
            while (rdr.Read())
            {
                // 初始化数据记录
                DataRow row = reportTable.NewRow();
                for (int i = 0; i < rdr.FieldCount; i++)
                {
                    row[i] = rdr[i];
                }
                reportTable.Rows.Add(row);

                // 保存病人ID
                primIDs.Add((string)rdr["PrimID"]);

                // 创建曲线点信息
                if (OnAddCurve != null)
                {
                    string label = "Channel " + rdr["ChnlNum"].ToString();

                    AggRamCurve crv = new AggRamCurve(
                        label,
                        (int)rdr["InitialMax"], (int)rdr["InitialMin"],
                        (int)rdr["ScaleSet1Rd"], (int)rdr["MaxPCPoint"], (double)rdr["ScaleSetResult"],
                        (int)rdr["DataPoints"], (byte[])rdr["Data"]);
                    OnAddCurve(label, crv);
                    //OnAddCurve(label, CreateCurve((int)rdr["DataPoints"], (byte[])rdr["Data"]));
                }
            }

            _ResultDataSet.Tables.Add(CreatePatientsTable(primIDs));

            return primIDs.Count;
        }
Exemplo n.º 4
0
        internal AggRamDbState GetSampleInfoByCrvSeqNum(int crvSeqNum)
        {
            var condition =
                new ParadoxCondition.LogicalAnd(
                    new ParadoxCondition.Compare(
                        ParadoxCompareOperator.Greater, 0, 0, 0),
                    new ParadoxCondition.Compare(
                        ParadoxCompareOperator.Equal, crvSeqNum, 3, 0));
            var sr = _Connection.ExecuteQuery("HRRuns", condition, false);

            if (sr.Read())
            {
                AggRamDbState result = new AggRamDbState();
                // 基本信息
                result.WrkLstNum = (int)sr["WrkLstNum"];
                result.ChnlNum   = (short)((short)sr["ChnlNum"] + 1);
                result.CrvSeqNum = (int)sr["CrvSeqNum"];
                result.StartTime = ((DateTime)sr["StartTime"]).ToString("yyyy/MM/dd HH:mm:ss");

                // 创建曲线点信息
                int         lblChnNum = (short)sr["ChnlNum"] + 1;
                string      label     = "Channel " + lblChnNum.ToString();
                AggRamCurve crv       = new AggRamCurve(
                    label,
                    (int)sr["InitialMax"], (int)sr["InitialMin"],
                    (int)sr["ScaleSet1Rd"], (int)sr["MaxPCPoint"], (double)sr["ScaleSetResult"],
                    (int)sr["DataPoints"], (byte[])sr["Data"]);
                Curve c = new Curve();
                c.Label       = crv.Label;
                c.InitialMin  = (int)sr["InitialMin"];
                c.InitialMax  = (int)sr["InitialMax"];
                c.ZeroODPoint = crv.ZeroODPoint;
                c.MaxPCPoint  = crv.MaxPCPoint;
                c.PointUnit   = crv.PointUnit;
                c.CurvePoints = crv.CurvePoints;
                c.Count       = crv.Count;
                result.Curve  = c;
                // Add Report Row
                ReportInfo reportRow = new ReportInfo();
                reportRow.ChnlNum   = lblChnNum;
                reportRow.StartTime = (DateTime)sr["StartTime"];

                int selectedProcTag = (int)sr["ProcTag"];
                var procInfo        = GetTestParams(selectedProcTag);
                if (procInfo != null)
                {
                    reportRow.ProcID = procInfo.ProcID;
                    reportRow.Abbrev = procInfo.Abbrev;
                }
                reportRow.Unit       = (string)sr["Unit"];
                reportRow.Conc       = (double)sr["Conc"];
                reportRow.PRP        = FloatPS(crv.PRP, 3);
                reportRow.PPP        = FloatPS(crv.PPP, 3);
                reportRow.MaxPercent = FloatPS(crv.MaxPercent * 100, 1);
                reportRow.MaxPCTime  = FloatPS((int)sr["MaxPCTime"] / 1000.0, 0);
                reportRow.LagTime    = FloatPS((int)sr["LagTime"] / 1000.0, 1);
                reportRow.Slope      = FloatPS((double)sr["Slope"], 1);
                result.Report        = reportRow;

                string selectedPrimID = (string)sr["PrimID"];

                result.Patient = GetPatientInfo(selectedPrimID);
                return(result);
            }
            return(null);
        }
Exemplo n.º 5
0
        public int GetCurves(string primID, int crvSeqNo, string worklistID, int worklistNumber)
        {
            ResultDataSet.Tables.Clear();
            OrderedEnumerableRowCollection <DataRow> selectedRows = null;

            if (crvSeqNo > 0)
            {
                //var condition = new ParadoxCondition.Compare(ParadoxCompareOperator.Equal, mainTestID, 8, 0);
                //QueryArgs q = new QueryArgs("HRRuns", condition, "CrvSeqNum", "");
                //return GetSimpleRowInfos(q, false);
            }

            if (!String.IsNullOrEmpty(primID) && worklistNumber > 0)
            {
                selectedRows = from qs in _dataSet.Tables["HRRuns"].AsEnumerable()
                               where qs.Field <string>("PrimID") == primID &&
                               qs.Field <int>("WrkLstNum") == worklistNumber
                               orderby qs.Field <int>("ChnlNum") ascending
                               select qs;
            }

            if (!String.IsNullOrEmpty(worklistID) && worklistNumber > 0)
            {
                selectedRows = from qs in _dataSet.Tables["HRRuns"].AsEnumerable()
                               where qs.Field <int>("WrkLstNum") == worklistNumber &&
                               qs.Field <string>("WrkLstID") == worklistID
                               orderby qs.Field <int>("ChnlNum") ascending
                               select qs;
            }

            if (selectedRows != null && selectedRows.Count() > 0)
            {
                // 创建结果报告集
                DataTable reportTable = CreateReportTable();
                ResultDataSet.Tables.Add(reportTable);

                // 创建病人信息结果集
                DataTable patientTable = CreatePatientTable();
                ResultDataSet.Tables.Add(patientTable);

                foreach (var sr in selectedRows)
                {
                    // 创建曲线点信息
                    int         lblChnNum = sr.Field <int>("ChnlNum") + 1;
                    string      label     = "Channel " + lblChnNum.ToString();
                    AggRamCurve crv       = new AggRamCurve(
                        label,
                        (int)sr["InitialMax"], (int)sr["InitialMin"],
                        (int)sr["ScaleSet1Rd"], (int)sr["MaxPCPoint"], (double)sr["ScaleSetResult"],
                        (int)sr["DataPoints"], (byte[])sr["Data"]);

                    // Add Curve
                    if (OnAddCurve != null)
                    {
                        OnAddCurve(label, crv);
                        //OnAddCurve(label, CreateCurve((int)rdr["DataPoints"], (byte[])rdr["Data"]));
                    }

                    int selectedProcTag = sr.Field <int>("ProcTag");
                    var procs           = from qs in _dataSet.Tables["HRTestParms"].AsEnumerable()
                                          where qs.Field <int>("ProcTag") == selectedProcTag
                                          select qs;
                    // Add Report Row
                    DataRow reportRow = reportTable.NewRow();
                    reportRow["ChnlNum"]   = lblChnNum;
                    reportRow["StartTime"] = sr.Field <DateTime>("StartTime");
                    if (procs.Count() > 0)
                    {
                        var procInfo = procs.First();
                        reportRow["ProcID"] = procInfo.Field <string>("ProcID");
                        reportRow["Abbrev"] = procInfo.Field <string>("Abbrev");
                    }
                    reportRow["Unit"]       = sr.Field <string>("Unit");
                    reportRow["Conc"]       = sr.Field <double>("Conc");
                    reportRow["PRP"]        = FloatPS(crv.PRP, 3);
                    reportRow["PPP"]        = FloatPS(crv.PPP, 3);
                    reportRow["MaxPercent"] = FloatPS(crv.MaxPercent * 100, 1);
                    reportRow["MaxPCTime"]  = FloatPS((double)sr.Field <int>("MaxPCTime") / 1000.0, 0);
                    reportRow["LagTime"]    = FloatPS((double)sr.Field <int>("LagTime") / 1000.0, 1);
                    reportRow["Slope"]      = FloatPS(sr.Field <double>("Slope"), 1);
                    reportTable.Rows.Add(reportRow);

                    // Add Patient Row
                    DataRow row = patientTable.NewRow();
                    row[0] = lblChnNum;
                    string selectedPrimID = sr.Field <string>("PrimID");
                    var    patientInfos   = from qs in _dataSet.Tables["Patients"].AsEnumerable()
                                            where qs.Field <string>("PrimID") == selectedPrimID
                                            select qs;

                    if (patientInfos.Count() > 0)
                    {
                        var      patientInfo = patientInfos.First();
                        object[] array       = (patientInfo.ItemArray.Take(patientTable.Columns.Count - 1)).ToArray();
                        for (int i = 0; i < patientTable.Columns.Count - 1; i++)
                        {
                            row[i + 1] = array[i];
                        }
                    }
                    else
                    {
                        row[1] = selectedPrimID;
                    }
                    patientTable.Rows.Add(row);
                }
                return(selectedRows.Count());
            }

            return(0);
        }
Exemplo n.º 6
0
        public int GetCurves(string primID, int crvSeqNo, string worklistID, int worklistNumber)
        {
            ResultDataSet.Tables.Clear();
            OrderedEnumerableRowCollection<DataRow> selectedRows = null;

            if (crvSeqNo > 0)
            {
                //var condition = new ParadoxCondition.Compare(ParadoxCompareOperator.Equal, mainTestID, 8, 0);
                //QueryArgs q = new QueryArgs("HRRuns", condition, "CrvSeqNum", "");
                //return GetSimpleRowInfos(q, false);
            }

            if (!String.IsNullOrEmpty(primID) && worklistNumber > 0)
            {
                selectedRows = from qs in _dataSet.Tables["HRRuns"].AsEnumerable()
                                   where qs.Field<string>("PrimID") == primID &&
                                   qs.Field<int>("WrkLstNum") == worklistNumber
                                   orderby qs.Field<int>("ChnlNum") ascending
                                   select qs;
            }

            if (!String.IsNullOrEmpty(worklistID) && worklistNumber > 0)
            {
                selectedRows = from qs in _dataSet.Tables["HRRuns"].AsEnumerable()
                               where qs.Field<int>("WrkLstNum") == worklistNumber
                               && qs.Field<string>("WrkLstID") == worklistID
                               orderby qs.Field<int>("ChnlNum") ascending
                               select qs;                
            }

            if (selectedRows != null && selectedRows.Count() > 0)
            {
                // 创建结果报告集
                DataTable reportTable = CreateReportTable();
                ResultDataSet.Tables.Add(reportTable);

                // 创建病人信息结果集
                DataTable patientTable = CreatePatientTable();
                ResultDataSet.Tables.Add(patientTable);

                foreach (var sr in selectedRows)
                {
                    // 创建曲线点信息
                    int lblChnNum = sr.Field<int>("ChnlNum") + 1;
                    string label = "Channel " + lblChnNum.ToString();
                    AggRamCurve crv = new AggRamCurve(
                        label,
                        (int)sr["InitialMax"], (int)sr["InitialMin"],
                        (int)sr["ScaleSet1Rd"], (int)sr["MaxPCPoint"], (double)sr["ScaleSetResult"],
                        (int)sr["DataPoints"], (byte[])sr["Data"]);

                    // Add Curve
                    if (OnAddCurve != null)
                    {
                        OnAddCurve(label, crv);
                        //OnAddCurve(label, CreateCurve((int)rdr["DataPoints"], (byte[])rdr["Data"]));
                    }

                    int selectedProcTag = sr.Field<int>("ProcTag");
                    var procs = from qs in _dataSet.Tables["HRTestParms"].AsEnumerable()
                                where qs.Field<int>("ProcTag") == selectedProcTag
                                select qs;
                    // Add Report Row
                    DataRow reportRow = reportTable.NewRow();
                    reportRow["ChnlNum"] = lblChnNum;
                    reportRow["StartTime"] = sr.Field<DateTime>("StartTime");
                    if (procs.Count() > 0)
                    {
                        var procInfo = procs.First();
                        reportRow["ProcID"] = procInfo.Field<string>("ProcID");
                        reportRow["Abbrev"] = procInfo.Field<string>("Abbrev");
                    }
                    reportRow["Unit"] = sr.Field<string>("Unit");
                    reportRow["Conc"] = sr.Field<double>("Conc");
                    reportRow["PRP"] = FloatPS(crv.PRP, 3);
                    reportRow["PPP"] = FloatPS(crv.PPP, 3);
                    reportRow["MaxPercent"] = FloatPS(crv.MaxPercent * 100, 1);
                    reportRow["MaxPCTime"] = FloatPS((double)sr.Field<int>("MaxPCTime") / 1000.0, 0);
                    reportRow["LagTime"] = FloatPS((double)sr.Field<int>("LagTime") / 1000.0, 1);
                    reportRow["Slope"] = FloatPS(sr.Field<double>("Slope"), 1);
                    reportTable.Rows.Add(reportRow);

                    // Add Patient Row
                    DataRow row = patientTable.NewRow();
                    row[0] = lblChnNum;
                    string selectedPrimID = sr.Field<string>("PrimID");
                    var patientInfos = from qs in _dataSet.Tables["Patients"].AsEnumerable()
                                       where qs.Field<string>("PrimID") == selectedPrimID
                                       select qs;

                    if (patientInfos.Count() > 0)
                    {
                        var patientInfo = patientInfos.First();
                        object[] array = (patientInfo.ItemArray.Take(patientTable.Columns.Count - 1)).ToArray();
                        for (int i = 0; i < patientTable.Columns.Count - 1; i++)
                        {
                            row[i + 1] = array[i];
                        }
                    }
                    else
                    {
                        row[1] = selectedPrimID;
                    }
                    patientTable.Rows.Add(row);
                }
                return selectedRows.Count();
            }

            return 0;
        }