public Models.Production.DestinationFacility New() { var customer = new Models.Production.Customer { CustomerId = new Random().Next(1, 999999).ToString(), Name = "BD Rowa Germany GmbH DestinationFacility", ContactPerson = new Models.Production.ContactPerson { Email = "*****@*****.**", Name = "Johanna Blisterfrau", TelephoneNumber = "0269292060" }, ContactAddress = new Models.Production.ContactAddress { Addressline1 = "Rowastraße 1-3", NameLine1 = "BD Rowa Germany GmbH", City = "Kelberg", Country = "Germany", Postalcode = "53539", State = "Rheinland-Pfalz" } }; var departmentItem = DepartmentGenerator.Random(); var destinationFacility = new Models.Production.DestinationFacility { DepartmentCode = departmentItem.Code, DepartmentName = departmentItem.Name, Name = customer.Name, ContactAddress = customer.ContactAddress, ContactPerson = customer.ContactPerson, CustomerId = customer.CustomerId }; return(destinationFacility); }
public static Models.Production.ExternalOrder New( List <Models.Production.Medicine> medicine, Models.Production.Customer value, Models.Production.DestinationFacility destinationFacility, int mPatientCounter, int mPatientDays, int mIntakeTimesPerDay, int mMedicationPerIntakeTime, int mPillsPerMedication, bool mRandomValuePatientDays, bool mRandomValueIntakeTimesPerDay, bool mRandomValueMedicationPerIntakeTime, bool mRandomValuePillsPerMedication, bool isYesSelected) { var random = new Random(); medicine = medicine.Where(medicine1 => medicine1.Active).ToList(); var externalOrder = new Models.Production.ExternalOrder { Customer = value, Timestamp = DateTime.Now.ToString("g"), OrderDetails = new List <Models.Production.OrderDetail>() }; if (value != null) { externalOrder.ExternalId = "GO_" + value.Name.Replace(" ", "") + "_" + DateTime.Now.ToString("yyyyMMdd_HHmmss"); } else { externalOrder.ExternalId = "GO_NoCustomer_" + DateTime.Now.ToString("yyyyMMdd_HHmmss"); } for (var i = 0; i < mPatientCounter; i++) { var countOfDay = mRandomValuePatientDays ? random.Next(1, mPatientDays) : mPatientDays; var countOfInatkeTimes = mRandomValueIntakeTimesPerDay ? random.Next(1, mIntakeTimesPerDay) : mIntakeTimesPerDay; var orderDetail = new Models.Production.OrderDetail { Patient = PatientGenerator.New(), Pharmacy = new Models.Production.Customer { Name = "Pharmacy_" + value?.Name, ContactAddress = value?.ContactAddress, ContactPerson = value?.ContactPerson, CustomerId = "Pharmacy_" + value?.CustomerId }, IntakeDetails = new List <Models.Production.IntakeDetail> { }, DestinationFacility = destinationFacility }; orderDetail.ExternalDetailPrintInfo1 = "EDPI1: " + orderDetail.Patient.ContactPerson.Name + "/" + DateTime.Parse(orderDetail.Patient.DateOfBirth, CultureInfo.CurrentCulture) .ToShortDateString(); orderDetail.ExternalDetailPrintInfo2 = "EDPI2: " + orderDetail.DestinationFacility.DepartmentName + "/" + orderDetail.Pharmacy.CustomerId; for (var j = 0; j < countOfInatkeTimes; j++) { var medicationDetails = new List <Models.Production.MedicationDetail>(); var countOfMedsPerIntake = mRandomValueMedicationPerIntakeTime ? random.Next(1, mMedicationPerIntakeTime) : mMedicationPerIntakeTime; for (var k = 0; k < countOfMedsPerIntake; k++) { var medicationDetail = new Models.Production.MedicationDetail(); var medicationForIntake = medicine[random.Next(0, medicine.Count)]; medicationDetail.MedicineId = isYesSelected ? medicationForIntake.SynonymIds.FirstOrDefault()?.Identifier : medicationForIntake.Identifier; medicationDetail.IntakeAdvice = "IntakeAdvice"; medicationDetail.Physician = "Physician"; medicationDetail.PhysicianComment = "PhysicianComment"; medicationDetail.PrescribedMedicine = medicationForIntake.Name; var countOfPills = mRandomValuePillsPerMedication ? random.Next(1, mPillsPerMedication) : mPillsPerMedication; medicationDetail.Count = countOfPills; medicationDetails.Add(medicationDetail); } var intakeDateAndTime = DateTime.Today + TimeSpan.FromDays(1) + TimeSpan.FromMinutes(random.Next(1, 1440)); for (var k = 0; k < countOfDay; k++) { var intakeDetail = new Models.Production.IntakeDetail { IntakeDateTime = (intakeDateAndTime + TimeSpan.FromDays(k)).ToString("s"), MedicationDetails = new List <Models.Production.MedicationDetail> { }, }; // intakeDetail.ExternalIntakePrintInfo1 = "EIPI1: " + intakeDetail.IntakeDateTime; intakeDetail.MedicationDetails.AddRange(medicationDetails); // intakeDetail.ExternalIntakePrintInfo2 = "EIPI2: " + intakeDetail.MedicationDetails.Count; orderDetail.IntakeDetails.Add(intakeDetail); } } externalOrder.OrderDetails.Add(orderDetail); } return(externalOrder); }