/// <summary> /// Creates the medication. /// </summary> /// <param name="patient">The patient.</param> /// <param name="medicationCodeCodedConcept">The medication code coded concept.</param> /// <param name="provenance">The provenance.</param> /// <returns>A Medication.</returns> public Medication CreateMedication(Patient patient, CodedConcept medicationCodeCodedConcept, Provenance provenance) { var medication = new Medication(patient, medicationCodeCodedConcept, provenance); _medicationRepository.MakePersistent(medication); return medication; }
/// <summary> /// Destroys the medication. /// </summary> /// <param name="medication">The medication.</param> public void DestroyMedication( Medication medication ) { _medicationRepository.MakeTransient ( medication ); }
/// <summary> /// Destroys the medication. /// </summary> /// <param name="medication">The medication.</param> public void DestroyMedication(Medication medication) { _medicationRepository.MakeTransient(medication); }
// TODO: Based on some business rule private OutsidePrescriptionType TransformRemMedicationIntoOutsidePrescriptionAsMappedDrug( Medication medication ) { Check.IsNotNull ( medication.UsageDateRange.StartDate, "Medication Usage Start Date cannot be null" ); Debug.Assert ( medication.UsageDateRange.StartDate != null, "medication.UsageDateRange.StartDate != null" ); var prescription = new OutsidePrescriptionType { ExternalId = medication.Key.ToString (), Date = medication.UsageDateRange.StartDate.Value.ToString ( "yyyMMdd" ), DoctorName = medication.PrescribingPhysicianName, DrugIdentifierTypeSpecified = true, DrugIdentifier = medication.MedicationCodeCodedConcept.CodedConceptCode, DrugIdentifierType = DrugDatabaseType.RXNORM, PrescriptionType = "reconcile", }; return prescription; }
private static OutsidePrescriptionType TransformRemMedicationIntoOutsidePrescriptionAsFreeText( Medication medication ) { Check.IsNotNull ( medication.UsageDateRange, "Medication Usage Range was provided for " + medication.MedicationCodeCodedConcept.DisplayName ); Check.IsNotNull ( medication.UsageDateRange.StartDate, "Medication Usage Start Date cannot be null" ); Debug.Assert ( medication.UsageDateRange.StartDate != null, "medication.UsageDateRange.StartDate != null" ); var prescription = new OutsidePrescriptionType { ExternalId = medication.Key.ToString (), Date = medication.UsageDateRange.StartDate.Value.ToString ( "yyyMMdd" ), DoctorName = medication.PrescribingPhysicianName, DrugIdentifierTypeSpecified = false, Drug = NcScriptHelper.RemoveUnwantedPartsFromDrugName ( medication.RootMedicationCodedConcept.DisplayName ), //// DrugIdentifier = medication.MedicationCodeCodedConcept.CodedConceptCode, PrescriptionType = "reconcile", ////DispenseNumber = "0", ////RefillCount = "0", Sig = medication.FrequencyDescription, PrescriptionStatus = NcScriptHelper.TransformRemMedicationStatusIntoNewCropPrescriptionStatus ( medication.MedicationStatus.WellKnownName ), PrescriptionArchiveStatus = NcScriptHelper.TransformRemMedicationIntoNewCropPrescriptionArchiveStatus ( medication.MedicationStatus.WellKnownName ), }; return prescription; }
/// <summary> /// Removes the medication. /// </summary> /// <param name="medication">The medication.</param> public virtual void RemoveMedication(Medication medication) { if (_medications.Contains(medication)) { _medications.Remove(medication); } else { throw new ArgumentException("Medication not found."); } var factory = IoC.CurrentContainer.Resolve<IMedicationFactory>(); factory.DestroyMedication(medication); NotifyItemRemoved(() => Medications, medication); }
private Medication BuildMedication( Patient patient, CodedConcept medicationCode ) { var medication = new Medication ( patient, medicationCode, medicationCode ); Session.SaveOrUpdate ( medication ); return medication; }