@Test public void testEstimatedBirthDate() { visitLocation.setName("Hôpital Universitaire de Mirebalais"); Patient patient = new Patient(); patient.setGender("M"); patient.setBirthdate(new DateTime(1940, 7, 7, 5, 5, 5).toDate()); patient.setBirthdateEstimated(true); PatientIdentifier primaryIdentifier = new PatientIdentifier(); primaryIdentifier.setIdentifier("ZL1234"); primaryIdentifier.setIdentifierType(primaryIdentifierType); primaryIdentifier.setVoided(false); patient.addIdentifier(primaryIdentifier); PatientIdentifier paperRecordIdentifier = new PatientIdentifier(); paperRecordIdentifier.setIdentifier("A00005"); paperRecordIdentifier.setIdentifierType(paperRecordIdentifierType); paperRecordIdentifier.setVoided(false); patient.addIdentifier(paperRecordIdentifier); PersonName name = new PersonName(); name.setGivenName("Ringo"); name.setFamilyName("Starr"); patient.addName(name); String output = wristbandTemplate.generateWristband(patient, new Location()); assertThat(output, containsString("^FO160,200^FB2150,1,0,L,0^AU^FD1940^FS")); }
@RequestMapping("/module/hirifxray/createParticipant.form") public String createParticipant( ModelMap model, @RequestParam(value = "identifier", required = true) String identifier, @RequestParam(value = "gender", required = true) String gender) throws Exception { Patient p = new Patient(); PersonName pn = new PersonName(); pn.setGivenName("XXXX"); pn.setFamilyName("XXXX"); p.addName(pn); p.setGender(gender); DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); p.setBirthdate(df.parse("1900-01-01")); PatientIdentifier pi = new PatientIdentifier(); pi.setPatient(p); pi.setLocation(HirifMetadata.getUnknownLocation()); pi.setIdentifierType(HirifMetadata.getIdentifierType()); pi.setIdentifier(identifier); p.addIdentifier(pi); p = Context.getPatientService().savePatient(p); return "redirect:/module/hirifxray/participant.form?id=" + p.getPatientId(); }
@Test public void testWristBandTemplate() { Date today = new Date(); visitLocation.setName("Hôpital Universitaire de Mirebalais"); Patient patient = new Patient(); patient.setGender("M"); patient.setBirthdate(new DateTime(1940, 7, 7, 5, 5, 5).toDate()); PatientIdentifier primaryIdentifier = new PatientIdentifier(); primaryIdentifier.setIdentifier("ZL1234"); primaryIdentifier.setIdentifierType(primaryIdentifierType); primaryIdentifier.setVoided(false); patient.addIdentifier(primaryIdentifier); PatientIdentifier paperRecordIdentifier = new PatientIdentifier(); paperRecordIdentifier.setIdentifier("A000005"); paperRecordIdentifier.setIdentifierType(paperRecordIdentifierType); paperRecordIdentifier.setVoided(false); paperRecordIdentifier.setLocation(visitLocation); patient.addIdentifier(paperRecordIdentifier); PersonAddress address = new PersonAddress(); address.setAddress2("Avant Eglise Chretienne des perlerlerin de la siant tete de moliere"); address.setAddress1("Saut D'Eau"); address.setAddress3("1ere Riviere Canot"); address.setCityVillage("Saut d'Eau"); address.setStateProvince("Centre"); patient.addAddress(address); PersonName name = new PersonName(); name.setGivenName("Ringo"); name.setFamilyName("Starr"); patient.addName(name); when(messageSourceService.getMessage( "coreapps.ageYears", Collections.singletonList(patient.getAge()).toArray(), locale)) .thenReturn("75 an(s)"); String output = wristbandTemplate.generateWristband(patient, visitLocation); assertThat(output, containsString("^XA^CI28^MTD^FWB")); assertThat( output, containsString( "^FO050,200^FB2150,1,0,L,0^AS^FDHôpital Universitaire de Mirebalais " + df.format(today) + "^FS")); assertThat(output, containsString("^FO100,200^FB2150,1,0,L,0^AU^FDRingo Starr^FS")); assertThat(output, containsString("^FO160,200^FB2150,1,0,L,0^AU^FD07 juil. 1940^FS")); assertThat( output, containsString("^FO160,200^FB1850,1,0,L,0^AT^FD" + patient.getAge() + " an(s)^FS")); assertThat(output, containsString("^FO160,200^FB1650,1,0,L,0^AU^FDMasculin A 000005^FS")); assertThat( output, containsString( "^FO220,200^FB2150,1,0,L,0^AS^FDAvant Eglise Chretienne des perlerlerin de la siant tete de moliere^FS")); assertThat( output, containsString( "^FO270,200^FB2150,1,0,L,0^AS^FDSaut D'Eau, 1ere Riviere Canot, Saut d'Eau, Centre^FS")); assertThat(output, containsString("^FO100,2400^AT^BY4^BC,150,N^FDZL1234^XZ")); }