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

DGRUGZDC.m

Go to the documentation of this file.
  1. DGRUGZDC ;ALB/GRR - HL7 ZDC SEGMENT BUILDER ;06/08/99
  1. ;;5.3;Registration;**190**;Aug 13, 1993
  1. ;
  1. ;This routine will build an HL7 ZDC segment for an inpatient.
  1. ;
  1. EN(DFN,DGDC,DGSSNC,DGMDT) ;Entry point of routine
  1. ;DFN - Patient Internal Entry Number
  1. ;DGDC -Type of date Change~Prior Date
  1. ;DGSSNC - Prior SSN
  1. ;DGMDT - Movement Date
  1. ;DGDC - Type of date change^Prior date
  1. ;
  1. S DGMDT=$$HLDATE^HLFNC(DGMDT)
  1. N DGRREC ;Initialize variables
  1. S $P(DGRREC,HL("FS"))="ZDC" ;Set segment ID to ZDC
  1. S $P(DGRREC,HL("FS"),2)=1 ;Set Set ID to 1
  1. I $G(DGDC)]"" S DGCDT=$P(DGDC,"^",2),DGODT=$$HLDATE^HLFNC(DGCDT) D ;If date change do the following
  1. .I $E(DGDC)="A" D ;If Admit date changed
  1. ..S $P(DGRREC,HL("FS"),3)=1 ;Set type to 1
  1. ..S $P(DGRREC,HL("FS"),4)=DGODT ;old date
  1. ..S $P(DGRREC,HL("FS"),5)=DGMDT ;new date
  1. .I $E(DGDC)="T" D ;If Transfer date changed
  1. ..S $P(DGRREC,HL("FS"),3)=2 ;Set type to 2
  1. ..S $P(DGRREC,HL("FS"),4)=DGODT ;old date
  1. ..S $P(DGRREC,HL("FS"),5)=DGMDT ;new date
  1. .I $E(DGDC)="D" D ;If Discharge date changed
  1. ..S $P(DGRREC,HL("FS"),3)=3 ;Set type to 3
  1. ..S $P(DGRREC,HL("FS"),4)=DGODT ;old date
  1. ..S $P(DGRREC,HL("FS"),5)=DGMDT ;new date
  1. I $G(DGSSNC)]"" D ;If SSN change, do the following
  1. .S $P(DGRREC,HL("FS"),3)=+$P(DGRREC,HL("FS"),3)+10 ;Set type to current value plus 10. If date change and SSN, type is 11, 12, or 13. Will be a 10 for SSN change only
  1. .S $P(DGRREC,HL("FS"),6)=DGSSNC ;old SSN
  1. .S SSN=$$GET1^DIQ(2,DFN,.09,"I") ;Get new SSN
  1. .S $P(DGRREC,HL("FS"),7)=SSN ;Set new SSN in message
  1. EXIT ;
  1. Q DGRREC ;Quit and return formatted segment