source: WorldVistAEHR/trunk/r/CLINICAL_PROCEDURES-MD/MDHL7X.m@ 1432

Last change on this file since 1432 was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 1.3 KB
RevLine 
[623]1MDHL7X ; HOIFO/WAA -Generate HL7 Error Message ; 06/08/00
2 ;;1.0;CLINICAL PROCEDURES;;Apr 01, 2004
3 ; Reference IA #1131 for ^XMB("NETNAME") access.
4 ; Reference IA #2165 for HLMA1 calls.
5 ; Reference IA #2729 for XMXAPI calls.
6 D GENERR,GENACK Q
7GENERR ; Generate error message
8 N TXT,INST,MG,XMTO,XMDUZ,XMSUBJ,XMBODY,N,X S MG=0
9 S INST=DEVIEN
10 I INST>1 S MG=$P($G(^MDS(702.09,INST,0)),"^",2)
11 I 'MG!('$$MG^MDHL7U2(MG)) S MG=$$FIND1^DIC(3.8,"","BX","MD DEVICE ERRORS") Q:'MG
12 S MG=$$GET1^DIQ(3.8,+MG_",",.01)
13 S XMTO="G."_MG_"@"_^XMB("NETNAME"),XMINSTR("FROM")=.5
14 I '$D(X) S X=ECODE(0)
15 S TXT(1)=ERRTX,TXT(2)=X,TXT(3)=" "
16 S N=3
17 I 'ECODE D ; This is to process Device errors
18 . N X
19 . S X=0
20 . F S X=$O(ECODE(X)) Q:X<1 S N=N+1,TXT(N)=ECODE(X)
21 . S N=N+1,TXT(N)=" "
22 . Q
23 F X="MSH","PID","OBR","OBX" I $D(SEG(X)) S N=N+1,TXT(N)=SEG(X)
24 S XMSUBJ="A Clinical Instrument HL7 Error has occurred."
25 S XMBODY="TXT"
26 D SENDMSG^XMXAPI(DUZ,XMSUBJ,XMBODY,XMTO,.XMINSTR)
27 Q
28GENACK ; Generate an HL7 ACK message
29 ; Reference IA #2165 for GENACK^HLMA1 call
30 N HLA,HLEID,HLEIDS,HLARYTYP,HLFORMAT,HLRESLTA
31 S HLA("HLA",1)="MSA"_HL("FS")_$S($D(ERRTX):"AR",1:"AA")_HL("FS")_HL("MID")_$S($D(ERRTX):HL("FS")_ERRTX,1:"")
32 S HLEID=HL("EID"),HLEIDS=HL("EIDS"),HLARYTYP="LM",HLFORMAT=1,HLRESLTA=HL("MID")
33 D GENACK^HLMA1(HLEID,HLMTIENS,HLEIDS,HLARYTYP,HLFORMAT,.HLRESTLA)
34 N ERRTX Q
Note: See TracBrowser for help on using the repository browser.