Пример #1
0
        public static PharmaceuticalPrescription Create(PrescriptionIdentifier identifier,
                                                        HealthcarePractitioner prescriber,
                                                        Patient patient,
                                                        IEnumerable <PrescribedMedication> prescribedMedications,
                                                        DateTime createdOn,
                                                        Alpha2LanguageCode languageCode,
                                                        EncounterIdentifier encounterIdentifier = null,
                                                        DateTime?delivrableAt = null)
        {
            var prescription = new PharmaceuticalPrescription
                               (
                identifier,
                prescriber,
                patient,
                prescribedMedications,
                languageCode,
                PrescriptionStatus.Created,
                createdOn,
                encounterIdentifier,
                delivrableAt
                               );

            prescription.AddEvent(new PharmaceuticalPrescriptionCreated(identifier.Value, createdOn));
            return(prescription);
        }
Пример #2
0
 protected Prescription(PrescriptionIdentifier identifier,
                        HealthcarePractitioner prescriber,
                        Patient patient,
                        Alpha2LanguageCode languageCode,
                        PrescriptionStatus status,
                        DateTime createdOn,
                        EncounterIdentifier encounterIdentifier = null,
                        DateTime?delivrableAt             = null,
                        EntityState entityState           = EntityState.Added,
                        IEnumerable <IDomainEvent> events = null)
     : base(entityState, events)
 {
     Condition.Requires(identifier, nameof(identifier)).IsNotNull();
     Condition.Requires(prescriber, nameof(prescriber)).IsNotNull();
     Condition.Requires(patient, nameof(patient)).IsNotNull();
     Condition.Requires(status, nameof(status)).IsNotNull();
     Condition.Requires(languageCode, nameof(languageCode)).IsNotNull();
     this.Identifier          = identifier;
     this.Prescriber          = prescriber;
     this.Patient             = patient;
     this.LanguageCode        = languageCode;
     this.Status              = status;
     this.CreatedOn           = createdOn;
     this.EncounterIdentifier = encounterIdentifier;
     this.DeliverableAt       = delivrableAt;
 }
Пример #3
0
 public static PharmaceuticalPrescription Create(PrescriptionIdentifier identifier,
                                                 HealthcarePractitioner prescriber,
                                                 Patient patient,
                                                 IEnumerable <PrescribedMedication> prescribedMedications,
                                                 Alpha2LanguageCode languageCode,
                                                 EncounterIdentifier encounterIdentifier = null,
                                                 DateTime?delivrableAt = null)
 {
     return(Create(identifier, prescriber, patient, prescribedMedications, SystemTime.Local(), languageCode, encounterIdentifier, delivrableAt));
 }
Пример #4
0
 public PharmaceuticalPrescription Translate(CreatePharmaceuticalPrescription command,
                                             IDictionary <string, object> options = null)
 {
     Condition.Requires(command, nameof(command)).IsNotNull();
     return(PharmaceuticalPrescription.Create
            (
                new PrescriptionIdentifier(command.PrescriptionIdentifier),
                ToPrescriber(command),
                ToPatient(command),
                command.Medications.Select(m => ToPrescribedMedication(m)),
                command.CreatedOn,
                new Alpha2LanguageCode(command.LanguageCode),
                EncounterIdentifier.CreateIfNotEmpty(command.EncounterIdentifier),
                command.DeliverableAt
            ));
 }
Пример #5
0
 public PharmaceuticalPrescription Translate(PharmaceuticalPrescriptionState state,
                                             IDictionary <string, object> options = null)
 {
     Condition.Requires(state, nameof(state)).IsNotNull();
     return(new PharmaceuticalPrescription
            (
                new PrescriptionIdentifier(state.Identifier),
                this.practitionerTranslator.Translate(state.Prescriber),
                this.patientTranslator.Translate(state.Patient),
                state.PrescribedMedications.Select(m => this.medicationTranslator.Translate(m)),
                new Alpha2LanguageCode(state.LanguageCode),
                Enumeration.ParseCode <PrescriptionStatus>(state.Status),
                state.CreatedOn,
                EncounterIdentifier.CreateIfNotEmpty(state.EncounterIdentifier),
                state.DeliverableAt,
                state.EntityState
            ));
 }
Пример #6
0
 public PharmaceuticalPrescription(PrescriptionIdentifier identifier,
                                   HealthcarePractitioner prescriber,
                                   Patient patient,
                                   IEnumerable <PrescribedMedication> prescribedMedications,
                                   Alpha2LanguageCode languageCode,
                                   PrescriptionStatus status,
                                   DateTime createdOn,
                                   EncounterIdentifier encounterIdentifier = null,
                                   DateTime?delivrableAt             = null,
                                   EntityState entityState           = EntityState.Added,
                                   IEnumerable <IDomainEvent> events = null)
     : base(identifier, prescriber, patient, languageCode, status, createdOn, encounterIdentifier, delivrableAt, entityState, events)
 {
     Condition.Requires(prescribedMedications, nameof(prescribedMedications))
     .IsNotNull()
     .IsNotEmpty()
     .DoesNotContain(null);
     this.prescribedMedications.AddRange(prescribedMedications);
 }
Пример #7
0
 private IEncounterData GetEncounterData(Agent mainTarget, LogProcessorState state)
 {
     return(EncounterIdentifier.GetEncounterData(mainTarget, state.Events, state.Agents, state.Skills, state.GameBuild, state.LogType));
 }
Пример #8
0
 private IEncounterData GetEncounterData(Agent mainTarget, LogProcessorContext context)
 {
     return(EncounterIdentifier.GetEncounterData(mainTarget, context.Events, context.Agents, context.GameBuild, context.LogType));
 }