use of ca.uhn.hl7v2.model.v25.datatype.DT in project openmrs-core by openmrs.
the class HL7ServiceTest method getUuidFromIdentifiers_shouldNotFailIfMultipleSimilarUUIDsExistInIdentifiers.
/**
* @throws HL7Exception
* @see HL7Service#getUuidFromIdentifiers(null)
*/
@Test
public void getUuidFromIdentifiers_shouldNotFailIfMultipleSimilarUUIDsExistInIdentifiers() throws HL7Exception {
HL7Service hl7service = Context.getHL7Service();
Message message = hl7service.parseHL7String("MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080226102656||ORU^R01|JqnfhKKtouEz8kzTk6Zo|P|2.5|1||||||||16^AMRS.ELD.FORMID\r" + "PID|||3^^^^||John3^Doe^||\r" + "NK1|1|Hornblower^Horatio^L|2B^Sibling^99REL||||||||||||M|19410501|||||||||||||||||2178037d-f86b-4f12-8d8b-be3ebc220022^^^UUID^v4~2178037d-f86b-4f12-8d8b-be3ebc220022^^^UUID^v4||||\r" + "PV1||O|1^Unknown Location||||1^Super User (1-8)|||||||||||||||||||||||||||||||||||||20080212|||||||V\r" + "ORC|RE||||||||20080226102537|1^Super User\r" + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r" + "OBX|1|NM|5497^CD4, BY FACS^99DCT||450|||||||||20080206\r" + "OBX|2|DT|5096^RETURN VISIT DATE^99DCT||20080229|||||||||20080212");
ORU_R01 oru = (ORU_R01) message;
List<NK1> nk1List = new ORUR01Handler().getNK1List(oru);
CX[] identifiers = nk1List.get(0).getNextOfKinAssociatedPartySIdentifiers();
String result = hl7service.getUuidFromIdentifiers(identifiers);
Assert.assertEquals("2178037d-f86b-4f12-8d8b-be3ebc220022", result);
}
use of ca.uhn.hl7v2.model.v25.datatype.DT in project openmrs-core by openmrs.
the class ORUR01HandlerTest method processMessage_shouldCreateEncounterAndObsFromHl7Message.
/**
* @see ORUR01Handler#processMessage(Message)
*/
@Test
public void processMessage_shouldCreateEncounterAndObsFromHl7Message() throws Exception {
ObsService obsService = Context.getObsService();
String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080226102656||ORU^R01|JqnfhKKtouEz8kzTk6Zo|P|2.5|1||||||||16^AMRS.ELD.FORMID\r" + "PID|||3^^^^||John3^Doe^||\r" + "PV1||O|1^Unknown Location||||1^Super User (1-8)|||||||||||||||||||||||||||||||||||||20080212|||||||V\r" + "ORC|RE||||||||20080226102537|1^Super User\r" + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r" + "OBX|1|NM|5497^CD4, BY FACS^99DCT||450|||||||||20080206\r" + "OBX|2|DT|5096^RETURN VISIT DATE^99DCT||20080229|||||||||20080212";
Message hl7message = parser.parse(hl7string);
router.processMessage(hl7message);
Patient patient = new Patient(3);
// check for an encounter
List<Encounter> encForPatient3 = Context.getEncounterService().getEncountersByPatient(patient);
assertNotNull(encForPatient3);
assertTrue("There should be an encounter created", encForPatient3.size() == 1);
// check for any obs
List<Obs> obsForPatient3 = obsService.getObservationsByPerson(patient);
assertNotNull(obsForPatient3);
assertTrue("There should be some obs created for #3", obsForPatient3.size() > 0);
// check for the return visit date obs
Concept returnVisitDateConcept = new Concept(5096);
Calendar cal = Calendar.getInstance();
cal.set(2008, Calendar.FEBRUARY, 29, 0, 0, 0);
Date returnVisitDate = cal.getTime();
List<Obs> returnVisitDateObsForPatient3 = obsService.getObservationsByPersonAndConcept(patient, returnVisitDateConcept);
assertEquals("There should be a return visit date", 1, returnVisitDateObsForPatient3.size());
Obs firstObs = (Obs) returnVisitDateObsForPatient3.toArray()[0];
cal.setTime(firstObs.getValueDatetime());
Date firstObsValueDatetime = cal.getTime();
assertEquals("The date should be the 29th", returnVisitDate.toString(), firstObsValueDatetime.toString());
}
use of ca.uhn.hl7v2.model.v25.datatype.DT in project openmrs-core by openmrs.
the class ORUR01HandlerTest method processMessage_shouldCreateBasicConceptProposal.
/**
* Should create a concept proposal because of the key string in the message
*
* @see ORUR01Handler#processMessage(Message)
*/
@Test
public void processMessage_shouldCreateBasicConceptProposal() throws Exception {
// remember initial occurrence of proposal's text in the model
int initialOccurrences = Context.getConceptService().getConceptProposals("PELVIC MASS").size();
String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20080924022306||ORU^R01|Z185fTD0YozQ5kvQZD7i|P|2.5|1||||||||3^AMRS.ELD.FORMID\r" + "PID|||7^^^^||Joe^S^Mith||\r" + "PV1||O|1^Unknown Module 2||||1^Joe (1-1)|||||||||||||||||||||||||||||||||||||20080212|||||||V\r" + "ORC|RE||||||||20080219085345|1^Joe\r" + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r" + "OBX|18|DT|5096^RETURN VISIT DATE^99DCT||20080506|||||||||20080212\r" + "OBR|19|||1284^PROBLEM LIST^99DCT\r" + "OBX|1|CWE|6042^PROBLEM ADDED^99DCT||PROPOSED^PELVIC MASS^99DCT|||||||||20080212";
Message hl7message = parser.parse(hl7string);
router.processMessage(hl7message);
// make sure that the proposal was added
Assert.assertEquals("Processing of the HL7 message did not result in the new proposal being added to the model", initialOccurrences + 1, Context.getConceptService().getConceptProposals("PELVIC MASS").size());
}
use of ca.uhn.hl7v2.model.v25.datatype.DT in project openmrs-core by openmrs.
the class ORUR01HandlerTest method processMessage_shouldCreateConceptProposalAndWithObsAlongside.
/**
* Should create a concept proposal because of the key string in the message
*
* @see ORUR01Handler#processMessage(Message)
*/
@Test
public void processMessage_shouldCreateConceptProposalAndWithObsAlongside() throws Exception {
// remember initial occurrence of proposal's text in the model
int initialOccurrences = Context.getConceptService().getConceptProposals("ASDFASDFASDF").size();
String hl7string = "MSH|^~\\&|FORMENTRY|AMRS.ELD|HL7LISTENER|AMRS.ELD|20081006115934||ORU^R01|a1NZBpKqu54QyrWBEUKf|P|2.5|1||||||||3^AMRS.ELD.FORMID\r" + "PID|||7^^^^~asdf^^^^||Joe^ ^Smith||\r" + "PV1||O|1^Bishop Muge||||1^asdf asdf (5-9)|||||||||||||||||||||||||||||||||||||20081003|||||||V\r" + "ORC|RE||||||||20081006115645|1^Super User\r" + "OBR|1|||1238^MEDICAL RECORD OBSERVATIONS^99DCT\r" + "OBX|2|DT|5096^RETURN VISIT DATE^99DCT||20081004|||||||||20081003\r" + "OBR|3|||1284^PROBLEM LIST^99DCT\r" + "OBX|2|CWE|6042^PROBLEM ADDED^99DCT||PROPOSED^ASDFASDFASDF^99DCT|||||||||20081003";
Message hl7message = parser.parse(hl7string);
router.processMessage(hl7message);
// make sure that the proposal was added
Assert.assertEquals("Processing of the HL7 message did not result in the new proposal being added to the model", initialOccurrences + 1, Context.getConceptService().getConceptProposals("ASDFASDFASDF").size());
}
Aggregations