• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GenericParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中ca.uhn.hl7v2.parser.GenericParser的典型用法代码示例。如果您正苦于以下问题:Java GenericParser类的具体用法?Java GenericParser怎么用?Java GenericParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GenericParser类属于ca.uhn.hl7v2.parser包,在下文中一共展示了GenericParser类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parseACKError

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
private String parseACKError(String response) throws HL7Exception {
    Parser parser = new GenericParser();
    Object parsedMsg = parser.parse(response);
    if (!(parsedMsg instanceof ACK)) {
        return "Message response received in unsupported format: " + parsedMsg.getClass();
    }

    ACK msg = (ACK)parsedMsg;
    if (msg.getMSA()!=null && msg.getMSA().getAcknowledgmentCode()!=null &&
            "AA".equalsIgnoreCase(msg.getMSA().getAcknowledgmentCode().getValue())) {
        return null;
    }

    String err = "Failed to register new patient:\n";

    if (msg.getERR()!=null && msg.getERR().getErr3_HL7ErrorCode()!=null) {
        if (msg.getERR().getErr3_HL7ErrorCode().getCwe1_Identifier()!=null) {
            err += msg.getERR().getErr3_HL7ErrorCode().getCwe1_Identifier().getValue() + "\n";
        }
        if (msg.getERR().getErr3_HL7ErrorCode().getCwe2_Text()!=null) {
            err += msg.getERR().getErr3_HL7ErrorCode().getCwe2_Text().getValue() + "\n";
        }
    }

    return err;
}
 
开发者ID:jembi,项目名称:openhim-mediator-xds,代码行数:27,代码来源:PIXRequestActor.java


示例2: init

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的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


示例3: createRouteBuilder

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
protected RouteBuilder createRouteBuilder() throws Exception {
    HapiContext hapiContext = new DefaultHapiContext();
    hapiContext.setValidationContext(new NoValidation());
    Parser p = new GenericParser(hapiContext);
    hl7 = new HL7DataFormat();
    hl7.setParser(p);
    
    /*
     * Let's start by adding a validation rule to the default validation
     * that disallows PID-2 to be empty.
     */
    ValidationRuleBuilder builder = new ValidationRuleBuilder() {
        private static final long serialVersionUID = 1L;

        @Override
        protected void configure() {
            forVersion(Version.V24)
                    .message("ADT", "*")
                    .terser("PID-2", not(empty()));
        }
    };
    ValidationContext customValidationContext = ValidationContextFactory.fromBuilder(builder);
    
    HapiContext customContext = new DefaultHapiContext(customValidationContext);
    final Parser customParser = new GenericParser(customContext);
    
    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");
            from("direct:start1").marshal().hl7(customParser).to("mock:end");
            from("direct:start2").marshal().hl7(true).to("mock:end");
            
        }
    };
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:38,代码来源:HL7ValidateTest.java


示例4: createRouteBuilder

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
protected RouteBuilder createRouteBuilder() throws Exception {
    HapiContext hapiContext = new DefaultHapiContext();
    hapiContext.setValidationContext(new NoValidation());
    Parser p = new GenericParser(hapiContext);
    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:HydAu,项目名称:Camel,代码行数:15,代码来源:HL7XmlDataFormatTest.java


示例5: processMessage

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
public Message processMessage(Message msg) throws ApplicationException, HL7Exception
{
	LOG.info("Start Processing Message. " + msg.getName());
	LOG.debug("Incoming message. " + msg.toString());
	
	msgQ.add(msg);
	
	if (isMessageToBeLogged())
	{
		String msgLocation = ConfigFlag.HL7.HL7_STORE_INBOUND_LOC.getValue();
		GenericParser parser = new GenericParser();			
		logMessage(parser.encode(msg), HL7Utils.getEventCode(msg), msgLocation);
	}		
	return HL7Utils.buildPosAck(msg.get("MSH"));		
}
 
开发者ID:oopcell,项目名称:AvoinApotti,代码行数:16,代码来源:HL7PasApplication.java


示例6: constructQBP_Q21

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
public String constructQBP_Q21(String correlationId, ResolvePatientIdentifier msg) throws HL7Exception {

        QBP_Q21 qbp_q21 = new QBP_Q21();
        Terser t = new Terser(qbp_q21);

        constructBasicMSHSegment(correlationId, t);
        t.set("MSH-9-1", "QBP");
        t.set("MSH-9-2", "Q23");
        t.set("MSH-9-3", "QBP_Q21");

        t.set("QPD-1-1", "IHE PIX Query");
        t.set("QPD-2", UUID.randomUUID().toString());
        t.set("QPD-3-1", msg.getIdentifier().getIdentifier());
        t.set("QPD-3-4", msg.getIdentifier().getAssigningAuthority().getAssigningAuthority());
        t.set("QPD-3-4-2", msg.getIdentifier().getAssigningAuthority().getAssigningAuthorityId());
        t.set("QPD-3-4-3", "ISO");
        t.set("QPD-3-5", "PI");

        t.set("QPD-4-4", msg.getTargetAssigningAuthority().getAssigningAuthority());
        t.set("QPD-4-4-2", msg.getTargetAssigningAuthority().getAssigningAuthorityId());
        t.set("QPD-4-4-3", "ISO");
        t.set("QPD-4-5", "PI");

        t.set("RCP-1", "I");

        Parser p = new GenericParser();
        return p.encode(qbp_q21);
    }
 
开发者ID:jembi,项目名称:openhim-mediator-xds,代码行数:29,代码来源:PIXRequestActor.java


示例7: constructADT_A04

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
public String constructADT_A04(String correlationId, RegisterNewPatient msg) throws HL7Exception {

        ADT_A01 adt_a04 = new ADT_A01();
        Terser t = new Terser(adt_a04);

        constructBasicMSHSegment(correlationId, t);
        t.set("MSH-9-1", "ADT");
        t.set("MSH-9-2", "A04");
        t.set("MSH-9-3", "ADT_A01");

        t.set("EVN-2", dateFormatDay.format(new Date()));

        for (int i=0; i<msg.getPatientIdentifiers().size(); i++) {
            t.set("PID-3(" + i + ")-1", msg.getPatientIdentifiers().get(i).getIdentifier());
            t.set("PID-3(" + i + ")-4", msg.getPatientIdentifiers().get(i).getAssigningAuthority().getAssigningAuthority());
            t.set("PID-3(" + i + ")-4-2", msg.getPatientIdentifiers().get(i).getAssigningAuthority().getAssigningAuthorityId());
            t.set("PID-3(" + i + ")-4-3", msg.getPatientIdentifiers().get(i).getAssigningAuthority().getAssigningAuthorityIdType());
        }
        t.set("PID-5-1", msg.getFamilyName());
        t.set("PID-5-2", msg.getGivenName());
        t.set("PID-7", msg.getBirthDate());
        t.set("PID-8", msg.getGender());
        t.set("PID-13", msg.getTelecom());
        t.set("PID-15", msg.getLanguageCommunicationCode());

        t.set("PV1-2", "O");

        Parser p = new GenericParser();
        return p.encode(adt_a04);
    }
 
开发者ID:jembi,项目名称:openhim-mediator-xds,代码行数:31,代码来源:PIXRequestActor.java


示例8: parseRSP_K23

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
private Identifier parseRSP_K23(String response) throws HL7Exception {
    Parser parser = new GenericParser();
    Object parsedMsg = parser.parse(response);
    if (!(parsedMsg instanceof RSP_K23)) {
        return null;
    }

    RSP_K23 msg = (RSP_K23)parsedMsg;

    int numIds = msg.getQUERY_RESPONSE().getPID().getPid3_PatientIdentifierListReps();
    if (numIds < 1) {
        return null;
    }

    String id = msg.getQUERY_RESPONSE().getPID().getPatientIdentifierList(0).getCx1_IDNumber().getValue();

    String assigningAuthority = null;
    if (msg.getQUERY_RESPONSE().getPID().getPatientIdentifierList(0).getAssigningAuthority().getNamespaceID()!=null) {
        assigningAuthority = msg.getQUERY_RESPONSE().getPID().getPatientIdentifierList(0).getAssigningAuthority().getNamespaceID().getValue();
    }

    String assigningAuthorityId = null;
    if (msg.getQUERY_RESPONSE().getPID().getPatientIdentifierList(0).getAssigningAuthority().getUniversalID()!=null) {
        assigningAuthorityId = msg.getQUERY_RESPONSE().getPID().getPatientIdentifierList(0).getAssigningAuthority().getUniversalID().getValue();
    }

    String assigningAuthorityIdType = null;
    if (msg.getQUERY_RESPONSE().getPID().getPatientIdentifierList(0).getAssigningAuthority().getUniversalIDType()!=null) {
        assigningAuthorityIdType = msg.getQUERY_RESPONSE().getPID().getPatientIdentifierList(0).getAssigningAuthority().getUniversalIDType().getValue();
    }

    return new Identifier(id, new AssigningAuthority(assigningAuthority, assigningAuthorityId, assigningAuthorityIdType));
}
 
开发者ID:jembi,项目名称:openhim-mediator-xds,代码行数:34,代码来源:PIXRequestActor.java


示例9: processEncounter

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
@Path("patient/encounters")
@POST
public Response processEncounter(String body, @QueryParam("patientId") String pid, @QueryParam("idType") String idType) {
	log.info("Called RapidSMS Alerts Service: process encounter");
	
	Parser p = new GenericParser();
	
	Message hl7 = null;
	try {
		hl7 = p.parse(body);
		
		ORU_R01 oruMsg = (ORU_R01) hl7;
		
		if (oruMsg != null) {
			log.info("Successfully parsed body as HL7v2 ORU_R01 message");
			//TODO determine result of alert request
			if ((oruMsg.getPATIENT_RESULT().getPATIENT().getVISIT().getPV1().getPv14_AdmissionType().getValue()).toLowerCase().contains("referral") &&
				!(oruMsg.getPATIENT_RESULT().getPATIENT().getVISIT().getPV1().getPv14_AdmissionType().getValue()).toLowerCase().contains("confirmation")) {
			//if (true) {
				sendRapidSMSAlert(oruMsg, pid, idType);
				log.info("Sent RapidSMS alert message");
			} else {
				log.info("ORU_R01 message is not a referral, no alert message sent");
			}
			return Response.created(null).build();
		}
	} catch (Exception e) {
		log.error("Parsing failed: ", e);
		return Response.status(400).entity("Failed to parse body as HL7v2 ORU_R01 message: " + e).build();
	}
	
	return Response.status(500).build();
}
 
开发者ID:jembi,项目名称:rapidsms-alerts-service,代码行数:34,代码来源:RapidSMSAlertsService.java


示例10: createRouteBuilder

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的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


示例11: sendResponseToNewSocket

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
private void sendResponseToNewSocket(Socket sock,Message msg,int nasError,StringBuffer outMess,boolean bLastMess) throws Exception
{
	Message resp = msg;
	Message ack = null;
	ImsNasMsg nm = new ImsNasMsg(outMess.toString());
	
	if ((resp = this.generate(msg,nm)) == null){
		LOG.warn("Error generating Response for NO_DATA_FOUND");								
		resp = HL7Utils.buildRejAck(msg.get(SegName.MSH), "Error occured generating response",-1);								
	}
	else
	{
		if (!(msg instanceof ADT_A01) && !(msg instanceof ADT_A39)) 
		{	
			if (nasError == NO_DATA_FOUND || nasError == NO_MORE_DATA || nasError == 0 || bLastMess)
			{
				if (bNackReceived == false) 
				{
					LOG.debug("Setting QueryResultsLevel to F" );
					((QRD)resp.get("QRD")).getQueryResultsLevel().setValue("F");
				}
				else
				{
					LOG.debug("Setting QueryResultsLevel to P" );
					((QRD)resp.get("QRD")).getQueryResultsLevel().setValue("P"); //partial as there was a NACK
				}
			}
			else if (nasError > 0)
			{
				LOG.debug("Setting QueryResultsLevel to T" );
				((QRD)resp.get("QRD")).getQueryResultsLevel().setValue("T");
			}
			else if (nasError < 0)
				((MSA)resp.get("MSA")).getTextMessage().setValue("Nas Error" + nasError + " occurred sending message to EPM");
		}
	}
	LOG.debug("Sending response to remote server: nasError was " + nasError);				
	GenericParser parser = new GenericParser();			
	String msgTxt = parser.encode(resp);
	String ackTxt = ""; 
	msgTxt = msgTxt.replaceAll("\n", "\r");
	LOG.debug("Sending Message " +msgTxt);
	HL7Writer writer = new MinLLPWriter(sock.getOutputStream());
	HL7Reader reader = new MinLLPReader(sock.getInputStream());
	writer.writeMessage(msgTxt); 
	
	LOG.debug("Message sent, waiting for ACK... ");
	ackTxt = reader.getMessage();//parser.encode(resp,reader.getMessage().toString());

	ack = parser.parse(ackTxt);
	MSA msa = (MSA)ack.get("MSA");
	if (!msa.getAcknowledgementCode().getValue().equals("AA"))
	{
		LOG.debug("Received NACK: " + ackTxt);
		bNackReceived = true;
	}
	else
		LOG.debug("Received ACK: " + ackTxt);
}
 
开发者ID:oopcell,项目名称:AvoinApotti,代码行数:60,代码来源:HL7PasProcessor.java


示例12: doConfigure

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
private void doConfigure() 
{
	try
	{
		app = (Application)(Class.forName(cfg.getApplicationClassName()).newInstance());
	}
	catch(Exception e)
	{
		throw new RuntimeException("Failed to load HL7 Nas Application", e);
	}
	
	server = new SimpleServer(cfg.getPort(), new MinLowerLayerProtocol(), new GenericParser());		
	
	//PMI ADT Messages handled
	server.registerApplication(MsgTypes.ADT, EvnCodes.A01, app); //Admit Patient
	server.registerApplication(MsgTypes.ADT, EvnCodes.A02, app); //Transfer Patient
	server.registerApplication(MsgTypes.ADT, EvnCodes.A03, app); //Discharge Patient
	server.registerApplication(MsgTypes.ADT, EvnCodes.A04, app); //Discharge Patient
	server.registerApplication(MsgTypes.ADT, EvnCodes.A05, app); //Pre-admit/book
	server.registerApplication(MsgTypes.ADT, EvnCodes.A08, app); //Update Patient Information
	server.registerApplication(MsgTypes.ADT, EvnCodes.A11, app); //Cancel Patient Admit
	server.registerApplication(MsgTypes.ADT, EvnCodes.A12, app); //Cancel Transfer
	server.registerApplication(MsgTypes.ADT, EvnCodes.A13, app); //Cancel Patient Discharge		
	server.registerApplication(MsgTypes.QRY, EvnCodes.A19, app); //Patienty Query
	server.registerApplication(MsgTypes.ADT, EvnCodes.A23, app); //Register Patient		
	server.registerApplication(MsgTypes.ADT, EvnCodes.A28, app); //Register Patient
	server.registerApplication(MsgTypes.ADT, EvnCodes.A29, app); //Delete Patient
	server.registerApplication(MsgTypes.ADT, EvnCodes.A31, app); //Update Patient
	server.registerApplication(MsgTypes.ADT, EvnCodes.A34, app); //Merge Patient
	server.registerApplication(MsgTypes.ADT, EvnCodes.A38, app); //Cancel Transfer
	server.registerApplication(MsgTypes.ADT, EvnCodes.A40, app); //Merge Patient
	server.registerApplication(MsgTypes.ADT, EvnCodes.A47, app); //Update IDs
	server.registerApplication(MsgTypes.ADT, EvnCodes.A60, app); //Allergy
	//MFN
	server.registerApplication(MsgTypes.MFN, EvnCodes.M01, app); //Lookups Master File Message
	server.registerApplication(MsgTypes.MFN, EvnCodes.M02, app);
	server.registerApplication(MsgTypes.MFN, EvnCodes.M05, app);
	//ORU
	server.registerApplication(MsgTypes.ORU, EvnCodes.R01, app); //Observation Reporting		
	//SIU
	server.registerApplication(MsgTypes.SIU, EvnCodes.S12, app); 
	server.registerApplication(MsgTypes.SIU, EvnCodes.S13, app); 
	server.registerApplication(MsgTypes.SIU, EvnCodes.S14, app); 
	server.registerApplication(MsgTypes.SIU, EvnCodes.S15, app);
	server.registerApplication(MsgTypes.SIU, EvnCodes.S26, app); 
	

	server.registerApplication(MsgTypes.ACK, "*", app); //ACK Message		
}
 
开发者ID:oopcell,项目名称:AvoinApotti,代码行数:50,代码来源:HL7NasListener.java


示例13: Enviar

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
public boolean Enviar() throws HL7Exception, LLPException, IOException{
	int num=0;
	for(RecepcionPrestaciones rp : this.recepcion.getRecepcionPrestaciones()){
		//Se crea un tipo de dato segun el mensaje, en este caso ORM^O01
		ORM_O01 orm = new ORM_O01();
		/***************************************************************************************************************/
		MSH MSH = orm.getMSH();
		MSH.getFieldSeparator().setValue("|");
		MSH.getEncodingCharacters().setValue("^~\\&");
		MSH.getSendingApplication().getNamespaceID().setValue("EIMSRISV1");
		MSH.getSendingFacility().getNamespaceID().setValue(""+this.getRecepcion().getDerivador().getId());
		MSH.getDateTimeOfMessage().getDay();
		MSH.getMessageType().getMessageCode().setValue("ORM");
		MSH.getMessageType().getTriggerEvent().setValue("O01");
		MSH.getMessageControlID().setValue(""+this.getRecepcion().getId());
		MSH.getProcessingID().getProcessingID().setValue("P");
		MSH.getVersionID().getVersionID().setValue("2.6");
		ORM_O01_PATIENT PAT = orm.getPATIENT();
		PAT.getPID().getSetIDPID();
		PAT.getPID().getPatientID().getIDNumber().setValue(this.getRecepcion().getPaciente().getRUN());
		PAT.getPID().insertPid3_PatientIdentifierList(0).getCx1_IDNumber().setValue(""+this.getRecepcion().getPaciente().getId());
		PAT.getPID().getPatientName(0).getFamilyName().getSurname().setValue(this.getRecepcion().getPaciente().getAPaterno()+
																				" "+this.getRecepcion().getPaciente().getAMaterno());
		PAT.getPID().getPatientName(0).getGivenName().setValue(this.getRecepcion().getPaciente().getNombre());
		//PAT.getPID().getDateTimeOfBirth().setValue(this.getRecepcion().getPaciente().getFechaNacimiento().toString("yyyyMMdd"));
		PAT.getPID().getAdministrativeSex().setValue(this.getRecepcion().getPaciente().getSexo());
		PAT.getPID().getPatientAddress(0).getStreetAddress().getStreetOrMailingAddress().setValue(this.getRecepcion().getPaciente().getDireccion());
		PAT.getPID().getPatientAddress(0).getCity().setValue(this.getRecepcion().getPaciente().getCiudad().getDescripcion());
		ORM_O01_ORDER segmentoORDEN = orm.getORDER();
		segmentoORDEN.getORC().getOrc1_OrderControl().setValue("NW");
		segmentoORDEN.getORC().getPlacerOrderNumber().getEntityIdentifier().setValue(""+rp.getResponsable().getId());
		segmentoORDEN.getORC().getFillerOrderNumber().getEntityIdentifier().setValue(rp.getPrestacion().getId());
		segmentoORDEN.getORC().getEnteredBy(0).getIDNumber().setValue(this.getRecepcion().getUsuario());
		segmentoORDEN.getORC().getOrderingProvider(0).getIDNumber().setValue(this.getRecepcion().getResponsable().getIniciales());
		segmentoORDEN.getORC().getOrderingProvider(0).getFamilyName().getSurname().setValue(this.getRecepcion().getResponsable().getAPaterno());
		segmentoORDEN.getORC().getOrderingProvider(0).getGivenName().setValue(this.getRecepcion().getResponsable().getNombre());
		segmentoORDEN.getORC().getOrderingProvider(0).getPrefixEgDR().setValue(this.getRecepcion().getResponsable().getProfesion().getAbreviacion());
		segmentoORDEN.getORC().getEntererSLocation().getPointOfCare().setValue(""+this.getRecepcion().getIDCitacion());
		ORM_O01_ORDER_DETAIL segmentoORDEND = orm.getORDER().getORDER_DETAIL();
		segmentoORDEND.getOBR().getObr2_PlacerOrderNumber().getEi1_EntityIdentifier().setValue("EIMSRIS");
		segmentoORDEND.getOBR().getObr4_UniversalServiceIdentifier().getText().setValue(rp.getPrestacion().getDescripcion());
		segmentoORDEND.getOBR().getObr4_UniversalServiceIdentifier().getNameOfCodingSystem().setValue(""+
																				rp.getPrestacion().getRRFFxDefecto().getId());		
		segmentoORDEND.getOBR().getObr4_UniversalServiceIdentifier().getAlternateIdentifier().setValue(rp.getPrestacion().getDescripcion());
		segmentoORDEND.getOBR().getObr18_PlacerField1().setValue(""+this.getRecepcion().getId());
		segmentoORDEND.getOBR().getObr19_PlacerField2().setValue(this.getRecepcion().getId()+""+rp.getPrestacion().getId());
		segmentoORDEND.getOBR().getObr20_FillerField1().setValue(rp.getPrestacion().getId());
		segmentoORDEND.getOBR().getObr24_DiagnosticServSectID().setValue(rp.getPrestacion().getRRFFxDefecto().getModalidad().getDescripcion());
		segmentoORDEND.getOBR().getObr44_ProcedureCode().getText().setValue(rp.getPrestacion().getDescripcion());
		segmentoORDEND.getOBR().getObr44_ProcedureCode().getCne1_Identifier().setValue(rp.getPrestacion().getId());
		segmentoORDEN.getMessage().addNonstandardSegment("ZDS");
		Terser t = new Terser(orm);
		t.set("ZDS-1-1","1.2.826.0.1.3680043.9.88");
		Parser parser = new PipeParser();
	    String encodedMessage = parser.encode(orm);
	    String original = "áàäéèëíìïóòöúùuñÁÀÄÉÈËÍÌÏÓÒÖÚÙÜÑçÇ";
	    String    ascii = "aaaeeeiiiooouuunAAAEEEIIIOOOUUUNcC";
	    String output = encodedMessage;
	    for (int i=0; i<original.length(); i++) {
	        output = output.replace(original.charAt(i), ascii.charAt(i));
	    }
	    System.out.println("Printing ER7 Encoded Message:");
	    System.out.println(output);
	    Parser p = new GenericParser();
	    Message adt = parser.parse(output);
	    ConnectionHub connectionHub = ConnectionHub.getInstance();
	    // A connection object represents a socket attached to an HL7 server
	    Connection connection = connectionHub.attach("localhost", port, new PipeParser(), MinLowerLayerProtocol.class);
	    // The initiator is used to transmit unsolicited messages
	    Initiator initiator = connection.getInitiator();
	    Message response = initiator.sendAndReceive(adt);
	    String responseString = parser.encode(response);
	    System.out.println("Received response:\n" + responseString);
	    // Close the connection
	    //....
	    connection.close();
	    //connection2.close();
	    num++;
	}
	return false;
}
 
开发者ID:avenda,项目名称:miniRIS,代码行数:82,代码来源:HL7Message.java


示例14: execute

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
public Result execute(Result previousResult, int nr)
{
	Result result = previousResult;
	
	try {
	  
	  String serverName = environmentSubstitute(server);
	  int portNumber = Integer.parseInt(environmentSubstitute(port));
	  String messageVariable = environmentSubstitute(messageVariableName);
     String messageTypeVariable = environmentSubstitute(messageTypeVariableName);
     String versionVariable = environmentSubstitute(versionVariableName);
     
     MLLPSocketCacheEntry entry = MLLPSocketCache.getInstance().getServerSocketStreamSource(serverName, portNumber);
     if (entry.getJobListener()!=null) {
       parentJob.addJobListener(entry.getJobListener());
     }
     MLLPTransport transport = entry.getTransport();
     
     // Get the next value...
     //
     synchronized(transport) {
       Transportable transportable = transport.doReceive();
 	    String message = transportable.getMessage();
 	    
 	    logDetailed("Received message: "+message);
 	    
 	    parentJob.setVariable(messageVariable, message);
    
 	    //  Parse the message and extract the control ID.
       //
       Parser parser = new GenericParser();
       ValidationContext validationContext = new NoValidation();
       parser.setValidationContext(validationContext);
       Message msg = parser.parse(message);
       Structure structure = msg.get("MSH");
       String messageType = null;
       String version = msg.getVersion();
       
       if (structure instanceof ca.uhn.hl7v2.model.v21.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v21.segment.MSH)structure).getMESSAGETYPE().encode();
       } else if (structure instanceof ca.uhn.hl7v2.model.v22.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v22.segment.MSH)structure).getMessageType().encode();
       } else if (structure instanceof ca.uhn.hl7v2.model.v23.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v23.segment.MSH)structure).getMessageType().encode();
       } else if (structure instanceof ca.uhn.hl7v2.model.v231.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v231.segment.MSH)structure).getMessageType().getMessageStructure().getValue();
       } else if (structure instanceof ca.uhn.hl7v2.model.v24.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v24.segment.MSH)structure).getMessageType().getMessageStructure().getValue();
       } else if (structure instanceof ca.uhn.hl7v2.model.v25.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v25.segment.MSH)structure).getMessageType().getMessageStructure().getValue();
       } else if (structure instanceof ca.uhn.hl7v2.model.v251.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v251.segment.MSH)structure).getMessageType().getMessageStructure().getValue();
       } else if (structure instanceof ca.uhn.hl7v2.model.v26.segment.MSH) {
         messageType = ((ca.uhn.hl7v2.model.v26.segment.MSH)structure).getMessageType().getMessageStructure().getValue();
       } else {
         logError("This job entry does not support the HL7 dialect used. Found MSH class: "+structure.getClass().getName());
       }
       
       if (!Const.isEmpty(messageTypeVariable)) parentJob.setVariable(messageTypeVariable, messageType);
       if (!Const.isEmpty(versionVariable)) parentJob.setVariable(versionVariable, version);
     }
     
		// All went well..
		//
		result.setNrErrors(0);
		result.setResult(true);
		
	} catch(Exception e) {
		log.logError(BaseMessages.getString(PKG, "HL7MLLPInput.Exception.UnexpectedError"), e);
		result.setNrErrors(1);
		result.setResult(false);
	} 
	
	return result;
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:76,代码来源:HL7MLLPInput.java


示例15: processRow

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
    meta = (HL7InputMeta) smi;
    data = (HL7InputData) sdi;
    
	Object[] r=getRow();    // get row, set busy!
	if (r==null)  // no more input to be expected...
	{
		setOutputDone();
		return false;
	}
	
	if (first) {
	  data.messageFieldIndex = getInputRowMeta().indexOfValue(meta.getMessageField());
	  if (data.messageFieldIndex<0) {
	    throw new KettleException("Unable to find field ["+meta.getMessageField()+"] in the input fields.");
	  }
	  
	  data.outputRowMeta = getInputRowMeta().clone();
	  meta.getFields(data.outputRowMeta, getStepname(), null, null, this);
	  
	  data.parser = new GenericParser();
	  data.parser.setValidationContext(new NoValidation());
	}
	
	String messageString = getInputRowMeta().getString(r, data.messageFieldIndex);
	
	try {
	  Message message = data.parser.parse(messageString);
      List<HL7Value> values = HL7KettleParser.extractValues(message);
      
      for (HL7Value value : values) {
   	      Object[] output = RowDataUtil.createResizedCopy(r, data.outputRowMeta.size());
   	      int outputIndex = getInputRowMeta().size();
   	      
   	      output[outputIndex++] = value.getParentGroup();
             output[outputIndex++] = value.getGroupName();
             output[outputIndex++] = value.getVersion();
             output[outputIndex++] = value.getStructureName();
             output[outputIndex++] = value.getStructureNumber();
             output[outputIndex++] = value.getFieldName();
             output[outputIndex++] = value.getCoordinate();
             output[outputIndex++] = value.getDataType();
             output[outputIndex++] = value.getDescription();
             output[outputIndex++] = value.getValue();
             
             putRow(data.outputRowMeta, output);
      }
	} catch(Exception e) {
	  throw new KettleException("Error parsing message", e);
	}
	
       if (checkFeedback(getLinesWritten())) 
       {
       	if(log.isBasic()) logBasic(BaseMessages.getString(PKG, "HL7Input.Log.LineNumber")+getLinesWritten()); //$NON-NLS-1$
       }
		
	return true;
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:60,代码来源:HL7Input.java


示例16: processRow

import ca.uhn.hl7v2.parser.GenericParser; //导入依赖的package包/类
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {
  meta = (HL7InputMeta) smi;
  data = (HL7InputData) sdi;

  Object[] r = getRow(); // get row, set busy!
  if ( r == null ) { // no more input to be expected...
    setOutputDone();
    return false;
  }

  if ( first ) {
    data.messageFieldIndex = getInputRowMeta().indexOfValue( meta.getMessageField() );
    if ( data.messageFieldIndex < 0 ) {
      throw new KettleException( "Unable to find field [" + meta.getMessageField() + "] in the input fields." );
    }

    data.outputRowMeta = getInputRowMeta().clone();
    meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore );

    data.parser = new GenericParser();
    data.parser.setValidationContext( new NoValidation() );
  }

  String messageString = getInputRowMeta().getString( r, data.messageFieldIndex );

  try {
    Message message = data.parser.parse( messageString );
    List<HL7Value> values = HL7KettleParser.extractValues( message );

    for ( HL7Value value : values ) {
      Object[] output = RowDataUtil.createResizedCopy( r, data.outputRowMeta.size() );
      int outputIndex = getInputRowMeta().size();

      output[outputIndex++] = value.getParentGroup();
      output[outputIndex++] = value.getGroupName();
      output[outputIndex++] = value.getVersion();
      output[outputIndex++] = value.getStructureName();
      output[outputIndex++] = value.getStructureNumber();
      output[outputIndex++] = value.getFieldName();
      output[outputIndex++] = value.getCoordinate();
      output[outputIndex++] = value.getDataType();
      output[outputIndex++] = value.getDescription();
      output[outputIndex++] = value.getValue();

      putRow( data.outputRowMeta, output );
    }
  } catch ( Exception e ) {
    throw new KettleException( "Error parsing message", e );
  }

  if ( checkFeedback( getLinesWritten() ) ) {
    if ( log.isBasic() ) {
      logBasic( BaseMessages.getString( PKG, "HL7Input.Log.LineNumber" ) + getLinesWritten() );
    }
  }

  return true;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:59,代码来源:HL7Input.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Function类代码示例发布时间:2022-05-21
下一篇:
Java Language类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap