예제 #1
0
        /// <summary>
        /// All pertinent data other than the Profiles gets copied from otherPatient to thisPatient
        /// </summary>
        /// <param name="thisPatient"></param>
        /// <param name="otherPatient"></param>
        /// <param name="context"></param>
        static private void ReconnectRelatedPatientInformation(Patient thisPatient, Patient otherPatient, IPersistenceContext context)
        {
            foreach (PatientNote note in otherPatient.Notes)
            {
                thisPatient.AddNote(note);
            }

            OrderSearchCriteria orderCriteria = new OrderSearchCriteria();

            orderCriteria.Patient.EqualTo(otherPatient);
            IList <Order> otherOrders = context.GetBroker <IOrderBroker>().Find(orderCriteria);

            foreach (Order order in otherOrders)
            {
                order.Patient = thisPatient;
            }

            VisitSearchCriteria visitCriteria = new VisitSearchCriteria();

            visitCriteria.Patient.EqualTo(otherPatient);
            IList <Visit> otherVisits = context.GetBroker <IVisitBroker>().Find(visitCriteria);

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

            // TODO: delete the otherPatient
        }
예제 #2
0
파일: Operation.cs 프로젝트: nhannd/Xian
			/// <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;
				}
			}
예제 #3
0
        public void Synchronize(Patient patient, ICollection <PatientNoteDetail> sourceList, Staff newNoteAuthor, IPersistenceContext context)
        {
            foreach (PatientNoteDetail noteDetail in sourceList)
            {
                if (noteDetail.PatientNoteRef == null)
                {
                    patient.AddNote(CreateNote(noteDetail, newNoteAuthor, context));
                }
                else
                {
                    PatientNote note = CollectionUtils.SelectFirst(patient.Notes,
                                                                   delegate(PatientNote n) { return(n.GetRef().Equals(noteDetail.PatientNoteRef, true)); });

                    if (note != null)
                    {
                        UpdateNote(note, noteDetail);
                    }
                }
            }
        }
예제 #4
0
파일: Operation.cs 프로젝트: hksonngan/Xian
            /// <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;
                }
            }