ORMBLDOR ; SLC/MKB - Build outgoing OR msgs ;11/17/00 11:11
;;3.0;ORDER ENTRY/RESULTS REPORTING;**97**;Dec 17, 1997
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
ORMBLDOR ; SLC/MKB - Build outgoing OR msgs ;11/17/00 11:11
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**97**;Dec 17, 1997
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)