Exemplo n.º 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
		}
Exemplo n.º 2
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);
					}
				}
			}
        }