MDUXMLM ; HOIFO/WAA -Utilities for XML text ; 7/26/00
;;1.0;CLINICAL PROCEDURES;**6**;Apr 01, 2004;Build 102
; This routine will loop throught the HL7 Message as sent
; by the vendor and convert that message into XML for
; Processing by the gateway.
;
MSH ; Parse the MSH
N MSGDATE
D XML^MDUXMLU1("<MESSAGE_HEADER>")
D BLDXML^MDUXMLU1("INTERNAL_APPLICATION","CLOB")
S DEVICE=$P(LINE,DL,4)
D BLDXML^MDUXMLU1("INSTRUMENT_INSTANCE_ID",DEVICE)
S MSGDATE=$P(LINE,DL,7) I MSGDATE="" D
. D NOW^%DTC
. S MSGDATE=%
. S MSGDATE=$$FTOHL7^MDHL7U2(MSGDATE)
. Q
D DATE^MDUXMLU1("TRANSMISSION_DATE_TIME",MSGDATE)
D BLDXML^MDUXMLU1("MESSAGE_CONTROL_ID",$P(LINE,DL,10))
D BLDXML^MDUXMLU1("MESSAGE_TYPE",$P(LINE,DL,9))
D BLDXML^MDUXMLU1("PRODUCTION_MODE",$S($P(LINE,DL,11)="P":"Y",1:"N"))
D BLDXML^MDUXMLU1("HL7_VERSION",$P(LINE,DL,12))
D XML^MDUXMLU1("</MESSAGE_HEADER>")
Q
PID ; Parse the PID
N SSN
D XML^MDUXMLU1("<PATIENT_INFORMATION>")
D BLDXML^MDUXMLU1("PATIENT_ID",$P(LINE,DL,4))
D XML^MDUXMLU1("<PATIENT_NAME>")
D NAME^MDUXMLU1($P(LINE,DL,6))
D XML^MDUXMLU1("</PATIENT_NAME>")
D DATE^MDUXMLU1("DATE_OF_BIRTH",$P(LINE,DL,8))
D BLDXML^MDUXMLU1("SEX",$P(LINE,DL,9))
S SSN=$P(LINE,DL,20) I SSN="" S SSN=$P(LINE,DL,4)
D BLDXML^MDUXMLU1("SSN",$P(LINE,DL,20))
D XML^MDUXMLU1("</PATIENT_INFORMATION>")
Q
PV1 ; Parse the PV1
D BLDXML^MDUXMLU1("PATIENT_CLASS",$P(LINE,DL,3))
D BLDXML^MDUXMLU1("PATIENT_LOCATION",$P(LINE,DL,4))
Q
ORC ; Parse the ORC
S ORDER=1
D XML^MDUXMLU1("<ORDER_INFORMATION>")
D BLDXML^MDUXMLU1("ORDER_CONTROL",$P(LINE,DL,2))
D BLDXML^MDUXMLU1("PLACER_ORDER_NUMBER",$P(LINE,DL,3))
D DATE^MDUXMLU1("TRANSACTION_DATE_TIME",$P(LINE,DL,10))
Q
OBR ; Parse the OBR
D XML^MDUXMLU1("<RESULTS>")
D BLDXML^MDUXMLU1("FILLER_ORDER_NUMBER",$P(LINE,DL,4))
D BLDXML^MDUXMLU1("PROCEDURE_INSTANCE_ID",$P(LINE,DL,4))
I $P(LINE,DL,5)'="" D ; Get the procedure type if there is one.
. N LINX
. S LINX=$P($P(LINE,DL,5),"^")
. I LINX="" S LINX=$P($P(LINE,DL,5),"^",2)
. D BLDXML^MDUXMLU1("PROCEDURE_TYPE",LINX)
. Q
D DATE^MDUXMLU1("DATE_OBSERVED",$P(LINE,DL,8))
I $P(LINE,DL,14)'="" D ; Pick up ICD9 code
. D XML^MDUXMLU1("<RELEVENT_CLINICAL>")
. D CODING^MDUXMLU1("ICD",$P(LINE,DL,14))
. D XML^MDUXMLU1("</RELEVENT_CLINICAL>")
. Q
I $P(LINE,DL,17)'="" D
. D XML^MDUXMLU1("<ORDERING_PROVIDER>")
. D NAME^MDUXMLU1($P(LINE,DL,17))
. D XML^MDUXMLU1("</ORDERING_PROVIDER>")
. Q
D BLDXML^MDUXMLU1("STATUS",$P(LINE,DL,26))
D BLDXML^MDUXMLU1("QUALITY_TIMING",$P(LINE,DL,28))
I $P(LINE,DL,37)'="" D DATE^MDUXMLU1("DATE_SCHEDULED",$P(LINE,DL,37))
I $P(LINE,DL,45)'="" D ; Pick up CPT code
. D XML^MDUXMLU1("<PROCEDURE_CODE>")
. D CODING^MDUXMLU1("CPT",$P(LINE,DL,45))
. D XML^MDUXMLU1("</PROCEDURE_CODE>")
. Q
Q
OBX ; Parse the OBX
D OBX^MDUXMLOX
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMDUXMLM 2877 printed Dec 13, 2024@01:44:23 Page 2
MDUXMLM ; HOIFO/WAA -Utilities for XML text ; 7/26/00
+1 ;;1.0;CLINICAL PROCEDURES;**6**;Apr 01, 2004;Build 102
+2 ; This routine will loop throught the HL7 Message as sent
+3 ; by the vendor and convert that message into XML for
+4 ; Processing by the gateway.
+5 ;
MSH ; Parse the MSH
+1 NEW MSGDATE
+2 DO XML^MDUXMLU1("<MESSAGE_HEADER>")
+3 DO BLDXML^MDUXMLU1("INTERNAL_APPLICATION","CLOB")
+4 SET DEVICE=$PIECE(LINE,DL,4)
+5 DO BLDXML^MDUXMLU1("INSTRUMENT_INSTANCE_ID",DEVICE)
+6 SET MSGDATE=$PIECE(LINE,DL,7)
IF MSGDATE=""
Begin DoDot:1
+7 DO NOW^%DTC
+8 SET MSGDATE=%
+9 SET MSGDATE=$$FTOHL7^MDHL7U2(MSGDATE)
+10 QUIT
End DoDot:1
+11 DO DATE^MDUXMLU1("TRANSMISSION_DATE_TIME",MSGDATE)
+12 DO BLDXML^MDUXMLU1("MESSAGE_CONTROL_ID",$PIECE(LINE,DL,10))
+13 DO BLDXML^MDUXMLU1("MESSAGE_TYPE",$PIECE(LINE,DL,9))
+14 DO BLDXML^MDUXMLU1("PRODUCTION_MODE",$SELECT($PIECE(LINE,DL,11)="P":"Y",1:"N"))
+15 DO BLDXML^MDUXMLU1("HL7_VERSION",$PIECE(LINE,DL,12))
+16 DO XML^MDUXMLU1("</MESSAGE_HEADER>")
+17 QUIT
PID ; Parse the PID
+1 NEW SSN
+2 DO XML^MDUXMLU1("<PATIENT_INFORMATION>")
+3 DO BLDXML^MDUXMLU1("PATIENT_ID",$PIECE(LINE,DL,4))
+4 DO XML^MDUXMLU1("<PATIENT_NAME>")
+5 DO NAME^MDUXMLU1($PIECE(LINE,DL,6))
+6 DO XML^MDUXMLU1("</PATIENT_NAME>")
+7 DO DATE^MDUXMLU1("DATE_OF_BIRTH",$PIECE(LINE,DL,8))
+8 DO BLDXML^MDUXMLU1("SEX",$PIECE(LINE,DL,9))
+9 SET SSN=$PIECE(LINE,DL,20)
IF SSN=""
SET SSN=$PIECE(LINE,DL,4)
+10 DO BLDXML^MDUXMLU1("SSN",$PIECE(LINE,DL,20))
+11 DO XML^MDUXMLU1("</PATIENT_INFORMATION>")
+12 QUIT
PV1 ; Parse the PV1
+1 DO BLDXML^MDUXMLU1("PATIENT_CLASS",$PIECE(LINE,DL,3))
+2 DO BLDXML^MDUXMLU1("PATIENT_LOCATION",$PIECE(LINE,DL,4))
+3 QUIT
ORC ; Parse the ORC
+1 SET ORDER=1
+2 DO XML^MDUXMLU1("<ORDER_INFORMATION>")
+3 DO BLDXML^MDUXMLU1("ORDER_CONTROL",$PIECE(LINE,DL,2))
+4 DO BLDXML^MDUXMLU1("PLACER_ORDER_NUMBER",$PIECE(LINE,DL,3))
+5 DO DATE^MDUXMLU1("TRANSACTION_DATE_TIME",$PIECE(LINE,DL,10))
+6 QUIT
OBR ; Parse the OBR
+1 DO XML^MDUXMLU1("<RESULTS>")
+2 DO BLDXML^MDUXMLU1("FILLER_ORDER_NUMBER",$PIECE(LINE,DL,4))
+3 DO BLDXML^MDUXMLU1("PROCEDURE_INSTANCE_ID",$PIECE(LINE,DL,4))
+4 ; Get the procedure type if there is one.
IF $PIECE(LINE,DL,5)'=""
Begin DoDot:1
+5 NEW LINX
+6 SET LINX=$PIECE($PIECE(LINE,DL,5),"^")
+7 IF LINX=""
SET LINX=$PIECE($PIECE(LINE,DL,5),"^",2)
+8 DO BLDXML^MDUXMLU1("PROCEDURE_TYPE",LINX)
+9 QUIT
End DoDot:1
+10 DO DATE^MDUXMLU1("DATE_OBSERVED",$PIECE(LINE,DL,8))
+11 ; Pick up ICD9 code
IF $PIECE(LINE,DL,14)'=""
Begin DoDot:1
+12 DO XML^MDUXMLU1("<RELEVENT_CLINICAL>")
+13 DO CODING^MDUXMLU1("ICD",$PIECE(LINE,DL,14))
+14 DO XML^MDUXMLU1("</RELEVENT_CLINICAL>")
+15 QUIT
End DoDot:1
+16 IF $PIECE(LINE,DL,17)'=""
Begin DoDot:1
+17 DO XML^MDUXMLU1("<ORDERING_PROVIDER>")
+18 DO NAME^MDUXMLU1($PIECE(LINE,DL,17))
+19 DO XML^MDUXMLU1("</ORDERING_PROVIDER>")
+20 QUIT
End DoDot:1
+21 DO BLDXML^MDUXMLU1("STATUS",$PIECE(LINE,DL,26))
+22 DO BLDXML^MDUXMLU1("QUALITY_TIMING",$PIECE(LINE,DL,28))
+23 IF $PIECE(LINE,DL,37)'=""
DO DATE^MDUXMLU1("DATE_SCHEDULED",$PIECE(LINE,DL,37))
+24 ; Pick up CPT code
IF $PIECE(LINE,DL,45)'=""
Begin DoDot:1
+25 DO XML^MDUXMLU1("<PROCEDURE_CODE>")
+26 DO CODING^MDUXMLU1("CPT",$PIECE(LINE,DL,45))
+27 DO XML^MDUXMLU1("</PROCEDURE_CODE>")
+28 QUIT
End DoDot:1
+29 QUIT
OBX ; Parse the OBX
+1 DO OBX^MDUXMLOX
+2 QUIT