source: WorldVistAEHR/trunk/r/CLINICAL_PROCEDURES-MD/MDHL7MCX.m@ 1080

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

initial load of WorldVistAEHR

File size: 1.2 KB
Line 
1MDHL7MCX ; HIRMFO/WAA - Generate HL7 Error Message for MEDICINE ; [05-07-2001 10:38]
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 ; Reference IA #10111 call to file 3.8 (Read w/FM).
7 D BULL,GENACK S MDERROR=1 Q
8BULL ; Generate error message
9 I $G(MDERROR,0)=0 S MDERROR=1
10 S INST=$O(^MCAR(690.7,"B",MCAPP,0)) Q:'INST
11 S MG=$P($G(^MCAR(690.7,INST,0)),"^",2) Q:'MG
12 S MG=$$GET1^DIQ(3.8,MG_",",.01) Q:MG=""
13 S XMTO="G."_MG_"@"_^XMB("NETNAME"),XMINSTR("FROM")=.5
14 S TXT(1)=ERRTX,TXT(2)=X,TXT(3)=" "
15 S N=3 F X="MSH","PID","OBR","OBX" I $D(SEG(X)) S N=N+1,TXT(N)=SEG(X)
16 S XMSUBJ="A Clinical Instrument HL7 Error has occurred."
17 S XMBODY="TXT"
18 D SENDMSG^XMXAPI(DUZ,XMSUBJ,XMBODY,XMTO,.XMINSTR)
19 K TXT Q
20GENACK ; Generate an HL7 ACK message
21 I $G(MDERROR,0)=0 Q:$G(MDFLAG)=1 ; CP is the interface to HL7 at this point
22 S HLA("HLA",1)="MSA"_HL("FS")_$S($D(ERRTX):"AR",1:"AA")_HL("FS")_HL("MID")_$S($D(ERRTX):HL("FS")_ERRTX,1:"")
23 S HLEID=HL("EID"),HLEIDS=HL("EIDS"),HLARYTYP="LM",HLFORMAT=1,HLRESLTA=HL("MID")
24 D GENACK^HLMA1(HLEID,HLMTIENS,HLEIDS,HLARYTYP,HLFORMAT,.HLRESTLA)
25 K ERRTX Q
Note: See TracBrowser for help on using the repository browser.