Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CodingContext"/> class.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <param name="procedures">The procedures.</param>
        protected internal CodingContext(Visit visit, IList<Procedure> procedures )
        {
            Check.IsNotNull(visit, "Visit is required.");
            Visit = visit;

            _procedures = new List<Procedure>();
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VitalSign"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <param name="activityType">Type of the activity.</param>
 protected internal VitalSign(
     Visit visit,
     ActivityType activityType )
     : base(visit, activityType)
 {
     _bloodPressures = new List<BloodPressure> ();
     _heartRates = new List<HeartRate> ();
 }
        /// <summary>
        /// Creates the gain short screener.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <returns>A GainShortScreener.</returns>
        public GainShortScreener CreateGainShortScreener( Visit visit )
        {
            var activityType = _lookupValueRepository.GetLookupByWellKnownName<ActivityType> ( WellKnownNames.VisitModule.ActivityType.GainShortScreener );
            var gainShortScreener = new GainShortScreener ( visit, activityType );

            _gainShortScreenerRepository.MakePersistent ( gainShortScreener );
            return gainShortScreener;
        }
        /// <summary>
        /// Creates the individual counseling.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <returns>
        /// An IndividualCounseling.
        /// </returns>
        public IndividualCounseling CreateIndividualCounseling( Visit visit )
        {
            var activityType = _lookupValueRepository.GetLookupByWellKnownName<ActivityType> ( WellKnownNames.VisitModule.ActivityType.IndividualCounseling );
            var individualCounseling = new IndividualCounseling ( visit, activityType );

            _individualCounselingRepository.MakePersistent ( individualCounseling );

            return individualCounseling;
        }
        /// <summary>
        /// Creates the radiology order.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <returns>A <see cref="T:Rem.Domain.Clinical.RadiologyModule.RadiologyOrder">RadiologyOrder</see>.</returns>
        public RadiologyOrder CreateRadiologyOrder( Visit visit )
        {
            var type = _lookupValueRepository.GetLookupByWellKnownName<ActivityType> ( WellKnownNames.VisitModule.ActivityType.RadiologyOrder );
            var radiology = new RadiologyOrder ( visit, type );

            _radiologyOrderRepository.MakePersistent ( radiology );

            return radiology;
        }
        /// <summary>
        /// Creates the DensAsi interview.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <returns>A DensAsiInterview.</returns>
        public DensAsiInterview CreateDensAsiInterview( Visit visit )
        {
            var activityType = _lookupValueRepository.GetLookupByWellKnownName<ActivityType>(WellKnownNames.VisitModule.ActivityType.DensAsiInterview);
            var densAsiInterview = new DensAsiInterview ( visit, activityType );

            _densAsiInterviewRepository.MakePersistent ( densAsiInterview );

            return densAsiInterview;
        }
        /// <summary>
        /// Creates the brief intervention.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <returns>A BriefIntervention.</returns>
        public BriefIntervention CreateBriefIntervention( Visit visit )
        {
            var activityType = _lookupValueRepository.GetLookupByWellKnownName<ActivityType> ( WellKnownNames.VisitModule.ActivityType.BriefIntervention );
            var briefIntervention = new BriefIntervention ( visit, activityType );

            _briefInterventionRepository.MakePersistent ( briefIntervention );

            return briefIntervention;
        }
        /// <summary>
        /// Creates the Teds interview.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <returns>A TedsAdmissionInterview.</returns>
        public TedsAdmissionInterview CreateTedsAdmissionInterview(Visit visit)
        {
            var activityType = _lookupValueRepository.GetLookupByWellKnownName<ActivityType>(WellKnownNames.VisitModule.ActivityType.TedsAdmissionInterview);
            var TedsAdmissionInterview = new TedsAdmissionInterview(visit, activityType);

            _tedsAdmissionInterviewRepository.MakePersistent(TedsAdmissionInterview);

            return TedsAdmissionInterview;
        }
Beispiel #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Activity"/> class.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <param name="activityType">Type of the activity.</param>
        protected internal Activity( Visit visit, ActivityType activityType )
        {
            Check.IsNotNull ( visit, "Visit is required." );
            Check.IsNotNull ( activityType, "Activity Type is required." );

            _visit = visit;
            _clinicalCase = visit.ClinicalCase;
            _activityType = activityType;
            _activityDateTimeRange = visit.AppointmentDateTimeRange;
        }
Beispiel #10
0
        /// <summary>
        /// Creates the visit.
        /// </summary>
        /// <param name="staff">The staff.</param>
        /// <param name="appointmentDateTimeRange">The appointment date time range.</param>
        /// <param name="clinicalCase">The clinical case.</param>
        /// <param name="visitTemplate">The visit template.</param>
        /// <param name="serviceLocation">The service location.</param>
        /// <returns>
        /// A Visit.
        /// </returns>
        public Visit CreateVisit(Staff staff, 
            DateTimeRange appointmentDateTimeRange,
            ClinicalCase clinicalCase,
            VisitTemplate visitTemplate,
            Location serviceLocation )
        {
            var visitStatus = _visitStatusRepository.GetByWellKnownName ( WellKnownNames.VisitModule.VisitStatus.Scheduled );
            var visit = new Visit (staff, appointmentDateTimeRange, clinicalCase, visitStatus, serviceLocation, visitTemplate.Name, visitTemplate.CptCode );

            _visitRepository.MakePersistent ( visit );
            return visit;
        }
Beispiel #11
0
        /// <summary>
        /// Creates the audit.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <returns>
        /// An Audit.
        /// </returns>
        public Audit CreateAudit( Visit visit)
        {
            // TODO: This checks only the currently submitted session activities. Need to implement a solution that addresses multiple session concurrency issues.
            var auditFirst = visit.Activities.FirstOrDefault(a => a.ActivityType.WellKnownName == WellKnownNames.VisitModule.ActivityType.Audit);
            if (auditFirst != null)
            {
                return auditFirst as Audit;
            }

            var activityType = _lookupValueRepository.GetLookupByWellKnownName<ActivityType>(WellKnownNames.VisitModule.ActivityType.Audit);
            var audit = new Audit(visit, activityType);

            _auditRepository.MakePersistent(audit);

            return audit;
        }
Beispiel #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GpraInterview"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <param name="activityType">Type of the activity.</param>
 protected internal GpraInterview(
     Visit visit,
     ActivityType activityType )
     : base(visit, activityType)
 {
     _gpraCrimeCriminalJustice = new GpraCrimeCriminalJustice(this);
     _gpraDemographics = new GpraDemographics(this);
     _gpraDischarge = new GpraDischarge(this);
     _gpraDrugAlcoholUse = new GpraDrugAlcoholUse(this);
     _gpraFamilyLivingConditions = new GpraFamilyLivingConditions(this);
     _gpraFollowUp = new GpraFollowUp(this);
     _gpraPlannedServices = new GpraPlannedServices(this);
     _gpraProblemsTreatmentRecovery = new GpraProblemsTreatmentRecovery(this);
     _gpraProfessionalInformation = new GpraProfessionalInformation(this);
     _gpraSocialConnectedness = new GpraSocialConnectedness (this);
 }
Beispiel #13
0
 /// <summary>
 /// Initializes a new instance of the <see
 /// cref="DensAsiInterview">DensAsiInterview</see> class.
 /// </summary>
 /// <param name="visit">The <see cref="Visit">Visit</see> in
 /// which the <see cref="DensAsiInterview">DensAsiInterview</see> is
 /// performed.</param>
 /// <param name="activityType">Type of the <see
 /// cref="Activity">Activity</see>.</param>
 protected internal DensAsiInterview(
     Visit visit,
     ActivityType activityType )
     : base(visit, activityType)
 {
     _densAsiPatientProfile = new DensAsiPatientProfile(this);
     ReviseDensAsiPatientProfile(new DensAsiPatientProfileSectionBuilder());
     _densAsiMedicalStatus = new DensAsiMedicalStatus(this);
     _densAsiEmploymentStatus = new DensAsiEmploymentStatus(this);
     _densAsiDrugAlcoholUse = new DensAsiDrugAlcoholUse(this);
     _densAsiLegalStatus = new DensAsiLegalStatus(this);
     _densAsiFamilySocialRelationships = new DensAsiFamilySocialRelationships(this);
     _densAsiPsychiatricStatus = new DensAsiPsychiatricStatus(this);
     _densAsiDsmIv = new DensAsiDsmIv(this);
     _densAsiClosure = new DensAsiClosure(this);
 }
        /// <summary>
        /// Synchronizes the encounter with the clinical visit.
        /// </summary>
        /// <param name="patientAccount">The patient account.</param>
        /// <param name="visit">The visit.</param>
        /// <returns>
        /// An <see cref="Encounter"/> instance.
        /// </returns>
        public Encounter SynchronizeEncounter( PatientAccount patientAccount, Visit visit )
        {
            Check.IsNotNull ( patientAccount, "Patient account is required." );
            Check.IsNotNull ( visit, "Visit is required." );

            var serviceProvider = visit.Staff;
            var placeOfService = visit.ServiceLocation;

            var encounter = _encounterRepository.GetByTrackingNumber ( visit.Key );
            if (encounter == null)
            {
                encounter = _encounterFactory.CreateEncounter (
                    patientAccount,
                    placeOfService,
                    serviceProvider,
                    visit.Key,
                    visit.CheckedInDateTime?? DateTime.Now);
            }
            else
            {
                if (encounter.PatientAccount.Key != patientAccount.Key)
                {
                    encounter.RevisePatientAccount(patientAccount );
                }

                if (encounter.ServiceLocation.Key != placeOfService.Key)
                {
                    encounter.RevisePlaceOfService(placeOfService);
                }

                if (encounter.ServiceProviderStaff.Key != serviceProvider.Key)
                {
                    encounter.ReviseServiceProvider ( serviceProvider );
                }
            }

            //TODO: move them to ctor
            var currency = _lookupValueRepository.GetLookupByWellKnownName<Currency>(WellKnownNames.CommonModule.Currency.USDollars);
            encounter.ReviseChargeAmount ( new Money ( currency, 2 ) );

            return encounter;
        }
Beispiel #15
0
        /// <summary>
        /// If the visit does not have a AuditC, then it returns a newly created AuditC,
        /// else, it returns an existing one from the visit.
        /// </summary>
        /// <param name="visit">A visit.</param>
        /// <returns>An AuditC.</returns>
        public AuditC CreateAuditC( Visit visit )
        {
            AuditC auditC;
            var existingNidaDrugQuestionnaire = _auditCRepository.GetAuditCByVisitKey( visit.Key );

            if (existingNidaDrugQuestionnaire != null)
            {
                auditC = existingNidaDrugQuestionnaire;
            }
            else
            {
                var activityType = _lookupValueRepository.GetLookupByWellKnownName<ActivityType> ( WellKnownNames.VisitModule.ActivityType.AuditC );
                auditC = new AuditC ( visit, activityType );

                _auditCRepository.MakePersistent ( auditC );

                DomainEvent.Raise ( new AuditCCreatedEvent { AuditC = auditC } );
            }

            return auditC;
        }
Beispiel #16
0
        /// <summary>
        /// If the visit does not have a SocialHistory, then it returns a newly created SocialHistory,
        /// else, it returns an existing one from the visit.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <returns>A SocialHistory.</returns>
        public SocialHistory CreateSocialHistory(Visit visit)
        {
            Check.IsNotNull(visit, "visit is required.");

            //NOTE : There can be only one 'Social History' per visit.
            SocialHistory socialHistory;

            var existingSocialHistory = _socialHistoryRepository.GetSocialHistoryInVisit(visit.Key);

            if (existingSocialHistory != null)
            {
                socialHistory = existingSocialHistory;
            }
            else
            {
                var type = _lookupValueRepository.GetLookupByWellKnownName <ActivityType> (WellKnownNames.VisitModule.ActivityType.SocialHistory);
                socialHistory = new SocialHistory(visit, type);

                _socialHistoryRepository.MakePersistent(socialHistory);
            }
            return(socialHistory);
        }
Beispiel #17
0
        /// <summary>
        /// If the visit does not have a Phq9, then it returns a newly created Phq9,
        /// else, it returns an existing one from the visit.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <returns>A Phq9.</returns>
        public Phq9 CreatePhq9( Visit visit )
        {
            Check.IsNotNull(visit, "visit is required.");

            Phq9 phq9;
            var existingNidaDrugQuestionnaire = _phq9Repository.GetPhq9ByVisitKey ( visit.Key );

            if (existingNidaDrugQuestionnaire != null)
            {
                phq9 = existingNidaDrugQuestionnaire;
            }
            else
            {
                var activityType = _lookupValueRepository.GetLookupByWellKnownName<ActivityType> ( WellKnownNames.VisitModule.ActivityType.Phq9 );
                phq9 = new Phq9 ( visit, activityType );

                _phq9Repository.MakePersistent ( phq9 );

                DomainEvent.Raise ( new Phq9CreatedEvent { Phq9 = phq9 } );
            }

            return phq9;
        }
Beispiel #18
0
        /// <summary>
        /// If the visit does not have a Dast10, then it returns a newly created Dast10,
        /// else, it returns an existing one from the visit.
        /// </summary>
        /// <param name="visit">A visit.</param>
        /// <returns>A Dast10.</returns>
        public Dast10 CreateDast10( Visit visit )
        {
            Check.IsNotNull(visit, "visit is required.");

            Dast10 dast10;
            var existingNidaDrugQuestionnaire = _dast10Repository.GetDast10ByVisitKey ( visit.Key );

            if (existingNidaDrugQuestionnaire != null)
            {
                dast10 = existingNidaDrugQuestionnaire;
            }
            else
            {
                var activityType = _lookupValueRepository.GetLookupByWellKnownName<ActivityType> ( WellKnownNames.VisitModule.ActivityType.Dast10 );
                dast10 = new Dast10 ( visit, activityType );

                _dast10Repository.MakePersistent ( dast10 );

                DomainEvent.Raise ( new Dast10CreatedEvent { Dast10 = dast10 } );
            }

            return dast10;
        }
        /// <summary>
        /// If the visit does not have a NidaDrugQuestionnaire, then it returns a newly created NidaDrugQuestionnaire,
        /// else, it returns an existing one from the visit.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <returns>A NidaDrugQuestionnaire.</returns>
        public NidaDrugQuestionnaire CreateNidaDrugQuestionnaire( Visit visit )
        {
            Check.IsNotNull(visit, "visit is required.");

            NidaDrugQuestionnaire nidaDrugQuestionnaire;
            var existingNidaDrugQuestionnaire = _nidaDrugQuestionnaireRepository.GetNidaDrugQuestionnaireInVisit ( visit.Key );

            if ( existingNidaDrugQuestionnaire != null )
            {
                nidaDrugQuestionnaire = existingNidaDrugQuestionnaire;
            }
            else
            {
                var activityType = _lookupValueRepository.GetLookupByWellKnownName<ActivityType> ( WellKnownNames.VisitModule.ActivityType.NidaDrugQuestionnaire );
                nidaDrugQuestionnaire = new NidaDrugQuestionnaire ( visit, activityType );

                _nidaDrugQuestionnaireRepository.MakePersistent ( nidaDrugQuestionnaire );

                DomainEvent.Raise(new NidaDrugQuestionnaireCreatedEvent { NidaDrugQuestionnaire = nidaDrugQuestionnaire });
            }

            return nidaDrugQuestionnaire;
        }
Beispiel #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VisitAggregateNodeBase"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 protected VisitAggregateNodeBase(Visit visit)
 {
     Check.IsNotNull(visit, "Visit is required.");
     _visit = visit;
 }
Beispiel #21
0
        /// <summary>
        /// If the visit does not have a SocialHistory, then it returns a newly created SocialHistory,
        /// else, it returns an existing one from the visit.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <returns>A SocialHistory.</returns>
        public SocialHistory CreateSocialHistory( Visit visit )
        {
            Check.IsNotNull ( visit, "visit is required." );

            //NOTE : There can be only one 'Social History' per visit.
            SocialHistory socialHistory;

            var existingSocialHistory = _socialHistoryRepository.GetSocialHistoryInVisit(visit.Key);

            if (existingSocialHistory != null)
            {
                socialHistory = existingSocialHistory;
            }
            else
            {
                var type = _lookupValueRepository.GetLookupByWellKnownName<ActivityType> ( WellKnownNames.VisitModule.ActivityType.SocialHistory );
                socialHistory = new SocialHistory ( visit, type );

                _socialHistoryRepository.MakePersistent ( socialHistory );
            }
            return socialHistory;
        }
Beispiel #22
0
 /// <summary>
 /// Creates the activity.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <returns>An Activity.</returns>
 public Activity CreateActivity( Visit visit )
 {
     return CreateSocialHistory ( visit );
 }
Beispiel #23
0
 /// <summary>
 /// Creates the activity.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <returns>An Activity.</returns>
 public Activity CreateActivity( Visit visit )
 {
     return CreateGpraInterview ( visit );
 }
Beispiel #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SocialHistory"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <param name="activityType">Type of the activity.</param>
 protected internal SocialHistory(
     Visit visit,
     ActivityType activityType)
     : base(visit, activityType)
 {
 }
Beispiel #25
0
 /// <summary>
 /// Creates the activity.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <returns>An Activity.</returns>
 public Activity CreateActivity(Visit visit)
 {
     return(CreateVitalSign(visit));
 }
Beispiel #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BriefIntervention"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <param name="activityType">Type of the activity.</param>
 protected internal BriefIntervention(Visit visit, ActivityType activityType)
     : base(visit, activityType)
 {
 }
Beispiel #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LabSpecimen"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <param name="activityType">Type of the activity.</param>
 protected internal LabSpecimen(Visit visit, ActivityType activityType)
     : base(visit, activityType)
 {
     _labTests = new List<LabTest>();
 }
 /// <summary>
 /// Creates the activity.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <returns>An Activity.</returns>
 public Activity CreateActivity(Visit visit)
 {
     return CreateIndividualCounseling(visit);
 }
Beispiel #29
0
 /// <summary>
 /// Creates the activity.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <returns>An Activity.</returns>
 public Activity CreateActivity(Visit visit)
 {
     return CreateAudit(visit);
 }
Beispiel #30
0
 /// <summary>
 /// Creates the activity.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <returns>An Activity.</returns>
 public Activity CreateActivity(Visit visit)
 {
     return(CreateSocialHistory(visit));
 }
Beispiel #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IndividualCounseling"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <param name="activityType">Type of the activity.</param>
 protected internal IndividualCounseling(Visit visit, ActivityType activityType )
     : base(visit, activityType)
 {
 }
Beispiel #32
0
        /// <summary>
        /// Creates the vital sign.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <returns>
        /// A VitalSign.
        /// </returns>
        public VitalSign CreateVitalSign( Visit visit )
        {
            var type = _lookupValueRepository.GetLookupByWellKnownName<ActivityType> ( WellKnownNames.VisitModule.ActivityType.VitalSign );

            var vitalSign = new VitalSign ( visit, type );

            _vitalSignRepository.MakePersistent ( vitalSign );

            return vitalSign;
        }
Beispiel #33
0
 /// <summary>
 /// Creates the activity.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <returns>An Activity.</returns>
 public Activity CreateActivity( Visit visit )
 {
     return CreateVitalSign ( visit );
 }
Beispiel #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Audit"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <param name="activityType">Type of the activity.</param>
 public Audit( Visit visit, ActivityType activityType )
     : base(visit, activityType)
 {
 }
Beispiel #35
0
 /// <summary>
 /// Destroys the visit.
 /// </summary>
 /// <param name="visit">The visit.</param>
 public void DestroyVisit(Visit visit)
 {
     visit.Activities.ForEach(visit.DeleteActivity);
     _visitRepository.MakeTransient(visit);
 }
 /// <summary>
 /// Creates the activity.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <returns>An Activity.</returns>
 public Activity CreateActivity(Visit visit)
 {
     return CreateRadiologyOrder(visit);
 }
Beispiel #37
0
        /// <summary>
        /// Creates the Gpra interview.
        /// </summary>
        /// <param name="visit">The visit.</param>
        /// <returns>A GpraInterview.</returns>
        public GpraInterview CreateGpraInterview(Visit visit )
        {
            var activityType = _lookupValueRepository.GetLookupByWellKnownName<ActivityType>(WellKnownNames.VisitModule.ActivityType.GpraInterview);
            var gpraInterview = new GpraInterview ( visit, activityType );

            _gpraInterviewRepository.MakePersistent ( gpraInterview );

            return gpraInterview;
        }
Beispiel #38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VisitProblem"/> class.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <param name="problem">The problem.</param>
 protected internal VisitProblem(Visit visit, Problem problem) : base(visit)
 {
     Check.IsNotNull(problem, "Problem is required.");
     _problem = problem;
 }
Beispiel #39
0
 /// <summary>
 /// Creates the activity.
 /// </summary>
 /// <param name="visit">The visit.</param>
 /// <returns>An Activity.</returns>
 public Activity CreateActivity(Visit visit)
 {
     return(CreateBriefIntervention(visit));
 }