use of org.openmrs.api.EncounterService in project openmrs-core by openmrs.
the class ORUR01HandlerTest method processMessage_shouldNotCreateProblemListObservationWithConceptProposals.
/**
* Tests that a ConceptProposal row can be written by the processor
*
* @see ORUR01Handler#processMessage(Message)
*/
@Test
public void processMessage_shouldNotCreateProblemListObservationWithConceptProposals() throws Exception {
ObsService obsService = Context.getObsService();
ConceptService conceptService = Context.getConceptService();
EncounterService encService = Context.getEncounterService();
String hl7String = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080630094800||ORU^R01|kgWdFt0SVwwClOfJm3pe|P|2.5|1||||||||15^AMRS.ELD.FORMID\r" + "PID|||3^^^^~d3811480^^^^||John3^Doe^||\r" + "PV1||O|1^Unknown||||1^Super User (admin)|||||||||||||||||||||||||||||||||||||20080208|||||||V\r" + "ORC|RE||||||||20080208000000|1^Super User\r" + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r" + "OBR|1|||1284^PROBLEM LIST^99DCT\r" + "OBX|1|CWE|6042^PROBLEM ADDED^99DCT||PROPOSED^SEVERO DOLOR DE CABEZA^99DCT|||||||||20080208";
Message hl7message = parser.parse(hl7String);
router.processMessage(hl7message);
Patient patient = new Patient(3);
// check for any obs
assertEquals("There should not be any obs created for #3", 0, obsService.getObservationsByPerson(patient).size());
// check for a new encounter
assertEquals("There should be 1 new encounter created for #3", 1, encService.getEncountersByPatient(patient).size());
// check for the proposed concept
List<ConceptProposal> proposedConcepts = conceptService.getConceptProposals("SEVERO DOLOR DE CABEZA");
assertEquals("There should be a proposed concept by this name", 1, proposedConcepts.size());
assertEquals(encService.getEncountersByPatient(patient).get(0), proposedConcepts.get(0).getEncounter());
}
Aggregations