Ejemplo n.º 1
0
        public void AddPatient(WCFPatient patient)
        {
            Guard.ArgumentNotNullOrEmpty(patient.PatientID, "PatientID");
            Guard.ArgumentNotNullOrEmpty(patient.IssuerOfPatientID, "IssuerOfPatientID");
            Guard.ArgumentNotNullOrEmpty(patient.PatientNameFamilyName + patient.PatientNameGivenName +
                                         patient.PatientNameMiddleName, "Patient Name");

            NullTheEmpty(patient);

            using (MWLDataset ds = new MWLDataset())
            {
                ds.AddPatient(patient);
                DB.DataAccess.UpdateMWL(ds);
            }
        }
Ejemplo n.º 2
0
        public void AddVisit(WCFVisit visit)
        {
            Guard.ArgumentNotNullOrEmpty(visit.AdmissionID, "AdmissionID");
            if (visit.ReferencedPatientSequence != null)
            {
                Guard.ArgumentNotNullOrEmpty(visit.ReferencedPatientSequence.ReferencedSOPClassUID, "ReferencedSOPClassUID");
                Guard.ArgumentNotNullOrEmpty(visit.ReferencedPatientSequence.ReferencedSOPInstanceUID, "ReferencedSOPInstanceUID");
            }

            using (MWLDataset ds = new MWLDataset())
            {
                ds.AddVisit(visit);
                DB.DataAccess.UpdateMWL(ds);
            }
        }
Ejemplo n.º 3
0
        public void UpdateImagingServiceRequest(string accessionNumber, string patientID, string issuerOfPatientID, ImagingServiceRequest request)
        {
            ImagingServiceRequest srcRequest = new ImagingServiceRequest()
            {
                AccessionNumber = accessionNumber
            };
            Patient patient = new Patient()
            {
                PatientID = patientID, IssuerOfPatientID = issuerOfPatientID
            };

            Guard.ArgumentNotNullOrEmpty(request.AccessionNumber, "AccessionNumber");
            Guard.ArgumentNotNullOrEmpty(patientID, "patientID");
            Guard.ArgumentNotNullOrEmpty(issuerOfPatientID, "issuerOfPatientID");

            //
            // Check to see if the accesion number exists
            //
            if (accessionNumber.ToLower() != request.AccessionNumber.ToLower())
            {
                using (MWLDataset ds = DB.DataAccess.Find(new ImagingServiceRequest()
                {
                    AccessionNumber = request.AccessionNumber
                }))
                {
                    if (ds != null && ds.ImagingServiceRequest.Rows.Count > 0)
                    {
                        throw new Exception("Primary key violation. Accession number already exist.");
                    }
                }
            }

            using (MWLDataset ds = DB.DataAccess.Find(patient, srcRequest))
            {
                if (ds != null && ds.ImagingServiceRequest.Rows.Count > 0)
                {
                    MWLDataset.ImagingServiceRequestRow row = ds.ImagingServiceRequest.Rows[0] as MWLDataset.ImagingServiceRequestRow;

                    row.Update(request);
                    DB.DataAccess.UpdateMWL(ds);
                }
                else
                {
                    throw new Exception("Imaging service request not found");
                }
            }
        }
Ejemplo n.º 4
0
        public WCFScheduledProcedureStep FindScheduledProcedureStep(string scheduledProcedureStepID)
        {
            WCFScheduledProcedureStep sps = new WCFScheduledProcedureStep()
            {
                ScheduledProcedureStepID = scheduledProcedureStepID
            };

            Guard.ArgumentNotNullOrEmpty(scheduledProcedureStepID, "scheduledProcedureStepID");
            using (MWLDataset ds = DB.DataAccess.Find(sps))
            {
                if (ds != null && ds.ScheduledProcedureStep.Rows.Count > 0)
                {
                    return(ds.ToScheduledProcedureStep());
                }
            }

            return(null);
        }
Ejemplo n.º 5
0
        public WCFVisit FindVisit(string admissionID)
        {
            WCFVisit visit = new WCFVisit()
            {
                AdmissionID = admissionID
            };

            Guard.ArgumentNotNullOrEmpty(admissionID, "AdmissionID");
            using (MWLDataset ds = DB.DataAccess.Find(visit))
            {
                if (ds != null && ds.Visit.Rows.Count > 0)
                {
                    return(ds.ToVisit());
                }
            }

            return(null);
        }
Ejemplo n.º 6
0
        public WCFPatient FindPatient(string patientID, string issuerOfPatientID)
        {
            WCFPatient patient = new WCFPatient()
            {
                PatientID = patientID, IssuerOfPatientID = issuerOfPatientID
            };

            Guard.ArgumentNotNullOrEmpty(patient.PatientID, "PatientID");
            Guard.ArgumentNotNullOrEmpty(patient.IssuerOfPatientID, "IssuerOfPatientID");
            using (MWLDataset ds = DB.DataAccess.Find(patient))
            {
                if (ds != null && ds.Patient.Rows.Count > 0)
                {
                    return(ds.ToPatient());
                }
            }

            return(null);
        }
Ejemplo n.º 7
0
        void QueryButton_Click(object sender, EventArgs e)
        {
            try
            {
                IWorklistDataAccessAgent worklistAgent;


                worklistAgent = DataAccessServices.GetDataAccessService <IWorklistDataAccessAgent> ( );

                _queryResult = worklistAgent.FindPatientInformation(new MatchingParameterCollection( ));
                List <string> tables = new List <string> ( );

                tableLayoutPanel1.Controls.Clear( );

                foreach (DatabaseDicomTags dbTag in _source)
                {
                    if (tables.Contains(dbTag.TableName))
                    {
                        continue;
                    }

                    DataGridView queryResultsDataGridView = new DataGridView( );
                    queryResultsDataGridView.AllowUserToAddRows = false;

                    queryResultsDataGridView.ColumnAdded += new DataGridViewColumnEventHandler(queryResultsDataGridView_ColumnAdded);

                    queryResultsDataGridView.DataSource = _queryResult;
                    queryResultsDataGridView.DataMember = dbTag.TableName;
                    queryResultsDataGridView.Dock       = DockStyle.Fill;

                    queryResultsDataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;

                    tables.Add(dbTag.TableName);

                    tableLayoutPanel1.Controls.Add(queryResultsDataGridView);
                }
            }
            catch (Exception exception)
            {
                Messager.ShowError(this, exception);
            }
        }
Ejemplo n.º 8
0
        public void DeleteThenAddVisit(WCFVisit visit)
        {
            Guard.ArgumentNotNullOrEmpty(visit.AdmissionID, "AdmissionID");
            if (visit.ReferencedPatientSequence != null)
            {
                Guard.ArgumentNotNullOrEmpty(visit.ReferencedPatientSequence.ReferencedSOPClassUID, "ReferencedSOPClassUID");
                Guard.ArgumentNotNullOrEmpty(visit.ReferencedPatientSequence.ReferencedSOPInstanceUID, "ReferencedSOPInstanceUID");
            }
            try
            {
                DB.DataAccess.DeleteWorklistEntity(visit);
            }
            catch { }//safe to ignore

            using (MWLDataset ds = new MWLDataset())
            {
                ds.AddVisit(visit);
                DB.DataAccess.UpdateMWL(ds);
            }
        }
Ejemplo n.º 9
0
        public WCFRequestedProcedure FindRequestedProcedure(string accessionNumber, string requestedProcedureID)
        {
            ImagingServiceRequest imgRequest = new ImagingServiceRequest()
            {
                AccessionNumber = accessionNumber
            };
            WCFRequestedProcedure reqProcedure = new WCFRequestedProcedure()
            {
                RequestedProcedureID = requestedProcedureID
            };

            using (MWLDataset ds = DB.DataAccess.Find(imgRequest, reqProcedure))
            {
                if (ds != null && ds.RequestedProcedure.Rows.Count > 0)
                {
                    return(ds.ToRequestedProcedure());
                }
            }
            return(null);
        }
Ejemplo n.º 10
0
        public void DeleteScheduledProcedureStep(string scheduledProcedureStepID)
        {
            WCFScheduledProcedureStep sps = new WCFScheduledProcedureStep()
            {
                ScheduledProcedureStepID = scheduledProcedureStepID
            };

            Guard.ArgumentNotNullOrEmpty(scheduledProcedureStepID, "scheduledProcedureStepID");
            using (MWLDataset ds = DB.DataAccess.Find(sps))
            {
                if (ds != null && ds.ScheduledProcedureStep.Rows.Count > 0)
                {
                    ds.ScheduledProcedureStep.Rows[0].Delete();
                    DB.DataAccess.UpdateMWL(ds);
                }
                else
                {
                    throw new Exception("Scheduled procedure step not found");
                }
            }
        }
Ejemplo n.º 11
0
        public void AddRequestedProcedure(string userName, string accessionNumber, WorklistRequestedProcedure procedure)
        {
            ImagingServiceRequest imgRequest = new ImagingServiceRequest()
            {
                AccessionNumber = accessionNumber
            };

            Check.ArgumentNotNullOrEmpty(accessionNumber, "accessionNumber");
            Check.ArgumentNotNullOrEmpty(procedure.RequestedProcedureID, "RequestedProceureID");
            Check.ArgumentNotNullOrEmpty(procedure.RequestedProcedureDescription, "RequestedProcedureDescription");

            if (string.IsNullOrEmpty(procedure.StudyInstanceUID))
            {
                procedure.StudyInstanceUID = DicomUtilities.GenerateDicomUniqueIdentifier();
            }

            if (procedure.RequestedProcedureCodeSequence != null)
            {
                Check.ArgumentNotNullOrEmpty(procedure.RequestedProcedureCodeSequence.CodeValue, "RequestedProcedureCodeSequence.CodeValue");
                Check.ArgumentNotNullOrEmpty(procedure.RequestedProcedureCodeSequence.CodingSchemeDesignator, "RequestedProcedureCodeSequence.CodingSchemeDesignator");
            }

            if (procedure.ReferencedStudySequence != null)
            {
                foreach (ReferencedStudySequence rs in procedure.ReferencedStudySequence)
                {
                    Check.ArgumentNotNullOrEmpty(rs.ReferencedSOPClassUID, "ReferencedStudySequence.ReferencedSOPClassUID");
                    Check.ArgumentNotNullOrEmpty(rs.ReferencedSOPInstanceUID, "ReferencedStudySequence.ReferencedSOPInstanceUID");
                }
            }

            using (MWLDataset ds = _DataAccessAgent.Find(imgRequest))
            {
                ImagingServiceRequest isr = new ImagingServiceRequest();

                imgRequest.CopyTo(isr);
                ds.AddRequestedProcedure(isr, procedure);
                _DataAccessAgent.UpdateMWL(ds);
            }
        }
Ejemplo n.º 12
0
        public void DeletePatient(string patientId, string issuerOfPatientID)
        {
            Patient patient = new Patient()
            {
                PatientID = patientId, IssuerOfPatientID = issuerOfPatientID
            };

            Guard.ArgumentNotNullOrEmpty(patient.PatientID, "PatientID");
            Guard.ArgumentNotNullOrEmpty(patient.IssuerOfPatientID, "IssuerOfPatientID");
            using (MWLDataset ds = DB.DataAccess.Find(patient))
            {
                if (ds != null && ds.Patient.Rows.Count > 0)
                {
                    ds.Patient.Rows[0].Delete();
                    DB.DataAccess.UpdateMWL(ds);
                }
                else
                {
                    throw new Exception("Patient id not found");
                }
            }
        }
Ejemplo n.º 13
0
        public void AddScheduledProcedureStep(string userName, string accessionNumber, string requestedProcedureID, WorklistScheduledProcedureStep procedureStep)
        {
            ImagingServiceRequest imgRequest = new ImagingServiceRequest()
            {
                AccessionNumber = accessionNumber
            };
            WorklistRequestedProcedure reqProcedure = new WorklistRequestedProcedure()
            {
                RequestedProcedureID = requestedProcedureID
            };

            Check.ArgumentNotNullOrEmpty(requestedProcedureID, "requestedProcedureID");
            Check.ArgumentNotNullOrEmpty(accessionNumber, "accessionNumber");
            Check.ArgumentNotNullOrEmpty(requestedProcedureID, "requestedProcedureID");
            Check.ArgumentNotNull(procedureStep.ScheduledProcedureStepStartDate_Time, "ScheduledProcedureStepStartDate_Time");
            Check.ArgumentNotNullOrEmpty(procedureStep.Modality, "Modality");
            Check.ArgumentNotNullOrEmpty(procedureStep.ScheduledProcedureStepDescription, "ScheduledProcedureStepDescription");

            if (procedureStep.ScheduledProtocolCodeSequence != null)
            {
                foreach (ScheduledProtocolCodeSequence cs in procedureStep.ScheduledProtocolCodeSequence)
                {
                    Check.ArgumentNotNullOrEmpty(cs.CodeValue, "ScheduledProtocolCodeSequence.CodeValue");
                    Check.ArgumentNotNullOrEmpty(cs.CodingSchemeDesignator, "ScheduledProtocolCodeSequence.CodingSchemeDesignator");
                }
            }

            using (MWLDataset ds = _DataAccessAgent.Find(imgRequest, reqProcedure))
            {
                if (ds != null && ds.RequestedProcedure.Rows.Count > 0)
                {
                    ds.AddScheduledProcedureStep(imgRequest, reqProcedure, procedureStep);
                    _DataAccessAgent.UpdateMWL(ds);
                }
            }
        }
Ejemplo n.º 14
0
        public ImagingServiceRequest FindImagingServiceRequest(string accessionNumber, string patientID, string issuerOfPatientID)
        {
            ImagingServiceRequest request = new ImagingServiceRequest()
            {
                AccessionNumber = accessionNumber
            };
            Patient patient = new Patient()
            {
                PatientID = patientID, IssuerOfPatientID = issuerOfPatientID
            };

            Guard.ArgumentNotNullOrEmpty(request.AccessionNumber, "AccessionNumber");
            Guard.ArgumentNotNullOrEmpty(patientID, "patientID");
            Guard.ArgumentNotNullOrEmpty(issuerOfPatientID, "issuerOfPatientID");
            using (MWLDataset ds = DB.DataAccess.Find(patient, request))
            {
                if (ds != null && ds.ImagingServiceRequest.Rows.Count > 0)
                {
                    return(ds.ToImagingServiceRequest());
                }
            }

            return(null);
        }
Ejemplo n.º 15
0
        public void UpdateScheduledProcedureStep(string scheduledProcedureStepID, WCFScheduledProcedureStep procedureStep)
        {
            WCFScheduledProcedureStep sps = new WCFScheduledProcedureStep()
            {
                ScheduledProcedureStepID = scheduledProcedureStepID
            };

            Guard.ArgumentNotNullOrEmpty(scheduledProcedureStepID, "scheduledProcedureStepID");
            Guard.ArgumentNotNull(procedureStep.ScheduledProcedureStepStartDate_Time, "ScheduledProcedureStepStartDate_Time");
            Guard.ArgumentNotNullOrEmpty(procedureStep.Modality, "Modality");
            Guard.ArgumentNotNullOrEmpty(procedureStep.ScheduledProcedureStepDescription, "ScheduledProcedureStepDescription");

            if (procedureStep.ScheduledProtocolCodeSequence != null)
            {
                foreach (ScheduledProtocolCodeSequence cs in procedureStep.ScheduledProtocolCodeSequence)
                {
                    Guard.ArgumentNotNullOrEmpty(cs.CodeValue, "ScheduledProtocolCodeSequence.CodeValue");
                    Guard.ArgumentNotNullOrEmpty(cs.CodingSchemeDesignator, "ScheduledProtocolCodeSequence.CodingSchemeDesignator");
                }
            }

            using (MWLDataset ds = DB.DataAccess.Find(sps))
            {
                if (ds != null && ds.ScheduledProcedureStep.Rows.Count > 0)
                {
                    MWLDataset.ScheduledProcedureStepRow row = ds.ScheduledProcedureStep.Rows[0] as MWLDataset.ScheduledProcedureStepRow;

                    row.Update(procedureStep);
                    DB.DataAccess.UpdateMWL(ds);
                }
                else
                {
                    throw new Exception("Scheduled procedure step not found");
                }
            }
        }
Ejemplo n.º 16
0
        public void AddScheduledProcedureStep(string accessionNumber, string requestedProcedureID, WCFScheduledProcedureStep procedureStep, MWLDataset ds)
        {
            ImagingServiceRequest imgRequest = new ImagingServiceRequest()
            {
                AccessionNumber = accessionNumber
            };
            WCFRequestedProcedure reqProcedure = new WCFRequestedProcedure()
            {
                RequestedProcedureID = requestedProcedureID
            };

            Guard.ArgumentNotNullOrEmpty(requestedProcedureID, "requestedProcedureID");
            Guard.ArgumentNotNullOrEmpty(accessionNumber, "accessionNumber");
            Guard.ArgumentNotNullOrEmpty(requestedProcedureID, "requestedProcedureID");
            Guard.ArgumentNotNull(procedureStep.ScheduledProcedureStepStartDate_Time, "ScheduledProcedureStepStartDate_Time");
            Guard.ArgumentNotNullOrEmpty(procedureStep.Modality, "Modality");
            Guard.ArgumentNotNullOrEmpty(procedureStep.ScheduledProcedureStepDescription, "ScheduledProcedureStepDescription");

            if (procedureStep.ScheduledProtocolCodeSequence != null)
            {
                foreach (ScheduledProtocolCodeSequence cs in procedureStep.ScheduledProtocolCodeSequence)
                {
                    Guard.ArgumentNotNullOrEmpty(cs.CodeValue, "ScheduledProtocolCodeSequence.CodeValue");
                    Guard.ArgumentNotNullOrEmpty(cs.CodingSchemeDesignator, "ScheduledProtocolCodeSequence.CodingSchemeDesignator");
                }
            }

            ds.AddScheduledProcedureStep(imgRequest, reqProcedure, procedureStep);
        }
Ejemplo n.º 17
0
        public void AddImagingServiceRequest(string patientID, string issuerOfPatientID, ImagingServiceRequest request, MWLDataset ds)
        {
            Patient patient = new Patient()
            {
                PatientID = patientID, IssuerOfPatientID = issuerOfPatientID
            };

            Guard.ArgumentNotNullOrEmpty(request.AccessionNumber, "AccessionNumber");
            Guard.ArgumentNotNullOrEmpty(patientID, "patientID");
            Guard.ArgumentNotNullOrEmpty(issuerOfPatientID, "issuerOfPatientID");

            ds.AddImagingServiceRequest(patient, request);
        }
Ejemplo n.º 18
0
 public void RollbackTransaction(MWLDataset ds)
 {
     ds.Dispose();
 }
Ejemplo n.º 19
0
        public void AddRequestedProcedure(string accessionNumber, WCFRequestedProcedure procedure, MWLDataset ds)
        {
            ImagingServiceRequest imgRequest = new ImagingServiceRequest()
            {
                AccessionNumber = accessionNumber
            };

            Guard.ArgumentNotNullOrEmpty(accessionNumber, "accessionNumber");
            Guard.ArgumentNotNullOrEmpty(procedure.RequestedProcedureID, "RequestedProcedureID");
            Guard.ArgumentNotNullOrEmpty(procedure.StudyInstanceUID, "StudyInstanceUID");
            Guard.ArgumentNotNullOrEmpty(procedure.RequestedProcedureDescription, "RequestedProcedureDescription");

            if (procedure.RequestedProcedureCodeSequence != null)
            {
                Guard.ArgumentNotNullOrEmpty(procedure.RequestedProcedureCodeSequence.CodeValue, "RequestedProcedureCodeSequence.CodeValue");
                Guard.ArgumentNotNullOrEmpty(procedure.RequestedProcedureCodeSequence.CodingSchemeDesignator, "RequestedProcedureCodeSequence.CodingSchemeDesignator");
            }

            if (procedure.ReferencedStudySequence != null)
            {
                foreach (ReferencedStudySequence rs in procedure.ReferencedStudySequence)
                {
                    Guard.ArgumentNotNullOrEmpty(rs.ReferencedSOPClassUID, "ReferencedStudySequence.ReferencedSOPClassUID");
                    Guard.ArgumentNotNullOrEmpty(rs.ReferencedSOPInstanceUID, "ReferencedStudySequence.ReferencedSOPInstanceUID");
                }
            }

            ds.AddRequestedProcedure(imgRequest, procedure);
        }
Ejemplo n.º 20
0
        public WorklistUpdate()
        {
            InitializeComponent();

            _queryResult = null;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Adds the patient.
        /// </summary>
        /// <param name="ds">The ds.</param>
        /// <param name="patient">The patient.</param>
        public static void AddPatient(this MWLDataset ds, WCFPatient patient)
        {
            MWLDataset.PatientRow pr = ds.Patient.NewPatientRow();
            MWLDataset.VisitRow   vr = ds.Visit.NewVisitRow();
            MWLDataset.ImagingServiceRequestRow    isrr   = ds.ImagingServiceRequest.NewImagingServiceRequestRow();
            MWLDataset.RequestedProcedureRow       rpr    = ds.RequestedProcedure.NewRequestedProcedureRow();
            MWLDataset.ScheduledProcedureStepRow   spsr   = ds.ScheduledProcedureStep.NewScheduledProcedureStepRow();
            MWLDataset.ScheduledStationAETitlesRow ssaetr = ds.ScheduledStationAETitles.NewScheduledStationAETitlesRow();
            Random rnd              = new Random();
            string AccessionNumber  = rnd.Next(100000000, 999999999).ToString() + "." + DateTime.Now.ToString("ssfff");
            string ReferDrLastName  = "N/A";
            string ReferDrFirstName = "N/A";
            string modality         = "IO";

            string[] Accessions = DB.DataAccess.GetAccessionNumbers(patient.PatientID, patient.IssuerOfPatientID);

            if (Accessions.Length < 1)
            {
                patient.CopyTo <MWLDataset.PatientRow>(pr);
                if (patient.LastMenstrualDate.HasValue)
                {
                    pr.LastMenstrualDate = patient.LastMenstrualDate.Value.Date1.ToDateTime();
                }
                if (patient.PatientBirthDate.HasValue)
                {
                    pr.PatientBirthDate = patient.PatientBirthDate.Value.Date1.ToDateTime();
                }
                if (!patient.PregnancyStatus.IsNullOrEmpty())
                {
                    switch (patient.PregnancyStatus.ToLower())
                    {
                    case "not pregnant":
                        pr.PregnancyStatus = 1;
                        break;

                    case "possibly pregnant":
                        pr.PregnancyStatus = 2;
                        break;

                    case "definitely pregnant":
                        pr.PregnancyStatus = 3;
                        break;

                    case "unknown":
                        pr.PregnancyStatus = 4;
                        break;

                    default:
                        pr.PregnancyStatus = 0;
                        break;
                    }
                }
                pr.IssuerOfPatientID = patient.IssuerOfPatientID;
                ds.Patient.AddPatientRow(pr);
            }
            else
            {
                LogMessage(Logger.Global, LogType.Information, "Patient <" + patient.PatientID + "> already exists.");
            }

            if (patient.MedicalAlerts != null)
            {
                foreach (string ma in patient.MedicalAlerts)
                {
                    MWLDataset.MedicalAlertsRow mar = ds.MedicalAlerts.NewMedicalAlertsRow();

                    mar.MedicalAlert      = ma;
                    mar.PatientID         = patient.PatientID;
                    mar.IssuerOfPatientID = patient.IssuerOfPatientID;
                    ds.MedicalAlerts.AddMedicalAlertsRow(mar);
                }
            }

            if (patient.ContrastAllergies != null)
            {
                foreach (string ca in patient.ContrastAllergies)
                {
                    MWLDataset.ContrastAllergiesRow car = ds.ContrastAllergies.NewContrastAllergiesRow();

                    car.ContrastAllergy   = ca;
                    car.PatientID         = patient.PatientID;
                    car.IssuerOfPatientID = patient.IssuerOfPatientID;
                    ds.ContrastAllergies.AddContrastAllergiesRow(car);
                }
            }

            if (patient.OtherPatientIDs != null)
            {
                foreach (string id in patient.OtherPatientIDs)
                {
                    MWLDataset.OtherPatientIDsRow oir = ds.OtherPatientIDs.NewOtherPatientIDsRow();

                    oir.OtherPatientID    = id;
                    oir.PatientID         = patient.PatientID;
                    oir.IssuerOfPatientID = patient.IssuerOfPatientID;
                    ds.OtherPatientIDs.AddOtherPatientIDsRow(oir);
                }
            }

            //Start Insert of Remaining Tables needed for MWL
            if (AccessionNumber != null)
            {
                if (Accessions.Length < 1)
                {
                    //Insert Visit
                    vr.AdmissionID            = AccessionNumber;
                    vr.CurrentPatientLocation = "MEDICAL";
                    ds.Visit.AddVisitRow(vr);

                    //Insert ImagingServiceRequest
                    isrr.AccessionNumber               = AccessionNumber;
                    isrr.PatientID                     = patient.PatientID;
                    isrr.IssuerOfPatientID             = patient.IssuerOfPatientID;
                    isrr.RequestingPhysicianFamilyName = ReferDrLastName;
                    isrr.RequestingPhysicianGivenName  = ReferDrFirstName;
                    isrr.ReferringPhysicianFamilyName  = ReferDrLastName;
                    isrr.ReferringPhysicianGivenName   = ReferDrFirstName;
                    ds.ImagingServiceRequest.AddImagingServiceRequestRow(isrr);

                    //Insert RequestedProcedure
                    rpr.AccessionNumber               = AccessionNumber;
                    rpr.RequestedProcedureID          = AccessionNumber;
                    rpr.StudyInstanceUID              = "1.2.840.114257.15.400000.2." + DateTime.Now.ToString("hhmmss") + patient.PatientID + DateTime.Now.ToString("yyyyMMdd");
                    rpr.RequestedProcedureDescription = "MEDICAL";
                    rpr.RequestedProcedurePriority    = "MED";
                    rpr.AdmissionID = AccessionNumber;
                    ds.RequestedProcedure.AddRequestedProcedureRow(rpr);

                    //Insert ScheduledProcedureStep
                    spsr.ScheduledProcedureStepID                   = AccessionNumber;
                    spsr.AccessionNumber                            = AccessionNumber;
                    spsr.RequestedProcedureID                       = AccessionNumber;
                    spsr.ScheduledProcedureStepLocation             = "MEDICAL";
                    spsr.ScheduledProcedureStepStartDate_Time       = DateTime.Now;
                    spsr.ScheduledPerformingPhysicianNameFamilyName = ReferDrLastName;
                    spsr.ScheduledPerformingPhysicianNameGivenName  = ReferDrFirstName;
                    spsr.Modality = modality;
                    spsr.ScheduledProcedureStepDescription = "MEDICAL";
                    ds.ScheduledProcedureStep.AddScheduledProcedureStepRow(spsr);

                    //Insert ScheduledStationAETitles
                    ssaetr.ScheduledProcedureStepID = AccessionNumber;
                    ssaetr.ScheduledStationAETitle  = patient.ScheduledStationAE;
                    ds.ScheduledStationAETitles.AddScheduledStationAETitlesRow(ssaetr);
                    LogMessage(Logger.Global, LogType.Information, "Patient <" + patient.PatientID + "> was added");
                }
            }
        }
Ejemplo n.º 22
0
        public static void AddPatient(this MWLDataset ds, WorklistPatient patient)
        {
            MWLDataset.PatientRow pr = ds.Patient.NewPatientRow();

            patient.CopyTo <MWLDataset.PatientRow>(pr);
            if (patient.LastMenstrualDate.HasValue)
            {
                pr.LastMenstrualDate = patient.LastMenstrualDate.Value.Date1.ToDateTime();
            }
            if (patient.PatientBirthDate.HasValue)
            {
                pr.PatientBirthDate = patient.PatientBirthDate.Value.Date1.ToDateTime();
            }
            if (!string.IsNullOrEmpty(patient.PregnancyStatus))
            {
                switch (patient.PregnancyStatus.ToLower())
                {
                case "not pregnant":
                    pr.PregnancyStatus = 1;
                    break;

                case "possibly pregnant":
                    pr.PregnancyStatus = 2;
                    break;

                case "definitely pregnant":
                    pr.PregnancyStatus = 3;
                    break;

                case "unknown":
                    pr.PregnancyStatus = 4;
                    break;

                default:
                    pr.PregnancyStatus = 0;
                    break;
                }
            }
            ds.Patient.AddPatientRow(pr);

            /*if (patient.MedicalAlerts != null)
             * {
             *  foreach (string ma in patient.MedicalAlerts)
             *  {
             *      MWLDataset.MedicalAlertsRow mar = ds.MedicalAlerts.NewMedicalAlertsRow();
             *
             *      mar.MedicalAlert = ma;
             *      mar.PatientID = patient.PatientID;
             *      mar.IssuerOfPatientID = patient.IssuerOfPatientID;
             *      ds.MedicalAlerts.AddMedicalAlertsRow(mar);
             *  }
             * }
             *
             * if (patient.ContrastAllergies != null)
             * {
             *  foreach (string ca in patient.ContrastAllergies)
             *  {
             *      MWLDataset.ContrastAllergiesRow car = ds.ContrastAllergies.NewContrastAllergiesRow();
             *
             *      car.ContrastAllergy = ca;
             *      car.PatientID = patient.PatientID;
             *      car.IssuerOfPatientID = patient.IssuerOfPatientID;
             *      ds.ContrastAllergies.AddContrastAllergiesRow(car);
             *  }
             * }
             *
             * if (patient.OtherPatientIDs != null)
             * {
             *  foreach (string id in patient.OtherPatientIDs)
             *  {
             *      MWLDataset.OtherPatientIDsRow oir = ds.OtherPatientIDs.NewOtherPatientIDsRow();
             *
             *      oir.OtherPatientID = id;
             *      oir.PatientID = patient.PatientID;
             *      oir.IssuerOfPatientID = patient.IssuerOfPatientID;
             *      ds.OtherPatientIDs.AddOtherPatientIDsRow(oir);
             *  }
             * }*/
        }