Exemplo n.º 1
0
        public void UpdatePatient(string origPatientId, string origIssuerOfPatientId, WCFPatient patient)
        {
            WCFPatient srchPatient = new WCFPatient()
            {
                PatientID = origPatientId, IssuerOfPatientID = origIssuerOfPatientId
            };

            Guard.ArgumentNotNullOrEmpty(patient.PatientID, "PatientID");
            Guard.ArgumentNotNullOrEmpty(patient.IssuerOfPatientID, "IssuerOfPatientID");
            Guard.ArgumentNotNullOrEmpty(patient.PatientNameFamilyName + patient.PatientNameGivenName +
                                         patient.PatientNameMiddleName, "Patient Name");

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

                    row.Update(patient);
                    DB.DataAccess.UpdateMWL(ds);
                }
                else
                {
                    throw new Exception("Patient id not found");
                }
            }
        }
Exemplo n.º 2
0
        public void AddPatient(WCFPatient patient, MWLDataset ds)
        {
            Guard.ArgumentNotNullOrEmpty(patient.PatientID, "PatientID");
            Guard.ArgumentNotNullOrEmpty(patient.IssuerOfPatientID, "IssuerOfPatientID");
            Guard.ArgumentNotNullOrEmpty(patient.PatientNameFamilyName + patient.PatientNameGivenName +
                                         patient.PatientNameMiddleName, "Patient Name");

            NullTheEmpty(patient);

            ds.AddPatient(patient);
        }
Exemplo n.º 3
0
 private void NullTheEmpty(WCFPatient patient)
 {
     if (patient.LastMenstrualDate.HasValue && patient.LastMenstrualDate.Value.IsEmpty)
     {
         patient.LastMenstrualDate = null;
     }
     if (patient.PatientBirthDate.HasValue && patient.PatientBirthDate.Value.IsEmpty)
     {
         patient.PatientBirthDate = null;
     }
 }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
0
        public WCFPatient getPatient()
        {
            if (null == _patient)
            {
                _patient = new WCFPatient();

                _patient.PatientID = _adapter.PID?.Patient_Identifier_List?[0]?.IDNumber.Read();
                if (string.IsNullOrEmpty(_patient.PatientID))
                {
                    _patient.PatientID = _adapter.PID?.Patient_ID?.IDNumber.Read();
                }
                if (string.IsNullOrEmpty(_patient.PatientID))
                {
                    _patient.PatientID = _adapter.PID?.Set_ID_PID.Read();
                }
                _patient.IssuerOfPatientID     = _adapter.PID?.Patient_Identifier_List?[0]?.AssigningAuthority.NamespaceID.Read();
                _patient.PatientNameFamilyName = _adapter.PID?.Patient_Name?[0]?.FamilyName.Surname.Read();
                _patient.PatientNameGivenName  = _adapter.PID?.Patient_Name?[0]?.GivenName.Read();
                _patient.PatientNameMiddleName = _adapter.PID?.Patient_Name?[0]?.SecondAndFurtherGivenNamesOrInitialsThereof.Read();
                _patient.PatientNamePrefix     = _adapter.PID?.Patient_Name?[0]?.PrefixEgDR.Read();
                _patient.PatientNameSuffix     = _adapter.PID?.Patient_Name?[0]?.SuffixEgJRorIII.Read();
                _patient.PatientBirthDate      = LTConvert.ToDicomDateRange(_adapter.PID?.Date_Time_of_Birth.Month, _adapter.PID?.Date_Time_of_Birth.Day, _adapter.PID?.Date_Time_of_Birth.Year);
                _patient.PatientSex            = _adapter.PID?.Administrative_Sex.Read();
                if (!DicomValidation.IsValidPatientSex(_patient.PatientSex))
                {
                    _patient.PatientSex = null;
                }
                _patient.EthnicGroup = _adapter.PID?.Race.Read();
                //_adapter.PID?.Patient_Address;
                //_adapter.PID?.Patient_Account_Number;
                _patient.PatientState  = _adapter.OBR?.Danger_Code.Read();
                _patient.MedicalAlerts = _adapter.OBR?.Relevant_Clinical_Information.ReadAsList();//may add support for plural (all OBR segements combined)
                _patient.ConfidentialityConstraintonPatientDataDescription = _adapter.PV1?.VIP_Indicator.Read();
                _patient.PregnancyStatus          = _adapter.PV1?.Ambulatory_Status.Read();
                _patient.PatientWeight            = _adapter.OBX?.Observation_Value.Read();
                _patient.ContrastAllergies        = _adapter.AL1?.Allergen_Type_Code.ReadAsList();//may add support for plural (all AL1 segements combined)
                _patient.PatientComments          = _adapter.Zxx?.Field_2.Read();
                _patient.AdditionalPatientHistory = _adapter.Zxx?.Field_3.Read();
                _patient.SpecialNeeds             = _adapter.Zxx?.Field_4.Read();
                _patient.LastMenstrualDate        = LTConvert.HL7DateToDicomDateRange(_adapter.Zxx?.Field_5.Read());

                DefaultValuesProvider.Visit(_patient);
            }
            return(_patient);
        }
Exemplo 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);
        }
Exemplo n.º 7
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");
                }
            }
        }
Exemplo n.º 8
0
 public DeleteImageServiceRequest(WCFPatient patient, ImagingServiceRequest imageServiceRequest)
 {
     _imageServiceRequest = imageServiceRequest;
     _patient             = patient;
 }
Exemplo n.º 9
0
 public DeletePatient(WCFPatient patient)
 {
     _patient = patient;
 }
Exemplo n.º 10
0
 public UpdatePatient(WCFPatient patient)
 {
     _patient = patient;
 }
Exemplo n.º 11
0
 public AddPatient(WCFPatient patient)
 {
     _patient = patient;
 }