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

DGMTU1.m

Go to the documentation of this file.
  1. DGMTU1 ;ALB/RMO/MIR/CKN - Patient Relation Utilities ; 11/8/05 2:21pm
  1. ;;5.3;Registration;**166,653**;Aug 13, 1993;Build 2
  1. ;
  1. ;
  1. ;=======================================================================
  1. ; The first set of utilities will display data from the PATIENT
  1. ; RELATION file
  1. ;=======================================================================
  1. ;
  1. ;
  1. DEM(DGPRI) ;Demographics of Patient Relation
  1. ; Input -- DGPRI Patient Relation IEN
  1. ; Output -- Patient or Income Person 0th node
  1. N DGVPI,DGVP0
  1. S DGVPI=$P($G(^DGPR(408.12,DGPRI,0)),"^",3)
  1. I DGVPI]"" S DGVP0=$G(@("^"_$P(DGVPI,";",2)_+DGVPI_",0)"))
  1. Q $S($G(DGVP0)]"":DGVP0,1:"")
  1. ;
  1. DEM1(DGPRI) ;Demographics of Patient Relation node 1
  1. ; Input -- DGPRI Patient Relation IEN
  1. ; Output -- Patient or Income Person node 1
  1. N DGVPI,DGVP1
  1. S DGVPI=$P($G(^DGPR(408.12,DGPRI,0)),"^",3)
  1. I DGVPI]"" S DGVP1=$G(@("^"_$P(DGVPI,";",2)_+DGVPI_",1)"))
  1. Q $S($G(DGVP1)]"":DGVP1,1:"")
  1. ;
  1. NODE(DGPRI) ;Send back the name, sex, dob, and SSN in external format
  1. ; Input -- DGPRI Patient Relation IEN
  1. ; Output -- External format of name, sex, dob, and SSN
  1. ; in pieces 1,2,3, and 9 respectively
  1. ;
  1. ; NOTE: date is in mm/dd/yyyy format
  1. ;
  1. N NODE,X,Y
  1. S NODE=$$DEM(DGPRI)
  1. S X=$P(NODE,"^",2) I X]"" S $P(NODE,"^",2)=$S(X="M":"MALE",X="F":"FEMALE",1:"") ; sex
  1. S X=$P(NODE,"^",3) I X]"" S X=$$FMTE^XLFDT(X,"5DF") S $P(NODE,"^",3)=$TR(X," ","0")
  1. S X=$P(NODE,"^",9) I X]"" S $P(NODE,"^",9)=$E(X,1,3)_"-"_$E(X,4,5)_"-"_$E(X,6,10)
  1. S $P(NODE,"^",4,8)="^^^^",$P(NODE,"^",10,99)=""
  1. Q NODE
  1. ;
  1. NAME(DGPRI) ;Name of Patient Relation
  1. ; Input -- DGPRI Patient Relation IEN
  1. ; Output -- Patient or Income Person Name
  1. N DGNM
  1. S DGNM=$P($$DEM(DGPRI),"^")
  1. Q $G(DGNM)
  1. ;
  1. SEX(DGPRI) ;Sex of Patient Relation
  1. ; Input -- DGPRI Patient Relation IEN
  1. ; Output -- Patient or Income Person Sex
  1. N DGSEX,Y
  1. S Y=$P($$DEM(DGPRI),"^",2) S DGSEX=$S(Y="M":"MALE",Y="F":"FEMALE",1:"")
  1. Q $G(DGSEX)
  1. ;
  1. DOB(DGPRI) ;Date of Birth of Patient Relation
  1. ; Input -- DGPRI Patient Relation IEN
  1. ; Output -- Patient or Income Person Date of Birth
  1. N DGDOB,Y
  1. S Y=$P($$DEM(DGPRI),"^",3) X ^DD("DD") S DGDOB=Y
  1. Q $G(DGDOB)
  1. ;
  1. SSN(DGPRI) ;Social Security Number of Patient Relation
  1. ; Input -- DGPRI Patient Relation IEN
  1. ; Output -- Patient or Income Person Social Security Number
  1. N DGSSN,Y
  1. S Y=$P($$DEM(DGPRI),"^",9) S DGSSN=$S(Y]"":$E(Y,1,3)_"-"_$E(Y,4,5)_"-"_$E(Y,6,10),1:"")
  1. Q $G(DGSSN)
  1. ;
  1. REL(DGPRI) ;Relationship of Patient Relation
  1. ; Input -- DGPRI Patient Relation IEN
  1. ; Output -- Relationship of Patient Relation
  1. N DGREL
  1. S DGREL=$P($G(^DG(408.11,+$P($G(^DGPR(408.12,DGPRI,0)),U,2),0)),U)
  1. Q $G(DGREL)