ORMBLDOR ; SLC/MKB,ASMR/BL - Build outgoing OR msgs ; 10/16/15 1:36pm
;;3.0;ORDER ENTRY/RESULTS REPORTING;**97,390,538**;Dec 17, 1997;Build 1
;Per VA Directive 6402, this routine should not be modified.
;
EN ; -- Generic orders: Activity, Nursing, Diagnosis, Condition, Vitals
N OI,START,STOP,SCH,TXT
S OI=$G(ORDIALOG($$PTR("ORDERABLE ITEM"),1))
S TXT=$G(ORDIALOG($$PTR("FREE TEXT 1"),1))
S START=$P(OR0,U,8),STOP=$P(OR0,U,9),SCH=""
S:ORDG=$O(^ORD(100.98,"B","V/M",0)) SCH=$$VALUE^ORCSAVE2(IFN,"SCHEDULE")
S $P(ORMSG(4),"|",8)=U_SCH_"^^"_$$HL7DATE(START)_U_$$HL7DATE(STOP) ; QT
S ORMSG(5)="OBR||||"_$$USID^ORMBLD(OI)
S:$L(TXT) ORMSG(6)="NTE|1|L|"_TXT ; order text?
Q
;
ADT ; -- M.A.S. event requests
Q N PROV,PROV1,ORIFN
S PROV=+$G(ORDIALOG($$PTR("PROVIDER"),1)) I 'PROV D EN Q
S PROV1=+$G(ORDIALOG($$PTR("PROVIDER 1"),1)),PKG="DGPM"
S $P(ORMSG(1),"|",5)="M.A.S.",$P(ORMSG(1),"|",9)="ADT"
K ORMSG(4) S ORMSG(4)=ORMSG(3),ORMSG(3)=ORMSG(2)
S ORMSG(2)="EVN|A08|"_$$HL7DATE($$NOW^XLFDT)
S $P(ORMSG(4),"|",8)=PROV
S:PROV1 ORMSG(5)="ZDG|"_PROV1
S ORIFN=+IFN D NW^ORMORG ; set status, start date
Q
;
PTR(X) ; -- Returns ptr value of prompt X in #101.41
Q +$O(^ORD(101.41,"AB",$E("OR GTX "_X,1,63),0))
;
HL7DATE(D) ; -- FM->HL7 format
Q $$FMTHL7^XLFDT(D) ;**97
;
COMP(IFN) ; -- send message for completed orders
N OR0,ORMSG S OR0=$G(^OR(100,+IFN,0))
S ORMSG(1)=$$MSH^ORMBLD("ORM","OR"),ORMSG(2)=$$PID^ORMBLD($P(OR0,U,2))
S ORMSG(3)=$$PV1^ORMBLD($P(OR0,U,2),$P(OR0,U,12),+$P(OR0,U,10))
S ORMSG(4)="ORC|SC|"_+IFN_"^OR|"_+IFN_"^OR||CM||||||"_DUZ_"||||"_$$FMTHL7^XLFDT($$NOW^XLFDT)
D MSG^XQOR("OR EVSEND VPR",.ORMSG)
Q
;
VER(IFN) ; -- Send msg for verified orders
N OR0,ORMSG S OR0=$G(^OR(100,+IFN,0))
S ORMSG(1)=$$MSH^ORMBLD("ORM","OR"),ORMSG(2)=$$PID^ORMBLD($P(OR0,U,2))
S ORMSG(3)=$$PV1^ORMBLD($P(OR0,U,2),$P(OR0,U,12),+$P(OR0,U,10))
S ORMSG(4)="ORC|ZV|"_IFN_"^OR|"_$G(^OR(100,+IFN,4))_U_$$NMSP^ORCD($P(OR0,U,14))_"||||||||"_DUZ_"||||"_$$FMTHL7^XLFDT($$NOW^XLFDT)
D MSG^XQOR("OR EVSEND VPR",.ORMSG)
Q
;
MSG(IFN,CC) ; -- send message for updated orders
; Can be used for any change that doesn't fire another application event
N OR0,OR3,STS,ORPKG,ORMSG
S IFN=$G(IFN),CC=$G(CC,"ZZ")
S OR0=$G(^OR(100,+IFN,0)),OR3=$G(^(3))
S STS=+$P(OR3,U,3) Q:STS=10!(STS=11) ;do NOT post unreleased orders
S ORPKG=$$NMSP^ORCD($P(OR0,U,14))
S ORMSG(1)=$$MSH^ORMBLD("ORM","OR"),ORMSG(2)=$$PID^ORMBLD($P(OR0,U,2))
S ORMSG(3)=$$PV1^ORMBLD($P(OR0,U,2),$P(OR0,U,12),+$P(OR0,U,10))
S ORMSG(4)="ORC|"_CC_"|"_+IFN_"^OR|"_$G(^OR(100,+IFN,4))_U_ORPKG_"||||||||"_DUZ_"||||"_$$FMTHL7^XLFDT($$NOW^XLFDT)
D MSG^XQOR("OR EVSEND VPR",.ORMSG)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORMBLDOR 2716 printed Oct 16, 2024@18:32:22 Page 2
ORMBLDOR ; SLC/MKB,ASMR/BL - Build outgoing OR msgs ; 10/16/15 1:36pm
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**97,390,538**;Dec 17, 1997;Build 1
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ;
EN ; -- Generic orders: Activity, Nursing, Diagnosis, Condition, Vitals
+1 NEW OI,START,STOP,SCH,TXT
+2 SET OI=$GET(ORDIALOG($$PTR("ORDERABLE ITEM"),1))
+3 SET TXT=$GET(ORDIALOG($$PTR("FREE TEXT 1"),1))
+4 SET START=$PIECE(OR0,U,8)
SET STOP=$PIECE(OR0,U,9)
SET SCH=""
+5 if ORDG=$ORDER(^ORD(100.98,"B","V/M",0))
SET SCH=$$VALUE^ORCSAVE2(IFN,"SCHEDULE")
+6 ; QT
SET $PIECE(ORMSG(4),"|",8)=U_SCH_"^^"_$$HL7DATE(START)_U_$$HL7DATE(STOP)
+7 SET ORMSG(5)="OBR||||"_$$USID^ORMBLD(OI)
+8 ; order text?
if $LENGTH(TXT)
SET ORMSG(6)="NTE|1|L|"_TXT
+9 QUIT
+10 ;
ADT ; -- M.A.S. event requests
+1 QUIT
NEW PROV,PROV1,ORIFN
+2 SET PROV=+$GET(ORDIALOG($$PTR("PROVIDER"),1))
IF 'PROV
DO EN
QUIT
+3 SET PROV1=+$GET(ORDIALOG($$PTR("PROVIDER 1"),1))
SET PKG="DGPM"
+4 SET $PIECE(ORMSG(1),"|",5)="M.A.S."
SET $PIECE(ORMSG(1),"|",9)="ADT"
+5 KILL ORMSG(4)
SET ORMSG(4)=ORMSG(3)
SET ORMSG(3)=ORMSG(2)
+6 SET ORMSG(2)="EVN|A08|"_$$HL7DATE($$NOW^XLFDT)
+7 SET $PIECE(ORMSG(4),"|",8)=PROV
+8 if PROV1
SET ORMSG(5)="ZDG|"_PROV1
+9 ; set status, start date
SET ORIFN=+IFN
DO NW^ORMORG
+10 QUIT
+11 ;
PTR(X) ; -- Returns ptr value of prompt X in #101.41
+1 QUIT +$ORDER(^ORD(101.41,"AB",$EXTRACT("OR GTX "_X,1,63),0))
+2 ;
HL7DATE(D) ; -- FM->HL7 format
+1 ;**97
QUIT $$FMTHL7^XLFDT(D)
+2 ;
COMP(IFN) ; -- send message for completed orders
+1 NEW OR0,ORMSG
SET OR0=$GET(^OR(100,+IFN,0))
+2 SET ORMSG(1)=$$MSH^ORMBLD("ORM","OR")
SET ORMSG(2)=$$PID^ORMBLD($PIECE(OR0,U,2))
+3 SET ORMSG(3)=$$PV1^ORMBLD($PIECE(OR0,U,2),$PIECE(OR0,U,12),+$PIECE(OR0,U,10))
+4 SET ORMSG(4)="ORC|SC|"_+IFN_"^OR|"_+IFN_"^OR||CM||||||"_DUZ_"||||"_$$FMTHL7^XLFDT($$NOW^XLFDT)
+5 DO MSG^XQOR("OR EVSEND VPR",.ORMSG)
+6 QUIT
+7 ;
VER(IFN) ; -- Send msg for verified orders
+1 NEW OR0,ORMSG
SET OR0=$GET(^OR(100,+IFN,0))
+2 SET ORMSG(1)=$$MSH^ORMBLD("ORM","OR")
SET ORMSG(2)=$$PID^ORMBLD($PIECE(OR0,U,2))
+3 SET ORMSG(3)=$$PV1^ORMBLD($PIECE(OR0,U,2),$PIECE(OR0,U,12),+$PIECE(OR0,U,10))
+4 SET ORMSG(4)="ORC|ZV|"_IFN_"^OR|"_$GET(^OR(100,+IFN,4))_U_$$NMSP^ORCD($PIECE(OR0,U,14))_"||||||||"_DUZ_"||||"_$$FMTHL7^XLFDT($$NOW^XLFDT)
+5 DO MSG^XQOR("OR EVSEND VPR",.ORMSG)
+6 QUIT
+7 ;
MSG(IFN,CC) ; -- send message for updated orders
+1 ; Can be used for any change that doesn't fire another application event
+2 NEW OR0,OR3,STS,ORPKG,ORMSG
+3 SET IFN=$GET(IFN)
SET CC=$GET(CC,"ZZ")
+4 SET OR0=$GET(^OR(100,+IFN,0))
SET OR3=$GET(^(3))
+5 ;do NOT post unreleased orders
SET STS=+$PIECE(OR3,U,3)
if STS=10!(STS=11)
QUIT
+6 SET ORPKG=$$NMSP^ORCD($PIECE(OR0,U,14))
+7 SET ORMSG(1)=$$MSH^ORMBLD("ORM","OR")
SET ORMSG(2)=$$PID^ORMBLD($PIECE(OR0,U,2))
+8 SET ORMSG(3)=$$PV1^ORMBLD($PIECE(OR0,U,2),$PIECE(OR0,U,12),+$PIECE(OR0,U,10))
+9 SET ORMSG(4)="ORC|"_CC_"|"_+IFN_"^OR|"_$GET(^OR(100,+IFN,4))_U_ORPKG_"||||||||"_DUZ_"||||"_$$FMTHL7^XLFDT($$NOW^XLFDT)
+10 DO MSG^XQOR("OR EVSEND VPR",.ORMSG)
+11 QUIT