private void mergeGenderInformation(Patient preferred, Patient notPreferred, PersonMergeLogData mergedData) { // move all other patient info mergedData.setPriorGender(preferred.getGender()); if (!"M".equals(preferred.getGender()) && !"F".equals(preferred.getGender())) { preferred.setGender(notPreferred.getGender()); } }
patient.setGender("m"); patient.addIdentifier(new PatientIdentifier("" + (i + 1000), idType, location)); patient.addName(personName);
@Test public void savePatient_shouldUpdateAnExistingPatient() throws Exception { Patient patient = patientService.getPatient(2); // just some sanity checks assertNotNull("There should be a patient with patient_id of 2", patient); assertTrue("The patient should be listed as male", patient.getGender().equals("M")); patient.setGender("F"); patientService.savePatient(patient); Patient patient2 = patientService.getPatient(patient.getPatientId()); assertTrue("The updated patient and the orig patient should still be equal", patient.equals(patient2)); assertTrue("The gender should be new", patient2.getGender().equals("F")); }
throw new HL7Exception("Unrecognized gender: " + gender); patient.setGender(gender);
/** * @see PatientService#mergePatients(Patient,Patient) */ @Test public void mergePatients_shouldAuditPriorGender() throws Exception { //retrieve preferred patient and set gender Patient preferred = patientService.getPatient(999); preferred.setGender("M"); preferred.addName(new PersonName("givenName", "middleName", "familyName")); patientService.savePatient(preferred); //merge with not preferred Patient notPreferred = patientService.getPatient(7); voidOrders(Collections.singleton(notPreferred)); PersonMergeLog audit = mergeAndRetrieveAudit(preferred, notPreferred); Assert.assertEquals("prior gender was not audited", "M", audit.getPersonMergeLogData().getPriorGender()); }
patient.setDeathDate(new Date()); patient.setCauseOfDeath(new Concept(1)); patient.setGender("male"); List<PatientIdentifierType> patientIdTypes = ps.getAllPatientIdentifierTypes(); assertNotNull(patientIdTypes);
patient.setDeathDate(new Date()); patient.setCauseOfDeath(new Concept()); patient.setGender("male"); patient.setDeathdateEstimated(true);
preferred.setGender(notPreferred.getGender());
pName.setFamilyName("Patient"); patient.addName(pName); patient.setGender("male"); PersonAddress pAddress = new PersonAddress(); pAddress.setAddress1("123 My street");
/** * Regression test for ticket #1375: org.hibernate.NonUniqueObjectException caused by * PatientIdentifierValidator Manually construct a patient with a correctly-matching patientId * and patient identifier with validator. Calling PatientService.savePatient on that patient * leads to a call to PatientIdentifierValidator.validateIdentifier which used to load the * Patient for that identifier into the hibernate session, leading to a NonUniqueObjectException * when the calling saveOrUpdate on the manually constructed Patient. * * @see PatientService#savePatient(Patient) */ @Test public void savePatient_shouldNotThrowANonUniqueObjectExceptionWhenCalledWithAHandConstructedPatientRegression1375() { Patient patient = new Patient(); patient.setGender("M"); patient.setPatientId(2); patient.addName(new PersonName("This", "Isa", "Test")); PatientIdentifier patientIdentifier = new PatientIdentifier("101-6", new PatientIdentifierType(1), new Location(1)); patientIdentifier.setPreferred(true); patient.addIdentifier(patientIdentifier); patientService.savePatient(patient); }
pName.setFamilyName("Patient"); patient.addName(pName); patient.setGender("male"); PersonAddress pAddress = new PersonAddress(); pAddress.setAddress1("123 My street");
/** * Regression test for http://dev.openmrs.org/ticket/1375 * * @see PatientService#savePatient(Patient) */ @Test public void savePatient_shouldNotThrowANonUniqueObjectExceptionWhenCalledWithAHandConstructedPatient() throws Exception { Patient patient = new Patient(); patient.setGender("M"); patient.setPatientId(2); // patient.setCreator(new User(1)); // patient.setDateCreated date_created="2005-09-22 00:00:00.0" // changed_by="1" date_changed="2008-08-18 12:29:59.0" patient.addName(new PersonName("This", "Isa", "Test")); PatientIdentifier patientIdentifier = new PatientIdentifier("101-6", new PatientIdentifierType(1), new Location(1)); patientIdentifier.setPreferred(true); patient.addIdentifier(patientIdentifier); Context.getPatientService().savePatient(patient); }
patient.setDeathDate(new Date()); patient.setCauseOfDeath(new Concept()); patient.setGender("male");
pName.setFamilyName("Patient"); patient.addName(pName); patient.setGender("male"); PersonAddress pAddress = new PersonAddress(); pAddress.setAddress1("123 My street");
/** * @see PatientService#savePatient(Patient) */ @Test public void savePatient_shouldSetThePreferredNameAddressAndIdentifierIfNoneIsSpecified() throws Exception { Patient patient = new Patient(); patient.setGender("M"); PatientIdentifier identifier = new PatientIdentifier("QWERTY", patientService.getPatientIdentifierType(2), locationService.getLocation(1)); patient.addIdentifier(identifier); PersonName name = new PersonName("givenName", "middleName", "familyName"); patient.addName(name); PersonAddress address = new PersonAddress(); address.setAddress1("some address"); patient.addAddress(address); Context.getPatientService().savePatient(patient); Assert.assertTrue(identifier.getPreferred()); Assert.assertTrue(name.getPreferred()); Assert.assertTrue(address.getPreferred()); }
public void savePatient_shouldNotSetThePreferredNameAddressAndIdentifierIfTheyAlreadyExist() throws Exception { Patient patient = new Patient(); patient.setGender("M"); PatientIdentifier identifier = new PatientIdentifier("QWERTY", patientService.getPatientIdentifierType(5), locationService.getLocation(1));
public void savePatient_shouldNotSetAVoidedNameOrAddressOrIdentifierAsPreferred() throws Exception { Patient patient = new Patient(); patient.setGender("M"); PatientIdentifier identifier = new PatientIdentifier("QWERTY", patientService.getPatientIdentifierType(2), locationService.getLocation(1));
demo.setGender("F"); demo.setUuid("testing-html-form-entry");
public Patient buildOpenMrsPatient(MRSPatient patient, PatientIdentifierType patientIdentifierType, Location location, List<PersonAttributeType> allPersonAttributeTypes) { final Patient openMRSPatient = new Patient(createPersonWithNames(patient)); openMRSPatient.addIdentifier(new PatientIdentifier(patient.getMotechId(), patientIdentifierType, location)); openMRSPatient.setGender(patient.getPerson().getGender()); openMRSPatient.setBirthdate(patient.getPerson().getDateOfBirth().toDate()); openMRSPatient.setBirthdateEstimated(patient.getPerson().getBirthDateEstimated()); openMRSPatient.setDead(patient.getPerson().isDead()); if (patient.getPerson().getDeathDate() != null) { openMRSPatient.setDeathDate(patient.getPerson().getDeathDate().toDate()); } setPatientAddress(openMRSPatient, patient.getPerson().getAddress()); setPersonAttributes(patient, openMRSPatient, allPersonAttributeTypes); return openMRSPatient; }
openMrsPatient.setBirthdate(person.getDateOfBirth().toDate()); openMrsPatient.setBirthdateEstimated(person.getBirthDateEstimated()); openMrsPatient.setGender(person.getGender());