/// <summary> /// Creates the problem. /// </summary> /// <param name="clinicalCase">The clinical case.</param> /// <param name="problemCodeCodedConcept">The problem code coded concept.</param> /// <returns>A Problem.</returns> public Problem CreateProblem( ClinicalCase clinicalCase, CodedConcept problemCodeCodedConcept) { var problem = new Problem ( clinicalCase, problemCodeCodedConcept); _problemRepository.MakePersistent ( problem ); return problem; }
/// <summary> /// Gets the HL7 message. /// </summary> /// <param name="keyValues">The key values.</param> /// <returns>A <see cref="System.String"/></returns> public string GetHl7Message( Dictionary<string, long> keyValues ) { var problemKey = keyValues[HttpHandlerQueryStrings.ProblemKey]; var session = _sessionProvider.GetSession (); _messageLocalDateTime = DateTime.Now; _problem = session.Get<Problem> ( keyValues[HttpHandlerQueryStrings.ProblemKey] ); Check.IsNotNull ( _problem, string.Format ( "Problem not found for key {0}.", problemKey ) ); // Derive a visit appointment date for a problem associated with multiple visits. // Return the first minimum Appointment.ScheduledStartDateTime and Visit.Key where the Problem.Key is found. var queryResult = session.CreateQuery ( @"select min(v.AppointmentDateTimeRange.StartDateTime) as AppointmentStartDateTime, vp.Visit.Key as VisitKey from VisitProblem as vp join vp.Visit as v where vp.Problem.Key = :problemKey group by vp.Visit.Key" ) .SetParameter ( "problemKey", problemKey ) .List (); _minimumVisitScheduledStartDateTime = ( DateTime )( ( object[] )queryResult[0] )[0]; _minimumVisitKey = ( long )( ( object[] )queryResult[0] )[1]; VerifyDerivedVisit (); _clinicalCase = _problem.ClinicalCase; _patient = _problem.ClinicalCase.Patient; var dto = new SyndromicSurveillanceDto { MshDto = GetMshDto (), PidDto = GetPidDto (), EVNDto = GetEvnDto (), PV1Dto = GetPv1Dto (), Observations = GetObservations (), PresentedProblems = GetPresentedProblems () }; var helper = IoC.CurrentContainer.Resolve<IMessageHelper<ADT_A01, SyndromicSurveillanceDto>> (); var factory = IoC.CurrentContainer.Resolve<MessageFactoryBase<ADT_A01, SyndromicSurveillanceDto>>(); AbstractMessage message; if ( helper != null && factory != null ) { message = factory.CreateMessage ( dto ); } else { throw new ArgumentException ( "HL7 message helper or factory instances were not created." ); } return ( new PipeParser () ).Encode ( message ); }
/// <summary> /// Destroys the problem. /// </summary> /// <param name="problem">The problem.</param> public void DestroyProblem( Problem problem ) { _problemRepository.MakeTransient ( problem ); }
private Visit BuildScheduledVisit( Staff staff, DateTimeRange appointmentDateTimeRange, ClinicalCase clinicalCase, Problem problem = null ) { var visitTemplate = new VisitTemplate ( SafeHarborAgency, "Initial Behavioral Health - Adult", "99204" ); Session.SaveOrUpdate ( visitTemplate ); var visit = new Visit ( staff, appointmentDateTimeRange, clinicalCase, ScheduledVisitStatus, SafeHarborLocation, visitTemplate.Name, visitTemplate.CptCode ); if ( problem != null ) { visit.AddProblem ( problem ); } Session.SaveOrUpdate ( visit ); return visit; }
/// <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; }
private Problem BuildProblem( ClinicalCase clinicalCase, CodedConcept problemCode ) { var problem = new Problem ( clinicalCase, problemCode ); Session.SaveOrUpdate ( problem ); return problem; }
private Visit BuildCheckedInVisit( Staff staff, DateTimeRange appointmentDateTimeRange, ClinicalCase clinicalCase, Problem problem = null ) { Visit visit = BuildScheduledVisit ( staff, appointmentDateTimeRange, clinicalCase, problem ); visit.CheckIn ( new DateTime ( 2002, 3, 28, 9, 0, 0 ) ); Session.SaveOrUpdate ( visit ); return visit; }
/// <summary> /// Disassociates the problem. /// </summary> /// <param name="problem">The problem.</param> public virtual void DisassociateProblem(Problem problem) { var visitProblem = _problems.SingleOrDefault ( p => p.Problem.Key == problem.Key ); if ( visitProblem != null ) { _problems.Delete(visitProblem); NotifyItemRemoved ( () => Problems, visitProblem ); } }
/// <summary> /// Adds the problem. /// </summary> /// <param name="problem">The problem.</param> /// <returns>A VisitProblem.</returns> public virtual VisitProblem AddProblem( Problem problem ) { var visitProblem = new VisitProblem ( this, problem ); _problems.Add ( visitProblem ); NotifyItemAdded ( () => Problems, visitProblem ); return visitProblem; }
private void AddProblem( C32Dto dto, Problem problem, DateTime? diagnosisDate ) { var conditionDto = new ConditionDto (); conditionDto.DiagnosisPriority = 1; if ( diagnosisDate.HasValue ) { // TODO: The problem date should be the DiagnosisDate //conditionDto.ProblemDate = new OperatorDateTimeDto { Date = diagnosisDate.Value.ToString ( "yyyyMMdd" ) }; } else { if ( problem.OnsetDateRange != null && ( problem.OnsetDateRange.StartDate != null || problem.OnsetDateRange.EndDate != null ) ) { // TODO: The problem date should be the DiagnosisDate // conditionDto.ProblemDate = new OperatorDateTimeDto (); // if ( problem.OnsetDateRange.StartDate != null ) // { // conditionDto.ProblemDate.StartDate = new ValueDataTransferObject // { // Value = problem.OnsetDateRange.StartDate.Value.ToString ( "yyyyMMdd" ) // }; // } // if ( problem.OnsetDateRange.EndDate != null ) // { // conditionDto.ProblemDate.EndDate = new ValueDataTransferObject // { // Value = problem.OnsetDateRange.EndDate.Value.ToString ( "yyyyMMdd" ) // }; // } } } if ( problem.ProblemType != null ) { conditionDto.ProblemType = new OriginalTextCodedConceptDto { Code = problem.ProblemType.CodedConceptCode, DisplayName = problem.ProblemType.Name, CodeSystem = problem.ProblemType.CodeSystemIdentifier, CodeSystemName = problem.ProblemType.CodeSystemName }; } if ( problem.ProblemCodeCodedConcept != null ) { conditionDto.ProblemName = problem.ProblemCodeCodedConcept.DisplayName; conditionDto.ProblemCode = new OriginalTextCodedConceptDto { Code = problem.ProblemCodeCodedConcept.CodedConceptCode, CodeSystem = problem.ProblemCodeCodedConcept.CodeSystemIdentifier, DisplayName = problem.ProblemCodeCodedConcept.DisplayName, CodeSystemName = problem.ProblemCodeCodedConcept.CodeSystemName }; } //TODO: Provider problem.ClinicalCase.PerformedByStaff //conditionDto.Provider = new ProviderDto() { ProviderId = new IIDataTransferObject() { Root = "npi", Extension = "npi-extension" } }; //TODO: We don't have Age At Onset //conditionDto.AgeAtOnset = 100; //conditionDto.CauseOfDeath = new CauseOfDeathDto() //{ // ProblemCode = new CodedConceptDataTransferObject() { Code = "195967001", CodeSystem = "2.16.840.1.113883.6.96", DisplayName = "Asthma", CodeSystemName = "SNOMED-CT" }, // TimeOfDeath = new ValueDataTransferObject() { Value = "20101010" }, // AgeAtDeath = 100 //}; if ( problem.ProblemStatus != null ) { conditionDto.ProblemStatus = new OriginalTextCodedConceptDto { Code = problem.ProblemStatus.CodedConceptCode, CodeSystem = problem.ProblemStatus.CodeSystemIdentifier, CodeSystemName = problem.ProblemStatus.CodeSystemName, DisplayName = problem.ProblemStatus.Name }; } if ( dto.Body.Conditions == null ) { dto.Body.Conditions = new List<ConditionDto> (); } dto.Body.Conditions.Add ( conditionDto ); }