Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DGRUGA11

DGRUGA11.m

Go to the documentation of this file.
  1. DGRUGA11 ;ALB/GRR - HL7 ADT A11 MESSAGE BUILDER ;8/5/99 15:33
  1. ;;5.3;Registration;**190**;Aug 13, 1993
  1. ;
  1. ;This routine will build a ADT A11 (Cancel Admit) HL7 message for an inpatient.
  1. ;
  1. EN(DFN,DGMIEN,DGARRAY,DGWARD,DGDT) ;Entry point of routine
  1. ;DFN - Patient Internal Entry Number
  1. ;DGMIEN - Patient Movement Internal Entry Number
  1. ;DGARRAY - Name of output array by reference where built message will be contained.
  1. ;DGWARD - IEN of Ward Location (OPTIONAL)
  1. ;
  1. ;The HL7 variables must be initialized before calling this routine!
  1. ;HL("FS"),HL("ECH"),HLFS,HLECH, and HLQ are used by segment builders called by this routine
  1. ;
  1. N DGCNT,DGMDT,DGCDT,DGOADT,DGPV1,DGICD,DGICDCNT,DGIN,DGINCNT,DGWARDNM,DGCTRAN,DGHMDT S DGCNT=0,DGWARDNM=""
  1. Q:DGARRAY="" ;Required output variable name was not passed
  1. K @DGARRAY ;Kill output array to insure erronuous data does not exist
  1. S DGMDT=$S($G(DGCTRAN)=1:+DGPMP,1:$$GET1^DIQ(405,DGMIEN,.01,"I")),DGHMDT=$$HLDATE^HLFNC(DGMDT)
  1. D NOW^%DTC S DGCDT=$$HLDATE^HLFNC(%) ;Get current date/time and convert to HL7 format
  1. S DGCNT=DGCNT+1 ;Increment node counter by one for first segment
  1. S @DGARRAY@(DGCNT)=$$EVN^VAFHLEVN("A11","05",DGMDT) ;Create Event segment and store in output array (Use current date/time for cancel)
  1. S DGCNT=DGCNT+1 ;Increment node counter by one for next segment
  1. 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
  1. I DGWARD]"" S DGWARDNM=$$GET1^DIQ(42,+DGWARD,.01)
  1. S DGCNT=DGCNT+1 ;Increment node counter by one to store next segment
  1. S DGPV1="PV1"_HL("FS")_1_HL("FS")_"I" ;Create the PV1 segment with no visit data and store in output array
  1. S $P(DGPV1,HL("FS"),45)=$$HLDATE^HLFNC(DGDT) ;GRR 1/26/00
  1. S DGOADT=$$CKADMIT^DGRUUTL1(DFN) ;check if integrated site get original admit date/time
  1. I DGOADT]"" S $P(DGPV1,HL("FS"),45)=$$HLDATE^HLFNC(DGOADT)
  1. S DGPV1=$$DOCID^DGRUUTL(DGPV1)
  1. I DGWARDNM]"" S $P(DGPV1,HL("FS"),7)=DGWARDNM
  1. S @DGARRAY@(DGCNT)=DGPV1
  1. S DGCNT=DGCNT+1
  1. S @DGARRAY@(DGCNT)="PV2"
  1. Q