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

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

initial load of WorldVistAEHR

File size: 2.3 KB
Line 
1DGRUGA12 ;ALB/GRR - HL7 ADT A12 MESSAGE BUILDER ;8/5/99 15:33
2 ;;5.3;Registration;**190**;Aug 13, 1993
3 ;
4 ;This routine will build a ADT A12 (Cancel 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 DGPV1,DGHMDT,DGCNT,DGMDT,DGCDT,DGOADT,DGICD,DGICDCNT,DGIN,DGINCNT,DGCTRAN,DGHMDT 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=$S($G(DGCTRAN)=1:+DGPMP,1:$$GET1^DIQ(405,DGMIEN,".01","I")),DGHMDT=$$HLDATE^HLFNC(DGMDT)
19 D NOW^%DTC S DGCDT=$$HLDATE^HLFNC(%) ;Get current date/time and convert to HL7 format
20 S DGCNT=DGCNT+1 ;Increment node counter by one for first segment
21 S @DGARRAY@(DGCNT)=$$EVN^VAFHLEVN("A12","05",DGMDT) ;Create Event segment and store in output array (Use current date/time for cancel)
22 S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
23 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
24 S DGCNT=DGCNT+1 ;Increment node counter by one to store next segment
25 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
26 S DGOADT=$$CKADMIT^DGRUUTL1(DFN) ;check if integrated site get original admit date/time
27 I DGOADT]"" S $P(DGPV1,HL("FS"),45)=$$HLDATE^HLFNC(DGOADT)
28 I $G(DGCTRAN)=1 S $P(DGPV1,HL("FS"),4)=$P(DGPV1,HL("FS"),7)
29 S DGPV1=$$DOCID^DGRUUTL(DGPV1)
30 S @DGARRAY@(DGCNT)=$$LOCTRAN^DGRUUTL1(DGPV1) ;Translate Ward and Room-Bed name if needed, store into array
31 D IN^VAFHLDG1(DFN,DGMIEN,",2,3,5,","DGICD",DGMDT) ;Create DG1 segments if data exist and store in temporary array
32 I $O(DGICD(0))>0 D ;DG1 segments were built
33 .S DGICDCNT=0 F S DGICDCNT=$O(DGICD(DGICDCNT)) Q:DGICDCNT="" S DGCNT=DGCNT+1,@DGARRAY@(DGCNT)=DGICD(DGICDCNT,0) ;Loop through temporary array and store in output array
34 Q
Note: See TracBrowser for help on using the repository browser.