Announcement

Collapse
No announcement yet.

Copy part of OBX text to OBR Segment

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Copy part of OBX text to OBR Segment

    Hi All. I have done a ton of searching and I see similar examples but none requiring copying only part of an OBX segment.

    Using Java I am looking to copy the text after the word EXAM: which can show up in any random OBX line and paste it in OBR.4.3

    Below is an example of the ORU.

    Thanks for any help!

    MSH|^~\&|RIS||RIS2||201208280653||ORU^R01|20120828 065346910832|P|2.3
    PID|1|586680|586680||Test^Jane^||19801106|F||||||| |||||
    PV1|1||Test Hospital|||||Blank|||||||||||||||||||||||||||||||| |||||||||||||
    ORC|RE
    OBR|1||46123456|^APD|||201208280639|||||||||Blank^ ^||||1.2.123.456.45878||||CT|P|||||||123456^DOC^TE ST|||||
    OBX|1|ST|||Referring Physician: Joe Ref||||||P||||||
    OBX|2|ST|||||||||P||||||
    OBX|3|ST|||Patient Name: Jane Test||||||P||||||
    OBX|4|ST|||||||||P||||||
    OBX|5|ST|||PRELIM REPORT||||||P||||||
    OBX|6|ST|||||||||P||||||
    OBX|7|ST|||IMAGES: 260||||||P||||||
    OBX|8|ST|||||||||P||||||
    OBX|9|ST|||EXAM: CT ABDOMEN AND PELVIS WITHOUT CONTRAST||||||P||||||
    OBX|10|ST|||||||||P||||||
    OBX|11|ST|||||||||P||||||
    OBX|12|ST|||IMPRESSION: Normal CT AP.||||||P||||||

  • #2
    While the specific bit of code that you need hadn't yet existed verbatim on the forums, I think all the programmatic and logical tools you need already had... you just have to think outside of the box!

    Code:
    for each (obr in msg.OBR)
    	for each (obx in getSegmentsAfter(msg,obr,'OBX'))
    		if (/^EXAM:.*/.test(obx['OBX.5']['OBX.5.1'].toString()))
    			obr['OBR.4']['OBR.4.3'] = obx['OBX.5']['OBX.5.1'].toString().substr(5).trim();
    Also make sure to include this.
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment


    • #3
      Awesome! Worked perfectly. Thank you for your help and for the priceless code that will definitely come in handy time and time again. getSegmentsAfter is my new best friend....

      Jay

      Comment


      • #4
        Haha, glad to hear it!
        Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

        Nicholas Rupley
        Work: 949-237-6069
        Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


        - How do I foo?
        - You just bar.

        Comment

        Working...
        X