/** * Creates an obsgroup and adds it to the specified encounter. The obsDetails arguements should be triplets of conceptId, concept * value, and date created. * * @param encounter * @param groupingConceptId * @param date * @param obsDetails * @return */ public static Obs addObsGroup(Encounter encounter, Integer groupingConceptId, Date date, Object... obsDetails) { Obs obsgroup = addObs(encounter, groupingConceptId, null, date); int i = 0; while (i < obsDetails.length) { obsgroup.addGroupMember(addObs(encounter, (Integer) obsDetails[i], obsDetails[i + 1], (Date) obsDetails[i + 2])); // skip to the next triple to the next triplet i = i + 3; } return obsgroup; }
e.setProvider(Context.getPersonService().getPerson(502)); TestUtil.addObs(e, 2474, Context.getConceptService().getConcept(656), date); TestUtil.addObs(e, 3017, Context.getConceptService().getConcept(767), date); TestUtil.addObs(e, 3032, new Date(), date); TestUtil.addObs(e, 1, 5000, date); TestUtil.addObs(e, 2, 5000, date); //not in form schema, should not be included after trimEncounter TestUtil.addObs(e, 3, 5000, date); //not in form schema, should not be included after trimEncounter TestUtil.addObs(e, 6, "blah blah", date);
@Override public Encounter getEncounterToView() throws Exception { Encounter e = new Encounter(); e.setPatient(getPatient()); Date date = Context.getDateFormat().parse("01/02/2003"); e.setDateCreated(new Date()); e.setEncounterDatetime(date); e.setLocation(Context.getLocationService().getLocation(2)); e.setProvider(Context.getPersonService().getPerson(502)); TestUtil.addObs(e, 6, "blah blah", null); return e; }
e.setProvider(Context.getPersonService().getPerson(502)); TestUtil.addObs(e, 3032, date, date); TestUtil.addObs(e, 1441, Context.getConceptService().getConcept(656), date); TestUtil.addObsGroup(e, 1004, date, 1005, Context.getConceptService().getConcept(1001), new Date()); TestUtil.addObs(e, 1119, new Date(), date); TestUtil.addObs(e, 2474, Context.getConceptService().getConcept(767), date);
@Override public Encounter getEncounterToView() throws Exception { Encounter e = new Encounter(); e.setPatient(getPatient()); Date date = Context.getDateFormat().parse("01/02/2003"); e.setDateCreated(new Date()); e.setEncounterDatetime(date); e.setLocation(Context.getLocationService().getLocation(2)); e.setProvider(Context.getPersonService().getPerson(502)); TestUtil.addObs(e, 1, 965.0, null); // this is a CD4 Count return e; }
TestUtil.addObs(e, 2474, Context.getConceptService().getConcept(656), date); //matches TestUtil.addObs(e, 3017, Context.getConceptService().getConcept(767), date); //matches TestUtil.addObs(e, 3032, new Date(), date); //matches TestUtil.addObs(e, 1, 5000, date); // matches TestUtil.addObs(e, 2, 5000, date); //not in form schema TestUtil.addObs(e, 3, 5000, date); //not in form schema TestUtil.addObs(e, 6, "blah blah", date); // matches
@Override public Encounter getEncounterToView() throws Exception { Encounter e = new Encounter(); e.setPatient(getPatient()); Date date = Context.getDateFormat().parse("01/02/2003"); e.setDateCreated(new Date()); e.setEncounterDatetime(date); e.setLocation(Context.getLocationService().getLocation(2)); e.setProvider(Context.getPersonService().getPerson(502)); TestUtil.addObs(e, 19, "2 - Xanadu", null); // this is a location return e; }
@Override public Encounter getEncounterToView() throws Exception { Encounter e = new Encounter(); e.setPatient(getPatient()); Date date = Context.getDateFormat().parse("01/02/2003"); e.setDateCreated(new Date()); e.setEncounterDatetime(date); e.setLocation(Context.getLocationService().getLocation(2)); e.setProvider(Context.getPersonService().getPerson(502)); TestUtil.addObs(e, 19, "7 - Collet Test Chebaskwony", null); return e; }
@Override public Encounter getEncounterToView() throws Exception { Encounter e = new Encounter(); e.setPatient(getPatient()); Date date = Context.getDateFormat().parse("01/02/2003"); e.setDateCreated(new Date()); e.setEncounterDatetime(date); e.setLocation(Context.getLocationService().getLocation(2)); e.setProvider(Context.getPersonService().getPerson(502)); TestUtil.addObs(e, 2, 12.3, null); // weight has conceptId 2 return e; }
@Override public Encounter getEncounterToView() throws Exception { Encounter e = new Encounter(); e.setPatient(getPatient()); Date date = Context.getDateFormat().parse("01/02/2003"); e.setDateCreated(new Date()); e.setEncounterDatetime(date); e.setLocation(Context.getLocationService().getLocation(2)); e.setProvider(Context.getPersonService().getPerson(502)); TestUtil.addObs(e, 19, "2", null); // this is a location return e; }
@Test @Verifies(value = "should return encounter with all child objects voided according to schema", method = "voidEncounterByHtmlFormSchema") public void testVoidEncounterByHtmlFormSchema_shouldReturnEncounterVoided() throws Exception { executeDataSet(XML_DATASET_PATH + new TestUtil().getTestDatasetFilename(XML_REGRESSION_TEST_DATASET)); Encounter e = new Encounter(); e.setPatient(Context.getPatientService().getPatient(2)); Date date = Context.getDateFormat().parse("01/02/2003"); e.setDateCreated(new Date()); e.setEncounterDatetime(date); e.setLocation(Context.getLocationService().getLocation(2)); e.setProvider(Context.getPersonService().getPerson(502)); //add a bunch of obs... TestUtil.addObs(e, 2474, Context.getConceptService().getConcept(656), date); //matches Form form = new Form(); HtmlForm htmlform = new HtmlForm(); htmlform.setForm(form); form.setEncounterType(new EncounterType()); htmlform.setDateChanged(new Date()); htmlform.setXmlData(new TestUtil().loadXmlFromFile(XML_DATASET_PATH + "returnSectionsAndConceptsInSectionsTestFormWithGroups.xml")); HtmlFormEntryUtil.voidEncounterByHtmlFormSchema(e, htmlform, null); //this is going to test out the voided state of the obs in the encounter after processing: Assert.assertTrue(e.isVoided()); }
e.setLocation(Context.getLocationService().getLocation(2)); e.setProvider(Context.getPersonService().getPerson(502)); TestUtil.addObs(e, 1, 5000, date); //a matching obs
e.setLocation(Context.getLocationService().getLocation(2)); e.setProvider(Context.getPersonService().getPerson(502)); TestUtil.addObs(e, 3, 5000, date);//adding an un-matched, voided Obs for (Obs o : e.getAllObs(true)) { o.setVoided(true);
e.setLocation(Context.getLocationService().getLocation(2)); e.setProvider(Context.getPersonService().getPerson(502)); TestUtil.addObs(e, 3, 5000, date);//adding an un-matched Obs