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

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

initial load of FOIAVistA 6/30/08 version

File size: 2.1 KB
Line 
1DGRUGA02 ;ALB/GRR - HL7 ADT A02 MESSAGE BUILDER ;8/5/99 15:26
2 ;;5.3;Registration;**190,312**;Aug 13, 1993
3 ;
4 ;This routine will build a ADT A02 (Transfer) HL7 message for an inpatient.
5 ;
6EN(DFN,DGMIEN,DGARRAY) ;Entry point of routine
7 ;DFN - Patient Internal Entry Number
8 ;DGMIEN - Patient Movement Internal Entry Number
9 ;DGARRAY - Name of output array by reference where built message will be contained.
10 ;
11 ;The HL7 variables must be initialized before calling this routine!
12 ;HL("FS"),HL("ECH"),HLFS,HLECH, and HLQ are used by segment builders called by this routine
13 ;
14 N DGEDT,DGPV1,DGCNT,DGMDT,DGCDT,DGOADT,DGICD,DGICDCNT,DGIN,DGINCNT S DGCNT=0
15 Q:DGARRAY="" ;Required output variable name was not passed
16 K @DGARRAY ;Kill output array to insure erronuous data does not exist
17 Q:DGMIEN=""
18 S DGMDT=$$GET1^DIQ(405,DGMIEN,".01","I")
19 D NOW^%DTC S DGCDT=% ;Get current date/time
20 N DGBS I ($P(DGPMA,"^",6)=$P(DGPMP,"^",6)),($P(DGPMA,"^",7)'=$P(DGPMP,"^",7)) S DGEDT=DGCDT,DGBS=1 ;use current date/time because its a bed switch
21 E S DGEDT=DGMDT,DGBS=0 ;if not bed switch use movement date/time
22 S DGCNT=DGCNT+1 ;Increment node counter by one for first segment
23 S @DGARRAY@(DGCNT)=$$EVN^VAFHLEVN("A02","05",DGEDT) ;Create Event segment and store in output array
24 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
25 S @DGARRAY@(DGCNT)=$$EN^VAFCPID(DFN,",2,5,7,8,10,11,13,16,17,19,23,29",1) ;Create PID segment using segment sequence numbers passed and store in output array
26 S DGMDT=$$GET1^DIQ(405,DGMIEN,".01","I") ;Retrieve Movement Date/Time
27 S DGCNT=DGCNT+1 ;Increment node counter by one to store next segment
28 S DGPV1=$$IN^VAFHLPV1(DFN,DGMDT,",2,3,6,7,10,17,44,",$G(DGMIEN),"","") ;Create the PV1 segment based on sequence numbers passed, and store in output array
29 S DGOADT=$$CKADMIT^DGRUUTL1(DFN)
30 I DGOADT]"" S $P(DGPV1,HL("FS"),45)=$$HLDATE^HLFNC(DGOADT) I DGTYPE=1,'DGBS S $P(@DGARRAY@(1),HL("FS"),7)=$$HLDATE^HLFNC(DGOADT)
31 S DGPV1=$$DOCID^DGRUUTL(DGPV1)
32 S @DGARRAY@(DGCNT)=$$LOCTRAN^DGRUUTL1(DGPV1) ;Translate Ward and room-Bed name if needed, then store into array
33 Q
Note: See TracBrowser for help on using the repository browser.