Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ORMBLDGM

ORMBLDGM.m

Go to the documentation of this file.
ORMBLDGM ;SLC/MKB-Build outgoing GMR* ORM msgs ;Sep 10, 2020@14:16:56
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**26,68,97,190,195,280,361,350,519**;Dec 17, 1997;Build 36
 ;;ICR
 ;;XLFDT-10103
 ;;CODECS^ICDEX-5747
HL7DATE(DATE) ; -- FM -> HL7 format
 Q $$FMTHL7^XLFDT(DATE)  ;**97
 ;
PTR(NAME) ; -- Returns ptr value of prompt in Dialog file
 Q $O(^ORD(101.41,"AB",$E("OR GTX "_NAME,1,63),0))
 ;
CSLT ; -- Segments for new Consult order
 N OI,WP,URG,CATG,PLACE,ATTN,DIAG,CODE,QT,I,J,USID,CTYPE,RSERV,Z,CLIND,X,Y,ORCODE,NLTD,DSTID,TT,OK
 S OI=$G(ORDIALOG($$PTR("ORDERABLE ITEM"),1))
 S CTYPE=$G(ORDIALOG($$PTR("FREE TEXT OI"),1))
 S RSERV=$G(ORDIALOG($$PTR("REQUEST SERVICE"),1))
 S WP=$$PTR("WORD PROCESSING 1"),URG=+$G(ORDIALOG($$PTR("URGENCY"),1))
 S CATG=$G(ORDIALOG($$PTR("CATEGORY"),1))
 S PLACE=$G(ORDIALOG($$PTR("PLACE OF CONSULTATION"),1))
 S ATTN=$G(ORDIALOG($$PTR("PROVIDER"),1))
 S DIAG=$G(ORDIALOG($$PTR("FREE TEXT"),1))
 S CODE=$G(ORDIALOG($$PTR("CODE"),1))
 S DSTID=$G(ORDIALOG($$PTR("DST ID"),1))
 S X=$G(ORDIALOG($$PTR("CLINICALLY INDICATED DATE"),1)),%DT="TX" D ^%DT S:Y>0 CLIND=$$HL7DATE(Y) ;WAT/280/350
CS1 S QT="^^^"_$G(CLIND)_"^^"_$P($G(^ORD(101.42,+URG,0)),U,2),$P(ORMSG(4),"|",8)=QT ;WAT/280
 S $P(ORMSG(3),"|",3)=CATG S:PLACE="C" PLACE="OC"
 S USID=$$USID^ORMBLD(OI) ;S:$L(CTYPE) $P(USID,U,5)=CTYPE
 S ORMSG(5)="OBR||||"_USID_"||||||||||||||"_PLACE_"|"_ATTN,Z=5
 ; Create DG1 & ZCL segment(s) for Billing Awareness (BA) project
 D DG1^ORWDBA3($G(IFN),"Z",5)
 I RSERV'>0,$P(USID,U,6)="99CON" S RSERV=+$P(USID,U,4)
 S:RSERV Z=Z+1,ORMSG(Z)="ZSV|^^^"_+RSERV_U_$$GET1^DIQ(123.5,+RSERV_",",.01)_"^99CON|"_CTYPE
 I $L(DSTID) D
 . S TT="",OK=0
 . F  S TT=$O(ORMSG(TT),-1) Q:(TT="")!(OK=1)  I $P(ORMSG(TT),"|")="ZSV" D
 . . S ORMSG(TT)=ORMSG(TT)_"|"_DSTID,OK=1
 . S:OK=0 Z=Z+1,ORMSG(Z)="ZSV|^^^^^||"_DSTID
 S I=0,J=+$O(^TMP("ORWORD",$J,WP,1,0)),Z=Z+1 ; get first line
 S ORMSG(Z)="OBX|1|TX|2000.02^REASON FOR REQUEST^AS4||"_$G(^TMP("ORWORD",$J,WP,1,J,0))
 F  S J=$O(^TMP("ORWORD",$J,WP,1,J)) Q:J'>0  S I=I+1,ORMSG(Z,I)=^(+J,0)
 I $L(DIAG) D
 . N TYPE,VALUE S TYPE="TX",VALUE=DIAG
 . I $L(CODE) D
 .. S TYPE="CE",ORCODE=$$CODECS^ICDEX(CODE,"80")
 .. S ORCODE=$S($P(ORCODE,U)=1:"I9C",1:"I10")
 .. S VALUE=CODE_U_DIAG_U_ORCODE
 . S Z=Z+1,ORMSG(Z)="OBX|2|"_TYPE_"|^PROVISIONAL DIAGNOSIS^||"_VALUE
 Q