source: FOIAVistA/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VAFCA04.m@ 1123

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

initial load of FOIAVistA 6/30/08 version

File size: 4.5 KB
Line 
1VAFCA04 ;ALB/RJS-Creates the Registration Message ; 26 Mar 2003 3:13 PM
2 ;;5.3;Registration;**91,209,149,261,298,415,484,508**;Aug 13, 1993
3 ;
4 ;07/07/00 ACS - Added sequence 21 (physical treating specialty - ward
5 ;location) and sequence 39 (facility+suffix) to the inpatient string
6 ;of fields. Added sequence 39 to the outpatient string of fields.
7 ;
8EN(DFN,VAFCDATE,USER,PIVOTPTR) ;
9 Q:($G(DFN)="")!($G(VAFCDATE)="") "-1^Missing required parameter(s)"
10 N ERR,VCCI,SITE,FS,VAFCDT,VAFHPIV,REP,DGREL,DGINC,DGINR,DGDEP,VAFSTR
11 N ICN,CHKSUM,SETICN,SETLOC,HLA,HLRST,PV1,LIN
12 ;
13 ;check HL7 V2.3 messaging flag
14 N SEND S SEND=$P($$SEND^VAFHUTL(),"^",2)
15 Q:SEND=0 "-1^Stop HL7 V2.3 messaging flag is set"
16 ;
17 S USER=+$G(USER)
18 I 'USER,$D(DUZ) S USER=DUZ
19 I 'USER,'$D(DUZ) S USER=0
20 S PIVOTPTR=+$G(PIVOTPTR)
21 I 'PIVOTPTR D
22 .S VAFHPIV=+$$PIVNW^VAFHPIVT(DFN,VAFCDATE,3,DFN_";DPT(")
23 .Q:+VAFHPIV<0
24 .S PIVOTPTR=+$O(^VAT(391.71,"D",VAFHPIV,0))
25 ;
26 Q:+$G(VAFHPIV)<0 "-1^Could Not Create ADT/HL7 Pivot file entry"
27 K ERR
28 ;log edited field(s) in the ADT/HL7
29 I $D(VAFCFLDS) D
30 . S VAFCFLDS=$$PROCESS^VAFCDD01()
31 . Q:VAFCFLDS'=-1
32 . D REGEDIT^VAFCDD01(PIVOTPTR,VAFCFLDS)
33 ;Messaging flag set to SUSPEND - flag entry in ADT/HL7 Pivot file
34 ; for transmission and quit
35 I SEND=2 D TRANSMIT^VAFCDD01(PIVOTPTR) Q 1
36 K VAFCFLDS
37 D INIT^HLFNC2("VAFC ADT-A04 SERVER",.HL)
38 Q:$G(HL)]"" "-1^VAFC A04 SERVER NOT DEFINED PROPERLY"
39 S FS=HL("FS"),REP=$E(HL("ECH"))
40 ;
41 S VAFCDT=$$HLDATE^HLFNC(VAFCDATE,"TS")
42 S HLA("HLS",1)="EVN"_HLFS_"A04"_HLFS_VAFCDT_HLFS_HLFS_HLFS_USER_REP
43 S DIC="^VA(200,",DIC(0)="MZO",X="`"_USER D ^DIC K DIC
44 N DGNAME S DGNAME("FILE")=200,DGNAME("IENS")=USER,DGNAME("FIELD")=.01
45 I USER'=0 S HLA("HLS",1)=HLA("HLS",1)_$$HLNAME^XLFNAME(.DGNAME,"",$E($G(HLECH)))
46 ; ^ possible to not have a user defined
47 S LIN=1
48 K Y S VAFSTR=$$COMMANUM^VAFCADT2(1,9)_",10B,11PC,"_$$COMMANUM^VAFCADT2(13,21)_",22B,"_$$COMMANUM^VAFCADT2(23,30)
49 S HLA("HLS",$$ADD(.LIN,1))=$$EN^VAFCPID(DFN,VAFSTR)
50 ;CHECK IF PATIENT HAS AN ICN
51 I $P(HLA("HLS",LIN),HLFS,3)=HLQ D
52 . N X S X="MPIF001" X ^%ZOSF("TEST") Q:'$T
53 . ; if patient does not have an ICN still pass HLQ
54 . S ICN=$$GETICN^MPIF001(DFN)
55 . I +ICN>0 S $P(HLA("HLS",LIN),HLFS,3)=ICN
56 MERGE HLA("HLS",LIN)=VAFPID K VAFPID
57 S VAFSTR=$$COMMANUM^VAFCADT2(1,12)
58 S HLA("HLS",$$ADD(.LIN,1))=$$EN^VAFHLPD1(DFN,VAFSTR)
59 S VAFHPIV=$P($G(^VAT(391.71,PIVOTPTR,0)),"^",2)
60 Q:VAFHPIV'>0 "-1^COULDN'T FIND PIVOT ENTRY"
61 I $G(^DPT(DFN,.1))]"" D
62 . S PV1=$$EN^VAFHAPV1(DFN,VAFCDATE,",2,3,7,8,10,18,21,39,44,45,50")
63 . S HLA("HLS",$$ADD(.LIN,1))=PV1
64 . S VAFSTR=$$COMMANUM^VAFCADT2(1,4)
65 . N HLAROL
66 . D BLDROL^VAFCROL("HLAROL",DFN,VAFCDATE,VAFSTR,VAFHPIV)
67 . N I,J,K
68 . S I=""
69 . F K=1:1 S I=+$O(HLAROL(I)) Q:('I) D
70 . . S J=""
71 . . F S J=$O(HLAROL(I,J)) Q:(J="") D
72 . . . S:('J) HLA("HLS",LIN+K)=HLAROL(I,J)
73 . . . S:(J) HLA("HLS",LIN+K,J)=HLAROL(I,J)
74 . S LIN=LIN+K-1
75 E D
76 . S PV1=$$OPV1^VAFHCPV(DFN,+VAFHPIV,VAFCDATE,DFN_";DPT(",",2,3,7,18,39,45,50",1)
77 . S HLA("HLS",$$ADD(.LIN,1))=PV1
78 S HLA("HLS",$$ADD(.LIN,1))=$$EN^VAFHLOBX(DFN)
79 S VAFSTR=$$COMMANUM^VAFCADT2(1,21)
80 S HLA("HLS",$$ADD(.LIN,1))=$$EN^VAFHLZPD(DFN,VAFSTR)
81 S VAFSTR=$$COMMANUM^VAFCADT2(1,5)
82 S HLA("HLS",$$ADD(.LIN,1))=$$EN^VAFHLZSP(DFN)
83 S VAFSTR=$$COMMANUM^VAFCADT2(1,22)
84 S HLA("HLS",$$ADD(.LIN,1))=$$EN^VAFHLZEL(DFN,VAFSTR)
85 S HLA("HLS",$$ADD(.LIN,1))=$$EN^VAFHLZCT(DFN,"1,2,3,4,5,6,7,8,9")
86 S HLA("HLS",$$ADD(.LIN,1))=$$EN^VAFHLZEM(DFN,"1,2,3,4,5,6,7,8")
87 S HLA("HLS",$$ADD(.LIN,1))="ZFF"_HL("FS")_2_HL("FS")_$P($G(^VAT(391.71,+$G(PIVOTPTR),2)),U)
88 D ALL^DGMTU21(DFN,"V",VAFCDATE,"R")
89 S VAFSTR=$$COMMANUM^VAFCADT2(1,13)
90 S HLA("HLS",$$ADD(.LIN,1))=$$EN^VAFHLZIR(+$G(DGINR("V")),VAFSTR,1)
91 S VAFSTR=$$COMMANUM^VAFCADT2(1,10)
92 S HLA("HLS",$$ADD(.LIN,1))=$$EN^VAFHLZEN(DFN,VAFSTR,1,HL("Q"),HL("FS"))
93 D GENERATE^HLMA("VAFC ADT-A04 SERVER","LM",1,.HLRST,"",.HL)
94 ;Store result in pivot file
95 S HLRST=$S(+HLRST:HLRST,1:$P(HLRST,U,3))
96 I +HLRST>0 D MESSAGE^VAFCDD01(PIVOTPTR,+HLRST)
97 D FILERM^VAFCUTL($O(^VAT(391.71,"D",+VAFHPIV,0)),HLRST)
98 ;
99EX ;
100 Q 1
101 ;
102ADD(LINE,COUNTER) ;Increments Line = Line + Counter
103 ;Input : LINE - Line number
104 ; COUNTER - Increment number
105 ;Output : Updated LINE value
106 ;
107 S LINE=$G(LINE),COUNTER=$G(COUNTER)
108 S LINE=LINE+COUNTER
109 Q LINE
110 ;
111HL7A04(PIVOTNUM,IEN) ;
112 ;A new Registration was created capture the key demographic data.
113 ;Create an HL7 V2.3 entry in the ADT/HL PIVOT file so that the
114 ;demographic data can be broadcasted.
115 ; VAFCFLDS is set in routine VAFCDD01. It contains the
116 ; fields that were edited.
Note: See TracBrowser for help on using the repository browser.