当前位置: 首页>>代码示例>>Java>>正文


Java Parser.setValidationContext方法代码示例

本文整理汇总了Java中ca.uhn.hl7v2.parser.Parser.setValidationContext方法的典型用法代码示例。如果您正苦于以下问题:Java Parser.setValidationContext方法的具体用法?Java Parser.setValidationContext怎么用?Java Parser.setValidationContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ca.uhn.hl7v2.parser.Parser的用法示例。


在下文中一共展示了Parser.setValidationContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
@Override
public void init(String hl7Body) throws HL7Exception {
	if (hl7Body.startsWith("MSH")) {
		int index = 0;
		for (int i = 0; i < 11; i++)
			index = hl7Body.indexOf('|', index + 1);
		int tmp = index + 1;
		String tmph = hl7Body.substring(0, tmp);
		index = hl7Body.indexOf('|', index + 1);
		if (hl7Body.substring(tmp, index).trim().length() == 0)
			hl7Body = tmph + "2.3" + hl7Body.substring(index);
	}
	Parser p = new PipeParser();
	p.setValidationContext(new NoValidation());
	msg = (ORU_R01) p.parse(hl7Body.replaceAll("\n", "\r\n"));
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:17,代码来源:EpsilonHandler.java

示例2: init

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
@Override
	public void init(String hl7Body) throws HL7Exception {
//		if (hl7Body.startsWith("MSH")) {
//			int index = 0;
//			for (int i = 0; i < 11; i++) {
//				index = hl7Body.indexOf('|', index + 1);
//			}
//			int tmp = index + 1;
//			String tmph = hl7Body.substring(0, tmp);
//			index = hl7Body.indexOf('|', index + 1);
//			if (hl7Body.substring(tmp, index).trim().length() == 0) {
//				hl7Body = tmph + "2.3" + hl7Body.substring(index);
//			}
//		}
		Parser p = new PipeParser();
		p.setValidationContext(new NoValidation());
		hl7Body=hl7Body.replace("|P||", "|P|2.3|");  //If there is no version code in MHL lab hl7 file, add default 2.3 here. Otherwise it will fail on parsing.
		msg = (ORU_R01) p.parse(hl7Body.replaceAll("\n", "\r\n"));
	}
 
开发者ID:oscarservice,项目名称:oscar-old,代码行数:20,代码来源:EpsilonHandler.java

示例3: init

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
public void init(String hl7Body)
  throws HL7Exception
{
  Parser p = new PipeParser();

  this.msg = ((ORU_R01)p.parse(hl7Body.replaceAll("\n", "\r\n")));

  p.setValidationContext(new NoValidation());
  ArrayList labs = getMatchingHL7Labs(hl7Body);

  this.headers = new ArrayList<String>();

  for (int i = 0; i < labs.size(); i++)
  {
    this.msg = ((ORU_R01)p.parse(((String)labs.get(i)).replaceAll("\n", "\r\n")));

    ORU_R01_RESPONSE pat_res = this.msg.getRESPONSE();

    ORU_R01_ORDER_OBSERVATION obsr = pat_res.getORDER_OBSERVATION();

    this.pat_23 = pat_res.getPATIENT();
    this.obrseg = obsr.getOBR();
    this.obxseg = obsr.getOBSERVATION().getOBX();
  }
}
 
开发者ID:oscarservice,项目名称:oscar-old,代码行数:26,代码来源:TRUENORTHHandler.java

示例4: read

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
/**
 * Reads an ORU_R01 HL7 file
 * 
 * @param text
 *            ISO-8559-1 String
 * @param readWithValidation
 *            True for parsing with validation, False for parsing without validation
 * @return The ORU_R01 message
 * @throws HL7Exception
 */
public ORU_R01 read(String text, boolean readWithValidation) throws HL7Exception{
	Parser p = new PipeParser();
	if (readWithValidation) {
		p.setValidationContext(new ElexisValidation());
	} else {
		p.setValidationContext(new NoValidation());
	}
	Message hl7Msg = p.parse(text);
	if (hl7Msg instanceof ORU_R01) {
		return (ORU_R01) hl7Msg;
	} else {
		addError(MessageFormat.format(
			Messages.getString("HL7_ORU_R01.Error_WrongMsgType"), hl7Msg.getName())); //$NON-NLS-1$
	}
	return null;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:27,代码来源:HL7_ORU_R01.java

示例5: init

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
public void init(String hl7Body) throws HL7Exception, EncodingNotSupportedException {
	hl7Body = preProcess(hl7Body);
	Parser parser = new GenericParser();
	parser.setValidationContext(new NoValidation());
	Message m = parser.parse(hl7Body);
	if (!(m instanceof ORU_R01)) {
		throw new HL7Exception("Unsupported message type: " + m.getName() + ". Expected ORU^R01 ver 2.2");
	}
	ORU_R01 message = (ORU_R01) m;
	int commentReps = message.getPATIENT_RESULT().getORDER_OBSERVATION().currentReps("NTE");
	if (commentReps < 2) {
		throw new HL7Exception("Expected at least 2 comments in the NTE field.");
	}
	this.message = message;
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:16,代码来源:EaapsMessageSupport.java

示例6: read

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
/**
 * Reads an ORU_R01 HL7 file
 * 
 * @param text
 *            ISO-8559-1 String
 * @return
 * @throws HL7Exception
 */
public ORU_R01 read(String text) throws HL7Exception{
	Parser p = new PipeParser();
	p.setValidationContext(new ElexisValidation());
	Message hl7Msg = p.parse(text);
	if (hl7Msg instanceof ORU_R01) {
		return (ORU_R01) hl7Msg;
	} else {
		addError(MessageFormat.format(
			Messages.getString("HL7_ORU_R01.Error_WrongMsgType"), hl7Msg.getName())); //$NON-NLS-1$
	}
	return null;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:21,代码来源:HL7_ORU_R01.java

示例7: createRouteBuilder

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
protected RouteBuilder createRouteBuilder() throws Exception {
    Parser p = new PipeParser();
    p.setValidationContext(new NoValidation());
    hl7 = new HL7DataFormat();
    hl7.setParser(p);
    
    return new RouteBuilder() {
        public void configure() throws Exception {
            from("direct:unmarshalFailed").unmarshal().hl7().to("mock:unmarshal");
            from("direct:unmarshalOk").unmarshal().hl7(false).to("mock:unmarshal");
            from("direct:unmarshalOkCustom").unmarshal(hl7).to("mock:unmarshal");
        }
    };
}
 
开发者ID:KingsCollegeHospital,项目名称:rassyeyanie,代码行数:15,代码来源:HL7ValidateTest.java

示例8: createRouteBuilder

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
protected RouteBuilder createRouteBuilder() throws Exception {
    Parser p = new GenericParser();
    p.setValidationContext(new NoValidation());
    hl7 = new HL7DataFormat();
    hl7.setParser(p);
    
    return new RouteBuilder() {
        public void configure() throws Exception {
            from("direct:unmarshalOk").unmarshal().hl7(false).to("mock:unmarshal");
            from("direct:unmarshalOkXml").unmarshal(hl7).to("mock:unmarshal");
        }
    };
}
 
开发者ID:KingsCollegeHospital,项目名称:rassyeyanie,代码行数:14,代码来源:HL7XmlDataFormatTest.java

示例9: init

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
public void init(String hl7Body) throws HL7Exception {
    Parser p = new PipeParser();
    p.setValidationContext(new NoValidation());
    msg = (ORU_R01) p.parse(hl7Body.replaceAll( "\n", "\r\n" ).replace("\\.Zt\\", "\t"));
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:6,代码来源:PATHL7Handler.java

示例10: init

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
public void init(String hl7Body) throws HL7Exception {

        Parser p = new PipeParser();
        p.setValidationContext(new NoValidation());
        msg = (ORU_R01) p.parse(hl7Body.replaceAll( "\n", "\r\n" ));

        ArrayList<String> labs = getMatchingGDMLLabsByAccessionNo(hl7Body);
        headers = new ArrayList<String>();
        obrSegMap = new LinkedHashMap<OBR,ArrayList<OBX>>();
        obrSegKeySet = new ArrayList<OBR>();

        for (int i=0; i < labs.size(); i++){
            msg = (ORU_R01) p.parse(( labs.get(i)).replaceAll("\n", "\r\n"));
            int obrCount = msg.getRESPONSE().getORDER_OBSERVATIONReps();

            for (int j=0; j < obrCount; j++){

                // ADD OBR SEGMENTS AND THEIR OBX SEGMENTS TO THE OBRSEGMAP
                OBR obrSeg = msg.getRESPONSE().getORDER_OBSERVATION(j).getOBR();
                ArrayList<OBX> obxSegs = obrSegMap.get(obrSeg);

                // if the obrsegment has not yet been created it will be now
                if (obxSegs == null)
                    obxSegs = new ArrayList<OBX>();

                int obxCount = msg.getRESPONSE().getORDER_OBSERVATION(j).getOBSERVATIONReps();
                for (int k=0; k < obxCount; k++){
                    obxSegs.add(msg.getRESPONSE().getORDER_OBSERVATION(j).getOBSERVATION(k).getOBX());
                }

                obrSegMap.put(obrSeg, obxSegs);
                obrSegKeySet.add(obrSeg);

                // ADD THE HEADER TO THE HEADERS ARRAYLIST
                String header = getString(obrSeg.getUniversalServiceIdentifier().getAlternateIdentifier().getValue());
                if (!headers.contains(header)){
                    headers.add(header);
                }

            }
        }
    }
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:43,代码来源:GDMLHandler.java

示例11: init

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
public void init(String hl7Body) throws HL7Exception {

	        Parser p = new PipeParser();
	        p.setValidationContext(new NoValidation());
	      //  msg = (ORU_R01) p.parse(hl7Body.replaceAll( "\n", "\r\n" ));


	        	msg = (ORU_R01) p.parse(hl7Body);


	        ArrayList<String> labs = getMatchingPFHTlabs(hl7Body);
	        headers = new ArrayList<String>();
	        obrSegMap = new LinkedHashMap<OBR, ArrayList<OBX>>();
	        obrSegKeySet = new ArrayList<OBR>();


	        for (int i=0; i < labs.size(); i++){
	            msg = (ORU_R01) p.parse(( labs.get(i)).replaceAll("\n", "\r\n"));
	            int obrCount = msg.getRESPONSE().getORDER_OBSERVATIONReps();


	            for (int j=0; j < obrCount; j++){

	                // ADD OBR SEGMENTS AND THEIR OBX SEGMENTS TO THE OBRSEGMAP
	                OBR obrSeg = msg.getRESPONSE().getORDER_OBSERVATION(j).getOBR();
	                ArrayList<OBX> obxSegs =  obrSegMap.get(obrSeg);


	                // if the obrsegment has not yet been created it will be now
	                if (obxSegs == null)
	                    obxSegs = new ArrayList<OBX>();

	                int obxCount = msg.getRESPONSE().getORDER_OBSERVATION(j).getOBSERVATIONReps();

	                logger.info("obxCount = "+obxCount);
	                for (int k=0; k < obxCount; k++){
	                //	int obxNteCount = msg.getRESPONSE().getORDER_OBSERVATION(j).getOBSERVATION(k).getNTEReps();
	                	OBX curObxSeg = msg.getRESPONSE().getORDER_OBSERVATION(j).getOBSERVATION(k).getOBX();
	                	obxSegs.add(curObxSeg);
	                }

	                obrSegMap.put(obrSeg, obxSegs);
	                obrSegKeySet.add(obrSeg);

	                // ADD THE HEADER TO THE HEADERS ARRAYLIST
	                String header = getString(obrSeg.getUniversalServiceIdentifier().getIdentifier().getValue());
	                logger.info("PFHT header ="+header);
	                if (!headers.contains(header)){
	                    headers.add(header);
	                }

	            }
	        }
	    }
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:55,代码来源:PFHTHandler.java

示例12: init

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
public void init(String hl7Body) throws HL7Exception {
	Parser p = new PipeParser();
	p.setValidationContext(new NoValidation());
	msg = (ORU_R01) p.parse(hl7Body);
	terser = new Terser(msg);
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:7,代码来源:CLSHandler.java

示例13: init

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
public void init(String hl7Body) throws HL7Exception {
    Parser p = new PipeParser();
    p.setValidationContext(new NoValidation());
    msg = (ORU_R01) p.parse(hl7Body.replaceAll( "\n", "\r\n" ));
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:6,代码来源:CMLHandler.java

示例14: init

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
public void init(String hl7Body) throws HL7Exception {

        Parser p = new PipeParser();
        p.setValidationContext(new NoValidation());
        msg = (ORU_R01) p.parse(hl7Body.replaceAll( "\n", "\r\n" ));

        ArrayList<String> labs = getMatchingBioTestLabs(hl7Body);
        headers = new ArrayList<String>();
        obrSegMap = new LinkedHashMap<OBR,ArrayList<OBX>>();
        obrSegKeySet = new ArrayList<OBR>();

        for (int i=0; i < labs.size(); i++){
            msg = (ORU_R01) p.parse(( labs.get(i)).replaceAll("\n", "\r\n"));
            int obrCount = msg.getRESPONSE().getORDER_OBSERVATIONReps();

            for (int j=0; j < obrCount; j++){

                // ADD OBR SEGMENTS AND THEIR OBX SEGMENTS TO THE OBRSEGMAP
                OBR obrSeg = msg.getRESPONSE().getORDER_OBSERVATION(j).getOBR();
                ArrayList<OBX> obxSegs = obrSegMap.get(obrSeg);

                // if the obrsegment has not yet been created it will be now
                if (obxSegs == null)
                    obxSegs = new ArrayList<OBX>();

                int obxCount = msg.getRESPONSE().getORDER_OBSERVATION(j).getOBSERVATIONReps();
                for (int k=0; k < obxCount; k++){
                    obxSegs.add(msg.getRESPONSE().getORDER_OBSERVATION(j).getOBSERVATION(k).getOBX());
                }

                obrSegMap.put(obrSeg, obxSegs);
                obrSegKeySet.add(obrSeg);

                // ADD THE HEADER TO THE HEADERS ARRAYLIST
                String header = getString(obrSeg.getUniversalServiceIdentifier().getAlternateIdentifier().getValue());
                if (!headers.contains(header)){
                    headers.add(header);
                }

            }
        }
    }
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:43,代码来源:BioTestHandler.java

示例15: init

import ca.uhn.hl7v2.parser.Parser; //导入方法依赖的package包/类
public void init(String hl7Body) throws HL7Exception {

        Parser p = new PipeParser();
        p.setValidationContext(new NoValidation());

        // force parsing as a generic message by changing the message structure
        hl7Body = hl7Body.replaceAll("R01", "");
        msg = p.parse(hl7Body.replaceAll( "\n", "\r\n"));

        terser = new Terser(msg);

        int obrCount = getOBRCount();

        int obrNum;
        boolean obrFlag;
        String segmentName;
        String[] segments = terser.getFinder().getRoot().getNames();
        obrGroups = new ArrayList<ArrayList<Segment>>();

        /*
         *  Fill the OBX array list for use by future methods
         */
        for (int i=0; i < obrCount; i++){
            ArrayList<Segment> obxSegs = new ArrayList<Segment>();

            obrNum = i+1;
            obrFlag = false;

            for (int k=0; k < segments.length; k++){

                segmentName = segments[k].substring(0, 3);

                if (obrFlag && segmentName.equals("OBX")){

                    // make sure to count all of the obx segments in the group
                    Structure[] segs = terser.getFinder().getRoot().getAll(segments[k]);
                    for (int l=0; l < segs.length; l++){
                        Segment obxSeg = (Segment) segs[l];
                        obxSegs.add(obxSeg);
                    }

                }else if (obrFlag && segmentName.equals("OBR")){
                    break;
                }else if ( segments[k].equals("OBR"+obrNum) || ( obrNum==1 && segments[k].equals("OBR"))){
                    obrFlag = true;
                }

            }
            obrGroups.add(obxSegs);
        }

    }
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:53,代码来源:DefaultGenericHandler.java


注:本文中的ca.uhn.hl7v2.parser.Parser.setValidationContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。