public LoadPatientProfileEditorFormDataResponse LoadPatientProfileEditorFormData(LoadPatientProfileEditorFormDataRequest request) { var workflowConfig = new WorkflowConfigurationReader(); // ignore request // Sort the category from High to Low, then sort by name var categoryAssembler = new PatientNoteCategoryAssembler(); IList<PatientNoteCategory> sortedCategoryList = CollectionUtils.Sort( PersistenceContext.GetBroker<IPatientNoteCategoryBroker>().FindAll(false), (x, y) => string.Compare(x.Name, y.Name)); var response = new LoadPatientProfileEditorFormDataResponse { MrnAutoGenerated = workflowConfig.AutoGenerateMrn, AddressTypeChoices = EnumUtils.GetEnumValueList<AddressTypeEnum>(PersistenceContext), ContactPersonRelationshipChoices = EnumUtils.GetEnumValueList<ContactPersonRelationshipEnum>(PersistenceContext), ContactPersonTypeChoices = EnumUtils.GetEnumValueList<ContactPersonTypeEnum>(PersistenceContext), HealthcardAssigningAuthorityChoices = EnumUtils.GetEnumValueList<InsuranceAuthorityEnum>(PersistenceContext), MrnAssigningAuthorityChoices = EnumUtils.GetEnumValueList<InformationAuthorityEnum>(PersistenceContext), PrimaryLanguageChoices = EnumUtils.GetEnumValueList<SpokenLanguageEnum>(PersistenceContext), ReligionChoices = EnumUtils.GetEnumValueList<ReligionEnum>(PersistenceContext), SexChoices = EnumUtils.GetEnumValueList<SexEnum>(PersistenceContext), PhoneTypeChoices = (new SimplifiedPhoneTypeAssembler()).GetPatientPhoneTypeChoices(), NoteCategoryChoices = CollectionUtils.Map<PatientNoteCategory, PatientNoteCategorySummary, List<PatientNoteCategorySummary>>(sortedCategoryList, category => categoryAssembler.CreateNoteCategorySummary(category, this.PersistenceContext)), // Allergies related choices AllergenTypeChoices = EnumUtils.GetEnumValueList<AllergyAllergenTypeEnum>(PersistenceContext), AllergySeverityChoices = EnumUtils.GetEnumValueList<AllergySeverityEnum>(PersistenceContext), AllergySensitivityTypeChoices = EnumUtils.GetEnumValueList<AllergySensitivityTypeEnum>(PersistenceContext), PersonRelationshipTypeChoices = EnumUtils.GetEnumValueList<PersonRelationshipTypeEnum>(PersistenceContext) }; return response; }
private GetVisitDetailResponse GetVisitDetail(GetVisitDetailRequest request) { // hide visits if "visit workflow" is disabled var workflowConfig = new WorkflowConfigurationReader(); if (!workflowConfig.EnableVisitWorkflow) return null; var visit = this.PersistenceContext.Load<Visit>(request.VisitRef, EntityLoadFlags.Proxy); var assembler = new VisitAssembler(); var detail = assembler.CreateVisitDetail(visit, this.PersistenceContext); return new GetVisitDetailResponse(detail); }
private ListVisitsResponse ListVisits(ListVisitsRequest request) { // hide visits if "visit workflow" is disabled var workflowConfig = new WorkflowConfigurationReader(); if(!workflowConfig.EnableVisitWorkflow) return null; var browsePatientDataAssembler = new BrowsePatientDataAssembler(); var patient = this.PersistenceContext.Load<Patient>(request.PatientRef, EntityLoadFlags.Proxy); var where = new VisitSearchCriteria(); where.Patient.EqualTo(patient); var visits = this.PersistenceContext.GetBroker<IVisitBroker>().Find(where); return new ListVisitsResponse( CollectionUtils.Map<Visit, VisitListItem>( visits, v => browsePatientDataAssembler.CreateVisitListItem(v, this.PersistenceContext))); }
public AddPatientResponse AddPatient(AddPatientRequest request) { var profile = new PatientProfile(); // check if we should auto-generate the MRN var workflowConfig = new WorkflowConfigurationReader(); if (workflowConfig.AutoGenerateMrn) { var authorities = PersistenceContext.GetBroker<IEnumBroker>().Load<InformationAuthorityEnum>(false); // just use the first Information Authority (there is typically only one in this case) profile.Mrn.AssigningAuthority = CollectionUtils.FirstElement(authorities); profile.Mrn.Id = PersistenceContext.GetBroker<IMrnBroker>().GetNext(); } var patient = new Patient(); patient.AddProfile(profile); UpdateHelper(profile, request.PatientDetail, true, true, !workflowConfig.AutoGenerateMrn); PersistenceContext.Lock(patient, DirtyState.New); LogicalHL7Event.PatientCreated.EnqueueEvents(profile); PersistenceContext.SynchState(); var assembler = new PatientProfileAssembler(); return new AddPatientResponse(assembler.CreatePatientProfileSummary(profile, PersistenceContext)); }
private void CheckMultipleInformationAuthoritiesUsed() { var workflowConfig = new WorkflowConfigurationReader(); // if we're not generating the MRNs, then this doesn't apply if (!workflowConfig.AutoGenerateMrn) return; var iaInUse = PersistenceContext.GetBroker<IFacilityBroker>().FindAll(false) .Select(f => f.InformationAuthority) .Distinct() .Count(); if(iaInUse > 1) throw new RequestValidationException(SR.MessageMultipleInformationAuthoritiesNotSupported); }
public static List<Type> ListClassesHelper(List<string> classNames, List<string> categories, bool includeStatic) { var worklistClasses = (IEnumerable<Type>)WorklistFactory.Instance.ListWorklistClasses(true); // optionally filter classes by class name if (classNames != null && classNames.Count > 0) { worklistClasses = worklistClasses.Where(t => classNames.Contains(Worklist.GetClassName(t))); } // optionally filter classes by category if (categories != null && categories.Count > 0) { worklistClasses = worklistClasses.Where(t => categories.Contains(Worklist.GetCategory(t))); } // optionally exclude static if (!includeStatic) { worklistClasses = worklistClasses.Where(t => !Worklist.GetIsStatic(t)); } // manually exclude some classes based on workflow settings var workflowConfig = new WorkflowConfigurationReader(); if (!workflowConfig.EnableInterpretationReviewWorkflow) { worklistClasses = worklistClasses.Where(t => !_interpretationReviewClasses.Contains(Worklist.GetClassName(t))); } if (!workflowConfig.EnableTranscriptionReviewWorkflow) { worklistClasses = worklistClasses.Where(t => !_transcriptionReviewClasses.Contains(Worklist.GetClassName(t))); } return worklistClasses.ToList(); }