Пример #1
0
            /// <summary>
            /// Reconciles the specified patient to this patient
            /// </summary>
            /// <param name="thisPatient"></param>
            /// <param name="otherPatient"></param>
            /// <param name="workflow"></param>
            private static void Reconcile(Patient thisPatient, Patient otherPatient, IWorkflow workflow)
            {
                if (PatientIdentifierConflictsFound(thisPatient, otherPatient))
                {
                    throw new PatientReconciliationException("assigning authority conflict - cannot reconcile");
                }

                // copy the collection to iterate
                var otherProfiles = new List <PatientProfile>(otherPatient.Profiles);

                foreach (var profile in otherProfiles)
                {
                    thisPatient.AddProfile(profile);
                }

                // copy the collection to iterate
                var otherNotes = new List <PatientNote>(otherPatient.Notes);

                foreach (var note in otherNotes)
                {
                    thisPatient.AddNote(note);
                }

                // copy the collection to iterate
                var otherAttachments = new List <PatientAttachment>(otherPatient.Attachments);

                foreach (var attachment in otherAttachments)
                {
                    otherPatient.Attachments.Remove(attachment);
                    thisPatient.Attachments.Add(attachment);
                }

                // copy the collection to iterate
                var otherAllergies = new List <Allergy>(otherPatient.Allergies);

                foreach (var allergy in otherAllergies)
                {
                    otherPatient.Allergies.Remove(allergy);
                    thisPatient.Allergies.Add(allergy);
                }

                var visitCriteria = new VisitSearchCriteria();

                visitCriteria.Patient.EqualTo(otherPatient);
                var otherVisits = workflow.GetBroker <IVisitBroker>().Find(visitCriteria);

                foreach (var visit in otherVisits)
                {
                    visit.Patient = thisPatient;
                }

                var orderCriteria = new OrderSearchCriteria();

                orderCriteria.Patient.EqualTo(otherPatient);
                var otherOrders = workflow.GetBroker <IOrderBroker>().Find(orderCriteria);

                foreach (var order in otherOrders)
                {
                    order.Patient = thisPatient;
                }
            }
Пример #2
0
			/// <summary>
			/// Reconciles the specified patient to this patient
			/// </summary>
			/// <param name="thisPatient"></param>
			/// <param name="otherPatient"></param>
			/// <param name="workflow"></param>
			private static void Reconcile(Patient thisPatient, Patient otherPatient, IWorkflow workflow)
			{
				if (PatientIdentifierConflictsFound(thisPatient, otherPatient))
					throw new PatientReconciliationException("assigning authority conflict - cannot reconcile");

				// copy the collection to iterate
				var otherProfiles = new List<PatientProfile>(otherPatient.Profiles);
				foreach (var profile in otherProfiles)
				{
					thisPatient.AddProfile(profile);
				}

				// copy the collection to iterate
				var otherNotes = new List<PatientNote>(otherPatient.Notes);
				foreach (var note in otherNotes)
				{
					thisPatient.AddNote(note);
				}

				// copy the collection to iterate
				var otherAttachments = new List<PatientAttachment>(otherPatient.Attachments);
				foreach (var attachment in otherAttachments)
				{
					otherPatient.Attachments.Remove(attachment);
					thisPatient.Attachments.Add(attachment);
				}

				// copy the collection to iterate
				var otherAllergies = new List<Allergy>(otherPatient.Allergies);
				foreach (var allergy in otherAllergies)
				{
					otherPatient.Allergies.Remove(allergy);
					thisPatient.Allergies.Add(allergy);
				}

				var visitCriteria = new VisitSearchCriteria();
				visitCriteria.Patient.EqualTo(otherPatient);
				var otherVisits = workflow.GetBroker<IVisitBroker>().Find(visitCriteria);
				foreach (var visit in otherVisits)
				{
					visit.Patient = thisPatient;
				}

				var orderCriteria = new OrderSearchCriteria();
				orderCriteria.Patient.EqualTo(otherPatient);
				var otherOrders = workflow.GetBroker<IOrderBroker>().Find(orderCriteria);
				foreach (var order in otherOrders)
				{
					order.Patient = thisPatient;
				}
			}