[613] | 1 | ORMBLDRA ; SLC/MKB - Build outgoing Radiology ORM msgs ;05/30/06 11:30AM
|
---|
| 2 | ;;3.0;ORDER ENTRY/RESULTS REPORTING;**75,97,190,195,243**;Dec 17, 1997;Build 242
|
---|
| 3 | HL7DATE(DATE) ; -- FM -> HL7 format
|
---|
| 4 | Q $$FMTHL7^XLFDT(DATE) ;**97
|
---|
| 5 | ;
|
---|
| 6 | PTR(NAME) ; -- Returns ptr value of prompt in Dialog file
|
---|
| 7 | Q $O(^ORD(101.41,"AB",$E("OR GTX "_NAME,1,63),0))
|
---|
| 8 | ;
|
---|
| 9 | EN ; -- Segments for new Radiology order
|
---|
| 10 | N ORSEX,OI,START,IP,URG,ILOC,MODE,CATG,PREOP,PREG,MODS,CLHIST,PROV,REASON,QT,I,J,Z,J0,LIN,RA75
|
---|
| 11 | S OI=$G(ORDIALOG($$PTR("ORDERABLE ITEM"),1))
|
---|
| 12 | S START=$P($G(^OR(100,IFN,0)),U,8),IP=$G(ORDIALOG($$PTR("YES/NO"),1))
|
---|
| 13 | S URG=$P($G(^ORD(101.42,+$G(ORDIALOG($$PTR("URGENCY"),1)),0)),U,2)
|
---|
| 14 | S ILOC=$G(ORDIALOG($$PTR("IMAGING LOCATION"),1))
|
---|
| 15 | S MODE=$G(ORDIALOG($$PTR("MODE OF TRANSPORT"),1))
|
---|
| 16 | S CATG=$G(ORDIALOG($$PTR("CATEGORY"),1))
|
---|
| 17 | S PREOP=$G(ORDIALOG($$PTR("PRE-OP SCHEDULED DATE/TIME"),1))
|
---|
| 18 | S PREG=$G(ORDIALOG($$PTR("PREGNANT"),1))
|
---|
| 19 | S REASON=$G(ORDIALOG($$PTR("STUDY REASON"),1))
|
---|
| 20 | S MODS=$$PTR("MODIFIERS"),CLHIST=$$PTR("WORD PROCESSING 1")
|
---|
| 21 | S MODS=$$MULT(MODS) S:ILOC ILOC=ILOC_U_$P($G(^RA(79.1,+ILOC,0)),U)
|
---|
| 22 | S MODE=$S(MODE="A":"WALK",MODE="P":"PORT",MODE="S":"CART",1:"WHLC")
|
---|
| 23 | S PREG=$S(PREG="Y":"YES",PREG="N":"NO",1:"UNKNOWN")
|
---|
| 24 | S QT="^^^"_$$HL7DATE(START)_"^^"_URG,$P(ORMSG(4),"|",8)=QT
|
---|
| 25 | S PROV=+$G(ORDIALOG($$PTR("PROVIDER"),1)) S:PROV $P(ORMSG(4),"|",12)=PROV
|
---|
| 26 | S RA75=$$PATCH^XPDUTL("RA*5.0*75")
|
---|
| 27 | S ORMSG(5)="OBR||||"_$$USID^ORMBLD(OI)_"||||||||"_$S(IP:"isolation",1:"")_"||||||"_MODS_"|"_ILOC_"|||||||||||"_MODE,I=5
|
---|
| 28 | I +RA75 S $P(ORMSG(5),"|",32)=U_REASON
|
---|
| 29 | ; Create DG1 & ZCL segment(s) for Billing Awareness (BA) Project
|
---|
| 30 | D DG1^ORWDBA3($G(IFN),"I",I)
|
---|
| 31 | OBX S J0=0
|
---|
| 32 | I 'RA75 D
|
---|
| 33 | . S I=I+1,ORMSG(I)="OBX|1|TX|2000.02^CLINICAL HISTORY^AS4|1|"_"REASON FOR STUDY: "_REASON
|
---|
| 34 | . S $P(LIN,"-",55)=""
|
---|
| 35 | . S I=I+1,ORMSG(I)="OBX|2|TX|2000.02^CLINICAL HISTORY^AS4|1|"_LIN
|
---|
| 36 | . S J0=2
|
---|
| 37 | S J=0 F S J=$O(^TMP("ORWORD",$J,CLHIST,1,J)) Q:J'>0 S I=I+1,J0=J0+1,ORMSG(I)="OBX|"_J0_"|TX|2000.02^CLINICAL HISTORY^AS4|1|"_^(J,0)
|
---|
| 38 | S ORSEX=$P($G(^DPT(+ORVP,0)),U,2)
|
---|
| 39 | S:ORSEX="F" I=I+1,ORMSG(I)="OBX|1|TX|2000.33^PREGNANT^AS4||"_PREG
|
---|
| 40 | S:PREOP I=I+1,ORMSG(I)="OBX|1|TS|^PRE-OP SCHEDULED DATE/TIME||"_$$HL7DATE(PREOP)
|
---|
| 41 | I "CS"[CATG S Z=$$PTR("CONTRACT/SHARING SOURCE"),I=I+1,ORMSG(I)="OBX|1|CE|34^CONTRACT/SHARING SOURCE^99DD||"_+$G(ORDIALOG(Z,1))_U_$P($G(^DIC(34,+$G(ORDIALOG(Z,1)),0)),U)
|
---|
| 42 | I CATG="R" S Z=$$PTR("RESEARCH SOURCE"),I=I+1,ORMSG(I)="OBX|1|TX|^RESEARCH SOURCE||"_$G(ORDIALOG(Z,1))
|
---|
| 43 | Q
|
---|
| 44 | MULT(M) ; -- Returns string of MODIFIER~MODIFIER~...
|
---|
| 45 | N I,X S X="" Q:'$O(ORDIALOG(M,0)) X
|
---|
| 46 | S I=$O(ORDIALOG(M,0)),X=$P($G(^RAMIS(71.2,+ORDIALOG(M,I),0)),U)
|
---|
| 47 | F S I=$O(ORDIALOG(M,I)) Q:I'>0 S X=X_"~"_$P($G(^RAMIS(71.2,+ORDIALOG(M,I),0)),U)
|
---|
| 48 | Q X
|
---|