source: WorldVistAEHR/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNHL7.m@ 767

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

initial load of WorldVistAEHR

File size: 2.4 KB
Line 
1SPNHL7 ;WDE/SAN-DIEGO;validate then build the z segment
2 ;;2.0;Spinal Cord Dysfunction;**10,24**;01/02/97
3CHK(SPNFDFN) ;
4 ; ifn is the record number in SPN(154 it's dinumed to dpt
5 ;--------------------------------------------------------------------
6 ;check registration date
7 S SPNCHK=$$GET1^DIQ(154,SPNFDFN_",",.02)
8 I $G(SPNCHK)="" D ZAP Q
9 ;check registration status
10 S SPNCHK=$$GET1^DIQ(154,SPNFDFN_",",.03)
11 I $G(SPNCHK)="" D ZAP Q
12 ;check VA SCI STATUS
13 ;S SPNCHK=$$GET1^DIQ(154,SPNFDFN_",",2.6)
14 ;I $G(SPNCHK)="" D ZAP Q
15 ;check for etiology
16 ;D GETS^DIQ(154,SPNFDFN_",","4*","","SPNCHK")
17 ;I $D(SPNCHK)=0 D ZAP Q
18 ;the record passed the test and we want it
19CREATE ;this label is also called from the tag auto
20 K SPMSG
21 D INIT
22 I HLDAP="" D ZAP Q ;cant find the hl7 application
23 I $P($G(^HL(771,HLDAP,0)),U,2)'="a" D ZAP Q ;test for active/on
24 D EN^SPNHPID(SPNFDFN)
25 D EN^SPNHL1(SPNFDFN)
26 ;at this point we have the HL7 message in the msg arrary!
27 D SEND ;send will send the message off to the hl7 sftw
28ZAP ;
29 K SPMSG,X,Y,SPTMP,OBXCNT,SPLINE,DATA,CL,SPNOBR
30 K HL,HLA,SPNTMP,HLARYTYP,HLECH,HLFORMAT,HLFS,HLMTIEN,HLSAN,HLN,HLQ,HLRESLT
31 Q
32AUTO ;this tag is used for loading the AUSTIN system from a server request
33 ;this should never be ran from a site unless informed to.
34 S SPNIFN=0 F S SPNIFN=$O(^SPNL(154,SPNIFN)) Q:(SPNIFN="")!('+SPNIFN) D
35 . D CHK(SPNIFN) I $D(SPNCHK) D AUTO^SPNHL71
36 . K SPNCHK
37 . Q
38 Q
39INIT ;
40 ;
41 S HLDAP=$O(^HL(771,"B","SPN-HL7-APP",0))
42 Q:HLDAP="" ;cant find the hl7 application
43 Q:$P($G(^HL(771,HLDAP,0)),U,2)'="a" ;test for active/on
44 S HL="HL"
45 S PEIN=$O(^ORD(101,"B","SPN-HL7-SERVER",0))
46 D INIT^HLFNC2(PEIN,.HL,0)
47 S HLCOMP=$E(HL("ECH"),1),HLREP=$E(HL("ECH"),2),HLSUB=$E(HL("ECH"),4),HLFS=HL("FS"),HLQ=HL("Q"),HLECH=HL("ECH")
48 Q
49 ;-------------------------------------------------------------------
50SEND ;
51 S HLARYTYP="LM",HLFORMAT=1,HLMTIEN="",HLRESLT=""
52 S P=0 F S P=$O(SPMSG(P)) Q:P="" S HLA("HLS",P)=SPMSG(P)
53 D GENERATE^HLMA(PEIN,HLARYTYP,HLFORMAT,.HLRESLT,HLMTIEN,.HLP)
54 Q
55EXIT ;Exit point to clean up all var's
56 K CL,DATA,ETDAT,ETDATE,HL,HLA,HLARYTYP,HLDAP,HLDAP,HLECH,HLFORMAT,HLFS,HLMTIEN,HLN,HLP,HLQ,HLREP,HLRESLT,HLSAN,HLSUB,INJURY,INJURY,OBXCNT,PEIN,SPD,SPDATA,SPDD,SPDT,SPDTYPE,SPLINE,SPMSG,SPNCAUSE,SPNCHK,SPND,SPND1,SPNDD
57 K SPNDOC,SPNDT,SPNET,SPNETIOL,SPNFREQ,SPNLDT,SPNLET,SPNLEXAM,SPNLFAC,SPNLFAM,SPNLSEEN,SPNOBR,SPNRDT,SPNTBL,SPNTMP,SPTMP,SPX
Note: See TracBrowser for help on using the repository browser.