- MDHL7B ; HOIFO/WAA -Bi-directional interface routine ;7/23/01 11:41
- ;;1.0;CLINICAL PROCEDURES;**41**;Apr 01, 2004;Build 3
- ;
- ; IA# 5844 [Supported] Calls to XLFIPV
- ; This routine will take an entry from 702 and submit that data
- ; to the instrument that was indicated by the user
- ; SUB is a submit function
- ; MDD702 is the IEN for the Entry from 702 that
- ; needs to be sent.
- ; The function will return -1^Submission failed and why
- ; 0^Device not Bi-Directional
- ; 1^Study submitted
- ;
- ; 09/25/15 KAM Remedy ticket 1095728 patch MD*1*41 IPv6 modifications
- ;
- TMPSUB(MDD702) ; Process a submitted entry from user.
- ; drp 16-JUL-2002 13:30:32
- N DEVICE
- S DEVICE=+$P(^MDD(702,MDD702,0),U,11) Q:'DEVICE "0^No Device - TEST"
- I +$P($G(^MDS(702.09,DEVICE,.1)),U,3) Q "1^Study Submitted - TEST"
- Q "0^No Bi Di Cap - TEST"
- ;
- SUB(MDD702) ; Change to SUB when working
- N MDORFLG,RESULT,MSG,MDERROR
- S MDORFLG=1
- D EN1
- Q RESULT_U_MSG
- ;
- CANCEL(MDD702) ; Cancel Orders
- N MDORFLG,RESULT,MSG,MDERROR
- S MDORFLG=0
- D EN1
- Q RESULT_U_MSG
- ;
- EN1 ; The main entry point for the order to be processed.
- N DEVIEN,WORKING,MDIORD
- ; Get the device that will process this study
- ; Build an HL7 Message based in the device.
- ; After the device has processed the message this routine will
- ; update the status with in 702.
- S RESULT=1,MSG=$S(MDORFLG=1:"Study Submitted.",1:"Study Cancelled")
- I '$D(^MDD(702,MDD702,0)) S MSG="There is no study in 702 for entry "_MDD702_".",RESULT=-1
- I RESULT'=-1 D ;Get the device based on the CP def
- . S DEF=$P(^MDD(702,MDD702,0),U,4) I DEF<1 S RESULT=-1,MSG="No CP DEFINITION for this entry in file 702.01."
- . Q
- I RESULT'=-1 D ; Check to see that there is a device entered for this procedure
- . S DEVIEN=$P(^MDD(702,MDD702,0),U,11) I DEVIEN>0 Q
- . S RESULT=0,MSG="No DEVICE is defined." Q
- . Q
- ;
- ; DRP/16-MAY-2003 14:44:36 - Check for Loopback IP
- ; 09/25/15 KAM Remedy ticket 1095728 patch MD*1*41 IPv6 modifications
- ; Changed next line to use new IPv6 API
- ;
- ;I $$GET1^DIQ(702.09,DEVIEN_",",.14)="127.0.0.1" D Q
- I $$CONVERT^XLFIPV($$GET1^DIQ(702.09,DEVIEN_",",.14))=$$CONVERT^XLFIPV("127.0.0.1") D Q
- . D LOOPBACK^MDHL7XXX(MDD702,DEVIEN)
- . S RESULT=+$$GET1^DIQ(702.09,DEVIEN_",",.13,"I"),MSG="OK"
- . Q
- ;
- I RESULT>0 D ; Check to see that the device is a active and working
- . S WORKING="" D INST^MDHL7U2(DEVIEN,.WORKING)
- . Q:WORKING
- . S RESULT=-1,MSG="There is a problem with the device entry in file 702.09."
- . Q
- I RESULT>0 D ; Check to see if the device is bi-directional
- . N LINE
- . S LINE=$G(^MDS(702.09,DEVIEN,.1))
- . I $P(LINE,U,3)'=1 D Q ; The Device is not Bi-Directional
- . . S RESULT=0,MSG="Device not Bi-Directional."
- . . Q
- . ; The device is Bi-Directional and we are getting an MDIORD number.
- . S MDIORD=$$GETIORD^MDRPCOT1(MDD702) I MDIORD=-1 D
- . . S RESULT=-1,MSG="Unable to create Instrument Order Number."
- . . Q
- . Q
- I RESULT=1 D ; Process the message to be sent
- . D EN1^MDHL7BH ; Build HL7 Message
- . I $P(MDERROR,U,2) S RESULT="-1",MSG=$P(MDERROR,U,3)
- . Q
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMDHL7B 3192 printed Jan 18, 2025@02:43:58 Page 2
- MDHL7B ; HOIFO/WAA -Bi-directional interface routine ;7/23/01 11:41
- +1 ;;1.0;CLINICAL PROCEDURES;**41**;Apr 01, 2004;Build 3
- +2 ;
- +3 ; IA# 5844 [Supported] Calls to XLFIPV
- +4 ; This routine will take an entry from 702 and submit that data
- +5 ; to the instrument that was indicated by the user
- +6 ; SUB is a submit function
- +7 ; MDD702 is the IEN for the Entry from 702 that
- +8 ; needs to be sent.
- +9 ; The function will return -1^Submission failed and why
- +10 ; 0^Device not Bi-Directional
- +11 ; 1^Study submitted
- +12 ;
- +13 ; 09/25/15 KAM Remedy ticket 1095728 patch MD*1*41 IPv6 modifications
- +14 ;
- TMPSUB(MDD702) ; Process a submitted entry from user.
- +1 ; drp 16-JUL-2002 13:30:32
- +2 NEW DEVICE
- +3 SET DEVICE=+$PIECE(^MDD(702,MDD702,0),U,11)
- if 'DEVICE
- QUIT "0^No Device - TEST"
- +4 IF +$PIECE($GET(^MDS(702.09,DEVICE,.1)),U,3)
- QUIT "1^Study Submitted - TEST"
- +5 QUIT "0^No Bi Di Cap - TEST"
- +6 ;
- SUB(MDD702) ; Change to SUB when working
- +1 NEW MDORFLG,RESULT,MSG,MDERROR
- +2 SET MDORFLG=1
- +3 DO EN1
- +4 QUIT RESULT_U_MSG
- +5 ;
- CANCEL(MDD702) ; Cancel Orders
- +1 NEW MDORFLG,RESULT,MSG,MDERROR
- +2 SET MDORFLG=0
- +3 DO EN1
- +4 QUIT RESULT_U_MSG
- +5 ;
- EN1 ; The main entry point for the order to be processed.
- +1 NEW DEVIEN,WORKING,MDIORD
- +2 ; Get the device that will process this study
- +3 ; Build an HL7 Message based in the device.
- +4 ; After the device has processed the message this routine will
- +5 ; update the status with in 702.
- +6 SET RESULT=1
- SET MSG=$SELECT(MDORFLG=1:"Study Submitted.",1:"Study Cancelled")
- +7 IF '$DATA(^MDD(702,MDD702,0))
- SET MSG="There is no study in 702 for entry "_MDD702_"."
- SET RESULT=-1
- +8 ;Get the device based on the CP def
- IF RESULT'=-1
- Begin DoDot:1
- +9 SET DEF=$PIECE(^MDD(702,MDD702,0),U,4)
- IF DEF<1
- SET RESULT=-1
- SET MSG="No CP DEFINITION for this entry in file 702.01."
- +10 QUIT
- End DoDot:1
- +11 ; Check to see that there is a device entered for this procedure
- IF RESULT'=-1
- Begin DoDot:1
- +12 SET DEVIEN=$PIECE(^MDD(702,MDD702,0),U,11)
- IF DEVIEN>0
- QUIT
- +13 SET RESULT=0
- SET MSG="No DEVICE is defined."
- QUIT
- +14 QUIT
- End DoDot:1
- +15 ;
- +16 ; DRP/16-MAY-2003 14:44:36 - Check for Loopback IP
- +17 ; 09/25/15 KAM Remedy ticket 1095728 patch MD*1*41 IPv6 modifications
- +18 ; Changed next line to use new IPv6 API
- +19 ;
- +20 ;I $$GET1^DIQ(702.09,DEVIEN_",",.14)="127.0.0.1" D Q
- +21 IF $$CONVERT^XLFIPV($$GET1^DIQ(702.09,DEVIEN_",",.14))=$$CONVERT^XLFIPV("127.0.0.1")
- Begin DoDot:1
- +22 DO LOOPBACK^MDHL7XXX(MDD702,DEVIEN)
- +23 SET RESULT=+$$GET1^DIQ(702.09,DEVIEN_",",.13,"I")
- SET MSG="OK"
- +24 QUIT
- End DoDot:1
- QUIT
- +25 ;
- +26 ; Check to see that the device is a active and working
- IF RESULT>0
- Begin DoDot:1
- +27 SET WORKING=""
- DO INST^MDHL7U2(DEVIEN,.WORKING)
- +28 if WORKING
- QUIT
- +29 SET RESULT=-1
- SET MSG="There is a problem with the device entry in file 702.09."
- +30 QUIT
- End DoDot:1
- +31 ; Check to see if the device is bi-directional
- IF RESULT>0
- Begin DoDot:1
- +32 NEW LINE
- +33 SET LINE=$GET(^MDS(702.09,DEVIEN,.1))
- +34 ; The Device is not Bi-Directional
- IF $PIECE(LINE,U,3)'=1
- Begin DoDot:2
- +35 SET RESULT=0
- SET MSG="Device not Bi-Directional."
- +36 QUIT
- End DoDot:2
- QUIT
- +37 ; The device is Bi-Directional and we are getting an MDIORD number.
- +38 SET MDIORD=$$GETIORD^MDRPCOT1(MDD702)
- IF MDIORD=-1
- Begin DoDot:2
- +39 SET RESULT=-1
- SET MSG="Unable to create Instrument Order Number."
- +40 QUIT
- End DoDot:2
- +41 QUIT
- End DoDot:1
- +42 ; Process the message to be sent
- IF RESULT=1
- Begin DoDot:1
- +43 ; Build HL7 Message
- DO EN1^MDHL7BH
- +44 IF $PIECE(MDERROR,U,2)
- SET RESULT="-1"
- SET MSG=$PIECE(MDERROR,U,3)
- +45 QUIT
- End DoDot:1
- +46 QUIT