예제 #1
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);
             *  }
             * }*/
        }