开发者

HL7 parsing to get ORC-2

I am having trouble reading the ORC-2 field from ORM^O01 order message. I am using HapiStructures-v23-1.2.jar to read but this method(getFillerOrdersNumber()) is returning null value

    MSH|^~\\&|recAPP|20010|BIBB|HCL|20110923192607||ORM^O01|11D900220|D|2.3|1\r
    PID|1|11D900220|11D900220||TEST^FOURTYONE||19980808|M|||\r
    ZRQ|1|11D900220||CHARTMAXX TESTING ACCOUNT 2|||||||||||||||||Y开发者_开发问答\r

    ORC|NW|11D900220||||||||||66662^NOT INDICATED^X^^^^^^^^^^U|||||||||CHARTMAXX   
    TESTING ACCOUNT 2|^695 S.BROADWAY^DENVER^CO^80209\r

    OBR|1|11D900220||66^BHL, 9P21 GENOTYPE^L|NORMAL||20110920001800|
    ||NOTAVAILABLE|N||Y|||66662^NOT INDICATED^X^^^^^^^^^^U\r

I want to parse this message and read the ORC-2 field and save it in the database

    public static string getOrderNumber(){
         Message hapiMsg = null;
         Parser p = new GenericParser();
         p.setValidationContext(null);
         try {
            hapiMsg = p.parse(hl7Message);
         } catch (Exception e) {
            Logger.error(e);
         }

             Terser terser = new Terser(hapiMsg);
         try {
            ORM_O01 getOrc = (ORM_O01)hapiMsg;
            ORC orc = new ORC(getOrc, null);
            String fn= orc.getFillerOrderNumber().toString();
         }catch(Exception e){
            logger.error(e);
         }
         return fn;
    }

I read in some posts that I have to ladder through to reach the ORC OBR and NTE segments. can someone help me how to do this with a piece of code. Thanks in advance


First I have to point out that ORC-2 is Placer Order Number and ORC-3 is Filler Order Number, not the other way round. So, what you might want to do is this:

ORM_O01 msg = ... 
ORC orc = msg.getORDER().getORC();
String placerOrderNumber =
    orc.getPlacerOrderNumber().getEntityIdentifier().getValue();
String fillerOrderNumber =
    orc.getFillerOrderNumber().getEntityIdentifier().getValue();

I would suggest you to read Hapi documentation yourself: http://hl7api.sourceforge.net/v23/apidocs/index.html


Based on this code:

ORM_O01 getOrc = (ORM_O01)hapiMsg;
ORC orc = new ORC(getOrc, null);
String fn= orc.getFillerOrderNumber().toString();

It looks like you are creating a new ORC rather than pulling out the existing one from the message. I unfortunately can't provide the exact code as I'm only familiar with HL7, not HAPI.

EDIT: It looks like you may be able to do ORC orc = getOrc.getORDER().getORC();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜