Exemple #1
0
        public override int SaveECG(IECGFormat ecg, string patid, ECGConfig cfg)
        {
            if (Works() &&
                (_Config["AESCU"] != null) &&
                (_Config["AESCP"] != null) &&
                (_Config["Port"] != null))
            {
                if ((ecg != null) &&
                    ecg.Works() &&
                    (ecg.GetType() != typeof(DICOM.DICOMFormat)))
                {
                    IECGFormat dst = null;

                    int ret = ECGConverter.Instance.Convert(ecg, FormatName, cfg, out dst);

                    if (ret != 0)
                    {
                        return(2);
                    }

                    if ((dst != null) &&
                        dst.Works())
                    {
                        ecg = dst;
                    }
                }

                if ((ecg != null) &&
                    ecg.Works() &&
                    (ecg.GetType() == typeof(DICOM.DICOMFormat)))
                {
                    if (patid != null)
                    {
                        ecg.Demographics.PatientID = patid;
                    }

                    try
                    {
                        DICOM.DICOMFormat dcm = (DICOM.DICOMFormat)ecg;

                        BasicSCU scu = new BasicSCU(_Config["AESCU"], _Config["AESCP"], _Config["Server"], int.Parse(_Config["Port"]), 5000);

                        if (!scu.CStore(dcm.DICOMData))
                        {
                            return(4);
                        }

                        return(0);
                    }
                    catch {}

                    return(3);
                }

                return(2);
            }

            return(1);
        }
Exemple #2
0
        public override IECGFormat getECGByUI(object ui)
        {
            if (Works() &&
                (ui != null) &&
                (ui.GetType() == typeof(PACSUID)))
            {
                BasicSCU scu = new BasicSCU(_Config["AESCU"], _Config["AESCP"], _Config["Server"], int.Parse(_Config["Port"]), 5000);

                PACSUID uid = (PACSUID)ui;

                if (Config["WADO URL"] == null)
                {
                    Dataset[] ds = scu.CGet(uid.StudyInstanceUID, uid.SeriesInstanceUID, uid.SOPInstanceUID);

                    if ((ds != null) &&
                        (ds.Length > 0))
                    {
                        IECGFormat ret = new DICOMFormat(ds[0]);

                        if (ret.Works())
                        {
                            return(ret);
                        }
                    }
                }
                else
                {
                    Dataset ds = scu.WADOGet(Config["WADO URL"], uid.StudyInstanceUID, uid.SeriesInstanceUID, uid.SOPInstanceUID);

                    if (ds != null)
                    {
                        IECGFormat ret = new DICOMFormat(ds);

                        if (ret.Works())
                        {
                            return(ret);
                        }
                    }
                }
            }

            return(null);
        }
Exemple #3
0
        public override ECGInfo[] getECGList(string patid)
        {
            if (!Works())
            {
                return(null);
            }

            ECGInfo[] ret = null;

            try
            {
                BasicSCU scu = new BasicSCU(_Config["AESCU"], _Config["AESCP"], _Config["Server"], int.Parse(_Config["Port"]), 1000);

                string[] modalities = { "ECG" };

                Dataset[] dsa = scu.CFindStudy(patid, modalities);

                if (dsa != null)
                {
                    ArrayList alResult = new ArrayList();

                    foreach (Dataset ds in dsa)
                    {
                        string genderText = ds.GetString(Tags.PatientSex);

                        ECGDemographics.Sex gender = ECGDemographics.Sex.Unspecified;

                        switch (genderText)
                        {
                        case "M":
                        case "m":
                            gender = ECGDemographics.Sex.Male;
                            break;

                        case "F":
                        case "f":
                            gender = ECGDemographics.Sex.Female;
                            break;
                        }

                        alResult.Add(new ECGInfo(
                                         new PACSUID(ds.GetString(Tags.StudyInstanceUID)),
                                         ds.GetString(Tags.PatientID),
                                         ds.GetString(Tags.PatientName),
                                         ds.GetDateTime(Tags.StudyDate, Tags.StudyTime),
                                         gender));
                    }

                    if (alResult.Count > 0)
                    {
                        ret = new ECGInfo[alResult.Count];

                        for (int i = 0; i < ret.Length; i++)
                        {
                            ret[i] = (ECGInfo)alResult[i];
                        }
                    }
                }
            }
            catch {}

            return(ret);
        }