本文整理汇总了Java中ca.uhn.hl7v2.model.DataTypeException类的典型用法代码示例。如果您正苦于以下问题:Java DataTypeException类的具体用法?Java DataTypeException怎么用?Java DataTypeException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataTypeException类属于ca.uhn.hl7v2.model包,在下文中一共展示了DataTypeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCalendarFromDT
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
private static GregorianCalendar getCalendarFromDT(DT dt) throws DataTypeException {
// hl7/hapi returns 0 for no date
if (dt.getYear() == 0 || dt.getMonth() == 0 || dt.getDay() == 0) return (null);
GregorianCalendar cal = new GregorianCalendar();
// zero out fields we don't use
cal.setTimeInMillis(0);
cal.set(GregorianCalendar.YEAR, dt.getYear());
cal.set(GregorianCalendar.MONTH, dt.getMonth() - 1);
cal.set(GregorianCalendar.DAY_OF_MONTH, dt.getDay());
// force materialisation of values
cal.getTimeInMillis();
return (cal);
}
示例2: getCalendarFromDTM
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
public static GregorianCalendar getCalendarFromDTM(DTM dtm) throws DataTypeException {
// hl7/hapi returns 0 for no date
if (dtm.getYear() == 0 || dtm.getMonth() == 0 || dtm.getDay() == 0) return (null);
GregorianCalendar cal = new GregorianCalendar();
// zero out fields we don't use
cal.setTimeInMillis(0);
cal.set(GregorianCalendar.YEAR, dtm.getYear());
cal.set(GregorianCalendar.MONTH, dtm.getMonth() - 1);
cal.set(GregorianCalendar.DAY_OF_MONTH, dtm.getDay());
cal.set(GregorianCalendar.HOUR_OF_DAY, dtm.getHour());
cal.set(GregorianCalendar.MINUTE, dtm.getMinute());
cal.set(GregorianCalendar.SECOND, dtm.getSecond());
// force materialisation of values
cal.getTimeInMillis();
return (cal);
}
示例3: fillMsh
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
/**
* @param msh
* @param dateOfMessage
* @param clinicName
* @param messageCode i.e. "REF"
* @param triggerEvent i.e. "I12"
* @param messageStructure i.e. "REF_I12"
* @param hl7VersionId is the version of hl7 in use, i.e. "2.6"
*/
public static void fillMsh(MSH msh, Date dateOfMessage, String clinicName, String messageCode, String triggerEvent, String messageStructure, String hl7VersionId) throws DataTypeException {
msh.getFieldSeparator().setValue("|");
msh.getEncodingCharacters().setValue("^~\\&");
msh.getVersionID().getVersionID().setValue(hl7VersionId);
msh.getDateTimeOfMessage().setValue(getAsHl7FormattedString(dateOfMessage));
msh.getSendingApplication().getNamespaceID().setValue("OSCAR");
msh.getSendingFacility().getNamespaceID().setValue(clinicName);
// message code "REF", event "I12", structure "REF I12"
msh.getMessageType().getMessageCode().setValue(messageCode);
msh.getMessageType().getTriggerEvent().setValue(triggerEvent);
msh.getMessageType().getMessageStructure().setValue(messageStructure);
}
示例4: fillPrd
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
/**
* @param prd
* @param provider
* @param providerRoleId Note that this is not the oscar provider role, look in the method to see valid values
* @param providerRoleDescription Note that this is not the oscar provider role, look in the method to see valid values
*/
public static void fillPrd(PRD prd, Provider provider, String providerRoleId, String providerRoleDescription, Clinic clinic) throws DataTypeException, HL7Exception {
// Value Description
// -----------------
// RP Referring Provider
// PP Primary Care Provider
// CP Consulting Provider
// RT Referred to Provider
prd.getProviderRole(0).getIdentifier().setValue(providerRoleId);
prd.getProviderRole(0).getText().setValue(providerRoleDescription);
XPN xpn = prd.getProviderName(0);
xpn.getFamilyName().getSurname().setValue(provider.getLastName());
xpn.getGivenName().setValue(provider.getFirstName());
xpn.getPrefixEgDR().setValue(provider.getTitle());
XAD xad = prd.getProviderAddress(0);
fillXAD(xad, clinic, null, "O");
XTN xtn = prd.getProviderCommunicationInformation(0);
xtn.getUnformattedTelephoneNumber().setValue(provider.getWorkPhone());
xtn.getCommunicationAddress().setValue(provider.getEmail());
PLN pln = prd.getProviderIdentifiers(0);
pln.getIDNumber().setValue(provider.getProviderNo());
}
示例5: testUnmarshalFailed
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
@Test
public void testUnmarshalFailed() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:unmarshal");
mock.expectedMessageCount(0);
String body = createHL7AsString();
try {
template.sendBody("direct:unmarshalFailed", body);
fail("Should have thrown exception");
} catch (CamelExecutionException e) {
assertIsInstanceOf(HL7Exception.class, e.getCause());
assertIsInstanceOf(DataTypeException.class, e.getCause());
assertTrue("Should be a validation error message", e.getCause().getMessage().startsWith("ca.uhn.hl7v2.validation.ValidationException: Validation failed:"));
}
assertMockEndpointsSatisfied();
}
示例6: renderMemberOfStaffShortVoToXCNNatCode
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
protected final void renderMemberOfStaffShortVoToXCNNatCode(MemberOfStaffShortVo mos, XCN xcn,ProviderSystemVo providerSystem) throws DataTypeException
{
LOG.debug("VoMapper renderMemberOfStaffShortVoToXCNNatCode: entry");
if(mos!=null&&mos.getNameIsNotNull()&&mos.getName().getForenameIsNotNull())
xcn.getGivenName().setValue(mos.getName().getForename());
if(mos!=null&&mos.getNameIsNotNull()&&mos.getName().getSurnameIsNotNull())
xcn.getFamilyName().getSurname().setValue(mos.getName().getSurname());
if(mos!=null&&mos.getNationalConsCode()!=null)
{
xcn.getIDNumber().setValue(mos.getNationalConsCode());
}
else if(mos!=null)
{
TaxonomyMap mapping = mos.getExternalCode(providerSystem.getCodeSystem());
if (mapping != null)
{
xcn.getIDNumber().setValue(mapping.getTaxonomyCode());
}
}
LOG.debug("VoMapper renderMemberOfStaffShortVoToXCNNatCode: exit");
}
示例7: renderGpShortVoToXCN
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
protected final void renderGpShortVoToXCN(GpShortVo gp,XCN xcn,ProviderSystemVo providerSystem) throws DataTypeException
{
LOG.debug("VoMapper renderGpShortVoToXCN: entry");
if(gp!=null&&gp.getNameIsNotNull()&&gp.getName().getForenameIsNotNull())
xcn.getGivenName().setValue(gp.getName().getForename());
if(gp!=null&&gp.getNameIsNotNull()&&gp.getName().getSurnameIsNotNull())
xcn.getFamilyName().getSurname().setValue(gp.getName().getSurname());
TaxonomyMap mapping = null;
if (gp!=null)
mapping = gp.getExternalCode(TaxonomyType.NAT_GP_CODE);
if(mapping!=null)
{
xcn.getIDNumber().setValue(mapping.getTaxonomyCode());
}
if(gp!=null&&gp.getNameIsNotNull()&&gp.getName().getTitleIsNotNull())
xcn.getPrefixEgDR().setValue(svc.getRemoteLookup(gp.getName().getTitle().getID(), providerSystem.getCodeSystem().getText()));
LOG.debug("VoMapper renderGpShortVoToXCN: exit");
}
示例8: getCareContextFromPV1
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
public CareContextRefVo getCareContextFromPV1(PV1 pv) throws DataTypeException
{
String visitId=pv.getVisitNumber().getID().getValue() + "_" + pv.getVisitNumber().getComponent(1);
String pasEpisodeId = pv.getAlternateVisitID().getID().getValue();
CareContextInterfaceVo careContext;
if (pasEpisodeId!=null)
{
careContext=careSpellDialog.getCareContextFromPasEpisodeId(pasEpisodeId,visitId);
if (careContext!=null)
{
if (careContext.getEpisodeOfCare()!=null)
{
setCareContextContext(careContext.getID_CareContext(),careContext.getEpisodeOfCare().getID_EpisodeOfCare());
return (CareContextRefVo)careContext;
}
}
}
return null;
}
示例9: renderGpShortVoToXCN
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
protected final void renderGpShortVoToXCN(GpShortVo gp, XCN xcn, ProviderSystemVo providerSystem) throws DataTypeException
{
LOG.debug("VoMapper renderGpShortVoToXCN: entry");
if(gp!=null&&gp.getNameIsNotNull()&&gp.getName().getForenameIsNotNull())
xcn.getGivenName().setValue(gp.getName().getForename());
if(gp!=null&&gp.getNameIsNotNull()&&gp.getName().getSurnameIsNotNull())
xcn.getFamilyName().getSurname().setValue(gp.getName().getSurname());
TaxonomyMap mapping = null;
if (gp!=null)
mapping = gp.getExternalCode(TaxonomyType.NAT_GP_CODE);
if(mapping!=null)
{
xcn.getIDNumber().setValue(mapping.getTaxonomyCode());
}
if(gp!=null&&gp.getNameIsNotNull()&&gp.getName().getTitleIsNotNull())
xcn.getPrefixEgDR().setValue(svc.getRemoteLookup(gp.getName().getTitle().getID(), providerSystem.getCodeSystem().getText()));
LOG.debug("VoMapper renderGpShortVoToXCN: exit");
}
示例10: fillMsh
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
/**
* @param msh
* @param dateOfMessage
* @param facilityName facility.getName();
* @param messageCode i.e. "REF"
* @param triggerEvent i.e. "I12"
* @param messageStructure i.e. "REF_I12"
* @param hl7VersionId is the version of hl7 in use, i.e. "2.6"
*/
public static void fillMsh(MSH msh, Date dateOfMessage, String clinicName, String messageCode, String triggerEvent, String messageStructure, String hl7VersionId) throws DataTypeException {
msh.getFieldSeparator().setValue("|");
msh.getEncodingCharacters().setValue("^~\\&");
msh.getVersionID().getVersionID().setValue(hl7VersionId);
msh.getDateTimeOfMessage().setValue(getAsHl7FormattedString(dateOfMessage));
msh.getSendingApplication().getNamespaceID().setValue("OSCAR");
msh.getSendingFacility().getNamespaceID().setValue(clinicName);
// message code "REF", event "I12", structure "REF I12"
msh.getMessageType().getMessageCode().setValue(messageCode);
msh.getMessageType().getTriggerEvent().setValue(triggerEvent);
msh.getMessageType().getMessageStructure().setValue(messageStructure);
}
示例11: testUnmarshalFailed
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
@Test
public void testUnmarshalFailed() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:unmarshal");
mock.expectedMessageCount(0);
String body = createHL7AsString();
try {
template.sendBody("direct:unmarshalFailed", body);
fail("Should have thrown exception");
} catch (CamelExecutionException e) {
assertIsInstanceOf(HL7Exception.class, e.getCause());
assertIsInstanceOf(DataTypeException.class, e.getCause());
assertTrue("Should be a validation error message", e.getCause().getMessage().startsWith("Failed validation rule"));
}
assertMockEndpointsSatisfied();
}
示例12: fillPID
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
/**
* Fills PID segment
*
* @param pid
* @param patient
* @throws DataTypeException
* @throws HL7Exception
*/
protected void fillPID(final PID pid, final HL7Patient patient) throws DataTypeException,
HL7Exception{
String sex = ""; //$NON-NLS-1$
if (patient.isMale() != null) {
sex = "M"; //$NON-NLS-1$
if (!patient.isMale().booleanValue()) {
sex = "F"; //$NON-NLS-1$
}
}
pid.getPid1_SetIDPID().setValue("1"); //$NON-NLS-1$
pid.getPid2_PatientID().getIDNumber().setValue(patient.getPatCode());
pid.getPid3_PatientIdentifierList(0).getIDNumber().setValue(patient.getPatCode());
pid.getPid4_AlternatePatientIDPID(0).getIDNumber().setValue(patient.getPatCode());
addKontaktToXPN(pid.getPid5_PatientName(0), patient);
pid.getPid16_MaritalStatus().getCwe1_Identifier().setValue(""); //$NON-NLS-1$
pid.getPid7_DateTimeOfBirth().setValue(HL7Helper.dateToString(patient.getBirthdate()));
pid.getPid8_AdministrativeSex().setValue(sex);
pid.getPid9_PatientAlias(0).getXpn1_FamilyName().getFn1_Surname().setValue(""); //$NON-NLS-1$
pid.getPid10_Race(0).getCwe1_Identifier().setValue(""); //$NON-NLS-1$
addAddressToXAD(pid.getPid11_PatientAddress(0), patient);
pid.getPid12_CountyCode().setValue(""); //$NON-NLS-1$
addPhone1ToXTN(pid.getPid13_PhoneNumberHome(0), patient);
addPhone2ToXTN(pid.getPid14_PhoneNumberBusiness(0), patient);
}
示例13: addKontaktToXPN
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
/**
* Adds patient data to XPN segment
*
* @param xpn
* @param patient
* @throws DataTypeException
*/
protected void addKontaktToXPN(XPN xpn, final HL7Kontakt kontakt) throws DataTypeException{
String name = ""; //$NON-NLS-1$
String vorname = ""; //$NON-NLS-1$
String title = ""; //$NON-NLS-1$
if (kontakt != null) {
name = kontakt.getName();
vorname = kontakt.getFirstname();
title = kontakt.getTitle();
}
xpn.getXpn1_FamilyName().getSurname().setValue(name);
xpn.getXpn2_GivenName().setValue(vorname);
xpn.getXpn3_SecondAndFurtherGivenNamesOrInitialsThereof().setValue(""); //$NON-NLS-1$
xpn.getXpn4_SuffixEgJRorIII().setValue(""); //$NON-NLS-1$
xpn.getXpn5_PrefixEgDR().setValue(""); //$NON-NLS-1$
xpn.getXpn6_DegreeEgMD().setValue(title);
xpn.getXpn7_NameTypeCode().setValue(""); //$NON-NLS-1$
xpn.getXpn8_NameRepresentationCode().setValue(""); //$NON-NLS-1$
xpn.getXpn9_NameContext().getCwe1_Identifier().setValue(""); //$NON-NLS-1$
}
示例14: addAddressToXAD
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
/**
* Adds address of kontakt to XAD segment
*
* @param xad
* @param kontakt
* @throws DataTypeException
*/
protected void addAddressToXAD(XAD xad, final HL7Kontakt kontakt) throws DataTypeException{
String street = ""; //$NON-NLS-1$
String other = ""; //$NON-NLS-1$
String city = ""; //$NON-NLS-1$
String zip = ""; //$NON-NLS-1$
String country = ""; //$NON-NLS-1$
if (kontakt != null) {
street = kontakt.getAddress1();
other = kontakt.getAddress2();
city = kontakt.getCity();
zip = kontakt.getZip();
country = kontakt.getCountry();
}
xad.getXad1_StreetAddress().getSad1_StreetOrMailingAddress().setValue(street);
xad.getXad2_OtherDesignation().setValue(other);
xad.getXad3_City().setValue(city);
xad.getXad4_StateOrProvince().setValue(""); //$NON-NLS-1$
xad.getXad5_ZipOrPostalCode().setValue(zip);
xad.getXad6_Country().setValue(country);
}
示例15: addPhone1ToXTN
import ca.uhn.hl7v2.model.DataTypeException; //导入依赖的package包/类
/**
* Adds contact informations to XTN segment
*
* @param xtn
* @param kontakt
* @throws DataTypeException
*/
protected void addPhone1ToXTN(XTN xtn, final HL7Kontakt kontakt) throws DataTypeException{
String phone1 = ""; //$NON-NLS-1$
String email = ""; //$NON-NLS-1$
String fax = ""; //$NON-NLS-1$
if (kontakt != null) {
phone1 = kontakt.getPhone1();
email = kontakt.getEmail();
fax = kontakt.getFax();
}
xtn.getXtn1_TelephoneNumber().setValue(phone1);
xtn.getXtn2_TelecommunicationUseCode().setValue(""); //$NON-NLS-1$
xtn.getXtn3_TelecommunicationEquipmentType().setValue(""); //$NON-NLS-1$
xtn.getXtn4_CommunicationAddress().setValue(email);
xtn.getXtn5_CountryCode().setValue(""); //$NON-NLS-1$
xtn.getXtn6_AreaCityCode().setValue(""); //$NON-NLS-1$
xtn.getXtn7_LocalNumber().setValue(""); //$NON-NLS-1$
xtn.getXtn8_Extension().setValue(""); //$NON-NLS-1$
xtn.getXtn9_AnyText().setValue(""); //$NON-NLS-1$
xtn.getXtn10_ExtensionPrefix().setValue(""); //$NON-NLS-1$
xtn.getXtn11_SpeedDialCode().setValue(fax);
}